How does Node.js execute two different scripts? -
i can't imagine how can node.js in 1 single thread execute 2 scripts different code simultaneously. example have 2 different scripts , b. happen if simultaneously several clients request , b. php understandable, example, created 5 threads handle , 5 threads handle b, , each request script executes again. happens in node.js? thank you!
it uses called event loop, implemented libuv
a simple explanation be: when new event occurs, put queue. every , then, node process interupt execution process these events.
the main difference between php , node node.js process stand-alone web server (single threaded), while php interpreter runs within web server (i.e. apache), responsible creating new threads each request.
Comments
Post a Comment