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

Lecture 11

The document provides an overview of Data Link Control, focusing on framing, flow control, and error control mechanisms in computer networks. It discusses various framing approaches, including character-oriented and bit-oriented methods, as well as protocols like Stop-and-Wait ARQ, Go-Back-N ARQ, and Selective Repeat ARQ. Additionally, it highlights the importance of efficient data transmission and acknowledgment processes to prevent data loss and ensure reliable communication between nodes.

Uploaded by

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

Lecture 11

The document provides an overview of Data Link Control, focusing on framing, flow control, and error control mechanisms in computer networks. It discusses various framing approaches, including character-oriented and bit-oriented methods, as well as protocols like Stop-and-Wait ARQ, Go-Back-N ARQ, and Selective Repeat ARQ. Additionally, it highlights the importance of efficient data transmission and acknowledgment processes to prevent data loss and ensure reliable communication between nodes.

Uploaded by

webinar trainer
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 36

Computer Networks

UNIT II – Data Link


Layer
Lecture 11 – Data Link Control
01
Understanding
Data Link
Control
Understanding Data Link
Control
● It deals with the design and procedures for communication between two
nodes.

Framin
g

Functions Flow
Protoco of
Data Link Contro
ls Control
l
Error
Contro
l
Framing
● The size of the frame is
fixed.
● The length of frame acts as
● The method of packing bits into frames, the boundary.
so that each frame is distinguishable
from another. Fixed Size
Framing
● Framing separates a message from one
source to a destination by adding a

Framing
sender address and a destination
address.
● The whole message is not sent in one
frame because if any one bit is damaged
Variable Size
then the whole message must be resent Framing
which results inefficiency.
● The size of the each frame
● Instead, they are divided into smaller transmitted is different.
sub frames. ● Certain mechanisms are used to
mark the boundaries of frames
Framing Approaches
Character

Variable Size Framing


Oriented
Approach

Bit Oriented
Approach
Character Oriented
Approach


Also called as Byte Oriented Framing.
The data which is sent from sender to receiver is 8-bit characters.
● It was used normally only when the text was exchanged between data link layers.
● In character oriented approach, a 8-bit character is added to the beginning and end
of each frame.

Flag : A 8-bit character is added to the beginning and of each frame.


Header : Carries the source and destination address and other control
information.
Data : Contains data from network layer.
Trailer : Carries the error detection and error correction bits.
Character Oriented
Approach
● Problem
○ The flag also can be a part of the data.
○ When receiver detects the flag character in the middle of the data, it may
think that it has reached the frame.

To fix this problem we use byte stuffing or character stuffing


strategy is used.
Byte Stuffing
● It is a process of adding 1 special byte whenever there is a character with the
same pattern as the flag.
● This byte is called escape character (ESC)
● Whenever the receiver encounters the ESC it removes the data section and treats
the next character as the data.

ESC

Problem is it adds to much extra bytes to the data which increases


the frame size
Bit Oriented Approach
● The data section of a frame is a sequence of bits.
● A special 8-bit pattern is added to the beginning and end of the frame (i.e.)
01111110

● Problem
○ The 8-bit flag also can be a part of the data.
○ When receiver detects the flag character in the middle of the data,
it may think that it has reached the frame.
○ To resolve this we use bit stuffing technique.
Bit Stuffing
● If the 8-bit flag pattern is found in
the data, an extra 0 is added after
five 1’s to prevent the data looking
like flag.
● At the receiver's end, this extra bit is
removed.

● Example of bit stuffing


○ Original Bit sequence: 110101111101011111101011111110
○ Stuffed Bit sequence: 110101111110010111111010101111110110
02
Flow & Error
Control
Flow Control
● Flow control refers to a procedure used to restrict the amount of data that the
sender can send before waiting for acknowledgment.
● The flow of data from sender must not overload the receiver.
● If receiving device has a limited speed for processing and a limited amount of
memory to store incoming data.
● The receiving device must be able to inform the sending device before those limits
are reached.
● It must request that the transmitting device send fewer frames or stop temporarily.
● The rate of processing is often slow when compared with rate of transmission.
● So, each receiving device has a block of memory, called buffer reserved for
storing incoming data until they are processed.
● If the buffer begins to fill up, the receiver must be able to tell the sender to halt
transmission until it is able to receive.
Error Control
● Error control is both error detection and error correction.
● It allows the receiver to inform the sender of any frames lost or damaged in
transmission and coordinates the retransmission of those frames by the
sender.
● This process is called automatic repeat request (ARQ).
03
Protocols
Protocols
● In order to transfer the data from sender to receiver some protocols are used in data
link layer:
Error free channel in
which no frames are lost,
duplicated, or corrupted
Simplest Protocol

