[Dev] Twisted has a home on Chandler Wiki
Jurgen Botz
jbotz at osafoundation.org
Thu Jun 3 16:15:14 PDT 2004
John Anderson wrote:
> I was thinking Macintosh OS 9, which had everything going through the
> main event loop. Unfortunately, this lead to very clunky multitasking
> (if you can remember that long ago) and didn't work very well. Things
> got much better when OS 10 came around and used threads.
Even though they're two sides of the same coin, still one should not
confuse threads and processes. You're throwing them into the same
bag with the comparison between OS 9 and X. "Real Operating
Systems(tm)" have had good multitasking long before they had
light-weight threads.
> I thought threads would actually scale better as we move towards
> multprocessor machines, but maybe I'm missing something here.
The idea behind that statement is that thread creation and/or context
switching overhead is non-trivial and can become problematic when you
use a thread-based model that has say one thread per connection for a
service that has to handle hundreds or thousands of connections. At
that scale an event-based/asynchronous model can easily be much more
efficient.
Taking advantage of multiprocessing capabilities within a machine is
another story; a pure asynchronous model can't do that, but a hybrid
that uses a small number of threads or processes that divide up the
processing of events can.
But to get specific to Chandler, we're probably not concerned with that.
First in our context network bandwith is more likely to be limiting than
CPU cycles, so limiting network handling to one thread should not be a
problem. And you may still get a benefit from a dual-CPU machine if
network processing and main (UI) event processing are in different
threads.
:j
More information about the Dev
mailing list