During online class we studied that, if the semaphore operations Wait and Signal are not executed atomically,then mutual exclusion may be violated. Assume that Wait and Signal are implemented as...

I gave you all information please help me
During online class we studied that, if the semaphore operations Wait and Signal are not<br>executed atomically,then mutual exclusion may be violated. Assume that Wait and Signal are<br>implemented as below:<br>void Wait (Semaphore s) {<br>while (S.count <= 0) {}<br>s.count = s.count - 1;<br>void signal (Semaphore s) {<br>S.count = S.count + 1;<br>Code: (a)<br>a) Build a scenario of context switches that includes two threads and permit to enter a<br>critical section<br>secured by a single mutex semaphore as a result of a lack of atomicity.<br>wait(S) = {while S < 0; S--; }<br>signal(S) = {S++; }<br>Code: (b)<br>b) Assume ,S=1,P&Q protects a critical region with thesemaphore S. Show that if one of<br>these operations is not executed atomically, we mayviolate mutual exclusion.<br>

Extracted text: During online class we studied that, if the semaphore operations Wait and Signal are not executed atomically,then mutual exclusion may be violated. Assume that Wait and Signal are implemented as below: void Wait (Semaphore s) { while (S.count <= 0)="" {}="" s.count="s.count" -="" 1;="" void="" signal="" (semaphore="" s)="" {="" s.count="S.count" +="" 1;="" code:="" (a)="" a)="" build="" a="" scenario="" of="" context="" switches="" that="" includes="" two="" threads="" and="" permit="" to="" enter="" a="" critical="" section="" secured="" by="" a="" single="" mutex="" semaphore="" as="" a="" result="" of="" a="" lack="" of="" atomicity.="" wait(s)="{while" s="">< 0;="" s--;="" }="" signal(s)="{S++;" }="" code:="" (b)="" b)="" assume="" ,s="1,P&Q" protects="" a="" critical="" region="" with="" thesemaphore="" s.="" show="" that="" if="" one="" of="" these="" operations="" is="" not="" executed="" atomically,="" we="" mayviolate="" mutual="">

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here