Types of CSMA in Computer Networks
Carrier Sense Multiple Access (CSMA) is a networking protocol used to control access to shared communication channels. In a shared communication channel, multiple devices are connected to the same channel and can transmit data over it. In order to avoid collisions between data transmissions, CSMA protocols ensure that only one device is transmitting at a time.
The basic principle of CSMA is that before transmitting data, a device must first check whether the communication channels are idle, meaning that no other device is currently transmitting data. The device does this by sensing the carrier signal on the communication channel. If the channel is busy, the device waits for a random amount of time before retrying the transmission.
There are several variations of the CSMA protocol, including CSMA/CD, CSMA/CA, and CSMA/CR.
CSMA protocols help to ensure that communication channels are used efficiently and that data transmissions are successful. However, they do not guarantee that collisions will never occur, especially in high-traffic networks. Therefore, other protocols, such as error-correction and retransmission, are often used in conjunction with CSMA to improve the reliability of data transmission.
The Three Types of CSMA
- CSMA/CD (Carrier Sense Multiple Access with Collision Detection): This type of CSMA is used in Ethernet networks. Before transmitting data, a device senses the communication channel to ensure it is idle. If another device begins transmitting at the same time, a collision occurs, and both devices stop transmission and retry after a random delay.
- CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance): This type of CSMA is used in wireless networks such as Wi-Fi. Before transmitting data, a device senses the communication channel to ensure it is idle. If the channel is busy, the device waits for a random period before trying again.
- CSMA/CR (Carrier Sense Multiple Access with Collision Resolution): This type of CSMA is used in token ring networks. Instead of sensing the communication channel, devices wait to receive a token, which grants them permission to transmit data. Once a device has finished transmitting data, it passes the token on to the next device in the ring.
Working Principle of CSMA
The working principle of Carrier Sense Multiple Access (CSMA) is based on the idea of sharing a common communication channel between multiple devices, while avoiding collisions between data transmissions.
The basic steps involved in the CSMA protocol are:
- Carrier Sense: Before transmitting data, a device first checks whether the communication channel is idle by sensing the carrier signal on the channel. If the channel is busy, the device waits for a random period of time before retrying the transmission.
- Multiple Access: Once the channel is sensed to be idle, the device can start transmitting data. However, other devices on the network may also be attempting to transmit data at the same time. To prevent collisions, CSMA ensures that only one device transmits data at a time.
- Collision Detection/Resolution: In CSMA/CD (used in Ethernet networks), if two devices transmit data at the same time, a collision occurs. The devices detect the collision and stop transmitting, then wait for a random period of time before retrying the transmission. In CSMA/CA (used in wireless networks), devices listen for an acknowledgement signal from the receiver before transmitting data, to reduce the likelihood of collisions.
- Retransmission: If a data transmission is unsuccessful, the device will retry the transmission after a random delay. This helps to ensure that data is successfully transmitted, even in the presence of collisions.
Vulnerable Time in CSMA
The vulnerable time in Carrier Sense Multiple Access (CSMA) refers to the period of time during which a collision can occur between two or more devices attempting to transmit data on a shared communication channel.
In CSMA protocols, devices first sense the carrier signal on the communication channel to determine if it is idle before attempting to transmit data. However, due to the propagation delay of the signal, there is a finite period of time during which two devices may start transmitting simultaneously, leading to a collision.
The vulnerable time can be calculated as the time taken for a signal to propagate across the entire network, plus any processing time required by the devices to sense the channel and start transmitting data. The length of the vulnerable time depends on factors such as the physical distance between devices, the transmission speed, and the network topology.
In Ethernet networks that use CSMA/CD, the vulnerable time is the time taken for a signal to travel the length of the cable twice. This is because a device can detect a collision only after the signal has travelled the entire length of the cable and returned to the device. In wireless networks that use CSMA/CA, the vulnerable time is generally longer due to the greater propagation delay of signals in the air.
To reduce the vulnerable time and minimize the likelihood of collisions, CSMA protocols typically use randomized backoff algorithms that introduce a random delay before a device retries a transmission after a collision. The backoff algorithm helps to ensure that devices do not retry transmissions simultaneously, reducing the likelihood of another collision.