Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"The assumptions are wrong" is an unsatisfying "catch-all": compiler, hardware, environment, concurrency bugs.

Here's one that's been bugging me lately: Dekker's algorithm (mutual exclusion / critical section) won't work on modern hardware. CPUs are free to rearrange reads and writes such that they still make sense under single-threaded conditions.

It's kind of put me off learning about lockfree/lockless programming. Even if I make a machine-checked proof that my concurrent code races only in acceptable ways, I have no way of knowing which instructions will be re-ordered, invalidating the proof.



Dekker's algorithm will work on modern hardware if you make use of the appropriate memory barriers. Memory barriers are essential for lock-free algorithms, so I’m not sure why that is putting you off learning them. They are, in a way, an embodiment of the assumptions underlying the algorithms, including Decker’s.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: