Media Access in Ethernet
What concepts is this applet illustrating?
When more than two computers share a single physical link, the link
is said to be a multiple access link.
Since only one computer may be transmitting on the link at a time,
the issue arises of ensuring that only one computer at a time
has control of the link.
This issue is called media access control since access to the
media (the shared link) needs to be controlled.
This applet and accompanying explanations illustrate the media
access control, CSMA/CD, used in a popular local area network, Ethernet.
Since the device transmitting on the Ethernet need not be a general
purpose computer, the applet follows the common convention of
calling the device a station.
The bandwidth of the link is the maximum number of bits
per second that can be transmitted on the link.
The term for a single message transmitted on an Ethernet is a frame.
CSMA/CD stands for Carrier Sense Multiple Access/Collision Detection.
The terms Carrier Sense and Collision Detection indicate properties
of two of the phases of the protocol.
The term Multiple Access indicates that the protocol is for
a multiple access link.
The protocol determines the steps that a station follows in
attempting to transmit a frame.
A station can be considered to be in one of five states or
phases as part of the protocol.
Each phase is indicated by a different color for the station's
rectangle in the applet.
- Transparent
:
The station is in the idle phase.
Clicking on the station's rectangle causes the station to start
attempting to transmit a frame by moving to the carrier sense phase
(color blue).
- Blue
.
The station is in the carrier sense phase which means that
the station is not currently transmitting a frame, but is sensing
(or examining) the state of the link at its position to see if the
frame of another station's is passing by.
The station stays in this state as long as it senses that the frame
of another station is passing by its position.
The station leaves this phase by moving to the transmit phase
(color green).
Note that a station can only sense the state of the link at
its own position.
A station can not detect the presence of a frame elsewhere on the link.
- Green
.
The station is in the transmit phase which means that
the station is transmitting a frame and trying to detect a frame
collision.
The station detects a collision by sensing that the frame of another
station is passing by its position.
Transmitting means the station is actually emitting the bits of
the frame.
Once a station has finished transmitting there still is a time
period before the last bit of the frame has propagated to both
ends of the link.
If the station has not detected a collision by the time the station
has finished transmitting the frame, then the station thinks
that the transmission is successful and moves to the message-in-progress
phase (color yellow).
An essential part of the protocol is that the time it takes to
transmit the frame must be long enough that the transmitting
station will not finish transmitting before detecting any
collision that might possibly occur to its frame.
This duration is called a slot time and depends on the
minimum frame size, the link bandwidth, and the link length.
If the station detects a collision, then the station continues
transmitting until the total time of its transmission is at
least one slot time (to ensure that all other transmitting stations
detect the collision).
The data the station transmits after detecting the collision is
called a jam sequence.
After completion of the jam sequence, the station moves to
the backoff phase (color red).
- Yellow
.
The station is in the message-in-progress phase which
means the station has finished transmitting the frame (that is,
has finished emitting the bits of the frame) but the last bit of
the frame has not yet propagated to both ends of the link.
During this phase the station thinks that the transmission was
successful and is no longer attempting to detect collisions.
Consequently, the station always moves from this phase to the
idle phase (color transparent).
If the frame size is too small, it is possible for a collision
to occur during the message-in-progress phase and thus, to go
undetected.
CSMA/CD actually does not make a distinction between the message-in-progress
phase and the idle phase since the minimum frame size is chosen
to ensure that no collisions are undetected.
Thus, in CSMA/CD once a station has finished transmitting
one frame, theoretically it is possible for that station to start
transmitting another frame even if the last bit of the first
frame has not yet reached the ends of the link.
The applet does not support this case.
- Red
.
The station is in the backoff phase which means that
the station had tried transmitting a frame but had aborted the
attempt because it had detected a collision with a frame from
another station.
To reduce the chance of another collision, the station waits
(or "backs off") before moving to the carrier sense phase
(color blue).
The procedure for calculating the duration of this wait time is
called an exponential backoff.
The first time a station encounters a collision when transmitting a
particular frame, that station waits an amount of time uniformly
distributed between 0 and the length of one slot time.
The station then moves to the carrier sense phase and then to
the transmit phase.
If during the transmit phase, a collision occurs again on this frame,
then for the second wait, the wait time is uniformly distributed
between 0 and the length of two slot times.
For the third wait, the wait time is uniformly distributed between
0 and the length of four slot times.
The maximum wait time continues to double until some maximum
number of wait times is reached.
If the maximum number of wait times is reached, then the station
stops trying to transmit the frame.
The backoff is called an exponential backoff since the maximum wait
time doubles with each attempt.
The actual duration of a particular wait time is sampled from a
probability distribution to avoid two stations always waiting
by the same amount and therefore colliding again.
When a station is waiting during a backoff period, the
applet displays a number below the station's rectangle
which is the amount of time remaining before the end of
its wait time.
Acknowledgements and Developer Information
Copyright notice (C) Mark A. Holliday. All rights reserved.