CSMA/CD - A Simple Definition
CSMA/CD - A Simple Definition
CSMA/CD - A Simple Definition
• A network station wishing to transmit will first check the cable plant
to ensure that no other station is currently transmitting (CARRIER
SENSE).
• The communications medium is one cable, therefore, it does allow
multiple stations access to it with all being able to transmit and
receive on the same cable (MULTIPLE ACCESS).
• Error detection is implemented throughout the use of a station
"listening" while it is transmitting its data.
–Two or more stations transmitting causes a collision
(COLLISION DETECTION)
–Detection and retransmission is accomplished in
microseconds.
LAN Technologies
Ethernet CSMA/CD
CSMA/CD (carrier sense multiple access with collision
detection) media access protocol is used.
Data is transmitted in the form of packets.
Sense channel prior to actual packet transmission.
Transmit packet only if channel is sensed idle; else,
defer the transmission until channel becomes idle.
After packet transmission is started, the node monitors
its own transmission to see if the packet has
experienced a collision.
If the packet is observed to be undergoing a collision,
the transmission is aborted and the packet is
retransmitted after a random interval of time using
Binary Exponential Backoff algorithm.
State Diagram for CSMA/CD
Packet?
No
Yes
Discard
Packet Jam channel
attempts < 16 b=CalcBackoff();
wait(b);
attempts++;
attempts == 16
CS 640 3
Collisions
Collisions are caused when two adaptors transmit at the same
time (adaptors sense collision based on voltage differences)
• Both found line to be idle
• Both had been waiting to for a busy line to become idle
A starts at A B
time 0
Message almost
A B
there at time T when
B starts – collision!
A B
time = T
A B
time = 2T
CS 640 5
Calculation of worst case delay
and slot time
– The maximum length of cable is 2.5km between hosts
– Assuming velocity of 2*108 ms-1
– Worst case delay = 2.5*103 / 2*108
12.5 micro seconds
25 micro seconds (Worst case time before station A detects that a
collision has occurred)
– To transmit the signal over the cable five 500 m segments are
interconnected by 4 repeaters
– Each repeater introduces a delay in order to synchronize each new
frame
– At 10Mbps bit rate ,the number of bits will be:
– 10*106 * 50 * 10-6 = 500 bits
– An additional 12 bits is added and minimum frame size is set at
512 bits also known as slot time
Collision Detection
• How can A know that a collision has taken place?
– There must be a mechanism to insure retransmission on collision
– A’s message reaches B at time T
– B’s message reaches A at time 2T
– So, A must still be transmitting at 2T
CS 640 7
Frame/Packet Format
Preamble SFD Dst Src Type Data/Pad FCS
Size 7 1 2/6 2/6 2 46-1500 4
(octets)
11
LAN Technologies
Ethernet Address
End nodes are identified by their Ethernet Addresses
(MAC Address or Hardware Address) which is a unique 6
Byte address.
MAC Address is represented in Hexa Decimal format e.g
00:05:5D:FE:10:0A
The first 3 bytes identify a vendor (also called prefix) and
the last 3 bytes are unique for every host or device
Ethernet
Addressing
Each station recognizes three classes of addresses.
• Own address
• Broadcast address (all 1's)
• Optionally, one or more multicast addresses
CS 640 18
MAC Rules and Collision
Detection/Backoff
Ethernet
10BaseT Half-Duplex Operation
and Collision Domains
RFC 894
Ethernet Encapsulation
Destination Source Type Data CRC
Address Address
6 Bytes 6 Bytes
2 46-1500 Bytes 4 Bytes
Type IP Datagram
0800
2B 46-1500 Bytes
2B
28 Bytes 18 Bytes
Ethernet Encapsulation
• 48-bit (6bytes) source and destination addresses. These are what
we call hardware addresses.
• The Ethernet type field identifies the type of data that follows.
• The data field is the actual payload and must be at least 46 bytes
• If needed (frames with less than 46 bytes of payload), Pad bytes are
inserted to assure that the frame is long enough.
• The CRC field is a cyclic Redundancy check (a checksum) that
detects errors in the frame. (This is also called FCS or Frame
Check Sequence)
Address Resolution Protocol:
ARP
• Is needed in order to for the source to Learn the MAC address for the
destination
• The IP address of the destination is used to learn the MAC address of the
destination
• Two-step process: ARP Request and ARP Reply
• ARP Requests are sent to the broadcast address of FFFF.FFFF.FFFF and
heard by all nodes in the same broadcast doamin (coming later)
• Only the node with the matching destination IP address replies
• AN ARP table is saved in RAM and can be viewed by using the command
arp –a from DOS
Ethernet Encapsulation
Destination Source Type Data CRC
Address Address
6 Bytes 6 Bytes
2 46-1500 Bytes 4 Bytes
Type IP Datagram
0800
2B 46-1500 Bytes
2B
28 Bytes 18 Bytes
Ethernet Operation (CSMA/CD)
• Thus, the following operating procedure can be formulated for the
LAN configuration shown below:
– CSMA, although more efficient than ALOHA or slotted ALOHA, still has one
glaring inefficiency. When two frames collide, the medium remains unusable for
the duration of transmission of both damaged frames. For long frames, compared
to propagation time, the amount of wasted capacity can be considerable. This
waste can be reduced if a station continues to listen to the medium while
transmitting. This leads to the following rules for CSMA/CD:
• If the medium is idle, transmit; otherwise, go to next.
• If the medium is busy, continue to listen until the channel is idle, then transmit
immediately.
• If a collision is detected during transmission, transmit a brief jamming signal
to assure that all stations know that there has been a collision and then cease
transmission.
• After transmitting the jamming signal, wait a random amount of time, then
attempt to transmit again (repeat step 1).
29
A B
T im e 2 P R O P
B d e te c ts c o llisio n
A d e te c ts c o llisio n
30
Background to Ethernet (CSMA/CD)
• To improve efficiency, slotted ALOHA, was developed. In
this scheme, time on the channel is organized into uniform
slots whose size equals the frame transmission time.
Transmission is permitted to begin only at a slot boundary.
Thus, frames that do overlap will do so totally. By this
approach the system utilization is improved as shown below.
• As seen from the curve the maximum efficiency of ALOHA
and Slotted ALOHA are 18% and 37% respectively.
• Both ALOHA and Slotted ALOHA exhibit poor utilization.
Both fail to take advantage of some key aspects of packet
length and propagation time as discussed below.
31
Background to Ethernet (CSMA/CD)
32
T w o tw iste d p a irs
M e d iu m a c c e s s u n it
T w o U T P s ( 0 .5 m m ) 1 0 0 m
H ub
I n te r f a c e
c ard
I n te r f a c e C o llis io n
c ard H ub d e te c te d H ub
M A U M A U
D a ta D a ta
C o llis io n
D a ta d e te c tio n
D a ta
D a ta
M A U M A U
I n te r f a c e C o llis io n
c ard d e te c te d
I n te r f a c e
c ard
33
Throughput Equation of Ethernet
34
Here, R = Data rate of the channel
d = Maximum distance between any two stations
V = Velocity of signal propagation
L = Average or fixed frame length
35
Evaluation of the above equation
• Two extreme cases are evaluated here:
– (1): Minimum end-to-end length of the
Ethernet = 600 meter. Packet length = 12,240.
Assuming the velocity within the twisted wire
3.5 sec/Km. The propagation delay for 600 meter
= 2.0 sec. Also, the packet transmission time
@ 10 Mbits/sec = 1224 sec. Thus, the efficiency =
1/(1+10.0/1224) 0.99
– (2) With Ethernet length = 2,500 meter and packet size
= 608 bits. The efficiency = 1/(1+3.5 x 2.5 x 5/60.8)=
0.58 0.6
• These two values are at two extremes of the curve
shown below
36
A w a its r a n d o m tim e A w a its r a n d o m tim e S u cc ess!
A d e te c ts c o llisio n A d e te c ts c o llisio n
A v e ra g e tim e w a s te d 5 P R O P TRA N S
a = P R O P /T R A N S
0 .0 2 0 .0 4 0 .0 6 0 .0 8 0 .1 0 .1 2 0 .1 4
-
99%
0 .9 -
-
1
= E ffic ie n c y
1 + 5a
0 .8 -
-
0 .7 -
-
60% 0 .6 -
-
600 m 2 ,5 0 0 m
1 2 ,2 4 0 - b it p a c k e ts 6 0 8 -b it p a c k e ts
-
37
-
Token Ring
• As discussed in earlier classes the token ring operates at 4 Mbps
and 16 Mbps. Network users are guaranteed to transmit before a
specific time. Also, the network is more efficient than Ethernet
• Terminals are in two configuration. Either they repeat whatever
they receive from other station (bit-by-bit) with a few bit delay
(small delay) or they are in the transmitting mode where they
also listen to the incoming link. The cabling used can be
Unshielded Twisted Pair (UTP).
• Figure below shows the sequence of events when a node wants
to transmit a packet: the node waits for the token, Upon
receiving the Token the terminal transmits some of its packets
and releases the token.
38
Token Ring
• There are two modes of operation
– Release after transmission (applicable to Token ring transmitting at
16 Mbps) where a node releases the token right after it finishes
transmitting its packets
– Release after reception (applicable to token ring operating at 4-
Mbps) Here, the node waits until it has completely received its last
packet before releasing the token. The standard 802.5 specifies that
a node can hold onto the token and transmit for some time, called
the token holding time (THT). A typical value of THT is 10 ms.
• As the figure shows, all stations except the sender forwards bits around
the ring. To verify that no transmission errors occurred, a sender can
compare the data being received to the data being transmitted. The
destined computer makes the copy of frame as the bit pass around
39
Token Ring
• Permission for transmission is granted by the Token. Token ring
hardware coordinates among all connected computers to ensure
that permission is passed to each computer in turn. Token is a
special message whose bit pattern differs from normal data
frames. Only one Token can exist within a ring which is passed
by the transmitting station to its adjacent neighbor.
• Token is passed fast (order of few milli-seconds) around the ring
for a lightly loaded ring. The short time is possible due to two
reasons: (1) Token is small, and (2) forwarding of the token is
done by the ring hardware and is independent of the computer.
Thus, the speed of connected computer has no influence.
• Two cases of analysis follows: (a) Release after reception, and (b)
release after transmission
40
Token Ring throughput analysis - case 1:
Release after reception
• Following analysis holds for N node token ring.
– Let Tn (0 < Tn < THT) be the time during which node n transmits.
T We assume that all the nodes want to transmit, so that Tn > 0 for
n = 1,2, ..., N.
– At time t = 0 the first node starts transmitting. Transmission is over
at T1
– The last bit of the last packet will return back to the first node after
one complete propagation delay round the ring
– Thus, at T1 + PROP the first user will start transmitting Token to its
neighbor. The token takes PROP 12 time to reach to node 2
(adjacent node)
– From these observations the efficiency of transmission can be
written as:
T 1 T 2 ......TN 1
Efficiency
T 1 T 2 ....TN N x ( PROP) PROP 1 a
Where, a PROP / E (TN ) 41
Token Ring throughput analysis - case 1:
Release after reception
42
Token Ring throughput analysis - case 2:
Release after Transmission
• Here the node does not wait for the last bit
of the last packet to arrive back. The user
releases the TOKEN immediately after
finishing its transmission. Thus, the new
equation is:
43
T 1 T 2 ......TN
Efficiency
T 1 T 2 ....TN PROP
1
N x PROP
1
N x (T 1 T 2.....TN )
1
1 a / N
44
N e tw o rk in te rfa c e c a rd
C o m p u te r b u s
Token
W a itin g to G ra b to k e n R e le a se
tra n s m it tra n s m it to k e n
45
Token Token
PRO P PRO P T im e
T 1 T N
N ode 1 N ode N
P R O P 12 PRO P N 1
0 .0 5 0 .1 0 .1 5 0 .2
a = P R O P /E (T n)
99%
0 .9 7 5 - -
0 .9 5 - T 1 + ... + T N 1
E ff ic ie n c y
0 .9 2 5 - ...
-
T1 + + T N + (N + 1 ) P R O P 1 + a
0 .9 -
0 .8 7 5 -
-
0 .8 5 -
8 3 % 0 .8 2 5
-
2 ,5 0 0 m
-
600 m 6 0 8 - b it p a c k e ts
1 2 ,2 4 0 - b it p a c k e ts
46
Background to Ethernet (CSMA/CD)
• CSMA/CD and its predecessors (ALOHA, Slotted ALOHA)
are termed random access, or contention channels. Thus, there
is no predictable or scheduled time for any station to transmit;
station transmissions are random. They exhibit contention in
the sense that stations contend for time on the medium.
• ALOHA, was developed for packet radio networks. With
ALOHA, when a station has a frame to send, it does so. The
station then listens for an amount of time equal to the
maximum possible round-trip propagation delay on the
network plus a small fixed time (receiver takes time to analyze
and acknowledge). If the station gets the acknowledgment
during that time, fine; otherwise, it resends the frame. If the
station fails to receive an acknowledgment after repeated
trials, it gives up. Failing to receive acknowledgement is
regarded as collision.
47
• http://www.techsupportalert.com/best-free-a
udio-video-format-conversion-program.htm
48
Background to Ethernet (CSMA/CD)
• Based on above following can be done to improve the
efficiency:
• A station wishing to transmit first listens to the medium to
determine if another transmission is in progress (carrier
sense). If the medium is in use, the station must wait. If the
medium is idle, the station may transmit. The station waits
a reasonable amount of time after transmitting for an
acknowledgment taking into account the maximum round-
trip propagation delay and the fact that the acknowledging
station must also contend for the channel to respond. If
there is no acknowledgement, the station assumes that a
collision has occurred and retransmits after certain wait
(successive retransmission with Exponential back-off).
49
Background to Ethernet (CSMA/CD)