> Dan Sugalski wrote:
>
> > >How does python handle MT?
> >
> > Honestly? Really, really badly, at least from a performance point of view.
> > There's a single global lock and anything that might affect shared state
> > anywhere grabs it.
>
> i.e. not so much 'threaded' as 'stitched up'.

Well, python never advertised speed.  Threading is just a clean way of
handling certain types of problems.  Sounds to me like they simply valued
simplicity and stability above other things.  So the word "bad" is
obviously subjective.  I've definately heard people praise their extension
code.  Recall, in fact, that in the review of the great perl6 conference,
several people walked out saying that they were just going to get into
Python.

Speed can't be the top factor here.  If you make extension code easy
enough to write, then people can profile and write "fast" code when
necessary.  And more to the current point, MT programming isn't
necessarily faster code (especially if you don't have multi-CPUs).  The
classic example of MT-code where you spawn off a new thread to do some
CPU-intesive work in the back-ground is less common than simple IO threads
(which includes server connection points and loading/saving files).  More
often, I see "forked" code which handles slow tasks.  They're reliable,
and have little over-head so long as the amount of work is great.

-Michael


Reply via email to