当前位置:网站首页>5-1 blocking / non blocking, synchronous / asynchronous
5-1 blocking / non blocking, synchronous / asynchronous
2022-07-03 14:49:00 【III VII】
Blocking / Non blocking 、 Sync / asynchronous
A typical time IO What are the two stages of ? Data ready and Data reading and writing
Data ready : According to the system IO Ready state of the operation
Blocking
Non blocking
Data reading and writing : Depending on how the application interacts with the kernel
Sync
asynchronous
Sync : After function call , After getting the program result , Immediately proceed ( It takes the time of the program );
Example : Buy air tickets , Take a taxi to the airport to get your ticket ( This action takes your own time );
Programming is relatively simple ;
asynchronous : asynchronous IO Interface (sockfd,buf, Inform the way ( It's usually sigio The signal )), Need notification , Don't wait for the program to call the function to return the result , Wait for the operating system ( kernel ) Put data into buf In , Notify the program to process the result of the function call ;
Example : After buying the ticket , The courier will send the ticket from the airport to his home ( It takes someone else's time )
A typical network IO Interface call , There are two stages , Namely “ Data ready ” and “ Data reading and writing ”, The data ready phase is divided into blocking and non blocking , The result is , Block the current thread or return directly .
Synchronization means A towards B Request to call a network IO Interface ( Or call some business logic API Interface ), The data is read and written by the requestor A Do it yourself ( Whether it's blocked or not ); Asynchronous representation A towards B Request to call a network IO Interface ( Or call some business logic API Interface ), towards B The event of the incoming request and the way of notification when the event occurs ,A You can handle other logic , When B After listening to the completion of event processing , Will be notified in advance , notice A Processing results .
边栏推荐
- Pytorch深度学习和目标检测实战笔记
- The latest M1 dedicated Au update Adobe audit CC 2021 Chinese direct installation version has solved the problems of M1 installation without flash back!
- 创业团队如何落地敏捷测试,提升质量效能?丨声网开发者创业讲堂 Vol.03
- 7-10 stack of hats (25 points) (C language solution)
- China PETG market forecast and Strategic Research Report (2022 Edition)
- [graphics] efficient target deformation animation based on OpenGL es 3.0
- Some concepts about agile
- Paper sharing: generating playful palettes from images
- 提高效率 Or 增加成本,开发人员应如何理解结对编程?
- Pyqt interface production (login + jump page)
猜你喜欢
[opengl] advanced chapter of texture - principle of flowmap
Bibit pharmaceutical rushed to the scientific innovation board: annual revenue of 970000, loss of 137million, proposed to raise 2billion
Amazon, express, lazada, shopee, eBay, wish, Wal Mart, Alibaba international, meikeduo and other cross-border e-commerce platforms evaluate how Ziyang account can seize traffic by using products in th
B2020 分糖果
US stock listing of polar: how can the delivery of 55000 units support the valuation of more than 20billion US dollars
The picture quality has been improved! LR enhancement details_ Lightroom turns on AI photo detail enhancement: picture clarity increases by 30%
[ue4] geometry drawing pipeline
How to query the baby category of tmall on Taobao
Niuke: crossing the river
Happy capital new dual currency fund nearly 4billion yuan completed its first account closing
随机推荐
零拷贝底层剖析
Talking about part of data storage in C language
链表有环,快慢指针走3步可以吗
Tonybot humanoid robot checks the port and corresponds to port 0701
Zhonggan micro sprint technology innovation board: annual revenue of 240million, net loss of 17.82 million, proposed to raise 600million
C language STR function
Luogu p5194 [usaco05dec]scales s solution
Common commands for getting started with mongodb database
Some concepts about agile
dllexport和dllimport
Zzuli: sum of 1051 square roots
牛客 BM83 字符串变形(大小写转换,字符串反转,字符串替换)
[engine development] in depth GPU and rendering optimization (basic)
406. 根据身高重建队列
[opengl] pre bake using computational shaders
[ue4] HISM large scale vegetation rendering solution
Zzuli:1059 highest score
Bucket sorting in C language
Puzzle (016.4) domino effect
关于敏捷的一些概念