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

Data Link Control 2

The document outlines the design issues and services provided by the data link layer in computer networking, including framing, error control, flow control, and link management. It describes different service types such as unacknowledged connectionless, acknowledged connectionless, and connection-oriented services, along with mechanisms for error detection and correction. Additionally, it details protocols like Stop and Wait ARQ for reliable data transmission and the importance of managing frame boundaries through various framing methods.

Uploaded by

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

Data Link Control 2

The document outlines the design issues and services provided by the data link layer in computer networking, including framing, error control, flow control, and link management. It describes different service types such as unacknowledged connectionless, acknowledged connectionless, and connection-oriented services, along with mechanisms for error detection and correction. Additionally, it details protocols like Stop and Wait ARQ for reliable data transmission and the importance of managing frame boundaries through various framing methods.

Uploaded by

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

Computer Networking Principles

CSC 225

Data Link Control-Design Issues


Design Issues
a) Providing well defined service interface to the network
layer
b) Framing: Determining how bits are grouped into frames
c) Error control: Detection and correction of transmission
errors
d) Flow control
e) Link Management
Design Issues
• To accomplish these goals, the data link layer takes the
packets it gets from the network layer and encapsulates
them into frames for transmission.
• Each frame contains a:
▪ Frame header
▪ Payload field for holding the packet
▪ Frame trailer.
Design Issues

Relationship between packets and frames


(a) Services provided to the
network layer
• The data link layer can be designed to offer various
services. These can vary from system to system.
• Unacknowledged connectionless service
• Acknowledged connectionless service
• Connection oriented service
(a) Services provided to the
network layer
Unacknowledged connectionless service

• Unacknowledged connectionless service consists of having


the source machine send independent frames to the
destination machine without having the destination
machine acknowledge them
• No connection is established before hand or released
afterwards
• If a frame is lost due to noise on the line, no attempt is
made to detect the loss or recover from it in the data link
layer.
(a)Services provided to the
network layer

Unacknowledged connectionless service

• It is appropriate where error rate is low e.g. LAN


• It is also appropriate for real time traffic e.g. Speech where
late data is worse than bad data.
• Most LANs use unacknowledged connectionless service in
the data link layer.
(a)Services provided to the
network layer

Acknowledged connectionless service


• No connections are used
• Each frame sent is individually acknowledged. Sender
knows whether or not a frame has arrived safely
• If it has not arrived within a specified time interval, it
can be sent again
• This service is useful over unreliable channels such as
wireless systems
(a)Services provided to the
network layer
Connection oriented service
• Source and destination machines establish a connection
before any data are transferred
• Each frame sent over the connection is numbered and
the data link layer guarantees that each frame sent is
indeed received
• It guarantees that each frame is received exactly once
and that all frames are received in the right order.
• Provides network layer with reliable bit stream
(a)Services provided to the
network layer
Three phases in connection oriented service
• Phase I: Connection is established by having both sides
initialize variables and counters needed to keep track of
frames which have been received and which ones have not.
• Phase II: Frames (one or more) are transmitted
• Phase III: Connection is released freeing up the variables,
buffers and other resources used to maintain the
connection
(a)Services provided to the
network layer
• The primitives used for communication between
network layer and data link layer

▪ Request: used by network layer to ask data link layer


to do something e.g. establish a connection, send a
frame.
▪ Confirm: Provide a way for the Network layer on the
requesting side to learn whether the request was
successfully carried out and if not why not
(a)Services provided to the
network layer
• The primitives used for communication between
network layer and data link layer

▪ Indication: Used to indicate to the network layer that


an event has happened e.g. a machine wishes to
establish or release a connection, or a frame has
arrived.
▪ Response: Used by network layer on receiving side
to reply to a previous indication.
a) Services provided to the network
layer

• Typical WAN subnet with routers connected by point-to-


point lines
▪ When a frame arrives at a router, the hardware checks it
for errors
▪ The data link layers checks to see if the frame is
expected, and if so gives the packet to the routing
software
▪ The routing software chooses the appropriate outgoing
line and passes the packet down to data link layer for
transmission
a) Services provided to the network
layer

Placement of the data link protocol


