A page runs JavaScript, layout and input handling on one main thread, so a 200 ms computation freezes the page for 200 ms. Either move the work to a worker thread, or split it into tasks the browser schedules around input (requestIdleCallback()-Prioritized Task Scheduling). Workers have no DOM but keep fetch(), timers, IndexedDB and caches; they exchange copies via postMessage() or share memory through SharedArrayBuffer (SharedArrayBuffer-Atomics).
| Dedicated | Shared | Service | |
|---|---|---|---|
| Constructor | Worker | SharedWorker | register() |
| Serves | One page | Same-origin pages | A URL scope |
| Lifetime | Its page | Its last page | Event-driven |
| Baseline | Widely (2015) | Newly (2026) | Widely (2018) |