Noiseless
Channels
Stop-and-Wait

Protocols
Protocol

Stop-and-Wait Protocol
ARQ
Noisy Channels Go-Back-N ARQ
Error causing channel in
which frames are lost, Selective Repeat ARQ
duplicated, or corrupted
Simplest

Protocol
Needs no flow or error control because the receiver can handle any frame that is
sent with a less processing time.
● It is unidirectional (i.e.) data is sent only in one direction.
● Design
○ At sender, data link layer gets data from its network layer and makes a
frame and sends it.
○ Procedure at sender runs constantly and there is no action until request
received from the network layer.
○ At receiver, data link layer receives a frame from its physical layer, extracts
data and delivers the data to its network layer.
○ Procedure at receiver runs constantly and there is no action until notification
received from the physical layer.
● Algorithm
Simplest
Protocol
Flow Diagram

Design
Stop-and-Wait
Protocol
● If data frames arrive at the
receiver, faster than they can be
processed then there will be
overflow of data.
● To avoid this problem, this
protocol uses flow control
mechanism.
● The sender sends one frame,
stops until it receives confirmation
from the receiver , and then sends
the next frame.
● It is also unidirectional (i.e.) only
sender can send the data but
receiver can only send
acknowledgement.
Flow
Diagram
Stop-and-Wait Protocol -
Design
Stop-and-Wait Protocol -
Algorithm
Stop-and-Wait Protocol -
Algorithm
Stop-and-Wait ARQ
Protocol
● Problem with Stop-and-wait
○ Lost data and
acknowledgement frame.
■ Solution is to have timer. If
timer expires and there is no
ACK for the sent frame, the
frame is resent.

○ Data/Acknowledgement frame
out of order and duplicate
frame.
■ Solution is to have sequence
numbers.
Flow
Diagram
Because of this issue both sender (will wait for
acknowledgement) and receiver (will wait for the frame).
Stop-and-Wait ARQ
Protocol
● In Stop-and-wait ARQ, if the acknowledgement is not arrived after a certain
period of time, the sender times out and retransmits the original frame.

● Sequence Numbers
○ Sequence numbers are used to number the frames.
○ If x is a sequence number, then we need to use only x+1 after that.
○ If the frame arrives safely at the receiver, it sends an acknowledgment to the
sender, causing the sender to send the next frame numbered x + 1.
○ If the frame arrives safely at the receiver,it sends an acknowledgment, but
the acknowledgment is corrupted or lost.
○ Then, the sender re-sends the frame (numbered x) after the time-out.
○ If the frame is corrupted or never arrives at the receiver, the sender re-sends
the frame (numbered x) after the time-out.
○ Acknowledgment number is the sequence number of the next frame
expected (i.e.)If frame 0(x) is received by the receiver, then the receiver
sends ACK frame with acknowledgement 1(x+1).
Stop-and-Wait ARQ
Protocol


Design
The sending device keeps a
copy of the last frame
transmitted until it receives an
acknowledgment for that
frame.
● The sender has a control
variable(Sn) that holds the
sequence number for the next
frame to be sent.
● The receiver has a control
variable, (Rn) that holds the
number of the next frame
expected.
Stop-and-Wait ARQ
Protocol


S
Algorithm - Sender Side
Initially Sn =0
n

● If data arrives 0 1 0 1 0
Send data frame
○ Start Timer
○ Set the Sn to 1 Sn
○ If ACK arrives
Rn = Sn (Not corrupted) 0 1 0 1 0
Stop Timer
Else
Restart timberland previous
frame is resent
Rn
● Algorithm - Receiver Side
● Initially Rn =0 0 1 0 1 0
● If data arrives
○ Check if corrupted
If Sn=Rn then Rn
Deliver the data (Not Corrupted)
Set Rn to the next frame 0 1 0 1 0
Send acknowledgement frame
Stop-and-Wait ARQ
Protocol

