Question: A spin lock acquire () can be implemented with a test - and - set instruction as follow: while (test - and - set (&lock

 A spin lock acquire () can be implemented with a test

A spin lock acquire () can be implemented with a test - and - set instruction as follow: while (test - and - set (&lock rightarrow held) = = 1);//spin Retail that test - and - set () returns the old value at the address while atomically selling it to I. Now a new lock acquire () is implemented as follows: while (1) {while (lock rightarrow held > 0);//spin if (test - and - set (&lock rightarrow held) = = 0) return;} Does it work? How does it change the behavior of the lock compared to the first implementation

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!