0% found this document useful (0 votes)
27 views

Lecture 7 (Data Link Layer) Part 41

CSMA/CD is a protocol used in Ethernet networks that addresses the multiple access problem of nodes sharing a common communication channel. It uses carrier sense multiple access (CSMA) where nodes listen to check if the channel is idle before transmitting. Collisions can still occur within a propagation time (Tc) of beginning transmission. CSMA/CD also uses collision detection (CD) where nodes sense collisions for at least 2Tc after transmitting and take remedial action like sending a jam signal. The protocol employs binary exponential backoff to schedule retransmissions after collisions to reduce future collisions.

Uploaded by

akshar170920
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Lecture 7 (Data Link Layer) Part 41

CSMA/CD is a protocol used in Ethernet networks that addresses the multiple access problem of nodes sharing a common communication channel. It uses carrier sense multiple access (CSMA) where nodes listen to check if the channel is idle before transmitting. Collisions can still occur within a propagation time (Tc) of beginning transmission. CSMA/CD also uses collision detection (CD) where nodes sense collisions for at least 2Tc after transmitting and take remedial action like sending a jam signal. The protocol employs binary exponential backoff to schedule retransmissions after collisions to reduce future collisions.

Uploaded by

akshar170920
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

CSMA/CD (Multiple Access Protocol on Ethernet)

Multiple access problem


If multiple nodes share a link, have traffic to send who gets to send? When?

Multiple laptops would like to talk to the AP


Multiple hosts want to send frames.

What is collision? How to detect it?


A collision is an event that happens on LAN when two stations simultaneously “talk” on
the wire.
The electrical signals “collide” and overlap, causing abnormal voltage on the wire. The
collides signal travels down the wire in each direction.
The multiple access problem is not easy to solve. There's no one in charge. Any host
can send randomly. It is a random multiple access problem.
CSMA/CD (Carrier-sense multiple access with collision detection)
CSMA/CD protocol is used in the Ethernet physical broadcast network

(1) CSMA (Carrier-sense multiple access)


◼ If a station wants to send a frame, it first listens (senses) to the common
channel to see if anyone is transmitting
◼ If the channel is idle (no other communication taking place), it sends the data
frame
◼ If the channel is busy, it waits until the channel is idle, then sends the frame
How to listen (sense) the channel to see if anyone is transmitting?

⚫ Transceiver of NIC card uses a carrier-sense mechanism to determine whether


another transmission is in progress before initiating a transmission.
⚫ It tries to detect the presence of a carrier signal from another node before
attempting to transmit. If a carrier is sensed, the node waits for the transmission in
progress to end before initiating its own transmission.
⚫ Frame is sent to all machines on the LAN. Any machine could use transceiver’s
sense circuit to sense if there is frame on the link. If there is data on the media, it is
broadcast and the transceiver could quickly detect it. Within a very short time, the
transceiver could tell if there is frame on the media or not.
If every node listens before it sends, is collision still possible?

Collision may occur in the first Tc seconds of the transmission, where

𝐿𝑒𝑛𝑔𝑡ℎ 𝑜𝑓 𝑡ℎ𝑒 𝑤𝑖𝑟𝑒


𝑇𝑐 =𝑆𝑖𝑔𝑛𝑎𝑙 𝑝𝑟𝑜𝑝𝑎𝑔𝑎𝑡𝑖𝑜𝑛 𝑆𝑝𝑒𝑒𝑑

◼ For t < Tc , some stations may find the channel is still idle and may
also transmit
◼ For t > Tc , all the stations find the channel is busy
Example: Determine Tc of the following links

200 m 20 m
A B A B

Wire length = 200m Wire length = 20m


200 20
𝑇𝑐 = = 1.0𝜇𝑠 𝑇𝑐 = = 0.1𝜇𝑠
2 × 108 2 × 108

𝜇𝑠 : A microsecond (10−6 of a second).

⚫ The longer of the link, the longer of Tc


(2) CD (Collision Detection)
In Ethernet, senders need to keep sensing if collision occur after send. Take action after
collision is sensed.
For all the other nodes who detect the collision, they can also retransmit their frame in
the future
If not, a collision may make the channel unusable for at least Tf. The frame already
collides but still occupy the channel.
Keep sensing the channel? How long the senders can detect a collision?

⚫ 2Tc seconds is needed to detect a collision


⚫ In CSMA/CD, to ensure all nodes know that a collision has occurred, Ethernet impose
a minimum frame size. It requires that the minimum frame a node to send need to
take at least 2Tc seconds. In that way you'll still be sending the frame for the time
interval during which you could detect a collision
In Ethernet, propagation time is much less than transmission time.

Example: Assume wire length is 200


1500 byte is max length of data in a frame
bit rate is 100Mbps

