[Python-ideas] [Python-Dev] A bit about the GIL

Charles-François Natali cf.natali at gmail.com
Mon Apr 1 11:35:34 CEST 2013


> Actually you don't need a per-thread counter, only per-cpu (see
> sched_getcpu()/getcpu()), although I'm not sure it'd be as fast as
> using thread-register like Trent does.

Of course, per-cpu only holds for kernel-space, in userland you could
get preempted...

So you'd need O(number of threads) counters per object (and allocating
them on demand will probably kill performance).

cf



More information about the Python-ideas mailing list