Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Process and thread fundamentals (qnx.com)
58 points by luu on March 29, 2015 | hide | past | favorite | 3 comments


Is it me, or are semaphores overrated? There seems to be so much emphasis on semaphores in textbooks & guides. Thread pools are just a footnote (if mentioned at all). They did mention them in the article, at the bottom..

Yet in the real world, it's thread pools that are the go to when you need to control the number of active threads. Can't think of any instances where semaphores would be a better choice over thread pools.

Also, I wish I knew how important a role CPU cache plays in performance. Another aspect which seems to be downplayed in academia.


You can't really compare thread pools to semaphores. They're don't have the same intended use, where semaphores are a low-level synchronization mechanism and thread pools are a bit higher up. In fact, I would wager that many, if not most, implementations of thread pools use semaphores to some degree.


I know what you mean; semaphores seem to crop up as a synchronization primitive everyone's supposed to learn about, but they are not so proportionately necessary in applications.

That said, they are useful to manage concurrency in a finer-grained way than setting up and tearing down thread pools for short durations. E.g., imagine you have a pool of 100 cached threads and want to apportion no more than 5 of these to any one client.




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

Search: