0% found this document useful (0 votes)
15 views40 pages

CN CDT14

The document discusses elementary data link protocols, focusing on their functions, requirements, and various types such as Unrestricted Simplex Protocol, Simplex Stop-and-Wait Protocol, and protocols for noisy channels. It explains the mechanisms for error detection, frame acknowledgment, and retransmission, as well as advanced techniques like sliding window protocols and piggybacking for improved efficiency. The document also contrasts Go-Back-N and Selective Repeat protocols, highlighting their operational differences and efficiencies in handling transmission errors.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views40 pages

CN CDT14

The document discusses elementary data link protocols, focusing on their functions, requirements, and various types such as Unrestricted Simplex Protocol, Simplex Stop-and-Wait Protocol, and protocols for noisy channels. It explains the mechanisms for error detection, frame acknowledgment, and retransmission, as well as advanced techniques like sliding window protocols and piggybacking for improved efficiency. The document also contrasts Go-Back-N and Selective Repeat protocols, highlighting their operational differences and efficiencies in handling transmission errors.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

U18CS503 Computer Networks

Classroom Discussion Topic


W5 – L1-CDT13
Topic: Elementary data link protocols

Dr. Syed Abdul Moeed


Dept of CSE
Kakatiya Institute of Technology and Science, Warangal, TS, India
FUNCTIONS AND REQUIREMENTS OF THE DATA LINK PROTOCOLS
• The basic function of the layer is to transmit frames over a
physical communication link.
• Transmission may be half duplex or full duplex. To ensure that
frames are delivered free of errors to the destination station.
• The protocol (control mechanism) should be capable of
performing:
• The identification of a frame (i.e. recognize the first and last bits
of a frame).
• The transmission of frames of any length up to a given
maximum size.
• The detection of transmission errors.
• The retransmission of frames which were damaged by errors.
• The assurance that no frames were lost.
• Some mechanism must be used for preventing conflicts caused
by simultaneous transmission by many stations.
• The detection of failure or abnormal situations for control and
60
monitoring purposes.
ELEMENTARY DATA LINK PROTOCOLS
• Protocols in the data link layer are designed so that this layer
can perform its basic functions: framing, error control and
flow control.
• The protocols are normally implemented in software by using
one of the common programming languages.
• An Unrestricted Simplex Protocol
• A Simplex Stop-and-Wait Protocol
• A Simplex Protocol for a Noisy Channel

3
AN UNRESTRICTED SIMPLEX PROTOCOL
 In this protocol: Data transmitted in one direction only
 The transmitting (Tx) and receiving (Rx) hosts are always ready
 Processing time can be ignored
 Infinite buffer space is available
 No errors occur; i.e. no damaged frames and no lost frames
(perfect channel)

4
A SIMPLEX STOP-AND-WAIT PROTOCOL
• Data are transmitted in one direction only
• No errors occur, and the sender can only process the received
information at a finite speed. (These assumptions imply that
the transmitter cannot send frames at a rate faster than the
receiver can process them.)
• The problem here is how to prevent the sender from flooding
the receiver.
• A general solution to this problem is to have the receiver
provide some sort of feedback(ACK) to the sender. The
process could be as follows: The receiver send an
acknowledge frame back to the sender telling the sender that
the last received frame has been processed and passed to the
host; permission to send the next frame is granted. The
sender, after having sent a frame, must wait for the
acknowledge frame from the receiver before sending another
5

frame.
STOP & WAIT PROTOCOL
The sender sends one frame and waits for feedback from the
receiver. When the ACK arrives, the sender sends the next
frame

6
A SIMPLEX PROTOCOL FOR A NOISY CHANNEL
 In this protocol the Frames may be either damaged or lost completely.
 We assume that transmission errors in the frame are detected.
 One suggestion is that the sender would send a frame, the receiver would
send an ACK frame only if the frame is received correctly.
 If the frame is in error the receiver simply ignores it; the transmitter
would time out and would retransmit it.
 One problem here is that if the ACK frame is lost or damaged, duplicate
frames are accepted at the receiver without the receiver knowing it.

7
 If the receiver has just sent an ACK frame back to the sender.
 However, the ACK frame gets lost completely, the sender times
out and retransmits the frame.
 There is no way for the receiver to tell whether this frame is a
retransmitted frame or a new frame, so the receiver accepts this
duplicate. The protocol thus fails in this aspect.
STOP-AND-WAIT, LOST FRAME STOP-AND-WAIT, LOST ACK FRAME

66
 To overcome this problem it is required that the receiver be
able to separate a frame that it is seeing for the first time
from a retransmission.
 One way to achieve this is to have the sender put a sequence
number in the header of each frame it sends.
 The receiver then can check the sequence number of each
arriving frame to see if it is a new frame or a duplicate to be
discarded.

 The receiver needs to distinguish only 2 possibilities: a new


frame or a duplicate; a 1-bit sequence number is sufficient.

67
FLOW DIAGRAM OF A STOP & WAIT PROTOCOL

68
SLIDING WINDOW PROTOCOLS

13
DATA FRAME TRANSMISSION

 Unidirectional assumption in previous elementary


protocols
 Not general

 Full-duplex - approach 1
 Two separate communication channels(physical circuits)
 Forward channel for data
 Reverse channel for acknowledgement

 Problems: 1. reverse channel bandwidth wasted


2. cost
14
DATA FRAME TRANSMISSION
 Full-duplex - approach 2
 Same circuit for both
directions
 Data and acknowledgement
are intermixed
 How do we tell
acknowledgement from
data?
 "kind" field in the header
telling data or
acknowledgement
•Although interleaving data and control frames
on the same link is a big improvement over
having two separate physical links
 Approach 3
 Attaching acknowledgement to outgoing
data frames 72

PIGGYBACKING
 Temporarily delaying transmission of outgoing
acknowledgement so that they can be hooked onto the
next outgoing data frame
 Advantage: higher channel bandwidth utilization
 Complication:
 How long to wait for a packet to piggyback?
 If longer than sender timeout period then sender retransmits
 Purpose of acknowledgement is lost
 Solution for timing complexion
 If a new packet arrives quickly
 Piggybacking
73
 If no new packet arrives after a receiver ack timeout
 Sending a separate acknowledgement frame
SLIDING WINDOW PROTOCOLS
 The next three protocols are bidirectional protocols that belong to a
class called sliding window protocols. (max sending window size,
receiving window size)
 One-bit sliding window protocol (1, 1)
 Go back N (>1, 1)
 Selective repeat (>1, >1)
 The three differ among themselves in terms of efficiency,
complexity, and buffer requirements.
 Each outbound frame contains an n-bit sequence number
 Range: 0 - MAX_SEQ (MAX_SEQ = 2n - 1)
 For stop-and-wait, n = 1 restricting the sequence numbers to 0 74

and 1 only
SENDING & RECEIVING WINDOWS
 At any instance of time
 Sender maintains a set of sequence numbers of frames permitted to
send
 These frames fall within sending window

 Receiver maintains a set of sequence numbers of frames permitted


to accept
 These frames fall within receiving window

 Lower limit, upper limit, and size of two windows need not be the
same - Fixed or variable size
 Senders Window contains frames can be sent or have been sent but
not yet acknowledged – outstanding frames
 When a packet arrives from network layer
 Next highest sequence number assigned
 Upper edge of window advanced by 1
75
 When an acknowledgement arrives
 Lower edge of window advanced by 1
 If the maximum window size is n, the sender needs n buffers to hold the
unacknowledged frames. If the window ever grows to its maximum
size, the sending data link layer must forcibly shut off the network layer
until another buffer becomes free.

 The receiving data link layer's window corresponds to the frames it may
accept. Any frame falling outside the window is discarded without
comment. When a frame whose sequence number is equal to the lower
edge of the window is received, it is passed to the network layer, an
acknowledgement is generated, and the window is rotated by one.

 Unlike the sender's window, the receiver's window always remains at its
