The work of controlling the traffic on the link between two adjacent nodes is completed in the "link layer"; the most basic function of the data link layer is to provide users of this layer with transparent and reliable data transmission. Service, the data link layer is to enhance the function of the physical layer to transmit the original bit stream, transform the possible error-prone physical connection provided by the physical layer into a logical error-free data link, so that it appears to the network layer as error-free line.
The operating environment of this tutorial: Windows 10 system, DELL G3 computer.
It is done at the link layer
Data link layer The most basic function is to provide transparent and reliable basic data transmission services to users at this layer. Transparency means that there are no restrictions on the content, format, and encoding of data transmitted on this layer, and there is no need to explain the meaning of the information structure; reliable transmission eliminates users' worries about lost information, interfering information, and incorrect order. These situations may occur in the physical layer, and error correction codes must be used in the data link layer to detect and correct errors. The data link layer enhances the function of the physical layer to transmit the original bit stream, transforming the possible error-prone physical connections provided by the physical layer into a logically error-free data link, so that it appears as an error-free line to the network layer. .
Extended knowledge: flow control
Error control is a part of the data link layer function ,Another important part is flow control. Flow control involves controlling the transmission rate of characters or frames on a link so that the receiver has enough buffer storage space to accept each character or frame before receiving. For example, in a character-oriented terminal-computer link, if the remote computer serves many terminals, it may be temporarily overloaded because it cannot transmit all characters at a predetermined rate during peak times. Similarly, in a frame-oriented automatic retransmission request system, when the number of frames to be acknowledged increases, the buffer storage capacity may be exceeded, causing overload.
XON/XOFF scheme
Increasing the buffer storage space can alleviate the difference in transmission rate between the receiving and sending parties to a certain extent, but this is a passive The negative and passive methods have many inconveniences and limitations in implementation. On the one hand, the system does not allow the establishment of an excessively large buffer space; on the other hand, when the speed is significantly mismatched and large files are transmitted, there will still be insufficient buffer space. The XON/XOFF scheme is a more active and active flow control method. In the XON/XOFF scheme, a pair of control characters is used to implement flow control. XON uses the control character DC1 in the ASCII character set, and XOFF uses the control character DC3 in the ASCII character set. When the receiver on the communication chain is overloaded, it sends an XOFF character to the sender and then temporarily stops sending data. After the receiver has processed the data in the buffer memory and the overload is restored, it sends an XON character to the sender. , to notify the sender to resume data sending. During a data transmission process, the XOFF and XON cycles can be repeated multiple times, but they are transparent to the user. Many asynchronous data communication software packages support the XON/XOFF protocol. This scheme can also be used for a computer to send characters to a printer or other terminal device, in which case the control component in the printer or terminal device is used to control the character flow.
Window mechanism
In order to improve the effective utilization of the channel. As mentioned in the previous section, the sender continuously sends several frames without waiting for the confirmation frame to return. This sending process is like a continuous pipeline, so it is also called pipelining technology. Since multiple unacknowledged folded frames are allowed to be sent continuously, the frame number can be distinguished using a multi-digit binary number. Because any frame that is sent but has not been acknowledged may be errored or lost and requires retransmission, these frames must be retained. This requires the sender to have a large send buffer to retain unacknowledged frames that may require retransmission. However, the buffer capacity is always limited. If the receiver cannot process the received frames at the sender's sending rate, it may still run out of buffer capacity and become temporarily overloaded. To this end, adjustment measures similar to the idle RQ scheme can be introduced. The essence is to limit the number of frames that the sender can send before receiving a certain frame. This is the result of the sender adjusting the number of frames reserved in the reissue. This is achieved by confirming the number of frames. If the receiver has no time to process the received frame, the receiver stops sending acknowledgment information. At this time, the sender's re-publication limit is reached. When the re-publication limit is reached, no new frames will be sent until the acknowledgment information is received again. . In order to implement this solution, the maximum number of unacknowledged frames should be set in the retransmission of unacknowledged frames. This limit is called the transmission window of the link. Obviously, if the window is set to 1, that is, the buffering capacity of the sender is equal to one frame, the transmission control scheme will return to the idle RQ scheme. At this time, the transmission efficiency is very low, so the window limit should be selected so that the receiver can process or accept it as much as possible. All frames received. Of course, factors such as the maximum frame length, available buffer capacity, and transmission bit rate must also be considered when choosing. A reissue is a list of consecutive sequence numbers corresponding to those frames that the sender has sent but has not yet acknowledged. The sequence numbers of these frames have a maximum value, which is the limit of the sending window. The so-called sending window refers to the bounds of the queue of frame numbers that have been sent but not yet confirmed by the sender. The upper and lower bounds are called the upper and lower edges of the sending window respectively, and the distance between the upper and lower edges is called the window size. The receiver similarly has a receive window, which indicates the sequence number of frames that are allowed to be received. The upper and lower bounds of the receiving window also slide with time.
Every time the sender sends a frame, the number of frames to be acknowledged increases by 1; similarly, every time the sender receives a confirmation message, the number of frames to be acknowledged decreases by 1. When the retransmission count value, that is, the number of frames to be acknowledged, is equal to the transmission window, new frames are stopped being sent. Generally, the frame number only takes a limited binary number, and it will cycle repeatedly after a certain period of time. If the frame number is equipped with a 3-digit binary number, the frame number will cycle between 0 and 7. When the transmission process is in progress, the window position keeps sliding, so it is also called a sliding window (Slidding Window), or simply a sliding window.
The state change process of the sliding window can be described as follows (assuming that the sending window is 2 and the receiving window is 1).
In the initial state, the sender sends no frames, and the front and rear edges of the sending window are equal. The receive window limit is 1, which allows frame 0 to be received.
The sender has sent frame No. 0. At this time, the transmission port is open (that is, the leading edge is increased by 1), and the window is aligned with No. 0, indicating that the frame has been sent but the confirmation return message has not yet been received. The receive window status is the same as before, indicating that reception of 0 frames is allowed.
The sender continues to send frame No. 1 before receiving the confirmation return information of frame 0. The status of the sending window remains unchanged.
The sender has received frame 0, and the window slides one space, indicating that it is ready to receive frame No. 1. The status of the sending window remains unchanged.
The sender has received the confirmation return information of frame No. 0, and the trailing edge of the sending window is increased by 1, indicating that frame No. 0 is deleted from the republishing, and the status of the receiving window remains unchanged.
The sender continues to send 2 frames, and the leading edge of the sending window is increased by 1, indicating that frame 2 is also included in the list of pending confirmation. The status of the receiving
window remains unchanged.
The receiver has received frame No. 1, and the receiving window slides one space, indicating that it is ready to receive frame No. 2. The status of the sending window remains unchanged.
The sender receives the confirmation message from the receiver that frame No. 1 has been received, and the trailing edge of the sending window increases by 1, indicating that the earliest incoming frame No. 1 will be deleted from the republishing. The receiving window status remains unchanged. Generally speaking, any frame that arrives within a certain range, even if it is out of sequence, must be received by the receiver. If this range is regarded as a receiving window, the size of the receiving window should be greater than 1, and Go-back-N is a special case where the receiving window is equal to 1. Selective retransmission can also be regarded as a sliding window protocol, except that both its sending window and receiving window are greater than 1. If we look at the three protocols of idle RQ, Go-back-N and selective retransmission from the perspective of a sliding window, the difference between them lies in the size of their respective windows:
Idle RQ: send window = 1 , receive window=1
Go-back-N: send window>1, receive window=1
Select resend: send window>1, receive window>1
If the frame sequence number adopts 3-digit binary encoding, the maximum sequence number is SMAX=2^3-1=7. For the ordered reception mode, the maximum size of the sending window is selected as SMAX; for the non-fence reception mode, the maximum size of the sending window is at most half of the sequence number range. The timer that manages the timeout control should be equal to the number of send buffers, not the size of the sequence number space. In fact, each buffer should correspond to a timer. When the timer times out, the contents of the corresponding buffer are retransmitted. The number of buffers that must be set by the receiver should be equal to the receive window size, not the size of the sequence number space.
For more related knowledge, please visit the FAQ column!
The above is the detailed content of Where is the work of controlling traffic on the link between two adjacent nodes done?. For more information, please follow other related articles on the PHP Chinese website!