"Avdi B. Grimm" wrote:
> 
>...

> ... Perl provides an interface to native
> threads, as does Python (although I've heard that Python's
> implementation is fairly crude).  

I agree that Python's implementation is crude in an absolute sense (but
not a relative sense...read on).

Python's threads are crude because although they are OS scheduled, only
one thread can access the Python internals at a time. This is seldom
(never?) a problem on a mono-processor machine but becomes a big problem
on a multi-processor one.

It is my understanding that threads in Perl are also somewhat crude --
just in very different ways than in Python. In fact I often hear Perl
programmers say that you just shouldn't use threads in Perl because they
are broken. Unfortunately, I think Perl is on about its third attempt to
do threads so it is very hard for me to keep straight in my mind what
the different schemes are and what their limitations are.

I don't want to do a bunch of research on this but google turns up, for
example: 
http://lists.zope.org/pipermail/zope-perl/2000-June/000030.html
http://www.perl.com/pub/a/2001/08/01/artur.html

(you've got two Perl experts there discussing the common perception that
Perl threads are not usable)

Tcl threads are also, according to my understanding, quite crude. They
are crude in yet another way. My understanding is that Tcl threads do
not allow you to share mutable data structures between threads. You can
send values between threads but two threads cannot (for example) modify
the same dictionary, even if there is a mutex on it. You would have to
write some kind of dictionary wrapper class and send messages to it from
multiple threads.

Ruby threads are of course crude in yet another way: they are not
OS-scheduled.

Javascript has no threading primitives.

Jythons threads are, I suppose, roughly as good as the underlying Java
implementation.

http://mail.python.org/pipermail/python-list/2001-December/075680.html

My vague recollection is that PHP has no threading primitives.

> P.S. Does anyone here have any theories on /why/ threads
> are still percieved as such an arcane topic in the UNIX and
> scripting language communities?

There is your answer. None of the scripting languages (well, bar Jython
and other JVM-based languages) have ideal threading so scripting
language users are not used to it. 

Why is threading so hard for scripting languages? Well scripting
language implementations obviously have many internal data structures.
If you share these between threads then you have to do locking on them
which slows things down. If you do NOT share these between threads then
you have big problems sharing mutable data between threads. Of the
various language communities I think that the Perl world is working on
this most actively so we should watch them.

 Paul Prescod