VPython/Tk app works on single processor but not dual

Fred Yankowski fcy at enteract.com
Mon Mar 19 12:44:33 EST 2001


I'm working on a VPython app that gives the user a Tk window with
sliders that they can use to control the application.  This program
works fine on WinNT if I "set affinity" of the python.exe process so
that it's forced to run on a single processor, but if I let it run
normally on my dual-processor system, the application hangs in short
order, refusing to respond to mouse actions in either the Tk or
VPython display windows.

My guess is that the multiple threads involved in this program are
deadlocking [well, duh].  My program seems to hang at the point where
it sets the .visible member of a VPython object to 0, causing VPython
to take the object out of the display list.  VPython uses several
read-locks while doing the display list changes, and explicitly messes
with the reference count managed by the underlying Python 'CXX'
package, which in turn wraps the yet-further-underlying Python ref
count.  But I don't see the cause of the deadlock.

So, I'm looking for ways to work around this problem.  At a minimum,
is there some way within a Python program to "set processor affinity"
so that all threads of the process are forced to run on the same
processor?  I couldn't find anything related to this in the Python
library manual.

More deeply, what is the current state of Python support for
multithreading over multiple processors?  Is this combination --
Python 2.0, VPython, tkinter -- known to have problems with multiple
processors?

The program itself is available, for now, at
<http://ontosys.com/src/residue.py>.  I'm using Python 2.0 and VPython
2001-02-27 on NT4SP6, on dual Pentium-III 800 processors.  I have
version 8.3.2 of tk83.dll and tcl83.dll.

--
Fred Yankowski






More information about the Python-list mailing list