How spin lock can be implemented using testandset?
Answers
Answered by
0
In software engineering, a spinlock is a lock which causes a thread trying to acquire it to simply wait in a loop ("spin") while repeatedly checking if the lock is available. ... However, spinlocks become wasteful if held for longer durations, as they may prevent other threads from running and require rescheduling.
In computer science, the test-and-set instruction is an instruction used to write 1 (set) to a memory location and return its old value as a single atomic (i.e., non-interruptible) operation. ... "Test and Test-and-set" is another example.
Similar questions