b) Framing
• Physical layer accepts a raw bit stream and attempts to
deliver it to the destination.
• This bit stream is not guaranteed to be error free.
• The number of bits received may be less than, equal to or
greater than the number of bits transmitted and may have
different values.
• It is up to the data link layer to detect and if necessary
correct the errors.
b) Framing
• Data link layer breaks the stream up into discrete frames
and computes the checksum for each frame.
• When a frame arrives at the destination, the checksum is
recomputed
• If the newly computed checksum is different from the one
contained in the frame, the data link layer knows that the
error has occurred and takes the steps to deal with it.
b) Framing
Framing methods
• Character count
• Start and end character with character stuffing
• Start and End flags with bit stuffing
b) Framing
Character count:
• A field in the header specifies the number of characters in
the frame

• Limitations: Character count can be garbled by


transmission errors causing destination to get out of synch
and be unable to locate the start of the next frame.
b) Framing

Character stream (a) without errors (b) with one error


b) Framing
Start and End character, with character stuffing
• Each frame starts with an ASCII character sequence( e.g.
DLE STX) and ends with the sequence (e.g. DLE ETX)
• If a destination looses track of frame boundaries, all it has
to do is look for the character sequence (e.g. DLE STX or
DLE ETX)
• If the start and end characters occurs in the data, the data
link layer inserts an additional character just before each
accidental start and end character. Example
• Inserts an ASCII DLE character just before each
accidental DLE character.
▪ DLE’s in data are always doubled.
▪ Problem: Closely tied to to the 8-bit characters in general
and the ASCII character code in particular.
b) Framing

(a) A frame delimited by flag bytes (b) Examples of byte


stuffung
b) Framing
Start and End flags, with bit stuffing
• Data frames can contain an arbitrary number of bits.
Allows character codes with an arbitrary number of bits
per character.
• Each frame begins and ends with a special bit pattern
namely: 01111110
• When data link layer encounters five consecutive 1’s In
data, it automatically stuffs in a 0 in the outgoing bit
stream (bit stuffing)
b) Framing
Start and End flags, with bit stuffing
• When the receiver sees five consecutive incoming 1 bits
followed by a 0 bit, it automatically destuffs (deletes) the 0
bit
• Character stuffing and bit stuffing are completely
transparent to the network layers in both computers
b) Framing

Bit stuffing: (a) the original data (b) Data on the line ©
data in the receiver’s memory
b) Framing
Adv:
• The boundary between two frames can be unambiguously
recognized by the flag pattern.
• If the receiver looses track of where it is, all it has to do is
to scan the input for flag sequence, since they can only
occur at frame boundaries and never within data
• Many data link layer protocols use: character count with
one of the other methods.
• When a frame arrives the count field is used to locate the
end of the frame. Only if the appropriate delimeter is
present at that position and the checksum is correct, is the
frame accepted as valid.
Framing
Questions from Chapter 3: Computer networks by Andrew
Tanenbaum
• Q1
• Q2
• Q3
• Q4: One of your classmates has pointed out that it is
wasteful to end each frame with a flag byte and then
begin the next one with a second flag byte. One flag
byte could do the job as well and a byte saved is a byte
earned. Do you agree?
• Q5
c) Error control
• Acknowledgements
• Timers
• Sequence numbers
c) Error control
• The usual way to ensure reliable delivery is to provide
sender with some feedback about what is happening on the
other end of the line.
• This is especially so for connection oriented service.
• The receiver sends back to the sender a special control frame
bearing positive or negative acknowledgement about the
incoming frames.
c)Error control
• Positive acknowledgement about a frame informs the
sender that the frame arrived safely
• A negative acknowledgement means that something has
gone wrong and the frame must be transmitted again
c)Error control
• Timers are introduced into the data link layer to deal with
the possibility of lost frames.
• Lost frames may lead to a sender hanging forever
waiting for a positive or negative acknowledgement
• The timer is set to go off after an interval long enough for
the frame to reach the destination, be processed there and
have the acknowledgement propagate back to the sender.
c)Error control
• Normally the frame will be correctly received and the
acknowledgement will get back before the timer runs out
in which case it will be cancelled.
• If either the frame or acknowledgement is lost, the timer
will go off, alerting the sender to a potential problem.
• The sender retransmits the frame.
c)Error control
• Retransmission of frames may lead to multiple deliveries
of a frame to the network layer.
• To avoid this, sequence numbers are generally assigned to
outgoing frames so that the receiver can distinguish
retransmissions from originals.
• Duties of data link layer ensure that each frame is
ultimately passed to the network layer at the destination,
exactly once, no more and no less.
d) Flow Control

