Test&Set Is A Simple Solution
Test_and_set R1, Loc fetches Loc’s value, and sets it to 1, returning value to R1
Consider its operation
lock: t&s R1,Loc -- atomically set
bnz R1,loc -- spin if loc ~ free?
ret
and
unlock: st Loc,#0 -- clear setting
ret
Previous slide
Next slide
Back to first slide
View graphic version