For nodejs the SharedArrayBuffer And Array buffer havee been supported officially since v10.5.0 and they are directly mentioned on the documentation on https://nodejs.org/api/worker_threads.html:
Unlike child_process or cluster, worker_threads can share memory. They
do so by transferring ArrayBuffer instances or sharing
SharedArrayBuffer instances.
Shared buffer and atomics:
https://www.sitepen.com/blog/the-return-of-sharedarraybuffers-and-atomics/
A good article that tackle directly the shared buffer. And the use with atomic (You must look at Atomic too).
Quick snippet (from the article):
// Creating a shared buffer
const length = 10;
// Get the size we want in bytes for the buffer
const size = Int32Array.BYTES_PER_ELEMENT * length;
// Create a buffer for 10 integers
const sharedBuffer = new SharedArrayBuffer(size);
const sharedArray = new Int32Array(sharedBuffer);
Now we have a shared buffer that we can pass to a worker context and also have an integer Array that leverages that shared buffer. To pass this buffer reference to the worker:
// main.js
worker.postMessage(sharedBuffer);
This buffer allows us to create another shared array on the worker side:
// worker.js
constsharedArray = new Int32Array(m.data);
The article cover a lot of details and the use of atomic too. Check the last section too about the support in the browser! It may be outdated already! but still relevant!
Check Introducing Atomics title for a good introduction! (too long to site here).
And from MDN https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics. A link to check.
And
https://blog.logrocket.com/a-complete-guide-to-threads-in-node-js-4fa3898fe74f/
And this one take the whole multi-threading including the shared buffer use. With good historical background. And it tackle many many things.
Check this too:
https://mcmap.net/q/485112/-node-js-worker-threads-shared-object-store
For the use of data view!