On 14 Jun 2020, at 22:59, Ben Rudiak-Gould
wrote: There isn't really any contention for these memory locations in CPython as it stands because only one interpreter thread can run at a time. The only time a cache handoff is needed is during a thread switch when the new thread is scheduled on a different core, which is pretty rare (at CPU timescales). Adding checks to every incref/decref would probably cost more time than it would save.
The problem is when you fork a python process. Each of the child processes you would hope shared the state of the parent that is not being changed. But because of ref counting even unchanging objects get modified by a ref count inc/dec cycle and then the page that the object is in is copy-on-write'ed. End result is that a children share no pages with the parent. Barry