In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about the difference between Proactor and Reactor, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
Proactor:
The event handle initializes an asynchronous read operation, which does not care about the result of the asynchronous operation, but registers to get the completion event
Event multiplexer waits until the io event completes
When the event multiplexer waits for the io event, the operating system processes the read operation on a parallel kernel thread, puts the data into a user-defined buffer, and notifies the event multiplexer that the operation is complete.
Event multiplexer invokes event handle
The event handle takes user data from the user-defined buffer and operates, then starts a new asynchronous operation and returns the controlled release to the event multiplexer
Proactor mode is AIO.
Added Java AIO in Java 7
Java AIO simulates the implementation based on the epoll pattern (Linux 2.6)
Https://www.jianshu.com/p/8dbb0686fb8b
Comparison between NIO and AIO
So NIO is not suitable for those who take a long time to read and write.
However, AIO was notified only after the reading and writing process was completed.
So AIO is competent for those heavyweight tasks with a long reading and writing process.
It's just that the stage of focusing on the event is different, and the system notifies the thread in a different way.
But AIO simplifies the complexity of coding than NIO.
And more efficient and more scalable.
Then execute the corresponding processing function (the system opens up a thread to complete it)
Execution completion notifies threads concerned about the completion of this event
The current thread can do its own thing without notification
Blocking when getting the notification result
Check the information notified when you are free.
But you can set the timeout.
When there is no result for a period of time, continue to do something else.
Then notify the current thread to process
You need to wait before the notification returns.
And Selector is required to cooperate with the notification thread
What event is NIO listening for? is it ready?
What event has been completed for AIO monitoring?
AIO is not faster to read and write than NIO's IO.
Because the reading and writing process of NIO is still completed in the application thread
These are the differences between Proactor and Reactor. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.