Bridging sync ↔ async & backpressure
P33.bridging.01 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Tasks, gather & timeouts
P33.bridging.01 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: Tasks, gather & timeouts
The event loop is one thread, so a single blocking call freezes every coroutine. Real systems are full of blocking libraries and CPU-bound work, so you must bridge between the async and sync worlds without stalling the loop — and bound your queues so a fast producer can't exhaust memory. The kernel rung offloads a real blocking call to a thread.
time.sleep, heavy CPU — inside a coroutine holds that thread, so no other coroutine runs until it returns. Awaiting doesn't help if the work itself never yields.Why it matters — This is the number-one asyncio production bug: a synchronous library call inside a coroutine silently stalls the entire service.
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
Offload a real blocking call to a thread on the kernel, then explain bridging and backpressure — closing the P32 → P33 concurrency arc.
Loading exercise…
Loading exercise…
That closes the concurrency arc: P32 gave you threads and processes, P33 gave you the event loop and how to bridge back to them. Next pillar: making it all fast.
Loading your notes...