Q2。 (a) You need to share one resource X between three threads P, Q and R. Write the critical section code for each of the threads and use semaphores to guarantee exclusive access by just one of the threads at a time to the resource X (which can be accessed by just calling “X)”) (b) Rewrite the critical section code of part (a) to allow at most two of the three threads
OR
OR