next up previous
Next: Example : Producer Consumer Up: No Title Previous: Lock and Unlock

Semaphores

P(s) ::= if s>0
 then s := s-1
 else -- suspend process on s ;

V(s) ::= if (process waiting on s)
 then -- resume one of these processes
 else s := s+1;

  figure82
Figure:

Producer - Consumer relation

Producer puts things into a buffer, consumer takes them out - need synchronisation for coordination
the Unix pipe :

 ls | sort | uniq



Omer F Rana
Tue Feb 11 19:19:09 GMT 1997