• Flow control deals with the issue of a sender that


transmits frames faster than the receiver can accept them.
• Flow control is introduced to keep the sender from
sending no faster than the receiver can handle the traffic
d)Flow Control

• It requires some kind of feedback mechanisms so that the


sender can be made aware of whether or not the receiver is
able to keep up
• Rules prohibit frames from being sent until the receiver
has granted permission either implicitly or explicitly
e) Link management
• Data link layer is to manage the administration of the link
• With connectionless service the administration is minimal.
• With connection oriented service, the administration is
complex.
e) Link management
• Connection must be established and released. Sequence
numbers must be initialized and possibly de initialized in
the face of errors
e) Link management
• Configuration of link
▪ Primaries and secondaries: Primary sends a short frame (poll) to
the first secondary asking if it has any data to send. If so the
terminal sends data, otherwise primary polls the next secondary. In
other systems terminals are allowed to send data to the computer
even in the absence of a poll.
▪ In others (e.g. LANS) there are no primaries and secondaries. All
stations are equals and have same access rights.
Questions
Computer Networking Principles
CSC 225

Data Link Control Protocols


Data Link Control Protocols
Error control refers to mechanisms to detect and correct
errors that occur in the transmission of frames.
• Two types of errors are possible:
▪ Lost frame: A frame fails to arrive on the other side e.g. due to a
noise burst. The receiver may not be aware that a frame has been
transmitted
▪ Damaged frame: A recognizable frame does arrive, but some bits
are in error (receiver hardware detects damage when it computes
checksum).
Data Link Control Protocols
Mechanisms used for error control:
▪ Error detection
▪ Positive acknowledgement
▪ Retransmission after timeout
▪ Negative acknowledgement and retransmission
Data Link Control Protocols
• Typically the receiving computer checks the received
frame for possible transmission errors and then returns a
short control message (frame) either to acknowledge its
correct receipt or to request that another copy of the frame
is sent.
Data Link Control Protocols
• Collectively these error control mechanisms are referred to
as automatic repeat request (ARQ). The effect of ARQ is
to turn an unreliable data link into a reliable one. The
following are three versions of ARQ
▪ Stop and wait ARQ
▪ GO Back N ARQ
▪ Selective Repeat ARQ
Stop and Wait Protocols
Unrestricted simplex protocol
Simplex stop and wait protocol
A simplex protocol for a noisy channel

Positive acknowledgement with retransmission


A simplex protocol for a noisy channel

Positive acknowledgement with retransmission


Stop and Wait Protocols

• The stop and wait protocol operates in a half duplex mode.


• The primary sends a frame and starts a timer. After sending a
frame, must wait until it receives a response (ACK) from the
secondary as to whether the frame was correctly received or not.
• The primary then either sends the next frame, if the previous frame
was correctly received, or retransmits a copy of the previous frame
if it was not.
• No other data frames can be sent until the destination station’s
reply arrives at the source station or fails to arrive.
• Must maintain a copy of the transmitted frame until an ACK is
received from that frame
Stop and Wait Protocols

• Each frame has a one bit sequence number in the header.


• The sender can have only one frame outstanding (waiting for an
ACK/unacknowledged) at a time.
• Timeout is required to be long enough to prevent premature timeouts.
▪ The time interval must be chosen to allow enough time for the
frame to get to the receiver, for the receiver to process it in the
worst case and for the acknowledgement to propagate back to
sender.
▪ The timeout interval must be long enough to avoid an ACK frame
being received after another copy of the previous frame has been
retransmitted.
▪ Collectively, the two frames :Information-Frame and ACK frame are
known as the protocol data units (PDUs) of the stop and wait
protocol.
Stop and Wait Protocols
• Assumptions:
▪ Frames may be lost
▪ Frames may be damaged
• How to sender and receiver respond to
▪ Lost frame, Lost Ack
▪ Damaged frame, Damaged Ack
▪ Valid frame, Valid Ack
Stop and Wait Protocols

