It is well known that some Java NIO, NIO2 support has been added in recent versions of Java, while one of the most praised advantages of the Nodejs technology stack is its high-performance IO, so the topic we are discussing today is the underlying technology that supports these technologies.
One of the first questions to ask before starting is:
Why did Nodejs and Java NIO2 not appear earlier in the day?
Answer: Personally think that the underlying support technology is immature.
So what does the underlying technology mean? Yes, I think a lot of people have guessed that it's operating system technology. The two concepts proposed in this paper, Java NIO2 and Nodejs, are either user-state or application-layer technology, and these application-layer technologies operate on the OS, while the programming models that can be supported are richer as the operating system progresses. It can be said that these two technologies are completely evolved to apply the dividends of operating system advances (Tengyun technology ty300.com). Generally the first technology to enjoy this bonus must be c\c++ (introductory tutorial qkxue.net), because the most recent advances in OS are system calls, and c\c++ is the most convenient to apply these system calls, but it is also the most complex. Other platforms in order to achieve the same performance, it must continue to evolve, encapsulation, so that users can use these bonuses, once the platform stalled update, that is, the platform is down. The more convenient the package is to the user, the more friendly it is to the user, and the more people it may use. While many people can quickly write code based on these platforms, they are often not the essence, because they do not inherently understand the motivations and principles of these technologies. The techniques we discuss below are the underlying technologies associated with these two technologies.
No matter which OS design, the following 5 IO models are essential.
1. Blocking I/O
2. nonblocking I/O
3. I/O multiplexing (SELECT, poll and Epoll)
4. Signal driven I/O (SIGIO)
5. Asynchronous I/O (the POSIX aio_ functions)
1. Blocking I/O
, the advantage of this IO model is that it is simple programming and one of the first IO models supported by the OS, and the disadvantage is that system calls block user dynamic thread execution, which results in wasted CPU time and low IO efficiency.
The underlying technology supporting Java NIO and NodeJS
2. nonblocking I/O
, one of the improvements to this IO model is that IO is nonblocking, but requires long polling and also wastes CPU clock cycles.
Manuscripts: Diligent Learning qkxue.net
Read full version support Java NIO and NodeJS's underlying technology
The underlying technology supporting Java NIO and NodeJS