Re: multi threading in multi processor (computer)

From: Alan Kennedy (alanmk_at_hotmail.com)
Date: 02/09/05


Date: Wed, 09 Feb 2005 16:19:23 +0000


[ajikoe@gmail.com]
> That's a pity, since when we have to run parallel, with single
> processor is really not efficient. To use more computers I think is
> cheaper than to buy super computer in developt country.

Although cpython has a GIL that prevents multiple python threads *in the
same python process* from running *inside the python interpreter* at the
same time (I/O is not affected, for example), this can be gotten around
by using multiple processes, each bound to a different CPU, and using
some form of IPC (pyro, CORBA, bespoke, etc) to communicate between
those processes.

This solution is not ideal, because it will probably involve
restructuring your app. Also, all of the de/serialization involved in
the IPC will slow things down, unless you're using POSH, a shared memory
based system that requires System V IPC.

http://poshmodule.sf.net

Alternatively, you could simply use either jython or ironpython, both of
which have no central interpreter lock (because they rely on JVM/CLR
garbage collection), and thus will support transparent migration of
threads to multiple processors in a multi-cpu system, if the underlying
VM supports that.

http://www.jython.org
http://www.ironpython.com

And you shouldn't have to restructure your code, assuming that it is
already thread-safe?

For interest, I thought I'd mention PyLinda, a distributed object system
that takes a completely different, higher level, approach to object
distribution: it creates "tuple space", where objects live. The objects
can be located and sent messages. But (Py)Linda hides most of gory
details of how objects actually get distributed, and the mechanics of
actually connecting with those remote objects.

http://www-users.cs.york.ac.uk/~aw/pylinda/

HTH,

--
alan kennedy
------------------------------------------------------
email alan:              http://xhaus.com/contact/alan


Relevant Pages

  • Re: modernization of FORTH, Age Results
    ... The power of things like C, Python, Unix, etc. is that they spread like ... Computers are just faster and vaster. ... If you were any way interested in programming, ... Computers are just faster and vaster these days that allow this. ...
    (comp.lang.forth)
  • Re: choosing between ipcop and iptables
    ... >of another distribution and continue using the other distribution. ... >Iptables is part of any normal distribution. ... if both the distribution startup scripts and your script try ... >a small home network with multiple computers, ...
    (comp.os.linux.security)
  • Re: Does Python really follow its philosophy of "Readability counts"?
    ... Because human are smarter than computers. ... Why can optimizing C compilers make more efficient code than the best human assembly language programmers? ... That's even better than Python ... protection module from their Python installations. ...
    (comp.lang.python)
  • Re: python for loop
    ... why half-open intervals are better than closed intervals: ... although both sides (mathematical vs engineer) adress some ... not our world to computers). ... Why, then, should Python be so foreign to you? ...
    (comp.lang.python)
  • Re: python for loop
    ... why half-open intervals are better than closed intervals: ... although both sides (mathematical vs engineer) adress some ... not our world to computers). ... but i just read somewhere that guido who wrote python is a mathem. ...
    (comp.lang.python)