Home > Common Problem > body text

What is the main function of the data link layer

青灯夜游
Release: 2023-01-13 00:38:50
Original
79721 people have browsed it

The main functions of the data link layer: 1. Combine data into data blocks and encapsulate them into frames; 2. Error control; 3. Flow control; 4. Link control; 5. MAC addressing; 6 , distinguish data and control information; 7. Transparent transmission.

What is the main function of the data link layer

The operating environment of this tutorial: Windows 10 system, Dell G3 computer.

Main functions of the data link layer

1. Framing (frame synchronization)---Transform data Combined into data blocks and encapsulated into frames

In order to provide services to the network layer, the data link layer must use the services provided by the physical layer. The physical layer is transmitted as a bit stream. This bit stream does not guarantee that there will be no errors during the data transmission process. The number of bits received may be less than, equal to, or more than the number of bits sent. And they may also have different values. At this time, in order to achieve effective error control of data, the data link layer uses a "frame" data block for transmission. To transmit in frame format, there must be corresponding frame synchronization technology. This is the "framing" (also called "frame synchronization") function of the data link layer.

The advantage of using the frame transmission method is: When a data transmission error is discovered, only the frame with the error needs to be transmitted again, without the need to retransmit the entire data bit stream. , which will greatly improve the transmission efficiency.

The advantage of using frame transmission method is that it brings two problems:

(1) How to identify the beginning and end of the frame;

(2) In a data frame mixed with retransmissions, does the receiver recognize the retransmitted data frame as a new data frame or as a retransmitted frame? This relies on various "frame synchronization" technologies at the data link layer to identify it. "Frame synchronization" technology allows the receiver to accurately distinguish the beginning and end of each frame from the bit stream that is not completely ordered, and can also identify retransmitted frames.

2. Error control

  • #During the data communication process, there may be errors due to physical link performance and network communication environment. Due to other factors, some transmission errors will inevitably occur, but in order to ensure the accuracy of data communication, the probability of these errors must be kept as low as possible. This function is also implemented at the data link layer, which is its "error control" function.

  • In digital or data communication systems, anti-interference coding is usually used for error control. Generally divided into 4 categories: forward error correction (FEC), feedback detection (ARQ), hybrid error correction (HEC) and information feedback (IRQ).

  • The FEC method is to add enough redundant bits in a specific structure in the information code sequence - called "supervision element" (or "check element"). The receiving end decoder can automatically identify a small number of errors and correct them according to the specific supervision rules agreed upon by both parties. FEC is most suitable for real-time high-speed data transmission situations.

  • In non-real-time data transmission, the ARQ error control method is commonly used. The decoder detects errors in the received code groups one by one according to the encoding rules. If there is no error, "confirmation" ACK information is fed back to the sending end; if there is an error, ANK information is fed back to indicate that the sending end is requested to resend the information just sent. The advantage of the ARQ method is that there are fewer redundant coding bits, strong error detection capabilities, and simple encoding and decoding. Since error detection has little relationship with channel characteristics, it has universal application value in non-real-time communications.

  • The HEC method is an organic combination of the above two methods, that is, automatic error correction is implemented within the error correction capability; when the number of error bits exceeds the error correction capability, it can be detected through When error codes are found, the ARQ method can be used for error correction regardless of the number of error codes.

  • The IRQ method is the simplest error control method with full receipt. In this error detection method, the receiving end forwards the received signal code back to the sending end as it is, and compares it with the original sending signal code. If an error is found, the sending end retransmits it. It is only suitable for low-speed non-real-time data communication and is a relatively primitive approach.

3. Flow control

In the data communication between both parties, how to control the flow of data communication is also very important. . It can not only ensure the orderly progress of data communication, but also avoid data loss caused by the receiver being late to receive during the communication process. This is the "flow control" function of the data link layer.

The sending and receiving of data must follow certain transmission rate rules, so that the receiver can receive the data sent by the sender in a timely manner. And when the receiver is too late to receive, it must control the sending rate of the sender's data in time so that the two rates basically match.

4. Link control

The "link management" function of the data link layer includes the establishment, maintenance and release of data links Three main aspects.

When two nodes in the network want to communicate, the sender of the data must know whether the receiver is ready to receive. For this purpose, both communicating parties must first exchange some necessary information to establish a basic data link. The data link must be maintained while transmitting data and released when the communication is completed.

5. MAC addressing

