When talking about network links, there are two kinds of network links: point-to-point links and broadcast links. Broadcast links can have multiple sending and receiving nodes connecting to the same, single, shared broadcast channel. Ethernet and wireless LANs are examples of broadcast link-layer topology. The problem of this topology is how to coordinate the access of multiple sending and receiving nodes to a shared broadcast channel-the multiple access problem. Random access protocol is a kind of method that a transmitting node always transmits at the full rate of the channel.
CSMA, carrier sensing multiple access, is a kind of random access protocol. Which has Two important rules for polite conversation:
1. Listen before speaking. If someone is speaking, wait until they are finished. In networking world, this is called carrier sensing.
2. If someone else begins talking at the same time, stop talking. In the networking world, this is called collision detection.
Because of propagation delay, collision can still occur. That is why the second rule is needed, above all, CSMA/CA, CSMA with collision detection.
Each adapter runs the CSMA/CD protocol without explicit coordination with the other adapters on the Ethernet. Within a specific adapter, the CSMA/CD protocol works as follows:
1. The adapter obtains datagram from upper layer, prepares an Ethernet frame, and puts the frame in an adapter buffer.
2. If the adapter senses the channel idle, it starts to transmit the frame. If busy, it waits until it senses no signal energy and then starts to transmit the frame.
3. While transmitting, the adapter monitors for the presence of signal energy coming from other adapters. If the adapter transmits the entire frame without detecting signal energy from other adapters, the adapter is finished with the frame.
4. If the adapter detects signal energy from other adapters while transmitting, it stops transmitting its frame and instead transmits a 48-bit jam signal.
5. After aborting, the adapter enters an exponential backoff phase. Specifically, when transmitting a given frame, after experiencing the nth collision in a row for this frame, the adapter chooses a value for K at random from {0,1,2,…,2^m-1} where m = min(n,10). The adapter then waits K*512 bit times and then returns to Step 2.
reference:
Computer networking A Top-Down Approach, Fourth Edition, James F. Kurose, Keith W. Ross