The following figure shows the Readers & Writers problem solution using semaphore. Writer W1 arrives first and enters its critical section. The following other processes then enter in sequence: ...R.. R...W2
Part-1 Find out which processes will be blocked and to which semaphore (mutex, "wrt). [1.5]
Part-2 In which order will other processes be entering and leaving their critical sections after W1 finishes execution of its critical section? [1.5]
Readers-Writers Problem
wait(mutex); readCount++; if (readCount==1) wait(wrt); signal(mutex);
wait(wrt); The writing is performed :(m)(eubps
Reader reading is performed wait(mutex); readCount--; if (readCount ==0
signal(mutex):