I am trying to implement a server in Node Js which simultaneously takes as input, multiple code files in other languages like python,c++ etc, simultaneously runs them in child process using ExecFile and then returns the outputs. However, I think that if a code file has problems, like infinite loops or segmentation faults, it might affect the health of my server (OR CRASH IT). I was searching on the internet, when I cam across the terms like containers, but I am not sure how will it help me in this context. Any guidance will be highly appreciated.
If by "containers" you mean Docker containers
, then that is unfeasible. You cannot separate the Node process into child processes in other containers.
if a code file has problems, like infinite loops or segmentation faults, it might affect the health of my server (OR CRASH IT)
This you should solve by proper error handling and execution time limitations (in case of infinite loops, f.e.), but not with child processes with the intention of just dumping them, if they crash.
simultaneously runs them in child process
And you don't really need to run the different file processing mechanisms in separate Node child processes (even though you can). You can just run them asynchronously (aka simultaneously) with promises, f.e.