Five kinds of IO model (illustrated by a simple example)

1. blocking I / O model
talk of the town to the train station to buy tickets, line up three days to buy a refund.
Cost: stop eating and drinking Lazard sleep in three days, one did not do other things.

2. Non-blocking I / O model
talk of the town to the train station to buy a ticket, every 12 hours to the train station asked whether or not a refund, three days later to buy a ticket. Cost: round-trip station six times, six hours on the road, a lot of time to do other things.

3. the I / O multiplexing model
1.select/poll
talk of the town to the train station to buy a ticket, commissioned by cattle, then every 6-hour telephone inquiry cattle, cattle to buy tickets within three days, and then talk of the town to the train station to pay for tickets .
Cost: round-trip station 2, on the road two hours, cattle fee $ 100, call 17 times
2.epoll
talk of the town to the train station to buy a ticket, commissioned by cattle, cattle buy talk of the town after notification to pick up, then go talk of the town Station pay to get tickets.
Cost: round-trip station 2, on the road two hours, cattle fee $ 100, without having to call

4. The signal driven I / O model
talk of the town to the train station to buy a ticket, the conductor to leave your phone, after the vote, conductor hear his phone call, then talk of the town to the train station to pay for tickets.
Cost: round-trip station 2, on the road two hours, costs 100 yuan cattle-free, without having to call

5. asynchronous I / O model
talk of the town to the train station to buy a ticket, the conductor to leave your phone, after the vote, conductor hear his phone call and express home delivery.
Cost: 1 and from the station, on the road for one hour costs 100 yuan cattle-free, no phone calls



Author: delicious salad Aunt
link: https: //www.jianshu.com/p/6a6845464770
Source: Jane book
Jane book copyright reserved by the authors, are reproduced in any form, please contact the author to obtain authorization and indicate the source.

Published 23 original articles · won praise 4 · Views 9975

Guess you like

Origin blog.csdn.net/hxp1994/article/details/90186008