Question: A spin lock acquire ( ) can be implemented with a test - and - set instruction as follows: while ( test - and -
A spin lock acquire can be implemented with a testandset instruction as follows:
while testandset&lockheld
; spin
Recall that testandsetreturns the old value at the address while atomically setting it to Now a
new lock acquire is implemented as follows:
: while
: while lockheld
: ; spin
: if testandset&lockheld
: return;
:
i Does it work? Ho
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
