|  |  |  |  |  |  |  |  |  |  |  |  |  | 
   
    | n | As before: 
 |  | 
   
    |  | 
   
    |  | u | we need a
    semaphore S to have mutual 
 |  | 
   
    |  | exclusion on
    buffer access 
 |  | 
   
    |  | 
   
    |  | u | we need a
    semaphore N to synchronize 
 |  | 
   
    |  | 
   
    |  | producer and
    consumer on the number of 
 | 
   
    |  | consumable items 
 |  | 
   
    |  | 
   
    | n | In addition: 
 |  | 
   
    |  | 
   
    |  | u | we need a
    semaphore E to synchronize 
 |  | 
   
    |  | producer and
    consumer on the number of 
 | 
   
    |  | 
   
    |  | empty spaces 
 |  |