Question: How can we make sure that ) will be executed before S 2 ( ) in the following two threads? Semaphore sync = 0 ;

How can we make sure that ) will be executed before S2() in the following two threads?
Semaphore sync =0;
Th1:
Th2 :
(1)(2)
S1() ;
S2();
(4)
(1) empty
(2) sem_wait(sync);
(3) sem_post(sync);
(4) empty
(1) empty
(2) sem_post(sync);
(3) sem_wait(sync);
(4) empty
(1) sem_wait(sync);
(2) sem_wait(sync);
 How can we make sure that ) will be executed before

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