Question: Implementing the General Semaphore G , Slide 8 struct semaphore ( int value = initial value > ; boolean mutex = FALSE; boolean hold =
Implementing the General Semaphore
G Slide
struct semaphore
int value initial value;
boolean mutex FALSE;
boolean hold TRUE;
shared struct semaphore s;
P struct semaphore s f
L
while TS mutex ;
s value;
L
L
ifsvalue f
smutex FALSE;
L
while TS shold :
else
L
smutex FALSE;
V struct semaphore s L while TS smutex ;
L svalue;
ifsvalue
L
while shold
;
L
shold FALSE;
L
smutex FALSE;
We have discussed the above solution to implement a general semaphore.
What is the purpose of LI points
What is the purpose of LS points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
