Programming Paradigms Session 6 · Wed 7 October 2026

← all sessions

Session 6

Asynchronous Programming

concurrency on one thread, from the ground up: continuations, promises, the event loop

Part 2 opens: coordination and communication, what a concurrent program must guarantee, and the four sessions on one bank; then concurrency on one thread, where a function that waits gives the thread back.

Before the session

Three ways in · about 17 minutes
Test yourselfFive short programs. What does each print?5 minTry it →Why study this?Where the event loop runs, and what the session teaches.2 minRead →A real-world caseCloudflare, 2019: one regular expression held every event loop.10 minRead the story →

Lecture

Lab

Warm-upThe lecture in JS and PythonPDF →
QuestContinuations (optional)FilesLab page →

Topics and languages

Main topics
The introduction to Part 2: Dijkstra's bounded buffer, safety and liveness, the four sessions on one system. Then asynchronous programming: suspension points, waiting is not running, run-to-completion, atomicity between suspension points, the race on one thread.
Written in
JS, Python
Read in
(OCaml absent by design)