PyCon Balkan 2018 Talks
Understanding multithreading by deciphering the cpython interpreter source code
In this talk, I will provide a concise understanding of Threading and Global Interpreter Lock(GIL) in Python.
In the modern era of hybrid cores and processors, there is an in demand need for concurrent and parallel programming paradigms. Python, since its inception has amazing support for single threaded applications. The extensive use of Python in booming fields like Machine Learning has paved the way to constantly improve multi-threaded applications in Python.
I will speak from ground level covering very crucial aspects of Threading and Locks which will pave the way for community to develop better Python applications.
Content to be covered:
1. Threading for noobs:
Terminologies: Process, threads, multithreading, multiprocessing, types of threads, locks, mutex, CPU and I/O bound processes.
Multithreading in Python: Threading module (with example)
Comparative analysis of Sequential vs Multithreaded execution in Python (with example)
2. Understanding the global interpreter lock (GIL):
What and why of GIL
Impact of GIL on CPU and I/O Bound Processes
In-depth understanding of GIL using cpython interpreter source code
Ticks via context switching
3. Infamous concepts:
Cooperative vs Preemptive multitasking
Parallelism vs Concurrency
Thread Safety in Python
4. Removing the GIL:
Famous GIL removal patch
Guido on GIL, Larry Hastings Gilectomy