The thread T8.1 must terminate before T3.4 starts, but T8.4 must start only after T3.4 terminates. semaphore 8_1 and semaphore 8_2 are 2 named semaphores, initialized with 0 permissions. My question is why semaphore 8_1 is not woken up on the “post” call from the function called threads created in process 8, even though that point of the function is reached. The execution stops and enters the infinite loop at that point, when the semaphore thread 8_1 should be woken up.
//body of function_3(threads of process 3)
if(param->thread_num == 4) {
sem_wait(semaphore_8_1); //here
sem_post(semaphore_8_2); }
//body of function_8(threads of process 8)
if(param->thread_num == 1)
{ sem_post(semaphore_8_1);
sem_wait(semaphore_8_2);
} else
if(param->thread_num == 4) {
sem_wait(semaphore_8_2); }
locki is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.