#define N 8 #define timescale 10000 //function defines, renaming wait and signal #define wait(x) sem_wait(&x) #define signal(x) sem_post(&x) // renaming link and unlink to match pseudocode semantics #define link(x,y) list_link(y,x) #define unlink(x) list_unlink(x) // Shared memory through global variables // Create all of memory extern block memory[N]; // create the three lists extern list *freelist, *list1, *list2; // count semaphores extern sem_t sem_freelist, sem_list1, sem_list2, sem_freelist_minus_1; // binary semaphores extern sem_t mut_freelist, mut_list1, mut_list2;