Ensure the frame is long enough so that the node can't finish transmitting the frame
before the collision occur. Thus Tf > 2Tc
If using IEEE 802.3 Ethernet, the bit rate is 10Mbps and the maximum length of the
medium in ethernet is 100m, you can know the minimum frame size for Ethernet is 64
bytes. If you want to send a 802.3 Ethernet frame, its minimum size is 64 bytes.
If you try to send something smaller, padding will be added to make it 64 bytes

Other Ethernet standards:

⚫ Fast Ethernet: 100 Mbps (IEEE 802.3u)


⚫ Gigabit Ethernet: 1,000 Mbps (IEEE 802.3ab)
⚫ 10 Gigabit Ethernet : 10,000 Mbps (IEEE 802.3ae)

The minimum size will be increased with the bandwidth increases.


If two nodes send frames and detect a collision, what should they do?
⚫ cease continue sending the frame and send a jam signal and let all nodes know that
a collision has occurred
CSMA - Stations can transmit only if the channel is idle
CD – reduce the collision period from 𝑇𝑓 to 2𝑇𝑐 (Tc<<Tf)
Link efficiency of CSMA/CD
The link efficiency is the fraction of time that nodes can transmit new frames under a
heavy load imposed by all the nodes.
or
The fraction of the time transmitting a new frame with possible number of collisions
delay + frame’s transmission delay
𝑇𝑓
Line efficiency =
𝐶 (𝑇𝑐 , 𝐿) × 2𝑇𝑐 + 𝑇𝑓
C(Tc, L): possible number of collisions

Theoretical analysis gives 𝐶 (𝑇𝑐 , 𝐿) ≈ 𝑒

1 𝑇𝑐
Link efficiency ≈ , 𝑎=
1+5𝑎 𝑇𝑓
⚫ If only one node attempts to transmit at any time. In this case, the NIC may saturate
the medium and efficiency is 100%.
⚫ When two or more NICs attempt to transmit at the same time, the performance of
Ethernet is less predictable. Some bandwidth is wasted by collisions.

We can conclude:

⚫ If distance increases, the efficiency of CSMA decreases.


⚫ CSMA is not suitable for long-distance networks like WAN but works optimally for
LAN.
⚫ If the length of the frame is bigger, the efficiency of CSMA also increases; but the
maximum limit for length is 1500 Bytes.
1 𝑇𝑐
Link efficiency ≈ , 𝑎=
1+5𝑎 𝑇𝑓
What’s the link efficiency of CSMA/CD for nodes attached to a 2.5 km copper cable
(speed of electricity in a copper cable = 200,000,000 meters/ second),
with 10Mbps transmission rate and 620 bits message?

Tc = 2500/200000000 = 1.2 *10 -5s


Tf = 620 bits/(10*1000000) = 6.2 * 10 -5s

Tc/Tf = 0.193

Link efficiency = 1/(1 + 5Tc/Tf) = 51%


Schedule a retransmission after collision?

What a node should do if it senses that another node is using the medium or collision is
detected?
⚫ wait and not send right away or that would cause a collision

You shouldn't send right away, but when you could?


It depends on the number of waiting nodes.
⚫ only one sender then sends right away
⚫ Two senders, each of them to send with probability about 1/2. One sends right away
and the other one has to wait
⚫ Fifty senders, each of them to send with probability about 1/50.
Ethernet estimates this probability of senders with a binary exponential back-off
algorithm
Binary exponential back-off
It determines who could send after each time collision happen

The algorithm does not know how many nodes are waiting when the first collision
occurs. It assumes that there are 2 nodes after first time collision happen.

After the first time collision, each node could send right away with roughly probability of
1/2. Each one will wait zero or one frame time.

Frame time is the time required for a signal to traverse from one end of the network to
another, plus the time required to send the jam signal in case of collision.
For 10/100Mbps Ethernets, the frame time is 5.12 μs
If collide again, each node sending will be with probability 1/4. Each node picks up a
random number of frame times to wait 0 – 3 frame times

If collide again, the algorithm will double the number of frame times again. Each node
needs to wait a random number of frame times 0 – 7 times

