EECE-4029 Operating Systems Fall 2016
Semaphores

processes, mutex, semaphores, memory management, producer-consumer, files, deadlock, more..

Sample code and documentation

Archive:
   
semaphore.tar     All code and Makefile in a tar file
   
Makefile:
   
Makefile.sema     Make all the code below with this
   
Code:
   
01-sema.c     Number of running 'W' threads <= number 'N' threads completed
02-sema.c     'W' threads wait until all 'N' threads are completed - one 'W' completes
03-sema.c     'W' threads wait until all 'N' threads are completed - all 'W' threads complete
04-sema.c     At most 3 'W' threads are running at a time
05-sema.c     Simple producer-consumer monitor
06-sema.c     Network of producers and consumers
queue_a.c     Implements the buffer in 06-sema
queue_a.h     The include file for queue_a.c
 
Documentation:
semaphores in linux    
semaphores vs. mutex    
Also see this    
semaphores in kernel threads