Question: Below is an algorithm for Readers - Writers problem. Fill in the table of the values of semaphores or variables. Shared data semaphore mutex, db;
Below is an algorithm for ReadersWriters problem. Fill in the table of the values of semaphores or variables.
Shared data
semaphore mutex, db;
Initially
mutex db readcount
Writer process:
waitdb;
writing is performed
signaldb;
Reader process:
waitmutex;
readcount;
if readcount
waitdb;
signalmutex;
reading is performed
waitmutex;
readcount;
if readcount
signaldb;
signalmutex:
event mutex db readcount
a writer comes
a reader comes
a writer has done
a reader comes
a reader comes
a writer comes
a reader has done
a reader has done
a reader has done
a writer comes
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
