We propose the solution shown in Figure 2. The reader should first note that the use of mutex 1 and w corresponds exactly to the use of mutex and w in the solution to Problem 1. The semaphore r is used to
protect the act of entering the critical section in the same way that w is used to protect the shared resource
in Problem 1. The first writer to pass P(r) will block readers from entering the section which manipulates
mutex 1 and w. mutex 2 is used here for writers just as mutex is used for readers in Problem I. mutex 3 is
necessary because of our absolute insistence on priority for writers. Without mutex 3 we have the possibility