Flow Diagram
Go-Back-N ARQ Protocol
● In Stop-and-wait ARQ, we can send only one
frame at a time.
● In Go-Back-N ARQ we can send several frames
before receiving acknowledgments.
● Also keeps a copy of these frames until the 0 00
acknowledgments arrive.
● Sequence Numbers 1 01
○ Frames from a sending station are numbered
sequentially. 2 10
○ The range of the sequence numbers ranges
from 0 to 2m-1 where m is the no of bits in 3 11
sequence number.
○ To determine the sender window size we use
2m.
○ For e.g.: m=2
○ Range = 0 to 22-1 (0 to 3)
○ 0,1,2,3,0,1,2,3,0,1,2,3,....
○ Sender window size = 22 = 4
Go-Back-N ARQ Protocol
Sender Receiver
● Sliding Window Frame
0 0
○ Sender can send multiple frames
Frame
before receiving an 1 1 0
acknowledgement for the first 2 Frame
2 1
frame. Frame
3 3 2
○ The frames are numbered in a
sequential manner. K0 AC
K1
AC
○ The no.of frames sent depends 0 Frame
0 K2
AC
on the window size of the
Frame
sender. 1 1

○ If the acknowledgement is not 2 Frame


2
received within a time period Frame
3 3
then, all frames in the current
window are retransmitted. 0 Frame
0

1 Frame
1

1 0 3 2 1 0 3 2 1 0
ACK not received by the sender and it times out.
Since frame 2 is not acknowledged all the frames from
Sender window size = frame 2 will be retransmitted (2,3,0,1)
4
Go-Back-N ARQ Protocol

Design
Selective Repeat ARQ
Protocol
● In Go-Back-N ARQ, if one frame is damaged then all the other frames
following that must also be resent.
● This resending uses up the bandwidth and slows down the transmission.
● To resolve this issue, instead of sending N-frames it just sends one frame
which is damaged. This mechanism is called Selective Repeat ARQ.
● The receiver will keep track of sequence numbers and sends
NACK(Negative Acknowledgement) for only the frame which is missing or
damaged.
● The sender will resend the frame for which NACK is received.
Sequence Numbers
○ Frames from a sending station are numbered sequentially.
○ The range of the sequence numbers ranges from 0 to 2m-1 where m is
the no of bits in sequence number.
○ To determine the sender window size we use 2m.
○ For e.g.: m=2
○ Range = 0 to 22-1 (0 to 3)
○ 0,1,2,3,0,1,2,3,0,1,2,3,....
○ Sender window size = 22 = 4
Selective Repeat ARQ
Protocol
Sender Receiver
● Sliding Window Frame
0 0
○ Sender can send multiple frames
Frame
before receiving an 1 1 0
acknowledgement for the first 2 Frame
2 1
frame. Frame
3 3 2
○ The frames are numbered in a
sequential manner. K0 AC
K1 3
AC 2
○ The no.of frames sent depends 0 Frame
0 NA
CK

on the window size of the 1 0


sender. Frame
1
○ If the acknowledgement is not 1
3
K
received within a time period Frame
2(Rese AC
2 n t)
then, only the frame which have
given NACK alone is 2
2 2
retransmitted. A CK

3
1 0 3 2 1 0 3 2 1 0
ACK not received by the sender and it times out.
Since frame 2 is not acknowledged only frame 2 is
Sender window size = resent
4
Selective Repeat ARQ
Protocol

Design
Selective Repeat ARQ
Protocol

Flow Diagram
Piggybacking
● It is used to improve the efficiency
of the bidirectional protocols.
● When a frame is carrying data
from A to B, it can also carry
control information about arrived
(or lost) frames from B.
● Similarly, when a frame is
carrying data from B to A, it can
also carry control information
about the arrived (or lost) frames
from A.
● Better use of available channel
bandwidth.
● The acknowledgement frame needs
not to be sent separately.
● Cost reduction
Query Time?
Next
C la s
HDL
C
s

You might also like