Synchronization in Python


Allen B. Downey


On July 14, 2005 I gave a talk for the Boston Python Interest Group on synchronization in Python. Most of the talk was based on my book, The Little Book of Semaphores.

Here are the notes I handed out, and here are the slides, which contain just the code we talked about.

I also demonstrated a simulator I use to animate the execution of synchronized, multithreaded programs. I haven't really released this program in a state that I can support, but if you want to play with it, you can download this gzipped tar file.

To unpack it, type "tar -xzf sync.tgz". It will create a directory named sync that contains Sync.py, which is the simulator, Gui.py, which is some utility code it uses, and several examples that run within the simulator.

To run the program, move into the sync directory and type "./Sync.py mutex.py". It should load and display the code from mutex.py, and allow you to run simulated threads through it.