Synchronous, asynchronous and blocking, non-blocking difference

- Source Network, author unknown.

 

Aihe Cha Zhang, do not talk nonsense, boil water.
Dramatis personae: Zhang, kettle two (ordinary kettle, referred kettle; will ring the kettle, kettle abbreviated ring).
1 Zhang put the kettle on the fire, such as legislation to open water. (Synchronous blocking)
Zhang felt a little silly
2 Zhang put the kettle on the fire to the living room to watch TV from time to time to see if the kitchen is not open water. (Synchronous non-blocking)
Zhang still felt a bit silly, so change high-end, bought a kettle that will ring the flute. After the water is boiling, it can emit a loud beep ~ ~ ~ ~ noise.
3 Zhang put the kettle on the fire ring, legislation and other open water. (Asynchronous blocking)
Zhang felt so little significance Shadeng
4 Zhang put the kettle on the fire ring, to the living room watching TV, not to see it before the kettle rang, rang get another pot. (Asynchronous non-blocking)
Zhang feel smart.


The so-called synchronous asynchronous, but for the purposes of the kettle.
Ordinary kettle, synchronization; whistling kettle, asynchronous.
Although able to work, but the whistling kettle may be completed after themselves, prompting Zhang open water. This is a common kettle can not reach.
Synchronization can only let the caller go to polling own (case 2), resulting in low efficiency of Zhang.

The so-called blocking non-blocking, only for Zhang terms.
Zhang Li, etc., obstruction; Zhang watching TV, non-blocking.
In cases 1 and 3 is blocked Zhang, his wife did not know he shouted. While 3 in response kettle is asynchronous, it may not make much sense for the erecting of Zhang. Therefore, the general is in line with asynchronous non-blocking use, so as to play an asynchronous effectiveness.




Guess you like

Origin www.cnblogs.com/leonandyou/p/11330075.html