• Receiver:
• Valid Frame:
• When a valid frame (error free frame) arrives at the receiver, its
sequence number is checked to see if it is a duplicate.
• If it is a duplicate it is discarded.
• If it is not, it is passed to the network layer, the expected
sequence number is incremented modulo 2 and
• In either case, the receiver returns an ACK frame.
• Damaged frame
• If a frame with error is received at the destination, the frame is
discarded
Stop and Wait Protocols
• Sender
• Valid Ack
• On receipt of a valid (error free ) ACK frame, sender transmits
another frame. Sequence number is incremented prior to this.
• Damaged Ack
• If damaged ACK frame is received by the sender, the frame is
discarded.
• The sending station will time out and resend the same frame
• Lost Ack
• If no ACK frame arrives at all, after a while the sender will time out
and send the frame again. The process will be repeated again until the
frame finally arrives intact.
Stop and Wait Protocols
• Sender
• Damaged frame
• Source waits for an ACK. If no ACK is received by the time the timer
expires, the same frame is sent again

Stop and Wait Protocols
• Adv
• Simple
• Disadv:
• Low Link Utilization:
Stop and Wait Protocols
• Flow control
▪ In stop and wait protocol, flow of frames across the
link is automatically tightly controlled’.
▪ This is because after a frame is transmitted by a sender,
it must wait until an acknowledgment is returned by the
receiver before transmitting the next frame.
Sliding window protocols
Sliding window protocols
• With sliding window protocols link utilization is much
improved at the expense of increased buffer storage
requirements.
• Full duplex transmission is required is required for its
implementation.
Sliding window protocols
• Sender:
• The sender maintains a sending window. At any instant in time, the sender
maintains a list of consecutive sequence numbers corresponding to frames
it is allowed to send. The frames are said to fall within the sending
window.
• The sender is allowed to transmit a series of frames (within the window)
without waiting for an acknowledgement.
• Therefore a number of unacknowledged frames may be outstanding at
any time.
• The number of outstanding unacknowledged frames is determined by
the sending window size.
• Since the frames currently within the sender’s window may ultimately be
lost or damaged in transit the sender must keep all frames in memory for
possible retransmission.
Sliding window protocols
• Receiver:
• The receiver similarly maintains a receiving window corresponding to the number
of consecutive frames it is able to accept.
• Any incoming frame falling outside the receiving window is discarded.
• Note: In all cases, corrupted frames are discarded and retransmission requests
are triggered only after the next error free frame is received.
• Each frame arriving at the receiver that falls within the receiver’s window is
acknowledged.
• An ACK frame contains the ID of the frame which it acknowledges.
• The receiver must be able to receive frames equal to the maximum receive
window size beyond the one it has last acknowledged.
• Note: The sender’s window and the receiver’s window need not have the
lower and upper limits or even the same size.
• A frame that falls within the receiver’s window may be:
• In sequence or
• Out of sequence
Sliding window protocols
• Receiver:
• On receipt of the next in-sequence frame, the receiver delivers the
packet to the network layer and acknowledges the frame.
• As the receiver acknowledges frames, it advances its receive
window to enable it receive new frames.
Sliding window protocols
• Receiver:
• On receipt of an out of sequence frame one of the two
retransmission strategies may be followed.
• Receiver detects the receipt of an out-of-sequence frame and
requests the sender to retransmit all outstanding
unacknowledged frames from the last correctly received, and
hence acknowledged, frame- go back-N
• Receiver detects and requests the retransmission of just those
frames in the sequence that are corrupted – selective repeat.
Meanwhile out of sequence frames will be buffered until the
next in sequence frame is received.
Sliding window protocols
• Sender
• As an acknowledgement arrives, the sender discards the buffered
frame that has been acknowledged.
• An acknowledgement for a frame whose sequence number is equal
to the lower edge of the window causes the window’s lower edge
to be advanced by one contracting the window.
• As the sending window contracts, the sender may open its window
to permit the sending of new frames subject to ensuring that the
number of outstanding unacknowledged frames must not exceed
the sending window size.
• An acknowledgement implicitly announces the receiver’s ability to
receive another frame.
Sliding window protocols
• Adv:
▪ Give the data link layer more freedom about the order
in which it may send and receive frames.
▪ Increases link utilization
A protocol using go back N
A protocol using go back N
• Sender (Assume a window size of n bits)
• The sender maintains a send window of Maxseq (or 2n-1).
• The sender is allowed to transmit up to a maximum of Maxseq
frames (not maxseq + 1 or 2n) without waiting for an
acknowledgement.
• A timer is started for each frame sent
• Since frames currently within the sender’s window may ultimately
be lost or damaged in transit , the sender must keep all these
frames in its memory for possible retransmission
A protocol using go back N
• Receiver:
• The receiver has a receive window of 1
• The receiver accepts frames in order.
• Valid frame:
• When an expected frame is received, it is passed to the network layer,
an acknowledgement is generated and the receive window is
advanced.
A protocol using go back N
• Sender:
• The sender discards acknowledged frames
• The lower edge of the send window is advanced appropriately.
• The sender may open its window to permit the sending of new
frames subject to ensuring that the number of outstanding
unacknowledged frames must not exceed the sending window
size.
• As each new packet is transmitted, it is given the next highest
sequence number, and the upper edge of the window is advanced
by 1.
A protocol using go back N
• Assumptions:
▪ Frames may arrive out of sequence/order
▪ Frames may be lost
▪ Frames may be damaged
▪ NACK or ACK may be lost
▪ NACK or ACK may be damaged
• How to sender and receiver respond to
▪ Out of sequence frame
▪ Lost frame, Lost Ack/Nack
▪ Damaged frame, Damaged Ack/Nack
▪ Valid frame, Valid Ack
A protocol using go back N
• The basic approach for dealing with an error (including an out of sequence error) in the
presence of a long stream of frames sent.
• Receiver:
▪ Damaged frame
▪ When a damaged frame is received it is simply discarded and no further action
is taken as a result of that frame.
▪ Out of sequence frame (implies Lost frame, )
▪ When the receiver detects an out-of sequence frame (due to lost frames(s)), it
is discards the frame. It may send a NAK for that frame.
▪ Frames following an error are discarded ( until the frame in error is
correctly received).
▪ This means that the receiver has a receive window of 1.
▪ The receiver informs the sender to start to retransmit frames from a specified
frame number. It does this by returning a special negative acknowledgment
frame ( NAK) known as reject.
A protocol using go back N
• The basic approach for dealing with an error (including an out of sequence
error) in the presence of a long stream of frames sent.
• Receiver:
▪ Out of sequence frame
• One way the receiver can deal with out of sequence frames is to send
a NAK frame informing the sender to go back and start retransmitting
from the frame whose number is included in the NAK frame (The one
following the last one acknowledged).
• Another way is take no further action as a result of that frame. The
sender will time out and retransmit all unacknowledged frames in
order starting with the lost one (or damaged one).
A protocol using go back N
• The basic approach for dealing with an error (including an out of sequence error) in the
presence of a long stream of frames sent.
• Sender:
• Valid NACK
• When a NAK frame arrives for frame N ,the sender retransmits all
unacknowledged frames (starting from N).
• Damaged ACK or NACK
• When a NACK or ACK frame is damaged, it is ignored.
• Ultimately the corresponding timer will expire and the frame will be
transmitted (and all subsequent frames).
• The sender may receive acknowledgement for subsequent frames before timer
expires. When an acknowledgement (ACK) frame arrives for frame n, frames
n-1, n-2 etc are acknowledged. Some previous acknowledgements may have
been lost
A protocol using go back N
• The basic approach for dealing with an error (including an out of sequence
error) in the presence of a long stream of frames sent.
• Sender:
• Lost Ack/Nack (Timer expires)
• When the timer expires before an ACK has been received, the sender
• Retransmits the frame (and all subsequent frames) or
• May explicitly request for an ACK (if no frames were sent after
the one whose timer has expired) indicating the next frame
expected.
A protocol using go back N

