SharedArrayBuffer
A block of raw memory that several threads can read and write at the same time, without copying.
In more detail
Posting one to a worker shares it rather than cloning it. Because threads can change it simultaneously, updates must use Atomics to avoid race conditions.
Related terms
- Atomics — A JavaScript object of functions that read and change shared memory in steps that cannot be interrupted by another thread.
- ArrayBuffer — A standard JavaScript object representing a block of raw binary memory, which you read and write through a typed array or DataView.
- race condition — A bug whose outcome depends on the timing of two things happening at once.
- worker threads — The Node.js module for running JavaScript in parallel threads inside one process, each with its own V8 isolate and event loop.
Taught in
- Worker Threads: worker_threads & SharedArrayBuffer — Node.js Internals & Backend Services