AI-powered
podcast player
Listen to all your favourite podcasts with AI-powered features
The Pros and Cons of a Global Interpreter Lock
Python uses reference counting for garbage collection. If you have threads, as we all know, we have things called race conditions. You don't want race conditions with your reference count because that's how you end up having memory leaks. Because of the global interpreter lock, we were able to design the entire system to have the best single threaded performance possible. But it does allow scaling with threads to number of cores roughly.