Effect on error recoery when (a) receiver’s window size


= 1 (b) Receiver’s window size is large (selective
Repeat)
A protocol using go back N
• Adv: With go-back-N strategy, the current frame sequence
is maintained, thus minimizing the buffer storage required
for its implementation.
• Disadv: However since some correctly received frames
must be retransmitted it is less efficient in its use of the
available transmission capacity than a selective
retransmission scheme.
A protocol using Selective Repeat
A protocol using Selective
Repeat
• Sender:
• The sender maintains a send window of Maxseq(2n-1).
• The sender is allowed to transmit up to a maximum of Maxseq
frames without waiting for an acknowledgement.
• A timer is started for each frame sent
• Since frames currently within the sender’s window may ultimately
be lost or damaged in transit , the sender must keep all these
frames in its memory for possible retransmission
A protocol using Selective
Repeat
• Receiver:
• The receiver has a corresponding receive window of
(Maxseq+1)/2.
• The receiver has a buffer reserved for each sequence number
within its window. Associated with each buffer is a bit telling
whether the buffer is full or empty.
• Valid frame:
• When a valid frame arrives it is checked to see whether it falls
within the receive window.
• If so and if it is not a duplicate it is accepted and stored
(whether or not it is the next frame expected)
A protocol using Selective
Repeat
• Receiver:
• Next in sequence frame
• When the frame received is the next expected frame (by Network
Layer) it is delivered to the network layer.
• All other pending in order frames are also delivered and the receive
window is advanced.
• An acknowledgement is generated.
• An ACK frame acknowledges all frames in the list up to and
including the sequence Number contained in the ACK frame
A protocol using Selective Repeat
• Sender:
• The sender discards acknowledged frames
• The lower edge of the send window is advanced appropriately .
• The sender may open its window to permit the sending of new
frames subject to ensuring that the number of outstanding
unacknowledged frames must not exceed the sending window
size.
• As each new packet is transmitted, it is given the next highest
sequence number, and the upper edge of the window is advanced
by 1.
A protocol using Selective Repeat
• Assumptions:
▪ Frames may arrive out of sequence/order
▪ Frames may be lost
▪ Frames may be damaged
▪ NACK or ACK may be lost
▪ NACK or ACK may be damaged
• How to sender and receiver respond to
▪ Out of sequence frame
▪ Lost frame, Lost Ack/Nack
▪ Damaged frame, Damaged Ack/Nack
▪ Valid frame, Valid Ack
A protocol using Selective Repeat
• The basic approach for dealing with error in the presence of a long
stream of frames sent (pipelining).
▪ When the receiver suspects an error has occurred (damaged or lost
frame) it sends a NACK back to the sender.
▪ This is a request for the retransmission of the frame specified in
the NACK.
▪ The receiver however continues to accept and buffer the frames
following a damaged or lost frames
• The only frames retransmitted are those that receive a NACK or those
that timeout
A protocol using Selective
Repeat
• Receiver:
• Damaged frame :
• When a damaged frame is received it is simply discarded and
no further action is taken as a result of that frame.
• Out of sequence frame
• When an out of sequence frame arrives the receiver sends a
NAK frame containing the identifier of the missing frame
(frame expected) informing the sender to retransmit the frame
whose number is included in the NACK frame.
• Only one NACK frame can be outstanding at a time(to
avoid request for retransmission of the same lost frame).
A protocol using Selective
Repeat
• Receiver:
• Damaged Nack/Ack :
• When a NAK or ACK frame is damaged it is ignored
▪ Ultimately the corresponding timer will expire and the frame
will be transmitted.
▪ An ACK is sent when it is clear that the sender is not responding
to the NAK (may involve setting an ack-timer)
▪ When an acknowledgement (ACK) frame arrives for frame n,
frames n-1, n-2 etc are acknowledged. Some previous
acknowledgements may have been lost
A protocol using Selective Repeat
• Sender:
• Lost Nack/Ack :
• When timer expires the question of whether to retransmit frame is not
easy to resolve.
▪ The protocol buffers frames received out of order
• However can simply retransmit the oldest unacknowledged frame or
may explicitly request status
A protocol using Selective Repeat

