good book on multithreaded programming with Python

F

Fernando Rodriguez

Hi,

Any recommendation for a good book on multithreaded programming with Python?
O:)

TIA
 
C

Cameron Laird

Hi,

Any recommendation for a good book on multithreaded programming with Python?
.
.
.
Do you *really* want
concurrent programming with Python
or
programming with Python's threads
or
Python programming with low-level threads
or
...?
 
N

Nick Vargish

Do you *really* want
concurrent programming with Python
or
programming with Python's threads
or
Python programming with low-level threads

Yes, please.

I'm not the OP, but right now I'm porting a C/C++ program from Win32
to Python on Linux and OS-X. The original program relies quite heavily
on threading.

A book that covers all the above options would really help me figure
out the optimal approach to this project. I'm especially concerned
that the GIL will make a pure-Python approach risky, since this
application involves a fair abount of network data and real-time data
processing.

As it is, I have to read several discussions of each
approach. Unfortunately, on this project learning time is not billable
time. (Fortunately, experimentation is billable, and with Python,
learning and experimenting are often one and the same...)

Nick
 
P

Peter Hansen

Nick said:
A book that covers all the above options would really help me figure
out the optimal approach to this project. I'm especially concerned
that the GIL will make a pure-Python approach risky, since this
application involves a fair abount of network data and real-time data
processing.

What risk concerns you with respect to doing networking and "real-time"
processing using Python, given that the GIL exists? Would you have the
same concerns if you didn't even know of the existence of the GIL?
(I believe you should have those concerns, but just because you're
trying to use an unfamiliar environment for something fairly intensive,
not because it's Python specifically, or the GIL.)

I do lots of "network data and real-time data processing" using Python
and have not encountered any particular difficulties, and certainly none
that can be attributed to the existence of the GIL.

Is this a case of fear arising out of ignorance? If so, why not just
write a quick test/experiment that will remove or affirm your concern?
It would be trivial to write a program that created a dozen threads,
each doing processing that would take five seconds of dedicated CPU time,
and a network thread which grabs data from an external source as it
becomes available, at whatever rate you need. You'll likely find out
that with an adequate CPU, everything will work just as you need it to,
and that the only difference between the old program and the new is that
the Python-based one consumes a lot more CPU time for the same data...

If you have specific reasons for the concern, please provide them so
we can address them. The GIL certainly doesn't get in the way of
soft real-time work in any way that's significant.

-Peter
 
M

MetalOne

A good book on writing multi-threaded applications is "Concurrent
Programming in Java" by Doug Lea. The focus is more on multi-threaded
applications than on Java.
 
F

Fernando Rodriguez

.
.
.
Do you *really* want
concurrent programming with Python
or
programming with Python's threads
or
Python programming with low-level threads
or
...?

An introduction to general concurrent programming concepts, using python for
the examples.
 
N

Nick Vargish

Peter Hansen said:
Is this a case of fear arising out of ignorance?

Most probably. On the other hand, I probably wouldn't have spoken up
if I hadn't seen the post I replied to.

I am planning on as pure Python an approach as possible, and have been
from the start. I certainly wasn't trying to borrow trouble from the
future or optimize too early in development.
If you have specific reasons for the concern, please provide them so
we can address them.

This is the attitude that makes me tell my boss(es) that I get better
support from the open source community than I ever could from a
commercial outfit. Thanks!
The GIL certainly doesn't get in the way of
soft real-time work in any way that's significant.

I'm going to proceed with that expectation, thanks again.

Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top