Help understanding IO-Models
Consider this Matrix:
I have been thinking for a while what could be a go开发者_Python百科od 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
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.
精彩评论