Python vs. Ruby: threads - advice appreciated

Alan Miller ajm at enteract.com
Sat Jun 10 11:02:11 EDT 2000


Tim Peters (tim_one at email.msn.com) wrote:
>[Jean-Paul Smets]
>> I wonder if it is possible to go that far with Python, either with
>> native threads
>
>You didn't name your OS, so nobody can try a comparable experiment.  The
>Python below invites 1,000 Philosophers to dinner, and ran fine without
>thrashing on an old 32Mb Win95 box.  I know from experience I can't push
>this particular box much farther than that.

Items worth noting:
 * On my 64MB/133Mhz Win95 box the attached code never had more than 175 
   philosophers actually trying to dine at the same time (based on 
   one thread per philosopher).  Setting things up to have a full 
   thousand threads running at once might cause very different 
   memory usage results.
 * The processor utilitzation for Python never surpassed the processor 
   utilization for MS-DOS, and was generally around half the MS-DOS 
   level, showing the importance of output in performance measures.
 * Running the original with pythonw instead of python, the thread count 
   topped out in the 450 range, and processor utilization (by 
   pythonw) made it as high as 95%.  Unfortunately, at the very end the 
   thread count never dropped below 61, indicating some sort of problem 
   with the app terminating.
 * Running a modified version (all the print statements removed) in 
   python, the thread count topped out in the 725 range and processor
   utilization made it up to 95%; pythonw with the same .py didn't seem 
   to get quite as high.

ajm (another rank beginner with Python)



More information about the Python-list mailing list