Help me use my Dual Core CPU!

S

Simon Wittber

Wolfgang said:
PyMPI?

Ironpython?

I'm looking at IronPython right now. I'm attempting to get it to run
pybench, but first, I think I have to work out how to enable
tracebacks...

When the dual core notebook finally arrives, I'm going to test out this
code:

http://entitycrisis.blogspot.com/2006/09/if-i-had-concurrent-python-what-would-i.html

(a multithreaded map function) on some nice large pixel buffers, and
compare performance to CPython. I think the results will be very
interesting!

-Sw.
 
P

Paul Rubin

mystilleef said:
I use D-Bus (Python). I recommend it. I don't know how cross platform
it is. However, it supports message passing of most built-in (strings,
ints, lists, dictionaries etc) Python objects accross processes. You
can mimick clean Erlang-like concurrency with it. It is the future of
IPC on Desktop Unix. Given Python's crippled threading implementation,
it can play a role in making your Python applications scalable, with
regards to concurrency. I am recommending D-Bus because I have used it,
and I know it works. I didn't read this of a newsgroup or mailing list.

It looks useful, but as far as I can tell, it's just another IPC
thingie that works through sockets, sort of like pyro without the
remote objects. I don't see how it's related to Erlang-like
concurrency (which means ultralightweight coroutines, not heavyweight
Unix or Windows processes). I think Python concurrency schemes get
interesting when they at least share memory (like POSH). Otherwise I
think of them more as "distributed" than "concurrent".
 
M

mystilleef

Paul said:
It looks useful, but as far as I can tell, it's just another IPC
thingie that works through sockets, sort of like pyro without the
remote objects. I don't see how it's related to Erlang-like
concurrency (which means ultralightweight coroutines, not heavyweight
Unix or Windows processes). I think Python concurrency schemes get
interesting when they at least share memory (like POSH). Otherwise I
think of them more as "distributed" than "concurrent".

What is revolutionary about Erlang's concurrency model isn't exactly
its light weight threads (Python already has a frame work that
implements something similar) but the fact that in Erlang each thread
behaves like a process and each thread communicates with each other via
message passing. In Erlang, threads do not share state information. So
all the limitations associated with concurrent programming in other
mainstream languages are absent in Erlang. Because threads behave like
processes and do not share state, Erlang allows you to create thousands
of threads easily without the drawbacks of thread locks. Each thread or
process manages its own state. Erlang then provides a protocol to allow
each thread to communicate with each other.

You can mimic this concept with a light weight event based IPC like
D-Bus. D-Bus supports message passing and signals. It also provides you
with an easy protocol that allows processes to talk to each other. You
are right when you say that D-Bus uses heavy processes while Erlang
uses light ones. But the robustness and scalability of Erlang's
concurrency model stems from the fact that Erlang's threads are not
really threads, but light weight processes that do not share state
information. In brief, Erlang's concurrency model is basically IPC
programming with light-weight processes. This is what I say you can
mimic with D-Bus albeit, unfortunately, with heavy-weight processes.
 
M

mystilleef

Paul said:
It looks useful, but as far as I can tell, it's just another IPC
thingie that works through sockets, sort of like pyro without the
remote objects. I don't see how it's related to Erlang-like
concurrency (which means ultralightweight coroutines, not heavyweight
Unix or Windows processes). I think Python concurrency schemes get
interesting when they at least share memory (like POSH). Otherwise I
think of them more as "distributed" than "concurrent".

I always forget to bring up Stackless Python in this kinda discussions.
I haven't used, but I plan porting one of my projects to it.

http://www.stackless.com/about/sdocument_view
 

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,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top