CSMA/CD stands for "Carrier Sense Multiple Access with Collision Detection" and is a medium access control method used in Ethernet. It is also called a "first-come, first-served medium access control method" and is specified in IEEE802.3.
A brief explanation of how CSMA/CD works is as follows:
Terminals (PCs, printers, etc.) connected to Ethernet always share the same bandwidth, and the number of terminals that can communicate on the transmission path is always limited to one. In other words, if another terminal is communicating, that terminal cannot communicate.
The terminal that wants to communicate checks the availability of the transmission line and starts sending data. Which terminal can send data is first come, first served.
Now let's take a closer look at CSMA/CD.
First, the terminal that you want to communicate with uses a NIC, etc., to check whether other data is flowing on the transmission path. This behavior is called "Carrier Sense".
If no data is flowing on the transmission line, PC_A will transmit data on a first-come, first-served basis. This data will reach all terminals except PC_A.
Terminals other than the destination PC_D are discarded because the data is not addressed to them.
If there are other terminals that you want to communicate with, wait for the communication to finish and send after a random waiting time.
In the example above, PC_A successfully sends data to PC_D, but what if the timing is bad?
If the timing is bad, multiple terminals will start sending data at the same time. Then, on the transmission path, mutual data will collide (collision).
When data collides on the transmission path, the data is destroyed and the waveform of the electrical signal flowing through the cable is destroyed.
Each terminal monitors the electrical signal with this collapsed voltage to determine whether a collision has occurred.
The first terminal to detect a collision broadcasts data to all terminals telling them that a collision has occurred. This data is called a "jam signal".
When a terminal detects a collision (Collision Detection), it waits for a random amount of time before retransmitting data. This random time is miso.
If both parties send data at the same time, another collision will occur. So I'm trying to wait a random amount of time and send it again.
The algorithm that calculates the waiting time until this transmission is called the "backoff algorithm", and the more retries, the longer the waiting time until the next transmission.
The number of retransmissions is up to 16 times, and if communication is not successful within 16 times, the communication fails and the OS is notified.
Because of its simple mechanism, Ethernet is widely used and is still a technology that supports LANs. However, in recent years, with the increase in the number of terminals in the segment and the speeding up of lines, CSMA/CD is no longer compatible. increase.
Therefore, full-duplex communication is now mainstream instead of CSMA/CD.