> Only use threads where true CPU concurrency is needed. This is the case much more often now than it was in 1995.
Somebody better tell the Node.js cluster guys :-) They manage without threads pretty well, I think. Shared state is deliberate, outside of individual processes, rather than accidental in-process. As it should be unless you are doing some serious systems level programming.
Why Threads Are a Bad Idea (1995) [pdf]
21–30 of 103 posts
Re: Why Threads Are a Bad Idea (1995) [pdf]
#22Earlier quoted context omitted.
The author is John Osterhout, a CS professor. He was working at Sunlabs at the time. It's not like some unknown lone voice from the bowels of Sun was 'trying to warn us'. Warn us about what, anyway?
There was a hype wave about multithreading (hey BeOS) that started around 1995.
Re: Why Threads Are a Bad Idea (1995) [pdf]
#23> Only use threads where true CPU concurrency is needed. This is the case much more often now than it was in 1995.
Shared mutable state is where the problem lies, but in a lot of cases shared memory can be used to pass it without copying from a "scheduler" thread to worker threads for parallel processing in non-overlapping chunks, and then back for compiling into a whole.
Re: Why Threads Are a Bad Idea (1995) [pdf]
#24Lots of systems/embedded programmers roll their eyes at this kind of talk. Threads aren't really that hard.
Event queues do have benefits in certain situations. They pair nicely with state machines. You can easily end up in callback hell though, and it is often difficult to integrate some long-running, atomic tasks into your event loop. You end up doing things like having a thread pool, at which point you have to wonder why you stopped using threads in the first place. Oftentimes a threaded approach is a cleaner approach. Just get the locking granularity right - it's not that difficult.
Re: Why Threads Are a Bad Idea (1995) [pdf]
#25Re: Why Threads Are a Bad Idea (1995) [pdf]
#26Re: Why Threads Are a Bad Idea (1995) [pdf]
#27Oh gee I guess I'm a wizard. Lots of systems/embedded programmers roll their eyes at this kind of talk. Threads aren't really that hard. Event queues do have benefits in certain situations. They pair nicely with state machines. You can easily end up in callback hell though, and it is often difficult to integrate some long-running, atomic tasks into your event loop. You end up doing things like having a thread pool, a…
Unmaintanable raw-pthread messes are a nightmare sequel from the director of Endless GOTOs.
Re: Why Threads Are a Bad Idea (1995) [pdf]
#28Earlier quoted context omitted.
The author is John Osterhout, a CS professor. He was working at Sunlabs at the time. It's not like some unknown lone voice from the bowels of Sun was 'trying to warn us'. Warn us about what, anyway?
There was a hype wave about multithreading (hey BeOS) that started around 1995.
Re: Why Threads Are a Bad Idea (1995) [pdf]
#29I have seen that argument in the past but somehow still can't see how event-based approach saves us from the headaches of concurrency. If you need to deal with parallel processing (which is relatively often in the real world) you WILL have to face the problems of consistency, visibility and program order. Many languages don't even require programmers to have much exposure to threading mechanics. It's an OS responsibi…
Re: Why Threads Are a Bad Idea (1995) [pdf]
#30Oh gee I guess I'm a wizard. Lots of systems/embedded programmers roll their eyes at this kind of talk. Threads aren't really that hard. Event queues do have benefits in certain situations. They pair nicely with state machines. You can easily end up in callback hell though, and it is often difficult to integrate some long-running, atomic tasks into your event loop. You end up doing things like having a thread pool, a…
But the point of this article is to say if we ditch the notion of threads entirely and go with this other thing, we won't need safety nets anymore because it will be impossible to deadlock and corrupt data (as opposed to less likely).