Software Developer | Barclays
Chirag is a software developer working at Barclays, India. Software Development is his long suite. His primary fields of interest are Artificial Intelligence and Machine Learning.
Chirag has immense interest in scalability and design principles. Competitive programming is something he likes to do occasionally. An avid reader and Pythonista by heart.
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