3 ms·
Could you explain why GIL wouldn't make it CPU bound, rather than memory bound?
by hodwik 10y ago
Could you explain why GIL wouldn't make it CPU bound, rather than memory bound?
- eveningcoffee 10y agoI am sorry, but by memory I meant cache memory that is in fact inside the CPU. This is error on my side. I read [0] and could not infer anything to confirm my understanding, but if we consider the semantics of GIL, then there should be some form of guarantee in place that two CPU cores see the coherent picture of the cache (other way two threads would see incoherent values of the same variable or would not see the changes at all). This is usually archived by some form of memory barriers and flushing the registers into memory and this by my experience (that comes from Java) makes the code order of magnitude or two slower. [0] https://wiki.python.org/moin/GlobalInterpreterLock https://wiki.python.org/moin/GlobalInterpreterLock