Show HN: Profile usage of the GIL in CPython
github.com
github.com
In my experience, in a lot of code (numerics is my background), the GIL is actually not held most of the time, and so programs can benefit from multithreading despite the GIL, as competition for it is low.
I also think this package is a bit clever - since the GIL is not exposed to Python code, I had to do some trickery to access it and check if is held or not. The code basically reads the data segment of process memory, and acquires and releases the GIL to see what changed, and uses that information to determined where in memory the variables for the GIL are located.