News for hackers. Stuff that matters.
Re:The Fastest Mutexes by epcoa on Thursday October 03, 2024 @10:24AM (#41731094)
What is the difference between a read and a “load” here?
Re:The Fastest Mutexes by loeg on Thursday October 03, 2024 @12:38PM (#41732347)
Read and load mean the same thing. (I think GP just missed the end of your comment.)

You care about exchange vs read/load because of cache line ownership. Every time you try to do the exchange, the attempting CPU must take exclusive ownership of the cacheline (stealing it from the lock owner). To unlock, the lock owner must take it back.

If the attempting CPU instead only reads, the line ownership stays with the lock holder and unlock is cheaper. In general you want cache line ownership to change hands as few times as possible.