Ask for help from the interview question, how does node solve the problem of js single thread? what is the principle?

the concept of node has always been vague

I have always thought that node is a server, similar to nginx. During the interview, node was asked how to solve single-threaded problems

unable to express, ask for help


the nodeJS engine is single-threaded. JS communicates with cPP through V8. The CPP module is multi-threaded and handles IO operations. After the operation is completed, JS


node is called back by callback, and the event round robin mechanism is used to asynchronously perform the callback O operation, and the next request is awakened by callback callback.


cluster
Worker Threads


ides/event-loop-timers-and-nexttick/" rel=" nofollow noreferrer "> https://nodejs.org/en/docs/gu.


ide/load-balancing/" rel=" nofollow noreferrer "> pm2 tool enables multicore mode, similar to stand-alone load balancing

clipboard.png


nonenode

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37144-2adab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37144-2adab.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?