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 - 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
Get step-by-step solutions from verified subject matter experts
