[Python-Dev] Making python C-API thread safe (try 2)

Pat Miller patmiller at llnl.gov
Tue Sep 16 12:24:45 EDT 2003


I used to work on the SISAL compiler which was a fine-grained parallel
functional language.  It reference counted its allocated data.

Updating the reference count is a critical section.
We were spending 40% of our time blocked for reference counting on only 4 threads.

We eventually taught the compiler to do reference count optimizations
(e.g. put all readers of an object before the writers), but these
optimizations are not suitable to the Python interpreter.

With this same reasoning, you can infer why C++ smart pointers are
also a bad idea for threaded code.

Pat


-- 
Patrick Miller | (925) 423-0309 | http://www.llnl.gov/CASC/people/pmiller

All you need in this life is ignorance and confidence, and then success is
sure. -- Mark Twain




More information about the Python-Dev mailing list