[Solved]6 System Multiple Reader Processes Read Shared File Multiple Writer Processes Update Share Q37242188
6. In a system, there are multiple reader processes which readfrom a shared file and multiple writer processes which update theshared file. The following variables are shared among allprocesses:

(a) How should the shared variable readCount, and the semaphoresmutex and writeBlock be initialized so that the system would workproperly?
(b) Suppose that when a writer is updating, three new readers,RA, RB, and RC , arrived in the given order and they are the onlyreader processes at that time. Show where the readers areblocked.
(c) Suppose that some readers are reading, explain what happensto a newly arrived writer.
(d) Are writers subject to starvation in this solution? Justifyyour answer
int readCount FILE *sharedFile; semaphore mutex, writeBlock; Reader and writer processes are given in the following C++-like pseudo programs Reader Process Writer Process while(TRUE) { R1<other computing>; R2 P(mutex); R3readCount++ R4 if(readCount–1) R5P(writeBlock); R6 V(mutex); R7Read(sharedFile); R8P(mutex); R9readCount–; R10 if(readCount = 0) R1 VwriteBlock); R12 V(mutex); while(TRUE) { wi 〈other computing〉; W2P(writeBlock); W3 Update(sharedFile); W4 V(writeBlock); Show transcribed image text int readCount FILE *sharedFile; semaphore mutex, writeBlock; Reader and writer processes are given in the following C++-like pseudo programs Reader Process Writer Process while(TRUE) { R1; R2 P(mutex); R3readCount++ R4 if(readCount–1) R5P(writeBlock); R6 V(mutex); R7Read(sharedFile); R8P(mutex); R9readCount–; R10 if(readCount = 0) R1 VwriteBlock); R12 V(mutex); while(TRUE) { wi 〈other computing〉; W2P(writeBlock); W3 Update(sharedFile); W4 V(writeBlock);
Expert Answer
Answer to 6. In a system, there are multiple reader processes which read from a shared file and multiple writer processes which up… . . .
OR

