### _Appendix A.3_  
Complete source code of the program code of the distributed muti-model (Section 8.3) using proxy and group service with remote worker processes. The number of worker processes is determined by nodes joining the compute group and is dynamically. Required software components: workbook.html, worksh, webwork.html, worker.js (see next code example). ``` varconfig={ PN:4, proxy:'[[http://192.168.0.101:22223](http://192.168.0.101:22223)]([http://192.168.0.101:22223](http://192.168.0.101:22223))', workgroup:'a5908583-31b6-46b1-bc19-1a8826d3409f', nodeid:Utils.UUIDv4(), verbose:1, } // Main worker RPC loop waiting for code evaluation requests async function workerLoop (config) {  print('WebWorker started. ',config.workgroup); // Load plug-ins load('math.plugin.js') load('ml.plugin.js') await sleep(1000); varurl=config.proxy; // Create group/proxy control channel vargs=group.client(url,{id:config.workerid}); print('ping',url,inspect(await gs.ping())) // Connect to proxy server, get a communication socket varsocket=await gs.connect(); // Join computational group, get all membersawait gs.join(config.workgroup)  // ReturnsUUID array  await gs.ask(config.workgroup) varEnv = {  print:function () {  print.apply({},Array.prototype.slice.call(arguments));  socket.write({cmd:'print',  id:config.workerid,  data:Array.prototype.slice.call(arguments))};  },  send:function (data) {  socket.write({cmd:'send',data:data,from:socket.peerid});  },  sleep:sleep,  schedule:schedule,  time:Date.now,  DB:DB,  JSON:JSON,  ML:ML,  Math:Math,  Utils:Utils,  } for(;;) {  // Get requests from master  var rpc = await socket.read();  switch (rpc.cmd) {  case 'run':  // Run code here! try { compile(rpc.code,Env,rpc.data) }  catch (e) { print(e.toString()) };  break;  case'stop':  Code.interrupt=true;  case 'ping':  socket.write({cmd:'pong',id:socket.peerid});  break;  }  }  // Start the worker processor code... async function main() {  var workers=[];  for(var i=0;i<config.PN;i++) {  var worker = Code.worker.create(i);  await Code.worker.ready(worker);  print('Worker #'+i+' started. ');  workers.push(worker);  } for(var i=0;i<config.PN;i++) {  Code.worker.evalf(workers[i],workerLoop,{  id:i,  proxy:config.proxy,  workgroup:config.workgroup,  nodeid:config.nodeid,workerid:config.nodeid+'-'+i, verbose:config.verbose, }) } } print('Initialized.') } main()

### Appendix A.4

Worker code, provided by the wproxy server and processed by the webwork.html App in a node Web browser. This worker waits for code execution requests from the master. ## References

* (1) PsiLAB 1/2. Scientific and Numeric Research Software Environment. Available online: [[http://psilab.sourceforge.net](http://psilab.sourceforge.net)]([http://psilab.sourceforge.net](http://psilab.sourceforge.net)) (accessed on 1 January 2022). * (2) node.js. Available online: [[https://github.com/nodejs/node](https://github.com/nodejs/node)]([https://github.com/nodejs/node](https://github.com/nodejs/node)) (accessed on 1 January 2022). * (3) [PERSON]; [PERSON] Parallel MATLAB: Doing It Right. _Proc. IEEE_**2008**, 93, 331-341. [CrossRef]
* (4) [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON] A hybrid GPU-FPGA based design methodology for enhancing machine learning applications performance. _J. Ambient. Intell. Humaniz. Comput._**2020**, _11, 2309-2323. [CrossRef]
* (5) [PERSON] WebMesh: A Browser-Based Computational Framework for Serverless Applications. Bachelor's Thesis, Computer Science Department, Brown University, Providence, RI, USA, 2019. * (6) [PERSON]; [PERSON] Parallel simulation today. _Ann. Oper. Res._**1994**, _53, 249-285. [CrossRef]
* (7) [PERSON]; [PERSON]; [PERSON] Structuring parallel and distributed programs. _Softw. Eng. J._**1993**, \(8\), 73. [CrossRef]
* (8) [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON]; [PERSON] Parsec: A parallel simulation environment for complex systems. _Computer_**1998**, _31_, 77-85.