Paul G wrote:
richard's advice is solid. use async io/event loops if possible, separate processes if possible, threads as a last resort, in that order. the grey area is the 'if possible' test, since it's a multi-way tradeoff between performance, simplicity and provable (to an extent) correctness. i fully expect that a lot of folks *do* need to use threads and the probability of that being the case on windows is much higher than on posixish platforms.
I agree with you, but it doesn't seem like you're exactly concurring with what DRH said though. I'm guessing that that 'if possible' test is huge, and very frequently will fail. Why suffer the context switch when you don't have to? Would you write a non-trivial GUI program today without using threads? Why subject the users to the added latency IPC is going to introduce? The funny thing is eventually multi-process apps go to MMap for IPC, for performance, and then run into a lot of the same issues they'd have to deal with if they were threaded. And as far as the 'threads introduce difficult to debug' errors; Isn't that the age-old performance versus complexity trade- off? Processes are easier to use, but very often perform worse under the same conditions as the more complex threaded application. That is a fact many of us can not look past easily. PS. It's funny, this discussion seems like its been taked right from a early '90s newsgroup :) Regards, Kervin