Non-blocking I/O Server Model and blocking I/O Server Model
Let's take a look at this situation. You and thousands of players are super fans of World of Warcraft. Every weekend, they will form a group of bosses. The game server is Alexander every weekend, because at least several hundred thousand users are online at the same time. Is it feasible to use our multi-thread
In network programming, a network handle may encounter the concept of blocking Io and non-blocking Io. Here we will first describe these two sockets:
Blocking IO: the blocking mode of the socket means that the IO operation (including errors) must be completed before returning.
Non-
1. Conceptual analysisBelieve that a lot of Linux background development work has been in contact with the concept of synchronous asynchronous, blocking non-blocking, but also believe that there have been misunderstandings, such as the idea that synchronization is blocking, asynchronous is non-blocking, the following
What is the difference between synchronous (synchronous) IO and asynchronous (asynchronous) Io, what is blocking (blocking) IO and non-blocking (non-blocking) IO respectively? The problem is that different people may give different answers, such as wikis, that asynchronous IO and non-
When writing a program, it takes a long time to finish a large function, but suddenly there is a need for a small function that needs to be completed first, then it pauses the big function, the first little function, this way is called blocking. As soon as the small function is done, continue to function bigger. This is the usual synchronous (synchronous) or blocking (B
) they handle.Ii. Blocking and non-blockingBlocking/non-blocking. They are the status when the program is waiting for the message (it doesn't matter whether it is synchronous or asynchronous.1. ConceptsA. BlockingBlocking call means that the current thread will be suspended before the call result is returned. The function is returned only after the result is obtained.Some people may equate
Blocking Mode
Windows Socket performs I/O operations in both blocking and non-blocking modes. In blocking mode, the operation function to be executed waits until the I/O operation is completed without returning immediately. The thread where the function is located will be blocked here. On the contrary, in non-
I. OverviewWhat is the difference between synchronous (synchronous) IO and asynchronous (asynchronous) Io, what is blocking (blocking) IO and non-blocking (non-blocking) IO respectively? The problem is that different people may give different answers, such as wikis, that asynchronous IO and non-
Old Zhang loves drinking tea, without talking nonsense, and boiling water.
Appearance character: Lao Zhang, two kettle (ordinary kettle for short; ring kettle for short ).
1. Old Zhang put the kettle on the fire and waited for the water to open. (Synchronous blocking)
Lao Zhang thinks he is a bit silly.
2. Old Zhang put the kettle on the fire, went to the living room to watch TV, and went to the kitchen from time to see if the water was open. (Non-
To put it more simply:
Obstruction is not to do not come back, has been waiting until the matter is completed before returning;If you do it first, I'll see if there's anything else. No, as soon as I found out something was stuck, I immediately reported to the leader.
Let's take the most commonly used send and recv two functions ...For example, you call the Send function to send a certain byte, in the system sent to do the work is actually just the data transfer (COPY) to the TCP/IP protocol st
IO Model Description:* Blocking IO blocking IO* nonblocking io non-blocking IO* IO multiplexing IO multiplexing* Signal driven IO signal driver io ()* Asynchronous IO Asynchronous IOIO Model Description: To better understand the IO model, we need to review it in advance: synchronous, asynchronous, blocking, non-blockin
) they handle.Ii. Blocking and non-blockingBlocking/non-blocking. They are the status when the program is waiting for the message (it doesn't matter whether it is synchronous or asynchronous.1. ConceptsA. BlockingBlocking call means that the current thread will be suspended before the call result is returned. The function is returned only after the result is obtained.Some people may equate
Original: http://blog.csdn.net/historyasamirror/article/details/5778378
When you find that your most popular blog is a big mistake, this is definitely not a pleasant thing to do.IO-Sync, asynchronous, blocking, non-blocking I wrote when I began to learn Epoll and libevent, and the main idea came from the link in the article. After writing to find a lot of people like, I am still very happy, it also shows t
Turn from: http://blog.csdn.net/historyasamirror/article/details/5778378
When you find that your most popular blog is a big mistake, this is definitely not a pleasant thing to do.IO-Sync, asynchronous, blocking, non-blocking I wrote when I began to learn Epoll and libevent, and the main idea came from the link in the article. After writing to find a lot of people like, I am still very happy, it also shows
If you want to have a kung pao chicken rice:
Synchronous congestion: you order food at the restaurant, and then wait there, and you have to shout: Okay!
Synchronous non-blocking: after ordering at the restaurant, you can walk the dog. But after a while, I went back to the restaurant and shouted: Okay!
Asynchronous blocking: when walking the dog, you receive a call from the restaurant saying that the meal is
synchronous asynchronous blocking non-blocking
Today and the small partners to discuss this issue, the online statement there are many kinds of, I follow my own ideas to summarize one side.A sentence summarizes the difference:Synchronous Async is concerned with your behavior when an event occurs.The state of the wait event that is blocking the non-
Synchronous asynchronous and non-blocking, synchronous asynchronous Blocking
Synchronous/asynchronous and blocking/non-blocking have different meanings in different scenarios.
In the operating system
Blocking statusIt means that when a running process is temporarily unab
1. What do the returned values of Recv in blocking mode and non-blocking mode mean? Is there a difference? (As far as I know at present, there is no distinction between blocking and non-blocking Recv return values, all of which are
2. What do the return values of write in blocki
1. What is "blocking"?Blocking is a side effect of the SQL database application "lock" mechanism. When an application request is locked for a database object (such as a full table, a row of data, or a data page), the lock blocks other application requests. It's like you lock your home door, your wife doesn't have a key, and you can only wait for you to go home. Her request to enter the room was blocked by y
Believe that the dry it more or less have heard of synchronous, asynchronous, blocking, non-blocking the four words, they can also be divided into two pairs, that is, synchronous, asynchronous pair, blocking, non-blocking a pair, this look at the word meaning is very good understanding. The key problem is the differenc
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.