Effect on error recoery when (a) receiver’s window size


= 1 (b) Receiver’s window size is large (selective
Repeat)
Sequence numbers
Sequence numbers
• The number of identifiers is a function of both the
retransmission control scheme and the size of the send and
receive window
Sequence numbers
• Stop and wait :
▪ The send and receive windows are both 1.
▪ Hence only two identifiers (0 and 1) are required to
allow to determine whether a particular I-frame is a
new frame or a duplicate.
▪ Sequence number is incremented modulo 2 by sender
Sequence numbers
• Go-back N
▪ A Send window of K
▪ The number of identifiers must be at least K-1.
▪ With the same number of identifiers as the send
window S will not be able to determine whether I-
frame (0) is a new frame or a duplicate;
Sequence numbers
• Selective repeat:
▪ Receive window of K, the number of identifiers must
not be less than 2K.
▪ When a receiver has advanced its window there should
be no overlap with the original window.
▪ Hence the maximum window size (of receiver)
should be at most half the range of the sequence
numbers. Window size = (maxseq + 1)/2
▪ Sender sends a full window of K frames, and receiver
must be able to determine if any of the next K-frame
are new frames hence next window must be K+1 to 2K.
Duplex Data transmission
• For clarity, we have assumed that I-frame flow in one
direction and that the return P out is used simply doe
acknowledgement.
• Normally however, most communication links that use
sliding window protocols use a duplex link, and carry
frames in both directions.
• Data frames from A to B are mixed with
acknowledgements from A to B
Duplex Data transmission
• When a data frame arrives, instead of immediately sending
a separate control frame, the outgoing acknowledgement is
delayed until it receives the next packet from the network
layer.
• The acknowledgement is attached to the outgoing data
frame in the ACK field.
• This technique of temporarily delaying outgoing
acknowledgements so they can be attached to the outgoing
data frame is known as piggybacking(as opposed to
separate acknowledgements)
Duplex data transmission
• To avoid a data link layer waiting unnecessarily long for
an outgoing data packet a timer is used. If a new packet
arrives quickly, the ACK is piggy backed onto it or else the
data link layer just sends a separate ACK.
• To implement duplex transmission, both receiver and
sender maintain a send and receive window.
Bidirectional protocol with one-bit
sliding window
Bidirectional protocol with one-bit
sliding window
• Sliding window protocol with a maximum window size of
1
• Both machines (A and B) are able to send and receive
frames and have the following variables (both initially 0)
defined.
▪ Next-frame to send
▪ Frame expected
▪ Ack is always equal to 1-frame expected
Bidirectional protocol with one-bit
sliding window
• One of the data link layers goes first
• The starting machine(A) fetches the first packet from its
network layer, builds a frame from it and sends it (seq 0,
Ack 1). Next frame to be sent is advanced to 1
Bidirectional protocol with one-bit
sliding window
• When the frame arrives, the receiving data link layer (B)
checks to see if it is the frame expected.
• If it is the frame expected it is passed to the network layer
and the receiver’s window is slid up. Frame expected is
advanced to 1
• The receiving machine may then send its next frame also
containing an acknowledgement for the packet just
received (seq 0, Ack 0)
Bidirectional protocol with one-bit
sliding window
• When the frame arrives at A, the data link layer checks to
see if it is the frame expected.
• If it is the frame expected it is passed to the network layer
and the receiving window is slid up. Frame expected is
advanced to 1
• It also checks to see if the acknowledgement is the one
expected.
• If it is, next frame to send is advanced to 1 and machine A
then fetches its next packet , builds its next frame also
containing an acknowledgement for the packet just
received (seq 1, Ack 0) and sends it. etc
Bidirectional protocol with one-bit
sliding window

