The Python Global Interpreter Lock (GIL) is a mutual exclusion mechanism that allows only one thread to execute Python bytecode at a time. While the GIL ensures memory safety between threads by avoiding race conditions, it effectively serializes execution across threads, preventing “true parallelism” from being achieved in Python programs. However, since Python 3.13, disabling the GIL is now possible. This option finally allows for Python threads to run fully in parallel. The ability to disable the Python GIL has fostered much discussion about both the pros and cons; therefore, the purpose of our project is to gain a better understanding of the potential performance and memory safety trade-offs between keeping and disabling the Global Interpreter Lock.
For our project, we plan to benchmark and analyze the performance (execution time) and memory safety (appearance of concurrency bugs) implications of disabling the GIL across a variety of Python programs. This might include single-threaded programs and multi-threaded programs in both CPU-bound and I/O-bound applications from online sources or written by us. We hope the results of our investigation will provide empirical insights into when removing the GIL can be beneficial, or when it might actually be harmful.