Beyond the Main Thread : Workers, Shared Memory and Scheduling for JavaScript in the Browser
Overview
A page freezes when one long task holds the main thread. This book covers the browser's tools for keeping that work out of the way: dedicated, shared and service workers, OffscreenCanvas, SharedArrayBuffer and Atomics, WebAssembly threads, the Scheduler API, the Origin Private File System, and Observables.
Each chapter explains one tool, shows where it is used, and builds a demo you can run. The timings come from measurements in real Chrome, and the code is in a download that goes with the book. Where a result was surprising, the book says so: plain JavaScript beat our hand-written WebAssembly on a single thread, and moving work to a worker didn't make it faster at all.
Some of what the demos measure
- A 1.5-second job that freezes the page on the main thread, and the same job in a worker
- Four workers losing more than half their updates to one shared counter
- A crashed tab noticed in about 200 ms, where a pagehide handler never noticed
- Eight threads rendering about six times faster than one, and a fixed split of the work taking twice as long as a shared counter
- 20,000 small file writes in about 70 ms instead of about 3.5 seconds
Who this book is for
Web developers who know JavaScript and want to keep their pages responsive. You don't need to have used workers or shared memory before.
This item is Non-Returnable
Customers Also Bought
Details
- ISBN-13: 9798163770656
- ISBN-10: 9798163770656
- Publisher: Independently Published
- Publish Date: October 2026
- Dimensions: 9.25 x 7.5 x 0.3 inches
- Shipping Weight: 0.56 pounds
- Page Count: 142
Related Categories
