Home technology Media access control

Media access control



Introduction

The data link layer of the local area network is divided into two sub-layers: the logical link layer LLC and the medium access control MAC.

Logical Link Control (Logical Link Control or LLC for short) is the upper part of the data link layer in the LAN , The logical link control protocol is defined in IEEE 802.2. The user's data link service provides a unified interface for the network layer through the LLC sublayer. Below the LLC sublayer is the MAC sublayer.

MAC (medium access control) belongs to a sub-layer under LLC (Logical Link Control). Two media access control methods widely used in local area networks are:

1. Contention-based media access control, also known as random media access control protocols, such as CSMA/CD.

2. Deterministic media access control, also known as orderly access control protocol, such as Token (token) mode.

CSMA/CD working principle

In CSMA, due to the channel propagation delay, even if the stations on both sides of the communication do not detect the carrier signal, it is still possible to send data Conflicts will occur because they may send data at the same time when they detect that the medium is free, causing conflicts to occur. Although CSMA can detect conflicts, it does not have the conflict detection and prevention functions of the prophet, resulting in frequent conflicts.

An improvement of CSMA is to make the sending station continue to listen to the medium during transmission to detect whether there is a conflict. If both stations detect that the channel is free at a certain time and start to transmit data at the same time, they will almost immediately detect that there is a conflict. If a conflict occurs, electromagnetic waves that exceed the amplitude of the carrier signal sent by the sending site can be detected on the channel, and the existence of the conflict can be judged from this. Once a conflict is detected, the sending station immediately stops sending and sends a series of blocking signals to the bus to notify the opposite station communicating on the bus to quickly terminate the corrupted frame, which can save time and bandwidth. This solution is the CSMA/CD (Carrier Sense Multiple Access with Collision Detection) introduced in this section, and it has been widely used in local area networks.

The so-called carrier sense (Carrier Sense) means that each workstation on the network must confirm whether there is data transmission on the bus before sending data. If there is data transmission (called the bus as busy), no data will be sent; if there is no data transmission (called the bus as empty), the prepared data will be sent immediately.

The so-called multiple access (Multiple Access) means that all workstations on the network use the same bus for sending and receiving data, and the data sent is broadcast.

The so-called collision (Collision) means that if there are two or more workstations on the Internet sending data at the same time, the signal will be mixed on the bus, so that no workstation can distinguish the real data. What. This situation is called a data conflict, also called a collision.

In order to reduce the impact of conflicts, the workstation must constantly check the data sent by itself during the process of sending data to see if there is any conflict with the data of other workstations during the transmission process. This is a conflict. Collision Detected.

1. CSMA/CD conflict detection principle

CSMA/CD is a media contention handling protocol uniformly adopted in standard Ethernet, fast Ethernet and Gigabit Ethernet (but in In 10 Gigabit Ethernet, because it uses full-duplex communication, this protocol is no longer used). The reason why it is called "Carrier Sense" ("Carrier" is the electromagnetic wave carrying the signal) instead of "Media Sense" is because if there is a carrier on the medium, it proves that the medium is busy. (Because the signal or data is not directly transmitted, but carried out through electromagnetic carrier); if there is no carrier, the medium is in an idle state. That is, through the detection of the carrier, the state of the medium can be known, but the idle state of the medium itself cannot be obtained by directly listening to the medium.

[Explanation] In fact, what is listening here should be the "channel", not the "medium" itself, because a transmission medium may contain multiple channels for different transmission links.

As mentioned earlier, the improvement of CSMA/CD over CSMA is that it has a conflict detection function. Then the question arises. How does CSMA/CD detect conflicts?

The working principle of CSMA/CD can be summarized in the following sentences:

Listen first, then speak, listen and speak.

In case of conflict, stop talking immediately.

Wait for the moment, and then talk.

Here, "listening" means monitoring and testing; "speaking" means sending data. The specific detection principle is described as follows:

(1) When a station wants to send data, it checks the network to see if other stations are transmitting, that is, whether the listening channel is free.

(2) If the channel is busy, wait until the channel is free; if the channel is free, the station is ready to send the data.

(3) While sending data, the site continues to listen to the network, making sure that no other sites are transmitting data at the same time before continuing to transmit data. Because it is possible that two or more stations simultaneously detect that the network is idle and then start transmitting data at almost the same time. If two or more stations send data at the same time, conflicts will occur. If there is no conflict, continue sending until all data is sent.

(4) If there is a conflict, stop sending data immediately, but send a JAM (blocking) signal that strengthens the conflict, so that all workstations on the network know that there is a conflict on the network, and then wait for a At a predetermined random time, and when the bus is idle, the unsent data will be resent.

