In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what is the difference between thread synchronous async and blocking non-blocking". In daily operation, I believe that many people have doubts about the difference between thread synchronous async and blocking non-blocking. The editor consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the question of "what is the difference between thread synchronous async and blocking non-blocking". Next, please follow the editor to study!
About synchronous, asynchronous, blocking, non-blocking, I believe that friends in the it industry will encounter a lot.
It is said that before the bill of lading thread, multi-threaded, single-threaded is very simple, that is, one thing goes on step by step, while multi-threaded things follow their own steps at the same time.
Then there are two types of situations in multithreading:
First, threads are independent and do not affect each other.
Second, calls need to be made between threads, which leads to our topic today-synchronous async, blocking and non-blocking.
Take a simple example of life to explain these four concepts:
Wu is a small employee (chengxuyuan) of the company (ITwaibao), and Xiao M is his direct superior (xiangmujingli).
The story begins. Xiao M needs to arrange work tasks for Xiao Wu and regularly follow up the implementation and make new work arrangements.
Scenario 1 (synchronization):
Xiao Wu is diligent and keeps a diary every day. Every time little M asks, he can immediately give an answer that all the tasks have been completed. Little M praised him for completing the task in time and reporting efficiently, and immediately assigned him more tasks.
Scenario 2 (async):
Xiao Wu is diligent but doesn't keep a diary. Every time Xiao M asks, he asks him to report to her after he has sorted out the tasks he has done. Little M praised that he had done a good job, but he should get into the habit of keeping records, and then assigned him the rest of the work.
Scenario 3 (blocking):
Xiao M is a patient leader. Every time Xiao M asks, he will wait for Xiao Wu to organize the language. sometimes for 10 minutes or even an hour, Xiao M will take the trouble to wait for him to finish his report before leaving to do his own thing.
Scenario 4 (non-blocking):
Little M is an impatient leader. Every time Xiao M asked, if Xiao Wu couldn't utter a word for a long time, Xiao M slammed the door and shouted, "I'll be back!" . . . (the true description is that Xiao M can't wait for him to report another day. If Xiao Wu can't speak the next day, repeat the scene of the day before. no, no, no. Knowing that Xiao Wu could finish the report, Xiao M stopped asking him about it. Little M didn't delay other jobs.
At this point, the study on "what is the difference between thread synchronization and async, blocking and non-blocking" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.