AlgoPlusAlgoPlus
AlgoPlus//web / browser-internals
Read the theory

How a Browser Works

A browser is many programs — a sandboxed process per site — and inside each, an event loop keeps one main thread responsive.

Step
Legend
Active / microtask
Task (timer, event)
AI Tutor Workspace
In a nutshell
Open a tab and the browser runs several processes: a browser process for the window, a sandboxed renderer process per site (so one site can't crash or read another), a GPU process, and a network service. Inside one renderer, the main thread runs one thing at a time. Synchronous code runs on the call stack; setTimeout queues a macrotask and a resolved promise queues a microtask. When the stack empties, the event loop drains every microtask first, may render a frame, then runs one task — so 'A, setTimeout(D), promise(C), B' prints A, B, C, D.
Ready
Press play to begin the cinematic walkthrough.
A browser is many programs, not one — a separate sandboxed process per site keeps a bad page contained. Inside each, the event loop lets a single main thread juggle work without ever stopping to wait.
Key terms
Go deeper in the lesson
Read the full theory, intuition & complexity for How a Browser Works.