Computer Network (10) CSMA Detailed Explanation

Random access cut-off access control (all users can send information randomly, occupying the entire bandwidth when sending information )

Category: CSMA: Listen Before You Speak

                CSMA/CD: Listen before speaking, listen and speak

                CSMA/CA:

CSMA protocol (Carrier Sense Multiple Access Protocol)

        CS : Carrier Sense , each station needs to check whether there are other computers sending data on the bus before sending data

        MA : Multi-point access, multi-point access to the same bus

        agreement idea

                Before sending a frame, listen to the channel. The monitoring results are divided into: channel idle (send complete frame)

                                                                                 Channel busy (postponed send)

       1- Stick to CSMA

                        If the channel is busy, it will keep listening until it is free to transmit immediately

                        If no reply is received for a period of time, wait for a random long time before listening, and repeat the above process.

                Advantages: As long as the media is idle, it will be sent immediately, avoiding the loss of media utilization

                Disadvantages: more than two channels will inevitably conflict

        Non-adhere to CSMA

                Listen to the channel before sending a frame, if busy, wait for a random time before listening (not always listening)

                Advantages: Using random retransmission delay time can reduce the possibility of collisions

                Disadvantage: The channel may be idle when everyone is waiting for delay, which reduces the media usage rate

        p-stick CSMA

                p : Handling of the listening channel being idle

                If idle, transmit directly with probability p; wait until the next time slot with probability 1-p before transmitting (not necessarily directly)

                If busy, wait for a random time before listening (not always listening)

                Pros: Skills reduce conflict like non-persist , but also reduce media idle time like 1-persist

                Disadvantage: If a conflict occurs, the data frame will still be transmitted, resulting in waste

 CSMA/CA protocol (carrier sense multi-point access/collision avoidance)

        Protocol ideas

                Before sending, check whether the channel is idle

                If the channel is idle, send RTS , which includes the address of the transmitter, the address of the receiver, and the time for the next data to be sent continuously; if the channel is busy, it will wait .

                Receiver receives RTS and will respond with CTS .

                After receiving the CTS, the sender starts to send data frames (and reserve the channel at the same time : the sender tells other stations how long they want to transmit)

                After receiving the data frame, the receiver will use CRC to check the data, and if it is correct, it will respond to the ACK frame

                After receiving the ACK, the sender can send the next data. If it has not been received it will retransmit until the number of arrivals (there will be a delay).

CSMA/CD protocol (carrier sense multipoint access/collision detection)

        CS: Carrier sense. Before sending data and when sending data, the site needs to detect whether other users send

        MA: Multi-point access (bus network)

        CD: Collision detection, listening while sending, half-duplex network

        Collision detection delay 0 ~  2\tau, ( \ canone-way propagation delay)

        Retransmit : Truncated Binary Exponential Evasion Algorithm

                1. Determine the basic avoidance (delay) time as the contention period2\tau

                2. Define the parameter k, which is equal to the number of retransmissions, but k does not exceed 10 times, that is, k=min[number of retransmissions, 10] 

                3. Randomly select a number r from the discrete integer set [0,1,2..,2^k-1], the backoff time required for retransmission is r times the basic backoff time (2r \ can)

                4. If the retransmission is still unsuccessful for 16 times, an error will be reported to the upper layer

         Minimum frame length: at least twice the propagation delay of the signal in the bus = 2\tauX data transmission rate

        work process

                Prepare to send : The adapter obtains a packet from the network layer, adds the header and tail of the Ethernet to form an Ethernet frame, and puts it in the cache of the network card, but before sending it, the channel must be detected.

                Channel detection : continuously detect the channel, wait for the channel to be free, and send the frame immediately .

                During the sending process, the channel is still continuously detected, that is, the network adapter needs to monitor while sending:

                        Successfully sent : No collision has been detected during the contention period , and this frame is sent successfully

                        Failed to send : When a collision is detected during the contention period, it immediately stops sending data and sends a signal that is considered to be an interference as required . The adapter then executes the exponential backoff algorithm, waits for r times 512 bit times, returns to the detection channel , and continues to detect the channel. If the retransmission is still unsuccessful after 16 retransmissions, the retransmission will be stopped and an error will be reported upward.

Guess you like

Origin blog.csdn.net/weixin_37878740/article/details/121862336