This is a relatively simple idea concerning mutex usage. I imagine someone else has probably thought of it before. However, since I just thought of it, I figured I'd blog it. I have no clue why I was thinking about mutexes. I usually prefer share-nothing approaches like Erlang. Note, I am specifically not trying to comment on Python's GIL.
Imagine you have a bunch of resources (like objects or structs) that you wish to protect. One way to protect them is to use a single mutex. This is called coarse-grained locking. At the opposite end of the spectrum, you can create a new mutex for every resource. This is called fine-grained locking. However, what if you want something in the middle?
Having a single lock is unfortunate because it forces a lot of your code to be effectively single-threaded, even if you have multiple processors. However, perhaps creating a new mutex for every single resource might be overkill. (Personally, I'm unsure of why that might be the case.)
Here's an approach to get arbitrarily fine locking. Create N mutexes (where N is tunable). Protect each resource using mutex number resource_id % N. The resource_id could be whatever, as long as it's unique. Perhaps it's the index of an array, or perhaps it's a pointer to the resource in memory.
And now for something completely different! The best part of Lisp is that it has garbage collection. It recycles garbage so that you can grow new trees ;)