Understanding multithreading by deciphering the cpython interpreter source code

Chirag Shah (~avidLearnerInProgress)


10

Votes

Description:

<h3>In this talk, I will provide a concise understanding of Threading and Global Interpreter Lock(GIL) in Python.</h3>

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 provide a better roadmap for community to develop better Python applications.

Program outcomes:

  • How threading can improve performance, its pros and cons.
  • What works best in which environment between threads and processes.
  • Why GIL matters the most in Python
  • How to leverage the power of open source source code to understand the crux of language.

Contents 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
  • Reference counting
  • 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

5. Questions


Agenda:

  1. 0 - 6 minutes: section 1, Threading for noobs

  2. 6 - 15 minutes: section 2, Understanding GIL

  3. 15 - 25 minutes: section 3, Infamous concepts

  4. 25 - 28 minutes: section 4, Removing the GIL

  5. 28 - 30 minutes: section 5, Questions


Prerequisites:

  • Basics of Python: Class, objects, list, libraries

Speaker Info:

  • I have been into CS field for over 6 years now. I have completed my BTech in Information Technology from Veermata Jijabai Technological Institute, Mumbai (VJTI). Also, I have done my diploma in Information Technology. I will be joining Barclays India as an SDE in the month of August.

  • Software development is my long suit. AI, ML and Data Science are my goto subjects. Competitive programming is something I love to do in my spare time.

  • I like tinkering with new technologies, creating new projects and implementing things by myself from scratch. I have been contributing on github for over a year now.

  • I am an avid learner and I can quickly adopt to new frameworks. Also, I am a mediocre public speaker with modest interest in Fintech and Investment Banking.

Speaker Links:

Section: Core python and Standard library
Type: Talks
Target Audience: Beginner
Last Updated: