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

Computer Communication and Networking

Uploaded by

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

Computer Communication and Networking

Uploaded by

Vankesh Mathrani
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

Computer Communication and

Networking
20CSE

DATALINK LAYER

ENGR.UNZELA TALPUR
[email protected]
The Data Link Layer (Layer 2) of the OSI model is divided into two sublayers:
1.Logical Link Control (LLC) Sublayer: This sublayer is responsible for error checking and flow control.
It ensures that data is reliably delivered between devices.
While transmitting data, if LLC detects any frame loss, immediately it sends back to the source to
transmit over again. The LLC layer comes above the MAC layer and acts as an interface between
the upper layers and the MAC layer.

2.Media Access Control (MAC) Sublayer: This sublayer is responsible for controlling how devices on the
network access the network medium and how data is placed on the medium
Multiple Access Control
• Multiple access protocols are a set of protocols operating in the
Medium Access Control sublayer (MAC sublayer) of the Open Systems
Interconnection (OSI) model.
• These protocols allow a number of nodes or users to access a shared
network channel.
• If there is a dedicated link between the sender and the receiver then
data link control layer is sufficient, however if there is no dedicated
link present then multiple stations can access the channel
simultaneously. Hence multiple access protocols are required to
decrease collision and avoid crosstalk
• For example, in a classroom full of students, when a teacher asks a
question and all the students (or stations) start answering
simultaneously (send data at same time) then a lot of disturbance is
created(data overlap or data lost) then it is the job of the teacher
(multiple access protocols) to manage the students and make them
answer one at a time.
• Thus, protocols are required for sharing data on non dedicated
channels. Multiple access protocols can be subdivided further as –
Multiple Access protocols
Random Access Protocol

• Random access protocols assign uniform priority to all connected


nodes. Any node can send data if the transmission channel is idle.
• In this , all the station has the equal priority to send the data over the
channel.
• No stations depends on another station, nor any station has control to
another station.
• Depending on the channel’s state ( idle or busy) , any station can
transmit the data frames
• However, if more than one station sends the data over a channel, there
may be a collision or data conflict
• Due to the collision, the data frame packets may be lost or changed and
hence, it does not receive be the receiver end So, all channel need to
follow some procedure to avoid collision.
Procedure to avoid access conflict
To avoid access conflict, each station follows a procedure
1. When can the station access the medium?
2. What can the station do if the medium is busy?
3. How can the station determine the success or failure of the
transmission?
4. What can the station do if there is an access conflict?
The random-access protocol is further divided into four categories, which
are:
• ALOHA
• CSMA
• CSMA/CD
• CSMA/CA
ALOHA
• Aloha is a random access protocol, i.e. any station can send data at
anytime.
• It was designed for wireless LAN but is also applicable for shared medium.
• In this, multiple stations can transmit data at the same time and can
hence lead to collision and data being garbled.
Collision
Types of Aloha
Pure aloha
Slotted aloha
Pure Aloha
• It is Lan-based.
• Pure aloha allows stations to transmit whenever they have data to be sent.
• When a station sends data it waits for an acknowledgement. If the acknowledgment
doesn’t come within the allotted time , it will wait for a random amount of time
before re-sending the data. This random waiting period is known as the back-off time
(Tb). The purpose of the back-off time is to reduce the probability of collisions by
ensuring that different stations do not re-transmit simultaneously after a collision. By
introducing randomness in the waiting period, the likelihood of collisions is reduced,
improving the overall efficiency of the network.
• Vulnerable Time = 2* Frame transmission time
• Efficiency / Throughput = G exp{-2*G}
Slotted Aloha
• It was developed just to improve the efficiency of pure aloha as the chances for
collision in pure aloha is high.
• Slotted ALOHA is an improved version of the pure ALOHA protocol.
• Here, time is divided into discrete intervals called slots, corresponding to a frame
means the entire channel is shared in terms of time.
• The sending of data is only allowed at the beginning of these slots.
• The channel time is separated into time slots in slotted ALOHA, and stations are only
authorized to transmit at particular times.
• If a station misses out the allowed time, it must wait for the next slot. This reduces the
probability of collision.
• Vulnerable Time = Frame transmission time
• Throughput = Gexp{-*G}
Task
• Difference between Pure aloha and Slotted aloha
CSMA (carrier sense multiple access)
• In this, we sense the carrier(medium) before transmitting the data.
• Hence it minimizes the chance of collision and increases the
performance
• CSMA principle: “sense before the transmit” or “ listen before talk”.
• There are two possibilities for carrier
1. Carrier busy: Transmission is taking place
2. Carrier idle: No transmission is taking place currently
• The possibility of collision still exists because of propagation delay.
Types of CSMA Access Modes:
There are 3 types of access modes available in CSMA. It is also referred as
3 different types of CSMA protocols which decide the time to start sending
data across shared media.
1-persistent CSMA
P-persistent CSMA
Non-persistent CSMA
1-persistent CSMA
• 1-persistent CSMA: This is one of the simplest and straightforward
methods. In 1-persistent CSMA, the station continuously senses the
channel to check its state i.e. idle or busy so that it can transfer data or
not. In case when the channel is busy, the station will wait for the channel
to become idle. When station found idle channel, it transmits the frame
to the channel without any delay. It transmits the frame with probability 1
( no randomness) . Due to probability 1, it is called 1-persistent CSMA.
• The problem with this method is that there are a large number of chances
for the collision it is because there is a chance when two or more stations
found channel in idle state and the transmit frames at the same time.
Flow diagram of 1-Persistent approach:
Non-persistent CSMA
• Before sending, a station senses the channel. If no one else is sending, the
station begins doing itself.
• In this method, a station has a frame to send senses the line. If the line is idle
then the station will send the frame and in case if the line is not idle then the
station will wait for a random amount of time and it then senses the line
again.
• With the help of the Nonpersistent CSMA approach, the chances of collision
get reduced because it is unlikely to happen that two or more stations wait
for the same amount of time and then retry to send simultaneously.
• But due to this approach, the efficiency of the network gets reduced because
the medium stays idle when there may be stations having frames to send.
Flow diagram of Non-Persistent approach:
p-persistent CSMA
• It applied to slotted channels.
• In p-persistent CSMA, when a station has data to send, it first senses the channel. If the
channel is idle, instead of transmitting immediately as in 1-persistent CSMA, the station
transmits with a probability of p.
• If the channel is sensed as idle and the station chooses to transmit (with probability p), the
frame is sent.
• If the channel is sensed as busy or the station chooses not to transmit the station waits for
the next time slot and repeats the process.
• In p-persistent CSMA, when a station senses that the channel is idle, it first checks its own
time slot. If it's the station's time slot, it transmits the data. If it's not the station's time slot,
it makes a probabilistic decision based on the value of "p"
• With a probability of "p", the station transmits in the current time slot.
• With a probability of "1-p", the station defers its transmission to the next time slot and
repeats the process.
• Modified protocols are:
CSMA/CD (CSMA with collision detection)
CSMA/CA (CSMA with collision avoidance)
TASK
CSMA/CD (CSMA with collision detection)
CSMA/CA (CSMA with collision avoidance)
CSMA/CD
• CSMA/CD stands for carrier sense multiple access with collision detection
• CSMA/CD (Carrier Sense Multiple Access/ Collision Detection) is a media access control method
that was widely used in Early Ethernet technology/LANs when there used to be shared Bus
Topology and each node ( Computers) was connected By Coaxial Cables.
• Each node first senses if the wire is idle.
• If the wire is idle, it sends its data.
• Consider a scenario where there are ‘n’ stations on a link and all are waiting to transfer data
through that channel. In this case, all ‘n’ stations would want to access the link/channel to
transfer their own data. The problem arises when more than one station transmits the data at
the moment. In this case, there will be collisions in the data from different stations.