This is the main function of the MAC sublayer in the data link layer. The "addressing" mentioned here is completely different from the "IP address addressing" that will be introduced in the next chapter, because the address found here is the MAC address of the computer network card, also known as "physical address" and "hardware address" ” instead of the IP address.

In Ethernet, the Media Access Control (MAC) address is used for addressing, and the MAC address is burned into each Ethernet network card. This is very necessary in the case of multi-point connections, because in this multi-point connection network communication, it must be ensured that each frame can be accurately sent to the correct address, and the receiver should also know which station the sender is.

6. Distinguish between data and control information

Since data and control information are transmitted on the same channel, in many cases, the data and control information are in the same frame, so there must be corresponding measures to enable the receiver to distinguish them so that only the data information that is really needed can be transmitted upwards.

7. Transparent transmission

The "transparent transmission" mentioned here means that no matter what kind of bit combination the data is, Efficient transmission can be carried out on the data link. This requires that when the bit combination in the transmitted data happens to be exactly the same as a certain piece of control information, corresponding technical measures can be taken so that the receiver will not mistake such data as some kind of control information. Only in this way can the transmission of the data link layer be guaranteed to be transparent.

Note: Among the above seven link layer functions, the first five are the most important. The last two functions are implemented incidentally in the first five functions and do not require additional ones. technology, so only the first five functions are introduced here.

Services provided by the link layer to the network layer

The design goal of the data link layer is to provide services to the network layer Provide various needed services. The actual services vary from system to system, but generally, the data link layer provides the following three types of services to the network layer:

1. No connection without confirmation Service

"Unacknowledged connectionless service" means that the source computer sends independent frames to the target computer, and the target computer does not acknowledge these frames. With this kind of service, there is no need to establish a logical connection in advance, and there is no need to explain the logical connection afterwards. Because of this, if a certain frame of data is lost due to reasons on the line, the data link layer will not detect such lost frames and will not recover these frames. The consequences of this situation are conceivable. Of course, when the error rate is very low or the data integrity requirements are not high (such as voice data), such a service is still very useful, because it is so simple. Errors can be recovered by layers above the OSI. For example, the services used by most LANs at the data link layer are also unconfirmed connectionless services.

2. Confirmed connectionless service

In order to solve the above shortcomings of "unconfirmed connectionless service", improve the efficiency of data transmission Reliability, introducing "Confirmed Connectionless Service". In this connection service, the source host data link layer must number each data frame sent, and the destination host data link layer must also acknowledge each received data frame. If the source host data link layer does not receive an acknowledgment of the sent data frame within the specified time, then it needs to resend the frame. This way the sender knows whether each frame reaches the other party correctly. This type of service is mainly used in unreliable channels, such as wireless communication systems. It differs from the "acknowledged connection-oriented service" described below in that it does not need to establish a data link before frame transmission, nor does it release the data link after the frame transmission is completed.

3. Confirmed connection-oriented service

Most data link layers provide connection-oriented confirmation services to the network layer. Using this service, the source computer and the target computer need to establish a connection before transmitting data. Each frame sent on the connection is also numbered, and the data link layer ensures that each frame will be received. And it also guarantees that each frame is received only once in normal order. This is also the difference between connection-oriented services and the "confirmation-free connection service" introduced earlier. In the connection-less confirmation service, when no confirmation is detected, the system will think that the other party has not received it, so it will resend the data. Since it is connectionless, such data may recur multiple times, and the other party may also receive it multiple times, causing data errors. This service type has three stages, namely: data link establishment, data transmission, and data link release stages. Each transmitted frame is numbered to ensure the correctness of the content and sequence of frame transmission. The data link layer of most WAN communications subnets uses connection-oriented acknowledgment services.

Ethernet uses a connectionless working mode. The data frames sent are not numbered and the other party is not required to send back confirmation. When the destination station receives an erroneous frame, it discards it and takes no other action.

Other knowledge points

  • Advantages of LAN: With broadcast function, you can easily access the entire network from one site network; facilitates the expansion and gradual evolution of the system; improves the reliability, availability and survivability of the system.

  • The protocol used by Ethernet is Carrier Sense Multipoint Access CMSA/CD with conflict detection. The key points of the protocol are: listen before sending, listen while sending, and stop sending immediately once a collision is found on the bus. Then wait for a random period of time according to the backoff algorithm and then send again. Therefore, within a short period of time after each station sends its data, there is the possibility of encountering a collision. Each station on the Ethernet competes equally for the Ethernet channel.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of What is the main function of the data link layer. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template