How to understand node is single-threaded asynchronous I/O

Source: Internet
Author: User

I/O: Refers to the operation of the interface circuit connected to the CPU by the device

Asynchronous: It is not necessary to wait for an operation to complete, but to execute other code, and so on after the completion of the operation to perform the results of that operation,

Nodejs uses a callback function to implement the

Single threaded: There are many workarounds when implementing asynchronous operations, and Apache's solution is multi-threading, and many programming languages use multithreading, but in later testing and practical applications,

Multi-threaded programming has a dramatic drop in performance over 10,000, because creating a new thread is a performance-intensive capability, even though multithreading can take the CPU to the extreme, but it doesn't solve too many people to access it. So

Node's single thread becomes its shining spot. And its callback and its grammar match very tacit understanding. But it also exposes its drawbacks , namely, the inability to make full use of the CPU. So treat the CPU

Intensive operation of its performance on the multi-threaded or insufficient. To solve this problem, node has a new process or sub-threading module (child-process) when it encounters CPU-intensive operations

You can create a new child process to fetch execution.

1190000007343993 This web site is very thin, child-process.

How to understand node is single-threaded asynchronous I/O

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.