Semicolony ELI5 · comic

The event loop.

One waiter covers the whole restaurant by refusing to ever stand and watch food cook.

  1. Just me, yes.
    a full room, one waiter
    1

    No second waiter is coming — every table in this room is one thread’s problem.

  2. You were ready first.
    task task task next ready one
    2

    The queue settles every argument about who is next: whichever task became ready first.

  3. Yell when it’s done.
    KITCHEN hand off, don't wait
    3

    Cooking belongs to the kitchen; the waiter’s entire job is to drop the order and walk away.

  4. never idle
    4

    The point is not speed — it is that nobody ever stands watching a pot while someone else could be served.

  5. On my way back round.
    ding! food's up picked up next lap
    5

    A finished dish is just a new item in the queue, collected on whichever lap comes next.

  6. Send help.
    heavy ! everything waits
    6

    One table that will not stop talking holds the whole room hostage — the loop cannot walk away mid-task.

One waiter, a full room: take the next ready task, hand off slow work, never sit idle.
Semicolony semicolony.dev/eli5/event-loop/comic
← All ELI5 explainers