3 ms·
> Linus says that almost all practical uses of semaphores is when they are just used as mutexes, and rightly so -- implementing concurrency patterns based only
by exDM69 12y ago
> Linus says that almost all practical uses of semaphores is when they are just used as mutexes, and rightly so -- implementing concurrency patterns based only on semaphores is a total pain.
Semaphores are not very good in practical programming but they're still valuable as a mental model and reasoning about algorithms.
It is a lot easier to prove by induction that an algorithm implemented with semaphores works than it is to deal with mutexes and conditions in a formal proof.
So semaphores are very useful in theoretical work, mutexes and conditions are more useful in practice.