Io multiplexing is one of the IO models in Linux, and IO multiplexing is the process of pre-telling the kernel to monitor the IO conditions so that once the kernel discovers that one or more of the IO conditions specified by the process is in place, it is processed through the process process, thus not blocking on a single IO. In Linux, there are three interface functions for IO
1 description
Stm8s's IO Multiplexing program code is cumbersome to configure, typically operating flash to manipulate the option byte byte, configuration registers are more cumbersome and can be set using the STM standard Peripheral driver Library. This article uses an interface configuration to configure the IO multiplexing pin, which is configured using STVP.
2 conf
I/O model
Five I/O models available in UNIX:
(1) blocking I/O
(2) non-blocking I/O
(3) I/O multiplexing (select and poll)
(4) signal-driven I/O (SIGIO)
(5) asynchronous I/O
For input operations on a set of interfaces, the first step usually involves waiting for data to arrive from the network. When the waiting group arrives, it is copied to a buffer in the kernel. The second step is to copy data from the kernel buffer to the application process
1, event channel model. The event channel is the prototype of asynchronous IO.2, io mode, one IO call will go through two stages. First, wait for the data phase, the data from the network or disk read to the system kernel (kennel) Two, the data from the kernel copy into the process.Based on these two phases, the Linux system generates five network mode scenarios.-Blocking I/O (blocking IO)-Non-blocking I/O (nobokcing IO)-I/O multiplexing. (I/O
many UI platforms provide the OnClick () event, which represents the mouse down event. The event-driven model is broadly thought of as follows:
There is an event (message) queue;
When the mouse is pressed, add a click event (message) to this queue;
There is a loop that constantly takes events out of the queue, and calls different functions, such as onclick (), OnKeyDown (), according to different events;
Events (messages) typically hold their own handler pointers, so that e
process begins data processing(2) non-blocking I/O The process sets a socket to non-blocking in the notification kernel: when the requested I/O operation has to put the process into sleep, it cannot put the process into sleep, but instead returns an error.No data can be returned at the first three calls to Recvfrom, so the kernel returns a ewouldblock error immediately, and the fourth time a datagram is ready when it is called Recvfrom, it is copied to the application buffer, so recvfrom return
I. About POLLFor the IO multiplexing model, the advantage is that it eliminates the wait for one IO event to be ready, instead of detecting multiple IO data at the same time, when at least one of the waiting events is ready, it will return to tell the user that the process "has data ready, quickly see which one to deal with", For the implementation of IO multiplexing, in addition to the use of the Select fu
First,Select I/O multiplexing (SELECT) is a kind of advanced I/O , blocking IO, record lock, System V-flow mechanism, I/O multiplexing (poll/epoll), READV and Writev functions, and storage mapping IO (mmap), These are collectively referred to as Advanced IO.The select system call is used to enable our program to monitor the state changes of multiple file handles to implement a multiplexed input/output mode
typically used in the following situations1. When dealing with multiple descriptors, such as simultaneous processing of sockets and disk IO, terminal IO2. One customer processes multiple sockets at the same time 3. The server handles both the listening socket and the connected Socket 4. Both TCP and UDP5 are processed. One server to process multiple services and protocolsI/O multiplexing is not limited to network programming, but can also be used in o
I/O multiplexing is required when the customer processes multiple Descriptors (usually interactive input and network sockets.
It is possible for a customer to process multiple sockets simultaneously, but this is rare.
If a TCP server processes both the listening socket and the connected socket, I/O multiplexing is generally used.
If a server needs to process both TCP and UDP, I/O
IO multiplexingThe word IO multiplexing may be a bit unfamiliar, but if I say select,epoll, I'll probably get it. Some places also call this IO mode for event driven IO. As we all know, the benefit of Select/epoll is that a single process can simultaneously handle multiple network connections of IO. The basic principle of the select/epoll is that the function will constantly poll all sockets that are responsible, and when a socket has data arrives, no
The status of a connected socket descriptor:Write-ready (or not-ready), read-ready (or not-ready). When the socket function performs I/O operations on the socket descriptor, such as reading data from the socket and writing data to the socketNot readyBy default, the socket function will be blocked until the socket is inReadiness status, These socket I/O processing functions will return.
This will cause some problems, such as when a process is readingRead not readyWill be blocked, unless the sock
The Select,epoll is a mechanism for IO multiplexing. I/O multiplexing is a mechanism by which multiple descriptors can be monitored, and once a descriptor is ready (usually read-ready or write-ready), the program can be notified of the appropriate read and write operations. But select,poll,epoll are essentially synchronous I/O, because they all need to read and write when the read-write event is ready, tha
easily cause the condition to be unsatisfied, and the thread goes into the sleep wait phase. So the question is, wait for the message to be ready. How to achieve this stage. It's still waiting, which means the thread still sleeps. The workaround is for the thread to actively query, or to have 1 threads waiting for all connections. This is the IO multiplexing. Multiplexing is the process of waiting for a me
Background Introduction If the server wants to handle both socket connection requests on the network and local standard input command requests, then if we accept the connection request using accept, we cannot process the standard input request; Similarly, if you wait for an input request in read, the request for the network connection cannot be processed. The so-called I/O multiplexing mechanism, which means that through a mechanism, you can monitor m
-blocking asynchronous three classes, in three ways, non-blocking asynchronous mode of scalability and performance best. This paper mainly introduces two kinds of IO multiplexing modes: Reactor and Proactor, and compares them. actorTwo IO multiplexing modes: Reactor and ProactorGenerally, the I/O multiplexing mechanism relies on an event demultiplexer. The Separa
In the previous article, I introduced the I/O model of five I/O models, which describes the use of I/O multiplexing in TCP sockets programming in I/O models. The use of the Select and poll functions is primarily in I/O multiplexing.Select functionThis function allows a process to instruct the kernel to wait for any one of several events to occur and to wake only if one or more events occur or exceed a specified time. The process call Select function t
The IO here refers to the network IOIO multiplexing via select module in Python, select, poll, Epoll, etc. in select moduleThe following example implements IO multiplexing with the Select moduleOnly IO multiplexing can only implement pseudo concurrencyServer-side#!/usr/bin/env python#-*-coding:utf-8-*-__author__='Zhoufeng'ImportSocketImportSelectsk=socket.socket
A high-performance server, it is necessary to solve the problem of IO multiplexing and multi-threaded services, this article in the study of "pattern-oriented software architecture-concurrent and networked object mode" after a little experience.
1.i/o multiplexing Mode:
Implemented using Select or poll or Epoll system-level functions in conventional I/O multiplexing
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.