Lecture 11
Lecture 11
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
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.
ESC
● 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.
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
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
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