basic books/guides on multithreading programming?

Cliff Wells logiplexsoftware at earthlink.net
Fri Feb 15 18:24:03 EST 2002


On Sat, 16 Feb 2002 05:57:09 +0700
Tripp Scott wrote:

> which ones do you recommend? examples in any language is fine, 
> though i prefer python, perl, or ruby. what i would like is 
> guidance on what is thread safety, how to achieve it, what are 
> the issues in multithreading programming, the global interpreter 
> lock, and other basics.

It's been many years since I've read a book on multi-threading, so I can't
suggest a good title, but it's a lot simpler than you might think (given
the fact you're looking for a book ;)  This is especially true with Python,
which has a remarkably easy-to-use threading library (use the threading
module, not the thread module).

Thread-safety boils down to this: lock any /shared/ resource that might be
/modified/ by a thread.  End of story.  You can get into all sorts of
debates about when these locks are necessary, but 99% of the time they are,
and the other 1% isn't worth the effort to decide whether they really are
or not.

I suggest implementing something simple, say a thread-safe queue, hammer it
with dozens/hundreds of threads and see what you learn.  Believe it or not,
the standard Python documentation will probably be sufficient.

-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308




More information about the Python-list mailing list