"

I think the definition of test-and-set ""If the test fails, the value is not set."" may have need some correction. According to ""Operation System Concepts"" By Abraham Silberschatz, etc. , in page 198 about the definition of TestAndSet instruction. The test and set operations are always executed no matter the test fails or not..."