Thus, binary exponential backoff is doubling the interval with each successive collision
Binary exponential Backoff
◼ Used for the scheduling of retransmissions
◼ A station involved in the collision chooses a random parameter K from a
delay set and schedules the retransmission after 𝑘 × frame time
◼ frame time = 2𝑇𝑐
◼ initial delay set = {0, 1}
◼ Station that generates the smallest 𝑘 will transmit first
◼ For m consecutive collisions, the random value 𝑘 is chosen from the
following delay set
Delay Set = {0, … , 2𝑚 − 1} if 𝑚 < 10
Delay Set = {0, … , 210 − 1} if 𝑚 ≥ 10
◼ After 16 consecutive collisions, gives up and reports systems error to the
network management
◼ Generation of the random number 𝒌
◼ Uniform Distribution function: 𝑛 = random(), 0 ≤ 𝑛 < 1
𝑘 = ⌊𝑛 × |delay set|⌋
◼ example
delay set = {0, 1}, |delay set|=2:
𝑛 = 0.345 → 𝑘 = 0
𝑛 = 0.711 → 𝑘 = 1
delay set = {0, 1, 2, 3, 4, 5, 6, 7}, |delay set|=8:
𝑛 = 0.345 → 𝑘 = 2
𝑛 = 0.711 → 𝑘 = 5
The back exponential backoff (one node sends a frame)
Each node makes their own decision following this algorithm
The back exponential backoff (multiple nodes send frames)
In this example, assume that A, B and C are willing to send at the same time. Collision
occurs.
At the end of successful transmission by C, both C and E attempt to transmit (C wants to transmit a new
frame. E wants to retransmit its frame). Will collision occur?
Yes, for the new frame by C, collision number N is set to 0. After collision, the delay set for C is {0,1} while
the delay set for E is {0, …… 15}.
Suppose C generated K is 0 and K generated K is 3, then C will transfer the frame before E.
Format of Classis Ethernet Header
It's often very helpful to look at the format so we can see the different functions that
are included for the link layer

How did sender create the frame?


1. Preamble-

• It is a 7 byte field that contains a pattern of 10101010.

• It alerts the receiver that a frame is going to start.

• Preamble is for bit synchronization


Bit synchronization and Frame synchronization

Bit synchronization: the receiving end clock has been adjusted to the same as the
sending end clock, so the receiver receives the bitstream and is able to adjudicate in
the middle of each bit. Bit synchronization is intended to properly receive each bit sent
by the sending side. This is done at the right moment (usually in the middle of each
position) to judge the received level according to the pre-agreed rules. For example, a
level above a certain value is 1, otherwise 0.
⚫ But just a bit of synchronization is not enough. Data is to be sent in frames. If a
frame is wrong, the wrong frame will be re-transmitted later. Therefore, a frame
should have a definite boundary, there must be a frame delimiter.

⚫ After receiving a bitstream, the receiver must be able to correctly locate the frame
delimiter so that it knows which bits make up a frame.

2. Start Frame Delimiter (SD)-

• It is a 1 byte field which is always set to 10101011.

• The last two bits “11” indicate the end of Start Frame Delimiter and marks the beginning of
the frame.

• No ending flag

3. Destination Address-

• It is a 6 byte field that contains the MAC address of the destination for which the data is
destined.
4. Source Address-

• It is a 6 byte field that contains the MAC address of the source which is sending the data.

5. Data-

• It is a variable length field which contains the actual data.

• It is also called as a payload field.

• The length of this field lies in the range [ 46 bytes , 1500 bytes ].

• In a Ethernet frame, minimum data has to be 46 bytes and maximum data is 1500 bytes.

Minimum Length of Data Field

• Ethernet uses CSMA /CD as access control method to deal with collisions.

• The minimum length of the Ethernet frame has to be 64 bytes starting from the destination
address field to the CRC field.

• Therefore, minimum length of the data field has to be = 64 bytes – (6+6+2+4) bytes = 46
bytes
Maximum Length of Data Field

• The maximum amount of data that can be sent in a Ethernet frame is 1500 bytes.

• This is to avoid the monopoly of any single station.

• If Ethernet allows the frames of big sizes, then other stations may not get the fair chance to
send their data.

6. Length-

• It is a 2 byte field which specifies the length (number of bytes) of the data field.

• We can determine the number of padding added to the data if its size is less than 64 bytes .

Frame Check Sequence (CRC)-


• It is a 4 byte field that contains the CRC code for error detection.
⚫ There are no acknowledgments or retransmissions on Ethernet because frames on
wire is usually fairly reliable. The CRC is just there in case something goes wrong to
check errors but mostly there won't be any errors
⚫ If there are errors detected by CRC, the frames will be dropped by the receiver. The
dropped frames will be considered as lost frames. They're not handled by Ethernet.
That will just have to be handled by the higher layers (TCP layer) that we'll discuss
later

⚫ If there are collisions, the collided frames will be retransmitted that will be handled
by CSMA/CD.

Nowadays we do not use this multiple access control protocol for LAN. Modern
Ethernet is really based on switches.
Switch-based Ethernet
A network switch forwards frames between devices. Switches send frames directly to
devices, rather than sending them to networks like a router does.

⚫ Every port on an Ethernet switch is in its own collision domain


A collision domain is the part of a network where packet collisions can occur.
When multiple devices are connected to the same shared Ethernet bus, CSMA/CD
(carrier sense multiple access/collision detection) must be enabled.

Because a switch port is connecting to a single device, there is no chance of having a


collision. With no chance of collision, collision detection is no longer needed.
With collision detection disabled, network devices can operate in full-duplex mode

The CSMA/CD only apply to half duplex classical Ethernet


802.11 is also half – duplex. It uses a similar CSMA/CA
Full duplex switch-based Ethernet do not need it.

You might also like