MULTICPU
Distributes the processing of a list of items over all available CPUs.
Installation
1/ install the package:
npm install --save-dep multicpu
2/ Have a look at the example app.js
const multicpu = ; /** * build and return a list of items, to be sent to each worker * @param * @returns */ { console; // build an array of N entries. let arr = ; for let i = 2; i < 20; i++ arr; return arr;} /** * process an item from the list built by start, spread over workers running on all CPUs. n this example, wait for the numer of seconds provided in parameters * @async * @param */ { console; let p = { ; }; await p; return itemwait} /** * called at the end of whole processing for master to do whatever work * @param * @param * @param * @param */ { console; var dt = ; console;} multicpustart start: start process: processing end: end;
© 2018-2019 devbab