CSMA/CD and CSMA/CA Explained

This tutorial explains CSMA/CD and CSMA/CA in detail. Learn what CSMA/CD and CSMA/CA are, how they work, and why they are used in computer networks.

What CSMA/CD and CSMA/CA are?

CSMA/CD and CSMA/CA are the media access methods that govern how a device can transmit data to the network. CSMA/CD stands for Carrier Sense Multiple Access / Collision Detection. CSMA/CA stands for Carrier Sense Multiple Access/Collision Avoidance.

Both methods are used in a single collision domain. A single collision domain is a group of devices that share a collision. Since all devices share a collision, they use a method to avoid and remove the collision. Based on the media type used in the network, this method is known as either CSMA/CD or as CSMA/CA.

If the network uses wired media, this method is known as CSMA/CD. If the network uses wireless media, this method is known as CSMA/CA.

How CSMA/CD works

In a single collision domain, only one NIC can send a frame at a time. All NICs, however, can simultaneously listen to the frame on the wire. Before a NIC puts a frame on the wire, it first senses the wire to ensure that no other frame is currently on the wire. If it is a copper wire, the NIC can detect the frame by examining the voltage levels on the wire. If it is a fiber wire, the NIC can detect the frame by examining the light frequencies on the wire. This process is known as carrier sense.

If a NIC detects a frame on the wire, it waits until the frame is transmitted. A NIC transmits a frame only when it detects no frame on the wire. Sometimes two or more NICs may accidentally detect no frame at the same time. For example, two NICs want to transmit frames, and there is no frame on the wire. Since there is no frame on the wire, both NICs put their frames on the wire at the same time. This process is known as multiple access.

If two or more NICs simultaneously sense the wire and see no frame, and each places its frame on the wire, a collision will occur. In this situation, the voltage levels on a copper wire and the light frequencies on a fiber wire get messed up. For example, if two NICs put the same voltage on the electrical part of the wire, the voltage level will be different from that of only one device. The two original frames become indecipherable. This process is known as collision detection.

Let's take a simple a simple example. There are four PCs in a single collision domain. PC-1 sends data to PC-3. At the same time, PC-2 also sends data to PC-3. Since both PC-1 and PC-3 put their frames on the wire at the same time, a collision will occur.

The following image shows this process.

If the NICs see a collision for their transmitted frames, they have to resend the frames. In this instance, each NIC that was transmitting a frame when a collision occurred creates a special signal, called a jam signal on the wire. It then waits for a small random time and senses the wire again. If no frame is currently on the wire, the NIC will then retransmit its original frame. The time that the NIC waits is measured in microseconds, a delay that can't be detected by a human. Likewise, the time the NICs wait is also random to help ensure a collision won't occur again when these NICs retransmit their frames. The more devices you place on an Ethernet segment, the more likely you will experience collisions. If you put too many devices on the segment, too many collisions will occur, seriously affecting your throughput. Therefore, you need to monitor the number of collisions on each of your network segments. The more collisions you experience, the less throughput you will get.

Key points
  • This mechanism is only used in a single collision domain.
  • All devices have equal priority.
  • In this process, only one device can send data at a time.
  • Before a device sends data, it will first sense the wire to ensure that no other device is currently sending data. If another device is currently using the media, it will have to wait till that transmission is over. If no device is currently using wire it can send the data.
  • If two or more devices simultaneously sense wire and see no data in it, they could place their data on the wire at the same time.
  • In this situation, a collision will occur.
  • When a collision occurs, a special jam signal is created in the wire.
  • Jam signal has a waiting time.
  • All devices have to wait till the jam signal time is over.
  • Once this time is over, devices can sense the wire again.
  • If a device's data is lost in the collision, the device sends the same piece of data again.

CSMA/CA

WLANs use a mechanism called Carrier Sense, Multiple Access/Collision Avoidance (CSMA/CA). Unlike Ethernet, it is impossible to detect collisions in a wireless medium. In a WLAN, a device cannot simultaneously send or receive data. It can only do one or the other. Because of this, it cannot detect a collision. To avoid collisions, a device will use Ready-to-Send (RTS) and Clear-to-Send (CTS) signals. When a device is ready to transmit, it first senses the airwaves for a current signal. If there is none, it generates an RTS signal, indicating that data is about to send. It then sends its data and finishes by sending a CTS signal, indicating that another wireless device can now transmit.

If you like this tutorial, please share it with friends via your favorite social networking sites and subscribe to our YouTube channel.

ComputerNetworkingNotes Networking Tutorials CSMA/CD and CSMA/CA Explained