Notation: seq, ack, packet number


Bidirectional protocol with one-bit
sliding window
• This protocol is resilient to premature timeouts and lost frames
▪ Let us suppose that A times out prematurely for the first frame sent
( seq 0, Ack 1) gets. A timesout sending an identical frame (seq 0,
ack 1).
▪ A may repeatedly send the same frame.
▪ When the first valid frame arrives at B, it will be accepted and
frame expected set to 1.
▪ All subsequent duplicated frames will be rejected since the frame
expected is the ine with seq 1
▪ If B’s subsequent frame(seq 0, ack 0) gets lost several times.
Eventually one will arrive correctly causing A to begin sending the
next packet.
Review Questions
• What are the possible types of transmission errors
• ARQ protocols
• Stop and wait ARQ
• Go Back n protocol
• Selective repeat
• For each of the above named ARQ protocols, answer with
appropriate explanations, the questions that follow
• Maximum number of outstanding unacknowledged frames
• Number of sequence-number bits
• What happens when an error free frame is received at the
receiver
• What happens when a damaged frame is received at the
receiver
Review Questions
• For each of the above named ARQ protocols, answer with
appropriate explanations, the questions that follow
• How does receiver respond to out of sequence frames, next in-
sequence frame, within receiver’s window frames, outside
receiver’s window frames.
• What happens when an error free ACK frame is received at the
sender
• What happens when a damaged ACK frame is received at the
sender
• What happens when no ACK frame is received at the sender
• One Adv and one disdav of each technique
• How each handles error control and flow control
• What if any are the restrictions on senders window size,
receiver’s window size? Why?
Questions

You might also like