learning about threads and processes (was Re: what would you like to see in a 2nd edition Nutshell?)

Arthhur ajsiegel at optonline.com
Wed Dec 29 21:55:25 CET 2004

On Wed, 29 Dec 2004 16:41:23 +0100, Alex Martelli wrote:
> Hmmm, well, the concepts are reasonably independent of the programming
> language involved.  If anything, threads and processes may be more tied
> to whatever _operating system_ you're using.  A very fundamental but
> good introduction to processes (and other such basics) is for example at
> <http://en.tldp.org/HOWTO/Unix-and-Internet-Fundamentals-HOWTO/>, but it
> will be only partially applicable if you need to understand in depth the
> process-model of Windows.  But of course this is about the concepts, not
> the practice of programming to interact with them.

Too basic. Doesn't speak to the "intermediate".  

I'll have you know, sir, you are speaking to someone who is
quite intermediate, at least in mediocre way.  Hummph ;)

>> If I want to no more than be able to follow, say, the current Idle code
>> of the PyShell module, I can find very little guidance from within the
>> canon of Python literature.
>> Help?
> Hmmm - have you looked at Deitel, Deitel, Liperi, Wiedermann, "Python
> how to program", chapters 18 (Process Management) and 19
> (Multithreading), pages 613-687?  They seem to do a rather workmanlike
> job -- of course, they can't do full justice to the subjects in 75
> pages; and if you don't want to buy a vast, costly 1300-pages tome for
> the sake of those 75 pages, I can't really blame you, either.  Still,
> without some clarification of how (if at all) those 75 pages fail to
> meet your learning needs, it's hard to know what else to suggest.  And
> what about Norman Matloff's
> <http://heather.cs.ucdavis.edu/~matloff/Python/PyThreads.pdf>, the first
> google hit if you're looking for
>     python threads

I never gotten to page 613 of any book in my life ;)

But the Matloff piece you site is in fact helpful to the intermediate.  

Frankly not sure how I missed it in past searches.  "Python threading" as
a google buries it a bit, but not that deeply.

This also comes up on a fresh search, and is to the point and at the level
of interest. It is also recent:


> ?  I haven't looked into it, but, again, without some specific
> explanation of how it fails to meet your needs, it's hard to offer
> alternatives.

The problem is when one starts off explaining threads by reference to
processes, I already have a practical problem.  Which, under what

Again referring back to the Idle code, class ModifiedInterpreter in the
PyShell module:

Within the space of a simple class, we are spawning 
a subprocess via:

self.rpcpid = os.spawnv(os.P_NOWAIT, sys.executable, args)

and a rpc client listening to a socket via:

self.rpcclt = MyRPCClient(addr)

which can be interrupted via a thread ala:


And then it gets a little complicated, to an intermediate ;)

Guess I am hoping to get to understand it as architecture, as well as as

This happens to be another piece of code I am trying to digest, which
allows one to experiment with building PyGTK widgets from an interactive


which uses os.fork and signals in its architecture, but no threads, as
opposed to this CookBook recipe:


which accomplishes a very similar functionality using threads as a
fundamental part of its strategy.

The closest thing I can think of as the kind of book I would love to see
is one similar to Steve Holden's book on web programming, which explained
lower level internet proctocols at the same time as it explained their
Python implementation.

Wonder what Steve's are doing this week? ;) 


More information about the Python-list mailing list