帮助理解 IO 模型
考虑这个矩阵:
我一直在思考什么可以成为每个 IO 模型的一个很好的例子。
到目前为止我得到了什么:
- 同步阻塞:例如,一个单线程应用程序在执行 read() 系统调用时发生阻塞
- 同步非阻塞:同一个应用程序,但只使用一个线程,使用一个线程池,其中多个线程处理阻塞 IO-主线程不阻塞时的操作。
- 异步阻塞:使用阻塞 poll() 调用来管理严重文件描述符(如套接字)的应用程序。 (libevent 也是异步阻塞还是异步非阻塞?那 ePoll() 呢?)
- 异步非阻塞:???
我想在你们的帮助下知道我的想法是否正确,以及你们是否可以帮助我理解每个模型。
谢谢!
异步
Consider this Matrix:
I have been thinking for a while what could be a good example for each IO-Model.
What i get so far:
- Synchronous Blocking: For example a Single Threaded Application which blocks while performing a read() System Call
- Synchronous Non-Blocking: The Same Application but instead just using one Thread using a Threadpool with several Threads which handle blocking IO-Operations while the main Thread doesnt block.
- Asynchonous Blocking: An Application which uses the blocking poll()-Call to manage severel File Descriptors like Sockets. (Is libevent also Asynchronous Blocking or Asynchronous Non-blocking? And what about ePoll()?)
- Asynchronous Non-Blocking: ???
I would like to know with some help of you guys if my thoughts are right and if you could help me understanding each Model.
Thanks!
Asynchronous
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
同步阻塞:你走到咖啡壶前,按下“冲泡”按钮。在咖啡冲泡完成之前,您不得离开。
同步非阻塞:你正在看报纸,想要喝点咖啡,你告诉你的朋友去煮壶。他这样做了,并且必须等到比赛结束才能离开彩池。
异步阻塞:您正在阅读报纸并想要更多咖啡。你告诉你的朋友去煮一壶咖啡,煮好后给你端来一杯咖啡。
Synchronous Blocking: You go to a coffee pot and hit brew. You are forbidden to leave until the coffee finishes brewing.
Synchronous Non-Blocking: You are reading a newspaper and want some coffee you tell your friend to go brew a pot. He does so and has to wait until it finishes to leave the pot.
Asynchronous Blocking: You are reading a newspaper and want more coffee. You tell your friend to go brew a pot and bring you a cup of coffee when it's done.