Avoiding deadlocks in concurrent programming

Donn Cave donn at u.washington.edu
Thu Jun 23 12:50:39 EDT 2005


In article <mailman.795.1119520004.10512.python-list at python.org>,
 Konstantin Veretennicov <kveretennicov at gmail.com> wrote:

> On 22 Jun 2005 17:50:49 -0700, Paul Rubin
> <"http://phr.cx"@nospam.invalid> wrote:
> 
> > Even on a multiprocessor
> > system, CPython (because of the GIL) doesn't allow true parallel
> > threads, ... .
> 
> Please excuse my ignorance, do you mean that python threads are always
> scheduled to run on the same single CPU? Or just that python threads
> are often blocked waiting for GIL?

Any thread may execute "inside" the interpreter, but not
concurrently with another.

I don't see the original point, though.  If you have a C application
with no GIL, the queueing model is just as useful -- more, because
a GIL avoids the same kind of concurrency problems in your application
that it intends to avoid in the interpreter.

Rigorous application of the model can be a little awkward, though,
if you're trying to adapt it to a basically procedural application.
The original Stackless Python implementation had some interesting
options along those lines.

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list