Node.js shared memory and atomics documentation and how tos

Viewed 2435
2 Answers

EVOLVING ANSWER

It appears that Node 9.0.0 supports SharedArrayBuffer which can be found on MDN at: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer

and atomics: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/store

This was added to Node.js in v9.0.0: http://node.green/#ES2017-features-shared-memory-and-atomics-SharedArrayBuffer

I will continue to document everything I learn on this for others who are interested in utilizing this in Node.js.

YouTube Videos Nidin Vinayakan: Shared Memory & Parallel Programming with JavaScript | JSConf EU 2017 https://www.youtube.com/watch?v=vvqfmskTIjE

Here you can find a Node.js + AssemblyScript multithreading boilerplate code.

Repo : as-multithreading-boilerplate

Dependencies

  • Node.js@10.5.0
  • AssemblyScript@0.6.0

This repo shows

  1. Basic setup to do multithreading using nodejs worker_threads
  2. Basic WebAssembly multithreading with AssemblyScript
  3. Atomic WebAssembly memory allocator
Related