-2

So out of curiosity, I was thinking of creating my own thread pool in nodejs from which I can run number of threads in parallelly? Been looking to webworker-threads and npool but not being to understand much from it..

Is it possible to create a thread pool in nodejs? Also how to execute number of threads from the pool created in parallel number of threads/chid_processes? Like is distributed system?

harshes53
  • 419
  • 1
  • 6
  • 17

1 Answers1

2

Yes there is an open source project on git called Threads a gogo written for node.

TAGG: Threads à gogo for Node.js Threads à gogo (*) is a native module for Node.js that provides an asynchronous, evented and/or continuation passing style API for moving blocking/longish CPU-bound tasks out of Node's event loop to JavaScript threads that run in parallel in the background and that use all the available CPU cores automatically; all from within a single Node process.

Installing the module

With npm:

npm install threads_a_gogo
From source:

git clone http://github.com/xk/node-threads-a-gogo.git
cd node-threads-a-gogo
node-gyp rebuild
# It also works with node-waf, but this is outdated, so please use node-gyp nowdays.
To include the module in your project:

var threads_a_gogo= require('threads_a_gogo');

https://github.com/xk/node-threads-a-gogo

penguin
  • 724
  • 5
  • 11