initial size.
76
SENDER SLIDING WINDOW
• At the sending site, to hold
the outstanding frames until
they are acknowledged, we
use the concept of a
window.

• The size of the window is


at most 2m -1 where m is
the number of bits for the
sequence number.

• Size of the window can be


variable, e.g. TCP.

• The window slides to


include new unsent frames
77
when the correct ACKs are
received
RECEIVER SLIDING WINDOW
• Size of the window at
the receiving site is
always 1 in this
protocol.
• Receiver is always
looking for a specific
frame to arrive in a
specific order.
• Any frame arriving out
of order is discarded
and needs to be
resent.
• Receiver window slides
as shown in fig.
• Receiver is waiting for 78

frame 0 in part a.
CONTROL VARIABLES
• Sender has 3 variables: S, SF, and SL
• S holds the sequence number of recently sent frame
• SF holds the sequence number of the first frame
• SL holds the sequence number of the last frame
• Receiver only has the one variable, R, that holds the
sequence number of the frame it expects to receive. If the
seq. no. is the same as the value of R, the frame is
accepted, otherwise rejected.

79
80
A ONE BIT SLIDING WINDOW PROTOCOL

Initially, no frames are outstanding, so the lower and upper edges of the
sender’s window are equal, but as time goes on, the situation progresses as
shown. Unlike the sender’s window, the receiver’s window always remains at
its initial size, rotating as the next frame is accepted and delivered to the
network layer.
A sliding window of size 1, with a 3-bit sequence number.
(a) Initially.
81
(b) After the first frame has been sent.
(c) After the first frame has been received.
(d) After the first acknowledgement has been received.
A ONE BIT SLIDING WINDOW PROTOCOL

(a) Case 1: Normal case. (b) Case 7: Abnormal case.


The notation is (seq, ack, packet number). An asterisk indicates 82
where a network layer accepts a packet.
ONE BIT SLIDING WINDOW PROTOCOL

 Case 1: no error  Case 2: data lost


A B
A B
Time (0,1,A0) Exp=0 Time Exp=0 (0,1,A0) Exp=0
Exp=0

83
X
* Timeout
(0,0,B0) Exp=1

* (1,0,A1)
Exp=1 (0,1,A0)
*
(1,1,B1) Exp=0 *
(0,0,B0) Exp=1
* (0,1,A2)
Exp=0 *
Exp=1
*
(0,0,B2) Exp=1

*
ONE BIT SLIDING WINDOW PROTOCOL

 Case 3: data error  Case 4: ack. lost


A B A B
Time Exp=0 Exp=0 Time Exp=0 Exp=0
(0,1,A0) (0,1,A0)

84
Timeout Error Timeout (0,0,B0) *
Exp=1
X

(0,1,A0) (0,1,A0)

* duplicate,
(0,0,B0) Exp=1 (0,0,B0)
discarded

* *
Exp=1 Exp=1
ONE BIT SLIDING WINDOW PROTOCOL

 Case 5: early timeout  Case 6: outgoing


A B frame timeout
Time Exp=0 Exp=0 Time
(0,1,A0)
A B

85
Timeout * Exp=0 (0,1,A0) Exp=0
(0,0,B0) Exp=1
*
(0,1,A0) Exp=1
*
Exp=1 (1,0,A1) duplicate, ACK 0 Timeout
discarded
*
Exp=0 (1,1,A1)
(1,1,B1)

* *
Exp=0 (0,1,B0) Exp=0

*
Exp= 1
Performance of Stop-and-Wait Protocol
• In stop-and-wait, at any point in time, there is only one frame
that is sent and waiting to be acknowledged.
• This is not a good use of transmission medium.
• To improve efficiency, multiple frames should be in transition
while waiting for ACK.
 Solution:
 Allowing w frames sent before blocking
 Problem: errors
 Solutions

Acknowledge n means frames n, n-1, n-2,… are 87


acknowledged (i.e., received correctly)
GO BACK N PROTOCOL
 Improves efficiency of Stop and Wait by not waiting
 Keep Channel busy by continuing to send frames
 Allow a window of upto Ws outstanding frames
 Use m-bit sequence numbering
 Receiver discards all subsequent frames following an
