2025-09-14 –, Track 1
Concurrency is essential for building scalable network applications, and Python offers several ways to achieve it. In this session, we’ll explore Python’s concurrency models through the lens of socket programming.
We’ll begin with Multi-threading and examine how the Global Interpreter Lock (GIL) affects performance. Then we’ll look at single-threaded alternatives using the selectors
module, introducing the idea of an event loop and how it helps manage multiple socket connections efficiently. Finally, we’ll dive into asyncio
, to understand how it builds on these lower-level ideas to provide a high-level, structured approach to asynchronous I/O. If you’re curious about how to write fast, modern, and scalable network applications in Python, this session will give you the tools and mental models to get started.
Takeaways:
1. Grasp Python’s key concurrency models for socket programming
2. Learn how selectors
enables efficient I/O multiplexing
3. Understand asyncio
through examples
-
Introduction
- Why concurrency matters in network programming
- The challenge: handling many simultaneous socket connections -
Threads and Blocking Sockets
- How traditional multithreading handles socket connections
- The role of the GIL and its impact on concurrency
- Downsides: context switching, memory overhead, blocking, and complexity -
A Different Path: Single-threaded Concurrency with
selectors
- Introduction to non-blocking sockets
- How theselectors
module lets us monitor multiple sockets
- Introduction to event loop -
Introducing asyncio
- Understanding howasyncio
builds on the same event loop idea
- Breaking down theawait
keyword, coroutines and tasks.
- Coroutines / Task as light weight user space threads
- Visualizing cooperative scheduling
- Async sockets -
Future of python concurreny: No GIL ?
- Brief discussion on NO GIL implementations of python such as numba, etc
- Upcoming changes into cpython focusing on no gil -
Wrap-Up, Q&A
Intermediate
Prerequisites –- Basic understanding of python
- Basic understanding of sockets (I might go over them briefly)
Hey everyone 👋,
I am a Solution Consultant at Sahaj Software, specializing in Backend Development, Cloud Computing, and bit into Retrieval-Augmented Generation (RAG) systems. I have a passion for database internals and system-level behavior, I focus on building efficient, elegant systems while exploring the interaction between hardware and software.