Media Access in Ethernet
How do I use this applet?
Place one or more stations on the link and then click on
each station's rectange to cause that station to start attempting
to transmit a frame.
The applet then shows graphically how the stations,
in following the media access control protocol, eventually
successfully transmit their frames.
A station is placed on the link by entering the location of the station
in the Station Position text field and then clicking the
Add Station button.
You can also change the link bandwidth, the frame size, and the link
length by entering a new value in the corresponding text field.
If you then press the Enter key the text field value change
immediately takes effect.
However, you do not need to press the Enter key because when you
click on a station to start it transmitting, the current values
for these text fields are read and take effect.
During the process of stations attempting to transmit there may be
collisions between frames of different stations as well as
backoffs by stations that detect collisions.
Click the Clear button to reset the simulation so that there are
neither any stations nor any frames in transmission.
Click the Suspend button to suspend the animation and click the
Resume button to resume the animation.
Click the Help button to cause a dialog to appear with a short
message about how to use the applet.
Applet User Operations
Applet Graphics
Link Bandwidth Field
The value in this field is the maximum number of bits per second
that can be transmitted across the link measured in Mbps
(Mega bits per second; a Mega in this context means 10^6).
The minimum bandwidth allowed is 10 Mbps;
the maximum bandwidth allowed is 100 Mbps.
Above the link's rectangle in the applet is a series of rows with
one row per station.
Along the left side of the applet each of these rows has a number
indicating the associated station and an edge marker.
The edge marker's height indicates the current bandwidth.
In particular, the edge marker's height as a fraction of the height
of the station's row is equivalent to the proportion of the current
bandwidth to the maximum bandwidth.
Once a value is entered in the Link Bandwidth field the edge maker
heights automatically adjust.
The height of transmitted frames will equal the new edge marker heights.
Frame Size Field
The value in this field is the size of a frame in bits.
The minimum frame size allowed is 80 bits (10 bytes);
the maximum frame size allowed is 16,000 bits (2000 bytes).
In a real Ethernet there is a minimum frame size and a maximum frame size
and a particular frame might be any size in between.
The applet assumes all frames are the size indicated in
the Frame Size field.
This was done so that the applet can be used to understand
the implications of different minimum frame sizes
(and in particular, how too small a minimum frame size can cause a
station to finish transmitting a frame before detecting a collision).
In a real Ethernet the minimum frame size is 512 bits (64 bytes)
with the maximum link length and the link bandwidth set so
that a 512 bit frame is sufficiently long to detect any collisions.
The applet does not attempt to guarantee that 512 bits is the
correct minimum frame size.
Station Position Field
The value in this field is the position of the station on
the link in meters.
Once this value is changed and the Enter key is pressed, the applet
attempts to place a station on the link at the specified position.
The applet allows a maximum of four stations.
A warning message is displayed if the user attempts to add a fifth
station.
To make it easier to see all the stations, the applet requires
that the rectangles of different stations can not overlap.
A warning message is displayed if they do overlap.
Clicking on a Station
Clicking on the rectangle of a station causes the station to
start attempting to transmit a frame.
Clicking elsewhere on the applet (not including the text fields
and buttons) has no effect.
Clear Button
Clicking on this button causes all stations and frames in
transmission to be removed.
Suspend Button
Clicking on this button causes the animation to be suspended.
The applet thread that updates the animation is stopped.
Stopping the applet thread also occurs anytime the browser leaves
this web page. Iconifying the web browser while the browser is
viewing the applet's web page does not suspend the animation;
the applet's animation thread continues to run in the background.
Resume Button
Clicking on this button causes the animation to resume.
The applet thread that updates the animation is restarted.
Restarting the applet thread also occurs anytime the browser
returns to this web page.
Help Button
Clicking on this button causes a dialog to appear containing
a short message about how to use the applet.
Applet Suspension and Termination
The applet (and all of its threads) automatically suspend execution
when the web browser moves to another web page.
The applet is terminated by clicking on the Close button of the
window containing the applet.
The applet includes a number of graphical techniques to help in
understanding the operation of the protocol.
The media access control protocol used by Ethernet is called CSMA/CD
(for Carrier Sense Multiple Access/ Collision Detection).
The color of a station's rectangle indicates which phase of the
protocol the station is currently in.
The bottom left corner of the applet's graphical area (canvas)
has a legend listing the possible colors and meanings for
station rectangles and frame rectangles.
- 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.
When a station does start transmitting a frame, the frame
propagates in both directions along the link so the applet displays
two copies of the frame. Each copy of a frame has four attributes:
its vertical position within the applet, the speed at which it is
propagating along the link, its shape, and its color.
- Vertical Position
.
Above the link's rectangle in the applet is a series of rows
with one row per station. Along the left side of the applet each
of these rows has a number indicating the associated station
and a edge marker.
The edge marker's height indicates the current bandwidth.
The copies of a frame being transmitted by station j
appear in the row for station j.
- Propagation Speed
.
The speed at which a frame copy moves relative to the link length
cannot be changed in the applet since it can not be changed in real
life
(If the user increases the link length the perceived frame propagation
speed in the applet increases since the length of the link
in pixels (in contrast to meters) is fixed.)
The speed of propagation depends only on the physical media of
the link (for example, the speed for a coaxial cable and a fiber
optic cable are not identical) and is a large fraction (around
two-thirds) of the speed of light.
Thus (for a given physical media), the time until the first bit
of a frame copy reaches one end of the link is determined solely
be the distance from the transmitting station to that end of the link.
The time until the first bit of a frame reaches some position is
called the propagation delay to that position.
Note that the time until the last bit of a frame copy reaches
some position equals the propagation delay to that position plus
the time from the arrival of the first bit of the frame until
the arrival of the last bit of the frame. This second term is
called the transmit time and is a function of the link
bandwidth and the frame size.
Graphically, a larger link bandwidth makes the rectangle
representing the frame copy taller and more narrow.
The total latency of a frame is the propagation delay plus
the transmit time.
The distinction between latency and bandwidth is important
in network design.
- Frame Copy Shape
.
Each frame copy's shape is a rectangle with the area of the
rectangle indicating the frame size. As the link bandwidth changes,
the dimensions of the rectangle change (though the area remains constant).
A larger link bandwidth makes the rectangle taller and more narrow.
Thus, the time (called the transmit time) from the arrival of
the first bit of the frame to some position until the arrival
of the last bit of the frame to that position is less as the
link bandwidth increases.
- Frame Copy Color
.
As long as a frame copy does not encounter a frame copy
from another station, that frame copy's color is transparent.
When two frame copies encounter each other, they both change
color to red to indicate a collision.
Note that one copy of a frame may be red and the other copy
of that frame be transparent.
Also, a frame copy being red is independent of the transmitting
station's rectangle being red.
Acknowledgements and Developer Information
Copyright notice (C) Mark A. Holliday. All rights reserved.