SMP, GIL and Threads

Steve Holden steve at holdenweb.com
Fri Dec 16 16:17:08 EST 2005


Donn Cave wrote:
> In article <mailman.2222.1134754305.18701.python-list at python.org>,
>  Steve Holden <steve at holdenweb.com> wrote:
> ...
> 
>>I don't see why you should get problems on SMP hardware, since the 
>>threads are all part of the same process and should therefore (I'd have 
>>thought) be tagged with the same processor affinity. Hence the GIL 
>>should manage contention successfully.
> 
> 
> Could you explain your thinking there?  I don't know that much
> about SMP.  Would have thought that affinity might make a difference
> with on-processor cache and so forth, but would be transparent to
> applications.  Are you thinking that the processor affinity would
> essentially serialize execution, so SMP hardware doesn't matter
> because your threads won't execute concurrently anyway?
> 
I was just trying to underline that the separate threads won't run 
concurrently, I suppose, and choosing a bad way to do it (since the 
affinity need not be set and the process can freely migrate between 
processors).
> 
>>Threads most often use Queue.Queue to communicate, precisely because its 
>>operations are guaranteed thread-safe.
> 
> 
> (Just thought that might bear repetition.)
> 
Yes!

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list