Node. js entry-6. I/o mode

Source: Internet
Author: User

We divide I/O into serial I/O and parallel I/O according to the execution method. After the serial I/O is completed, the next I/O will be executed. Parallel I/O is more complex, but it is easier to understand that several I/O operations are performed simultaneously. One thing to note is that in serial I/O, requests are generally executed in the order of request queues and results are returned in this order. The results returned by parallel I/O are not in any order. Serial I/O and parallel I/O can work in combination. For example, multiple groups of parallel I/O exist, and each group contains different numbers of serial I/O.

In node, we assume that all I/O delays are infinite, and they may execute 0 to infinite time. We do not know or assume their specific execution duration. Instead of waiting for their execution to complete, we should use the event-based mode. When I/O execution is complete, we should use the callback function to respond to the results. Therefore, using parallel I/O is an ideal solution. We can execute multiple requests and return results in the order they have been executed.

So we now have two ways to process I/O: sequential serial processing and non-sequential parallel processing. Sequential parallel processing is also a useful mode. This method can be used when I/O is allowed to run in parallel and the original sequence is used to return results. Non-sequential serialization does not benefit, so we will not discuss it.

Note:

I felt like I was familiar with this part. I used to learn how to run the operating system and how to implement multi-threaded programming. If you are familiar with the knowledge, it is certainly easier to understand this knowledge.

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.