Question: Explain how the example concurrent program that enforces mutual exclusion with testAndSet (Fig 5.13) could lead to indefinite postponement. Indicate why this would nevertheless be

Explain how the example concurrent program that enforces mutual exclusion with testAndSet (Fig 5.13) could lead to indefinite postponement. Indicate why this would nevertheless be highly unlikely. Under what circumstances would it be acceptable to use this mutual exclusion technique? Under what circumstances would it be completely unacceptable?

Explain how the example concurrent program that enforces mutual exclusion with testAndSet

(Fig 5.13) could lead to indefinite postponement. Indicate why this would nevertheless

System: 1 2 3 boolean occupied = false; startThreads(); // initialize and launch both threads 7 Thread To: void main() boolean p1 MustWait = true; while (!done) while (p1 MustWait ) testAndset( plMustWait, occupied ); // critical section code plMustWait = true; occupied = false; // code outside critical section } // end while 29 } // end Thread Ti 30 31 Thread Tz: 32 33 34 void main() { boolean p2MustWait = true; while (!done ) while (p2MustWait) testAndSet ( p2Mustwait, occupied ); // critical section code p2MustWait = true; occupied = false; Il code outside critical section } Il end while 53 } // end Thread T2 Figure 5.13 testAndSet instruction for mutual exclution

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!