[Python-Dev] Parrot -- should life imitate satire?
Dan Sugalski
dan@sidhe.org
Tue, 31 Jul 2001 20:13:33 -0400
At 04:42 PM 7/31/2001 -0700, Paul Prescod wrote:
>Dan Sugalski wrote:
> >
> >...
> >
> > As for threading, well, that's where things get interesting. Perl's tried
> > it two ways (multiple threads in the same interpreter, and one thread per
> > interpreter, with cloned interpreters) both of which aren't very good. And
> > the global lock thing's not that keen either.
>
>What is the downside of the global lock on the average single processor
>machine? I tend to think that the "default" threading model should allow
>simple and easy, everything-shared multi-threading on ordinary machines.
>Having a multi-processor-friendly advanced mode is a great extension for
>the wizards.
If you hold the lock during an I/O operation, you'll lose time you could
have otherwise used. Getting and releasing a global lock frequently also
costs performance you might otherwise have used in other places. Mutex
releases require memory coherency, which will force your CPU to flush any
pending writes that might be hanging about, which will tend to drop it's
efficiency, especially on heavily out-of-order machines like the Alpha.
Also, that is a zillion and a half mutex aquisition and releases, most of
which you probably have no need of. Even cutting out, say 5-10% of them
will be noticeable. (I do work on SMP machines as a rule, so I am a little
biased against things that single-thread me when I don't need it--what's
the point of 500% idle time?)
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
dan@sidhe.org have teddy bears and even
teddy bears get drunk