The advantages of the CSMA/CD control method are: the principle is relatively simple, technically easy to implement, all workstations in the network are in an equal position, no centralized control is required, and priority control is not provided. However, when the network load increases, the sending time increases, and the sending efficiency drops sharply.

2, the working principle of token access control

Token access control methods can be divided into token ring access There are two types of control and token bus access control. Token bus access control has been used less frequently.

Application

Whether in the traditional wired local area network (LAN) or in the popular wireless local area network (WLAN), the MAC protocol is widely used. In the traditional local area network, the physical layer of various transmission media corresponds to the corresponding MAC layer. The commonly used network adopts the IEEE802.3 MAC layer standard and adopts the CSMA/CD access control method; while in the wireless local area network, the MAC address The corresponding standard is IEEE802.11, and its working mode adopts DCF (distributed control) and PCF (central control).

Token Ring Media Access Control

IEEE 802.5 Token Ring Media Access Control uses a token to circulate along the ring, and it should be ensured that the token is unique in the ring. How Token Ring works:

Online sites require frames to be sent and must wait for an empty token.

When an empty token is obtained, it is changed to a busy token, followed by a data frame; other stations in the ring cannot send data.

The station on the ring receives, shifts data, and performs detection. If the address is the same as this station, the data will be received at the same time. After the reception is completed, the corresponding flag will be set.

After the frame circulates on the ring for a week, it returns to the sending station. After the sending station detects the corresponding mark, the frame is removed.

Change the busy token to an empty token, and continue to transmit for subsequent stations to send frames. The length of the loop is calculated in bits:

Because the propagation speed of electromagnetic waves is limited, there may be multiple data bits in the transmission medium at the same time.

Each repeater on the ring introduces at least 1 bit delay

The number of bits reserved on the ring:

Propagation delay (us /km) × medium length ×data rate + repeater delay

Example: medium length L = 1 km, data rate C = 4 Mbit/s, number of stations N = 50.

Solution: Propagation delay tp = L / v

v = 2 ×105km / s tp = 5 us Number of bits reserved on the ring = 5 × 1 ×4 + 50 = 70 bit

Token Ring MAC frame structure

IEEE 802.5 MAC frame format token and data frame management:

How to prevent data frames from endlessly on the ring Loop?

Set up the monitor

Leave a mark on the frame structure

How to monitor the token error?

No token

Multiple tokens

Busy token endless loop

Centralized detection:

Set up a centralized monitoring station (timeout counter)/mark loss

Detect busy mark identification/endless loop on the frame structure

Distributed detection:

Each station Set timer: when the station has data to send and the time waiting for the mark exceeds the limit/the mark is lost

Token Control Protocol

Topology: Working principle: Token Bus in the physical system Establish a logical ring online.

On the logical ring, the token is a necessary condition for the station to send data.

The token is transmitted to the next station in the logical ring in descending order of addresses.

From a physical point of view, the token frame containing DA is broadcast to the BUS, and all stations judge whether to receive it according to DA = the address of the station.

Features: No conflict, the length of the information frame of the token ring can be determined according to needs.

Sequentially receiving Fairness (fairness), the time that the station waits for the Token is known with certainty.

(Need to limit the maximum number of frames sent by each station).

Information bits need to be filled due to detection conflicts (not allowed to be less than 46 bytes).

Media Access Control Technology

The central topic of the media access sublayer is how to allocate a single broadcast channel among competing users.     

1. Static allocation: As long as one user gets the channel, it will not conflict with other users. (User data traffic is bursty and intermittent) .

2. Dynamic allocation: it is called multi-access or multi-point access, which refers to multiple users sharing a line, and the channel is not fixedly allocated to the user when the user communicates. Such a system is also called Competitive system. Dynamic allocation methods can be further divided into: random access, typical ALOHA protocol, CSMA protocol ; controlled access, typical token network competition system and centralized control of multi-point line polling. 

3. Five key assumptions in channel dynamic allocation. 

Station model: Stations are independent, frames are generated at a constant rate, and each station has only one program.  

Single-channel hypothesis (core)

Conflict hypothesis: two frames are transmitted at the same time, there will be conflicts, all stations can detect, the conflicting frames need to be retransmitted  

Send time: 1. Continuous time; 2. Time slot. 

Carrier detection: 1. With carrier sensing; 2. Without carrier sensing.

This article is from the network, does not represent the position of this station. Please indicate the origin of reprint
TOP