Question: Please help !!! i have no i dea how to solve it :( A synchronization mechanism consists of 2 atomic routines, ENQ(r) and DEQ(r). r
Please help !!! i have no i dea how to solve it :(

A synchronization mechanism consists of 2 atomic routines, ENQ(r) and DEQ(r). "r" is a resource variable that has two fields, inuse (boolean) and queue (a queue) which is a queue of processes waiting to acquire the resource. The definitions of ENQ and DEQ are: ENQ(r): if (r.inuse = =1) then begin insert current process in r.queue block end else r.inuse = 1; DEQ(r): if r.queue = nil then inuse = false else delete a process from r.queue and activate it. Construct an implementation of ENQ/DEQ using semaphores. You can use other variables, etc that you need, but no other atomic code or synchronization constructs other than P or V can be used. Do the reverse of Q3, that is implement Semaphores using ENQ/DE
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
