Day 31 of 133
Concurrency in Python: GIL, asyncio, multiprocessing + DSA Heap finish
When threads help, when they don't; futures and queues for ML pipelines.
DSA · NeetCode Heap / Priority Queue
- Find Median From Data StreamDSA · Heap / Priority Queue
Interview questions to prep
- Walk through the two-heaps trick (max-heap left, min-heap right). What invariant ties them?
- What's the space cost over a long-running stream, and how would you bound it (windowed median)?
SWE · Concurrency in Python
Interview questions to prep
- Explain the GIL and why threading helps I/O-bound but not CPU-bound work in CPython.
- When does multiprocessing beat threading for ML workloads?
Interview questions to prep
- When is asyncio the right choice over threads/processes?
- What are common pitfalls with mixing sync and async code?
Interview questions to prep
- How would you parallelize an embarrassingly parallel inference workload?
- Compare ThreadPoolExecutor vs ProcessPoolExecutor — when does each fit, and what does the GIL mean here?
References & further reading
- Real Python — Python GIL ↗Real Python