Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • I think it's a lot easier to start with Queue, then figure out how to write Queue yourself on top of Lock and Condition, then figure out how to write Lock and Condition on top of Semaphore and Event (writing Condition that way is hard, and the result will not be very efficient), rather than starting with the lowest-level primitives and trying to figure out what you could conceivably build out of them. Commented Jun 3, 2013 at 22:13
  • Easy is often in contradiction with best. You will not have Queue or Event at kernel level for example. Use them at the beginning force lazy programming. If you want to learn in depth the concept of thread synchronization and let it works in every context and language, then the road is a bit harder but it brings greater results. This is what I meant. However, there may be different ways depending on the purposes. I only suggested a possibility :) Commented Jun 4, 2013 at 7:40
  • Yes, it's important to know how to write a condition or a synchronized queue or a lock-free list out of nothing but semaphores, events, and compare-and-exchange. But until you know what they're used for, you can't do that. Instead, you'll build useless things at the wrong level of abstraction that work 99.99% of the time, and spend 99.99% of your time debugging code that doesn't even make sense. It took the industry a couple of decades to figure out the useful abstractions, and if you try to work bottom-up and discover the abstractions yourself, it will take you just as long. Commented Jun 4, 2013 at 18:15