Oracle Magazine, July/August 2017
Database Developer OPEN SOURCE ORACLE MAGAZINE JULY AUGUST 2017 52 process exit 0 As you can see JavaScript code can be entered and executed interactively Note that process exit is used to exit the REPL pressing Ctrl C twice will also exit The process object is a global object that provides programmatic access to the currently running Node js process It is important to understand that Node js runs as an operating system process Although Node js is often described as a single threaded environment that description isnt exactly complete In fact as shown in Figure 1 just by running Node js and looking up the process with Activity Monitor on my Mac I can see that the Node js process is running 10 threads Most of these threads are created by two open source libraries that Node js depends on V8 and Libuv V8 is the high performance JavaScript engine thats used by the Chrome web browser and Libuv is the cross platform framework that provides the evented architecture that makes Node js so efficient When Node js is described as a single threaded environment its because only one thread will be dedicated to running Libuvs event loop This thread is often referred to as the main thread and its where all the JavaScript code in a Node js Figure 1 Single threaded Node js and its 10 threads
You must have JavaScript enabled to view digital editions.