-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphilosophers.h
More file actions
41 lines (31 loc) · 807 Bytes
/
philosophers.h
File metadata and controls
41 lines (31 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* Dining philosophers
* --
* This program solves the known problem of the "dining philosophers". It uses
* POSIX unnamed pipes and forks in order to achieve this. As the OS kernel by
* Yann Bolliger conforms to the minimal subset of POSIX for these commands, the
* program is compileable and runnable on POSIX as well as on the OS kernel by
* Yann Bolliger.
*
* The only thing you need that changes are the includes below and the linking.
*/
#ifndef __PHILOSOPHERS_H
#define __PHILOSOPHERS_H
/**
* RUN on OS kernel by Yann Bolliger.
* Uncomment this line:
*/
#include "libc.h"
/**
* RUN on POSIX.
* Uncomment these lines:
*/
//#include <stdlib.h>
//#include <unistd.h>
#define PHIL_NUMBER (16)
#define ROUNDS (10)
typedef enum {
FIRST_FORK,
SECOND_FORK
} fork_t;
#endif