Question
What does a test-and-set instruction typically do atomically?
Select an option. Your answer will be checked instantly.
Correct Answer: A. Return the old value of a memory word and set it to a new locked value
Explanation:
Test-and-set combines reading a lock value with setting it in one atomic step.
This permits multiple threads to compete for a lock without a race between separate read and write instructions.
Leave a Reply