error one, and send no acknowledgement for those
discarded
 Receiving window size = 1 (i.e., frames must be accepted
in the order they were sent)
 Sending window might get full
If so, re-transmitting unacknowledged frames
 Wasting a lot of bandwidth if error rate is high
GO BACK N PROTOCOL

89

Frames 0 and 1 are correctly received and acknowledged. Frame


2, however, is damaged or lost. The sender, unaware of this
problem, continues to send frames until the timer for frame 2
expires. Then it backs up to frame 2 and starts all over with it,
sending 2, 3, 4, etc. all over again.
GO-BACK-N ARQ WITH WINDOW=4

90
SELECT REPEAT PROTOCOL
 Receiver stores correct frames following the bad one
 Sender retransmits the bad one after noticing

 Receiver passes data to network layer and acknowledge with


the highest number
 Receiving window > 1 (i.e., any frame within the window may
be accepted and buffered until all the preceding one passed to
the network layer. Might need large memory
 ACK for frame n implicitly acknowledges all frames ≤ n

 SRP is often combined with NAK

 When error is suspected by receiver, receiver request


retransmission of a frame
 Arrival of a damaged frame
 Arrival of a frame other than the expected

 NAKs stimulate retransmission before the corresponding timer 92


expires and thus improve performance.
SELECTIVE REPEAT WITH NAK
SELECTIVE REPEAT ARQ, SENDER AND RECEIVER WINDOWS.

• Go-Back-N ARQ simplifies the process at the receiver site. Receiver


only keeps track of only one variable, and there is no need to buffer
out-of-order frames, they are simply discarded.
• However, Go-Back-N ARQ protocol is inefficient for noisy link. It
bandwidth
inefficient and slows down the transmission.
• In Selective Repeat ARQ, only the damaged frame is resent. More
bandwidth efficient but more complex processing at receiver.
• It defines a negative ACK (NAK) to report the sequence number of a
damaged frame before the timer expires.
SELECTIVE REPEAT IN ACTION

95
SELECTIVE REPEAT ARQ, LOST FRAME
• Frames 0 and 1
are accepted when
received because
they are in the
range specified by
the receiver
window. Same for
frame 3.

• Receiver sends a
NAK2 to show
that frame 2 has
not been received
and then sender
resends only
frame 2 and it is
accepted as it is in
the range of the
window.
SELECTIVE REPEAT
DILEMMA
 Example:
 seq #’s: 0, 1, 2, 3
 window size=3
 receiver sees no
difference in two
scenarios!
 incorrectly passes
duplicate data as new in
(a)
 Q: what relationship
between seq # size and
window size?
97
SELECTIVE REPEAT ARQ, SENDER WINDOW SIZE
• Size of the sender and receiver windows must be at most one-half of 2 m.
• If m = 2, window size should be 2 m /2 = 2. Fig compares a window size of 2
with a window size of 3. Window size is 3 and all ACKs are lost, sender sends
duplicate of frame 0, window of the receiver expect to receive frame 0 (part of
the window), so accepts frame 0, as the 1st frame of the next cycle – an error.
SELECT REPEAT PROTOCOL - WINDOW SIZE
 Problem is caused by new and old windows overlapped
 Solution

99
 Window size=(MAX_SEQ+1)/2
 E.g., if 4-bit window is used, MAX_SEQ = 15
 window size = (15+1)/2 = 8
 Number of buffers needed
= window size
SELECT REPEAT PROTOCOL

00
(a) Initial situation with a window size seven.
(b) After seven frames sent and received, but not acknowledged.
(c) Initial situation with a window size of four.
(d) After four frames sent and received, but not acknowledged.
ACKNOWLEDGEMENT TIMER
 Problem
 If the reverse traffic is light, effect?
 If there is no reverse traffic, effect?

 Solution
 Acknowledgement timer:
If no reverse traffic before timeout
send separate acknowledgement
 Essential: ack timeout < data frame timeout Why?

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy