반응형

 

 

 

 

 

 

 

 

 

 

 

 

1. Using 'full' and 'empty' variables

to make producer wait when buffer is full, and to make consumer wait when buffer is empty

 

 

 

 

 

 

 

2. Fix deadlocked code

: It should be same order between producer's sem_init and consumer's sem_init

Because if the sem_init order is not the same, it will be in the following state

mutex1 = 0, mutex2 = 0

So, nobody can pass sem_init.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

반응형

+ Recent posts