CSMA/CD is one such technique where different stations that follow this protocol agree on some
terms and collision detection measures for effective transmission. This protocol decides which
station will transmit when so that data reaches the destination without corruption
• Step 1: Check if the sender is ready for transmitting data packets.
• Step 2: Check if the transmission link is idle.
Sender has to keep on checking if the transmission link/medium is idle. For this, it continuously
senses transmissions from other nodes. Sender sends dummy data on the link. If it does not
receive any collision signal, this means the link is idle at the moment. If it senses that the carrier is
free and there are no collisions, it sends the data. Otherwise, it refrains from sending data.
• Step 3: Transmit the data & check for collisions.
Sender transmits its data on the link. CSMA/CD does not use an ‘acknowledgment’ system. It
checks for successful and unsuccessful transmissions through collision signals. During transmission,
if a collision signal is received by the node, transmission is stopped. The station then transmits a
jam signal onto the link and waits for random time intervals before it resends the frame. After
some random time, it again attempts to transfer the data and repeats the above process.
• Step 4: If no collision was detected in propagation, the sender completes its frame transmission.
Collision detection in CSMA/CD involves the following
features:

• Carrier sense: Before transmitting data, a device listens to the network to check if the
transmission medium is free. If the medium is busy, the device waits until it becomes
free before transmitting data.
• Multiple Access: In a CSMA/CD network, multiple devices share the same
transmission medium. Each device has equal access to the medium, and any device
can transmit data when the medium is free.
• The collision detection technology detects collisions by sensing transmissions from
other stations. On detection of a collision, the station stops transmitting, sends a jam
signal, and then waits for a random time interval before retransmission.
• Backoff algorithm: In CSMA/CD, a backoff algorithm is used to determine when a
device can retransmit data after a collision. The algorithm uses a random delay before
a device retransmits data, to reduce the likelihood of another collision occurring.
Other scenario
CSMA/CA TASK

You might also like