Question: uestion # 4 (4 marks) The following code is designed so that mutual exclusion over critical sections (C.S.) is achieved. A process calls getLock0 prior

uestion # 4 (4 marks) The following code is designed so that mutual exclusion over critical sections (C.S.) is achieved. A process calls getLock0 prior to accessing the C.S. and calls releaseLock0 after the C.S. execution is finished. lock is defined as a Boolean variable and initially assigned a false value (i.e. Boolean lock false;). D.I. and E.I. denote Disable Interrupt and Enable Interrupt respectively. Is the solution capable of providing the needed mutual exclusion? If yes, explain why the solution holds. If no, give ample/scenario that shows how the solution fails. getLockO releaseLock0 while(true) { ge lock false E.I if lock false) E.I break; yield ) /I end while(true) so om Con os lock-true 3Iend getLock0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
