Protocols in which stations listen for a carrier (i.e., a transmission) and act accordingly are called carrier sense protocols.
There is various CSMA protocol:
- 1-persistent CSMA
- Non-persistent CSMA Protocol
- p-persistent CSMA Protocol
- CSMA/CD (CSMA with Collision Detection)
1-persistent CSMA Protocol
- When a station has data to send, it first listens to the channel to see if anyone else is transmitting at that moment.
- If the channel is busy, the station waits until it becomes idle.
- When the station detects an idle channel, it transmits a frame. If a collision occurs, the station waits a random amount of time and starts all over again.
- The protocol is called 1-persistent because the station transmits with a probability of 1 when it finds the channel idle.
- Moreover, The propagation delay has an important effect on the performance of the protocol.
- There is a small chance that just after a station begins sending, another station will become ready to send and sense the channel.
- If the first station’s signal has not yet reached the second one, the latter will sense an idle channel and will also begin sending, resulting in a collision.
- The longer the propagation delay, the more important this effect becomes, and the worse the performance of the protocol.
- Even if the propagation delay is zero, there will still be collisions.
- If two stations become ready in the middle of a third station’s transmission, both will wait politely until the transmission ends and then both will begin transmitting exactly simultaneously, resulting in a collision. If they were not so impatient, there would be fewer collisions.
Non-persistent CSMA Protocol
- In this protocol, a conscious attempt is made to be less greedy than in the previous one.
- Before sending, a station senses the channel. If no one else is sending, the station begins doing so itself.
- However, if the channel is already in use, the station does not continually sense it for the purpose of seizing it immediately upon detecting the end of the previous transmission.
- Instead, it waits a random period of time and then repeats the algorithm. Consequently, this algorithm leads to better channel utilization but longer delays than 1-persistent CSMA
Fig: Comparison of the channel utilization versus load for various random access protocols
P-persistent CSMA Protocol
- It applies to slotted channels.
- When a station becomes ready to send, it senses the channel.
- If it is idle, it transmits with a probability p.
- With a probability q=1−p, it defers until the next slot.
- If that slot is also idle, it either transmits or defers again, with probabilities p and q.
- This process is repeated until either the frame has been transmitted or another station has begun transmitting.
- Moreover, In the latter case, the unlucky station acts as if there had been a collision (i.e., it waits a random time and starts again).
- If the station initially senses the channel busy, it waits until the next slot and applies the above algorithm.
- The figure shows the computed throughput versus offered traffic for all three protocols.
CSMA/CD (CSMA with Collision Detection)
- Also, If two stations sense the channel to be idle and begin transmitting simultaneously, they will both detect the collision almost immediately.
- Rather than finish transmitting their frames, which irretrievably garbled anyway, they should abruptly stop transmitting as soon as the collision is detected.
- Quickly terminating damaged frames saves time and bandwidth.
- Moreover, This protocol, known as CSMA/CD (CSMA with Collision Detection) widely used on LANs in the MAC sublayer.
Fig: CSMA/CD can be in one of three states: contention, transmission, or idle
- CSMA/CD, as well as many other LAN protocols, use the conceptual model of Figure.
- At the point marked t0, a station has finished transmitting its frame.
- Any other station having a frame to send may now attempt to do so. If two or more stations decide to transmit simultaneously, there will be a collision.
- Collisions can detect by looking at the power or pulse width of the received signal and comparing it to the transmitted signal.
- Also, After a station detects a collision, it aborts its transmission, waits a random period of time, and then tries again, assuming that no other station has started transmitting in the meantime.
- Therefore, the model for CSMA/CD will consist of alternating contention and transmission periods, with idle periods occurring when all stations are quiet.