Computer Science/Operating System
Practice 6) Thread & Semaphore 2
Nolja놀자
2020. 12. 17. 06:40
반응형
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.
반응형