This article describes the differences between select, poll, and epoll by analyzing pythonselectepollpoll.
Select
Select first appeared in. it monitors arrays of multiple file descriptors through a select () system call (everything in linux is a file, a block device, socket connection, etc .), When select () is returned, the ready file descriptor in the array will be changed to ready by the kernel ), this allows the process to obtain these file descr
readiness notification.
4. Serve serving clients with each thread, and use asynchronous I/OOn OS with AI/O support, it can provide quite high performance. However, the AI/O programming model is quite different from the classic model.Big, it is basically difficult to write a framework that supports both AI/O and classic models, reducing program portability. InOn Windows, this is basically the only option.
This article mainly discusses the details of model 2, that is, how the application software
a blocking call has a strong correlation, but it is not one by one corresponding. Blocking objects can have non-blocking calls, we can use a certain API to poll the state, at the appropriate time to call the blocking function, you can avoid blocking. For Non-blocking objects, calling special functions can also go into blocking calls. The function Select is one such example.
1. Sync, that is, I call a feature that does not e
, int nr);
Only the Nr exclusive wait process is awakened
Wake_up_all (wait_queue_head_t *queue);
Wake_up_interruptible_all (wait_queue_head_t *queue);
Wake_up_interruptible_sync (wait_queue_head_t *queue);
Old history: sleep_on
void sleep_on (wait_queue_head_t *queue);
void interruptible_sleep_on (wait_queue_head_t *queue);
Never use them.
* nix. Each bit indicates whether the FD of the corresponding subscript is in fd_set. Fd_set can only accommodate the handles with numbers less than fd_setsize.The default value of fd_setsize is 1024. If a large handle is placed into fd_set, the program will collapse when the array is out of bounds. By default, the maximum handle number of a process cannot exceed 1024, but this limit can be extended through the ulimit-N command/setrlimit function. If, unfortunately, a program is compiled in an
function callingWhether the object is in blocking mode is highly correlated with whether the function is blocked or not, but it is not one-to-one. Blocking objects can have non-blocking calling methods. We can use certain APIs to poll the status and call the blocking function as appropriate to avoid blocking. For non-blocking objects, calling special functions can also be blocked. The select function is an example.
1. Synchronization means that I ca
Article title: Application of NAPI technology in Linux network drivers (III ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Can it make receiving faster?
Now let's take a look at how to improve NAPI efficiency. before talking about efficiency, let's take a look at a model provided in NAPI_HOWTO.txt in the linux documentation to construct your own nic
the result is not immediately available. Or wait for the courier example: if you use a busy polling method, every 5 minutes to a floor of a layer (kernel buffer) to see the courier is not. If not, return immediately. And express come, put on the a floor, waiting for you to fetch. Blocking mode and blocking function calls for objectsWhether the object is in blocking mode and if the function is not a blocking call has a strong correlation, but not one by one corresponds. Blocking objects can have
Purgatory Time-out detectionWhen a delayedopeartion time-out (timeout), it needs to be detected and then call its callback method. It seems simple, but it's not easy to do it well.The implementation of the 0.8.x Kafka is straightforward, but inefficient. These versions of the Kafka delayed request implement the Delayeditem interface required by Java.util.concurrent.DelayQueue. These requests are put in a delayqueue, and then a dedicated thread poll th
fd_set to check whether a corresponding event has occurred. If yes, it will be processed. 2. Poll
The poll library is introduced in linux2.1.23 and does not support poll on Windows. poll and select are basically the same. They both create a collection of event-focused descriptors, wait for these events, and then Roun
women, elegant, exotic, quiet, cool and independent. some people think that Nina is a charming easygoing girl.
O
Olina Hawaiian dialect refers to Joy and joy.
Oprah (USA) and opera, Opie. The name is almost equal to the TV star Oprah winmtr. Oprah gives the impression that it is overbearing, beautiful, positive, self-righteous, bold, intelligent, and sensitive.
P
Pamela (Greece) All honey. People think that if Pamela is not a proud and annoying princess, it is a single mother of the lower class
total land.\nthornton, Phillip, Mario Herrero, and Polly Ericksen. "Livestock and Climate change." Livestock Exchange, No. 3 (2011).\nhttps://cgspace.cgiar.org/bitstream/handle/10568/10601/issuebrief3.pdf","Burger":"One hamburger requires 660 gallons of water to produce–the equivalent of 2 months ' worth of showers.\ncatanese, Christina. "Virtual water, Real impacts." Greenversations:official Blog of the U.S. EPA. 2012.\nhttp://blog.epa.gov/healthywa
has successfully registered our Clienttest service.Where two arrows are the service we use,clienttest is what we just released. bservicetest is another test service.Clienttest is going to call bservicetest this test service to get the data.The following request looks at the effect.From the dynamic graph, it is already up to expectations, because bservicetest has two instances, so you can also see the above result is that two instances at random return results.Last look at the logThe request is
current thread and returns immediately until the result is not immediately available.Blocking mode and blocking function calls for objectsWhether the object is in blocking mode and if the function is not a blocking call has a strong correlation, but not one by one corresponds. Blocking objects can have non-blocking calls, we can use a certain API to poll the state, the appropriate time to call the blocking function, you can avoid blocking. For non-bl
poll the state, the appropriate time to call the blocking function, you can avoid blocking. For non-blocking objects, calling a special function can also enter a blocking call. The function Select is an example of this.1. Sync, that is, I call a function, the function does not end before I death the result.2. Asynchronous, that is, I call a function, do not need to know the result of the function, the function has a result notify me (callback notific
process a wide variety of messages.examples of Courier: For example, to you some time to a floor (if it is the kernel buffer) to pick up the courier, but you do not know when the courier come over, you can not do anything else, can only death. But you can sleep (the process is dormant), because you know the courier will give you a call when the goods are delivered (assuming you can wake you up).Non-blockingThe concept of non-blocking and blocking corresponds to a function that does not block th
/** * Author:hasen * Reference: Linux device Driver Development Details * Introduction: Android Small rookie Linux * device Driver Development Learning Journey * Topic: device drivers that support polling operations * DATE:2014-11-07 */
In
Globalfifo's poll () function, the r_wait and w_wait wait queue headers in the device structure are first added to the wait list.
Then by judging whether the Dev->current_len is equal to zero
two phases is readiness and read/write, synchronous read/write must be blocked), asynchronous means that after actively requesting data, you can continue to process other tasks, and then wait for the I/O to complete the operation, this allows the process to read and write data without blocking. (Wait for "notification ")
Ii. Five I/O models in Linux
1) block I/O (blocking I/O)2) non-blocking I/O (nonblocking I/O)3) I/O multiplexing (select and poll
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.