In: Computer Science
The typical solution of the readers-writers problem works for the following assumptions: (a) Only one writer at a time can access the buffer. Write two separate solutions (pseudo code) for the reader and the writer processes in the cases in which
1) exactly one writer and one reader exist
2) exactly two writers and two readers exist
Note: writers have priority In each case. Also, provide a short explanation (about 2 lines) of why there is no deadlock and no starvation in your new code.
Two separate pseudo code for the reader and the writer processes in the cases in which
1) exactly one writer and one reader exist.
2) exactly two writers and two readers exist.
Condition: - writers have priority In each case
pseudo code for Writer process
i) Writer asks the entry to critical section.
ii) If it is true or accepted, it goes into critical section and starting the operation.
ii) If it is false, it will wait until it is accepted.
pseudo code for reader process
i) Reader ask the entry to critical section. than in this case also 2 case are possible
If True: it will the count of number of readers available inside the section. If reader is the 1st one in section than it locks the setion to ensure no new entry of readers and also checks entry of writers if reader is already there.
it will also checks if other reader is allowed to enter while others are there.
it will also checks if other writer is allowed to enter while others are there.
After opration of reading and writing, both will quit the critical section.
ii) If not False, it will wait until it is accepted.
There is no deadlock and no starvation in my new pseudo code because no process is being blocked by anyone it will work flawlessly without distraction with each others processes.
Please hit that like or thubms-up button,It really motivates me(I hope you will do that?, it takes only 1-2 seconds)>3
Thank you!!