Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
94 views50 pages

CSMA/CD - A Simple Definition

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1/ 50

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

Sense Send Detect


Carrier Collision

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!

How can we be sure A knows about the collision?


CS 640 4
Collision Detection contd.
A B
time = 0

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

– The maximum distance of 2500m between hosts


– At 10Mbps it takes 0.1us to transmit one bit so 512 bits (64B) take 51.2us to send
– So, Ethernet frames must be at least 64B long
• 14B header, 46B data, 4B CRC
• Padding is used if data is less than 46B
• Send jamming signal after collision is detected to insure all hosts see collision
– 32 bit signal

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)

In IEEE 802.3, the Type field is used as a Length field.


LAN Technologies

Ethernet Frame Structure


Preamble:
7 bytes with pattern 10101010 followed by one byte with
pattern 10101011
Used to synchronize receiver, sender clock rates
Start-of-frame delimiter (1 octet, 10101011)
Addresses: Also known as MAC addresses , 6 bytes, frame is
received by all adapters on a LAN and dropped if address does
not match
Individual address or group address specified by first bit
0- individual address , 1- group address
Type of grouping specified in the second bit
0-locally administered 1- globally administered
Length: 2 bytes, length of Data field(indicates n/w layer
protocol that created the info or it may be length indicator
Ethernet and MTU
Data Payload: Maximum 1500 bytes, minimum 46
bytes
If data is less than 46 bytes, pad with zeros to 46
bytes
CRC: 4 bytes generated using CRC-32, checked at
receiver, if error is detected, the frame is simply
dropped
As you can see there is a limit on the size of an
Ethernet frame.This limits the number of bytes of
data to 1500 bytes.
This characteristics of the data link layer is called
MTU, or Maximum Transmission Unite
Exponential backoff method

11
LAN Technologies

Ethernet Wiring Configuration


10 Base 2 (Thinnet) (Bus Topology)
Thin wire coaxial cable (0.25 inch) with maximum segment
length of 200 m
10 Base 5 (Thicknet) (Bus Topology)
Thick wire coaxial cable (0.5 inch diameter) with maximum
segment length of 500 m
10 Base T (UTP) (Star/Tree Topology)
Hub (star) topology with twisted-pair drop cables
10 Base FL (Fiber) (Star/Tree Topology)
Hub (star) topology with optical fiber drop cables
Frame transmission
• Monitor link until empty. If not-empty, wait until empty and
also for interframe gap time before transmitting (to allow the
passing frame to be received)
• During transmission, monitor to detect collision
• If collision detected, stop transmission and a jam signal is
transmitted to network by the transmitting stations that
detected the collision, to ensure that all stations know of the
collision. All stations will "backoff" for a random time and
schedule retransmission after delaying for a short,randomly
selected, time interval
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

Major reason for broadcast is address discovery.


Multicast addresses are used for specialized link
layer functions.
Exponential Backoff
• If a collision is detected, delay and try again
• Delay time is selected using binary exponential backoff
– 1st time: choose K from {0,1} then delay = K * 51.2us
– 2nd time: choose K from {0,1,2,3} then delay = K * 51.2us
– nth time: delay = K x 51.2us, for K=0..2n – 1
• Note max value for k = 1023
– give up after several tries (usually 16)
• Report transmit error to host
• If delay were not random, then there is a chance that sources
would retransmit in lock step
• Why not just choose from small set for K
– This works fine for a small number of hosts
– Large number of nodes would result in more collisions

CS 640 18
MAC Rules and Collision
Detection/Backoff
Ethernet
10BaseT Half-Duplex Operation
and Collision Domains

• Stations separated by hubs are within the same collision


domain
• Let’s look at packet tracer to see how hubs work
Naming

• MAC addresses are sometimes referred to as burned-in addresses


(BIA) because they are burned into read-only memory (ROM) and
are copied into random-access memory (RAM) when the NIC
initializes.
Naming
Ethernet Encapsulation

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

Type ARP Request/Reply PAD


0806

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

Type ARP Request/Reply PAD


0806

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)

• If the station-to-station propagation time is large


compared to the frame transmission time, then, after
a station launches a frame, it will be a long time
before other stations know about it. During that time,
one of the other stations may transmit a frame; and
thus the possibility of contention. On the other hand,
if the propagation time is small compared to frame
transmission time, all the other stations know it
almost immediately. Thus, collisions would be rare.

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

Pr opagation time Length of the Data Link


Let , a  
Transmissi on time Length of the frame in bits
Throughput
Let , u 
Data Rate
L Pr opagation time d / V Rd
Throughput  ; Since a   
d L Transmissi on time L / R LV

V R
L
d L

L 1 1
Thus, u  V R   
R Rd Rd 1  a
 L 1
V VL
The above equation can be written as :
1
if the time wasted is 5 x Pr opagation delay
1  5a

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 12 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

• Thus, the efficiency obtained by the above


equation is > Ethernet efficiency. This is
shown in Figure below.

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

Where, a  PROP / E (TN )  PROP /((T 1  T 2...  TN ) / 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 12 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)

• One can see how this strategy would be effective


for networks where the average frame
transmission time is much longer than the
propagation time. The maximum utilization
achievable using CSMA can far exceed that of
ALOHA or slotted ALOHA. The maximum
utilization depends on the length of the frame and
on the propagation time; the longer the frames or
the shorter the propagation time, the higher the
utilization.
50

You might also like