Computer Networks Unit 2
Computer Networks Unit 2
Control
Unit 2
Introduction
• Data Link Control is the service provided by the
Data Link Layer to provide reliable data transfer
over the physical medium.
• For example, In the half-duplex transmission
mode, one device can only transmit the data
at a time.
• If both the devices at the end of the links
transmit the data simultaneously, they will
collide and leads to the loss of the information.
• The Data link layer provides the coordination
among the devices so that no collision occurs.
Cont..
• The Data link layer provides three functions:
Cont..
Line Discipline
• Line Discipline is a functionality
of the Data link layer that
provides the coordination
among the link systems. It
determines which device can
send, and when it can send
the data.
Line Discipline can be achieved
in two ways:
• ENQ/ACK
(Enquiry/Acknowledgement)
• Poll/select
ENQ/ACK
Cont..
Poll/select
• The Poll/Select method of
line discipline works with
those topologies where
one device is designated
as a primary station, and
other devices are
secondary stations.
Flow Control
• It is a set of procedures that tells the
sender how much data it can transmit
before the data overwhelms the
receiver.
Two methods have been developed to
control the flow of data:
• Stop-and-wait
• Sliding window
Cont..
Stop and wait
Sender:
• Rule 1) Send one data
packet at a time.
Rule 2) Send the next
packet only after receiving
acknowledgement for the
previous.
Receiver:
• Rule 1) Send
acknowledgement after
receiving and consuming a
data packet.
Rule 2) After consuming
packet acknowledgement
need to be sent (Flow
Control)
Cont..
Framing
• The data link layer encapsulates the packets from
the network layer into frame
• The framing in the data link layer separates a
message from one source to a destination or from
other messages to other destinations just by adding
a sender address and destination address.
• The destination address → where the packet has to
go and the sender address →helps the recipient to
acknowledge.
• By using frames the data can be easily get broken
up into recoverable chunks and in order to check
the corruption in transmission, these chunks can be
checked easily.
Cont..
• The frame fields
Problem:
• This technique was popular when the data was in
the form of text that was exchanged by the data link
layers. The flag selected could be any character that is
not used for text communication. But there is a need to
send other types of information like graphs, audio, and
video.
• Now any pattern that is used for the flag could also be a
part of the Information. If this happens then the receiver
encounters this pattern in the middle of the data and
then thinks that it has reached the end of the frame.
Data-Link Layer
Protocols
• 2 States:
o Ready state
o Blocking State
• Sending Node:
Receives from network
layer save a copy and
there will be a timer
i) If timeout --> resends
ii) Corrupted ack -->
Discards
iii) Error free ack --> Stops
the timer
Cont..
• Receiver Node
Receiving Node:
i) Error free frame --> Deliver
ii)Corrupted frame --> Discards
Cont..
• Flow Chart for Stop
and wait ARQ Protocol
Working of Stop and Wait for
ARQ:
1) Sender A sends a data frame or
packet with sequence number 0.
2) Receiver B, after receiving the
data frame, sends an
acknowledgement with sequence
number 1 (the sequence number of
the next expected data frame or
packet)
There is only a one-bit sequence
number that implies that both
sender and receiver have a buffer for
one frame or packet only.
Cont..
• Difference between Stop and wait (S&W)and S&W AQR)
Cont..
2. Go-Back-N Automatic Repeat Request
• Step 1 − In this protocol we can send several frames before
receiving acknowledgements.
• Step 2 − we keep a copy of these frames until the
acknowledgment arrives.
• Step 3 − Frames from a sending station are numbered
sequentially. However, we need to include the sequence
number of each frame in the header; we need to set a limit.
• Step 4 − If the header of the frame allows m bits for the
sequence number, the sequence numbers range from 0 to
2m-1. We can also repeat the sequence numbers.
Example
• For m = 2, the range of sequence numbers is: 0 to 3, i.e.
0,1,2,3, 0,1,2,3,…
• Problem − Consider a binary
signal sent over 4 KHZ wide
channel, find out the
maximum data rate for
noiseless and a noisy channel
whose signal to noise ratio is
20dB.
Cont..
Selective Repeat ARQ
• Selective repeat protocol, also called Selective Repeat
ARQ (Automatic Repeat reQuest), is a data link layer
protocol that uses sliding window method for reliable
delivery of data frames.
• Here, only the error frame or lost frames are
retransmitted, while the good frames are received and
buffered.
Cont..
Explanation
• Step 1 − Frame 0 sends from sender to receiver and set timer.
• Step 2 − Without waiting for acknowledgement from the receiver
another frame, Frame1 is sent by sender by setting the timer for it.
• Step 3 − In the same way frame2 is also sent to the receiver by
setting the timer without waiting for previous acknowledgement.
• Step 4 − Whenever sender receives the ACK0 from receiver, within
the frame 0 timer then it is closed and sent to the next frame, frame
3.
• Step 5 − whenever the sender receives the ACK1 from the receiver,
within the frame 1 timer then it is closed and sent to the next frame,
frame 4.
• Step 6 − If the sender doesn’t receive the ACK2 from the receiver
within the time slot, it declares timeout for frame 2 and resends the
frame 2 again, because it thought the frame2 may be lost or
damaged.
Cont..
High-level Data Link Control (HDLC)
• High-level Data Link Control (HDLC) is a group of
communication protocols of the data link layer for
transmitting data between network points or nodes.
• It is a bit - oriented protocol
• Transfer Modes
o Normal Response Mode (NRM)
• Point to point Communication
• Multipoint Communication
o Asynchronous Balanced Mode (ABM)
Failed
Medium Access Control
(MAC)
• A media access control is a network data transfer policy
that determines how data is transmitted between two
computer terminals through a network cable.
• The Data Link Layer is responsible for transmission of data
between two nodes. Its main functions are-
Maximum
15
retransmit
can do
CSMA/CA (Collision
Avoidance)
• It means that it is a network protocol that is used to avoid a
collision rather than allowing it to occur.
• Collisions are avoided using 3 CSMA/CA strategies
Minislot
Polling
Cont..
Cont..
2 function of polling
1.Poll function: if the primary wants to receive data, it
asks the secondaries if they have anything to send.
2. Select function: If the primary wants to send data, it
tells the secondary to get ready to receive
We calculate the efficiency of this method in terms of time for
polling & time required for transmission of data.
o T = time for polling
poll
Disadvantage: If any one node fails it will crash entire the network
Cont..
The nodes which hold the
token can send the data
Station 2
Station 3
Time Division Multiple
Access (TDMA)
• TDMA is the channelization protocol in which bandwidth of
channel is divided into various stations on the time basis.
• There is a time slot given to each station, the station can
transmit data during that time slot