Link Layer (Layer 2) in the OSI model.
While the upper sublayer (Logical Link Control) handles error checking and flow
control, the MAC sublayer is responsible for the actual "traffic rules" of the physical
medium.
CSMA
Carrier Sense Multiple Access (CSMA) is a Media Access Control (MAC) protocol
used in networking to control how multiple devices share a single communication
channel. It is based on the "listen before talk" principle to minimize the chances of
data collisions.
How CSMA Works
In a standard CSMA environment, any station that wants to transmit data must first
"sense" the medium (the cable or the air) to check its state:
Idle State: If the channel is sensed as clear, the station can transmit its data frame.
Busy State: If the channel is sensed as occupied, the station must wait and apply a
specific persistence strategy to determine when to try again.
Persistence Strategies
These strategies define exactly how a station reacts when it finds the line busy or
idle.
1. 1-Persistent CSMA
This is the most aggressive approach. The "1" stands for a probability of 1—meaning
the station transmits immediately whenever it finds the line idle.
The Process: * The station continuously senses the channel.
If the channel is busy, it keeps sensing and waits until it becomes idle.
As soon as the channel becomes idle, the station transmits immediately.
, The Catch: If two stations are both waiting for the same busy channel to clear, they
will both transmit the instant it becomes idle, leading to a guaranteed collision.
2. 0-Persistent CSMA
This is a more "patient" approach designed to reduce collisions, though it can lead to
longer delays.
The Process:
The station senses the channel.
If the channel is idle, it transmits immediately.
If the channel is busy, the station does not keep sensing. Instead, it waits for a
random amount of time and then starts the sensing process all over again.
The Catch: This reduces collisions because two stations waiting for the line will likely
pick different random back-off times. However, the channel might sit idle for a while
even if someone has data to send, which reduces efficiency.
3. p-Persistent CSMA
This is a compromise used in slotted channels (like CSMA/CD or CSMA/CA). It uses a
probability $p$ to decide whether to transmit.
The Process:
The station senses the channel.
If the channel is busy, it continues to sense until it becomes idle.
When the channel becomes idle, the station: