What is the difference between the test and set implementation of mutex
and the Peterson's Algorithm?
Which of them is actually used in the real systems?
Peterson's algorithm doesn't work very well in a modern memory architecture with caching. You end up needing to flush constantly. Test-and-set and interlocked operations like interlocked exchange or interlocked increment are going to be much more commonly used and have direct support on the CPU.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With