Making python C-API thread safe (try 2)

Gary Feldman gafStopSpamData at ziplink.stopallspam.net
Sun Sep 14 14:11:05 EDT 2003


On Sat, 13 Sep 2003 19:20:08 -0500, "A.M. Kuchling" <amk at amk.ca> wrote:

>
>* You don't have to add locks around your data structures, and run the risk
>  of subtle and time-dependent bugs if you forget or get the locking wrong.
>
>* You have to figure out some persistent way to store session information so
>  that all the processes can access it.  This is extra work, but it also

Of course, this point obviates the previous point.  And regardless of which
approach you use, you need to spend time to distinguish shared data and
per-thread/process data.

>any benefit from using threading in web applications.

The main benefit of threads is performance.  Sharing data among the threads
is often faster than sharing data among processes (you don't need to deal
with shm_get, etc. for sharing memory on UNIX systems).  Locking the shared
data is likewise often faster.  Finally, my understanding of the MS Windows
world is that threads as a general rule are more efficient than processes.

Gary




More information about the Python-list mailing list