3 ms·
If no data are shared, what is the point of having threads, as opposed to processes?
by nine_k 10y ago
If no data are shared, what is the point of having threads, as opposed to processes?
- tyingq 10y agoOne example is in NGINX. They mostly follow a "no threads" pattern, but specifically for Linux, they support "some threads" to get around issues with Linux aio. https://www.nginx.com/blog/thread-pools-boost-performance-9x/ https://www.nginx.com/blog/thread-pools-boost-performance-9x... That's not "shared nothing" threads, of course, so it doesn't answer your question at a high level. It does highlight, though, that Linux is especially challenging in this space as compared to FreeBSD. And not just because of epoll().
- arielweisberg 10y agoFD =\= data Get the data from the FD and then let the application decide the best dispatch policy.
- redahs 10y ago"Message passing" might be considered a component of a "shared nothing" system. If so, a thread-based message passing implementation might still use shared process memory behind the scenes to efficiently pass messages between local threads. Worker threads might be written so that the responsibility for managing a resource external to the process is assigned to max 1 thread simultaneously, even if the message passing abstraction uses a bit of shared process memory behind the scenes.
- BuuQu9hu 10y agoThreads are still the best way to get asynchronous filesystem I/O in a reliable way. I know that people will reply with various explanations of how to do it for some cases some of the time; however, nobody will post a way that works as reliably as threads, because none exist. At the same time, threads are a vile abomination and we should shun them whenever possible. Computers are terrible, aren't they?