[Tutor] Gaining Multiprocessor Systems' Throughput Benefits

dman dsh8290@rit.edu
Thu, 24 Jan 2002 18:44:51 -0500


On Thu, Jan 24, 2002 at 02:45:27PM -0800, Fred Allen wrote:
| Dear Sirs and Mesdames:
| 
| I understand that Python's interpreter sets a global lock that 
| bars concurrently active multiple threads.

The lock is for synchronization.  It is only used when two (or more)
threads require mutually exclusive access.

| Thus, Python's threading model provides no direct means to benefit
| from multiprocessors.

If it uses kernel-level (or "system" level) threads instead of
user-level (or "green") threads it can.

| I've related  questions and a request.  I 
| fear this mayn't be the forum for either.  If it isn't, I'd 
| be just as pleased by the identity of a preferable forum. 
| 
| 1.  I cannot find a PEP describing any change that might 
| enable Python's threading model to gain the benefits of 
| multiple processors.  Has such a change been considered and 
| rejected? Tabled for later consideration, e.g., Python 3.0?
| 
| 2.  Have any among you used multiple instantiations of the 
| Python interpreter to gain some of the benefits 
| multiprocessor systems offer?  If so, would you please bare 
| the code by which you did so and some estimate of the 
| marginal gain per additional processor?  

I've done almost no parallel work with python, but I've done a fair
amount of work with java threads.  This article from Sun regarding the
performance of java and solaris on multiprocessor machines may
interest you : http://www.sun.com/software/white-papers/wp-realtime/
The concepts described are not java- or solaris-specific.  You'll get
multiprocessor advantage in any program if kernel-level threads or
multiple processes are used.  I don't know of cpython uses
kernel-level threads (I think it does) on which platforms or if it
has a "green" thread implementation.

HTH,
-D

-- 

He who spares the rod hates his son,
but he who loves him is careful to discipline him.
        Proverbs 13:24