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 8
struct semaphore (
int value =initial value>;
boolean mutex = FALSE;
boolean hold = TRUE;
shared struct semaphore s;
P (struct semaphore s) f
L1
while (TS (.mutex)) ;
s. value--;
L3
L4
if(s.value <0) f
s-mutex = FALSE;
L5
while (TS (s.hold)) :
}
else
L6
}
s.mutex = FALSE;
V (struct semaphore s)( L7 while (TS (s.mutex)) ;
L8 s.value++;
19 if(s.value <=0)1
L10
while (!s.hold)
;
L11
s.hold = FALSE;
}
L12
}
s.mutex = FALSE;
6. We have discussed the above solution to implement a general semaphore.
1. What is the purpose of LI?(5 points)
2. What is the purpose of LS?(5 points)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!