Question: void P ( n ) { semwait ( sn ) semsignal ( s ( n - 1 ) ) } semwait ( s ( n

void P(n)
{
semwait(sn)
semsignal(s(n-1))
}
semwait(s(n-1))
count = count +1
semsignal(s(n-2))
}
30 processes P(1),dots,P(30) are concurrently executing on a system (see the pseudocode above with P(n)=P(30)). The shared variable called count is
initialised to 7, while the semaphores s1,s2,dots,s(n-1), sn are all initialised to 0. What is the value of count when process P(17) executes semsignal(s16)?
Answer:
void P ( n ) { semwait ( sn ) semsignal ( s ( n -

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 Programming Questions!