Start semaphoring out

This commit is contained in:
2022-04-04 20:12:40 -05:00
parent 31a7583074
commit 927b209cef
12 changed files with 205 additions and 53 deletions

View File

@@ -1,2 +1,8 @@
void consumer ();
/*
consumer:
Unlinks blocks from list2,
Consumes them,
Links them to freelist
*/
void *consumer (void *);

View File

@@ -4,4 +4,9 @@
extern block memory[N];
// create the three lists
extern list lists[3];
extern list *freelist, *list1, *list2;
extern list *freelist, *list1, *list2;
// count semaphores
extern sem_t semfl, seml1, seml2;
// binary semaphores
extern sem_t mutfl, mutl1, mutl2;

View File

@@ -20,5 +20,4 @@ void list_link (list *l, block *b);
// list_init: links an array of blocks onto the end of a list
void list_init (list *l, block *m, int size);
// list_print: prints a list
void list_print (list *l);
void list_concise(list *l);
void list_print(list *l, bool verbose = false);

View File

@@ -1,2 +1,8 @@
void producer ();
/*
producer:
Unlinks blocks from freelist,
Produces them,
Links them to list1
*/
void *producer (void *);

View File

@@ -1,2 +1,10 @@
void transformer ();
/*
transformer:
Unlinks block x from list1
Unlinks block y from freelist
Uses block x to generate block y's data
Links block x to freelist
Links block y to list2
*/
void *transformer (void *);