0% found this document useful (0 votes)
11 views28 pages

Ceng210 SP25 LCN11

Uploaded by

ghhmfyv9vb
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)
11 views28 pages

Ceng210 SP25 LCN11

Uploaded by

ghhmfyv9vb
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/ 28

It has been said

CENG210
Chapter 03 – Lecture 11
Flow And Error Control

Hassan Nasreddine
Spring 2025

1
It has been said

Outline
• Data Link Control Services
– Framing
– Flow and Error Control
• Flow and Error Control Protocols
– Simplest
– Stop-and-Wait
– Stop-and-Wait ARQ
– Go-Back-N ARQ
– Selective Repeat ARQ

2
It has been said

Data Link Control Services


• The data link control (DLC) deals with procedures for
communication between two adjacent nodes: node-to-
node communication no matter whether the link is
dedicated or broadcast.
• Data link control functions include framing , flow and
error control.

3
It has been said

Framing
• The data-link layer, on the other hand, needs to pack bits
into frames, so that each frame is distinguishable from
another.
• Framing in the data-link layer separates a message from
one source to a destination by adding a sender address
and a destination address.
• The destination address defines where the packet is to
go; the sender address helps the recipient acknowledge
the receipt.
• Large messages are divided into smaller frames to make
flow and error control very efficient.

4
It has been said

Frame Size
• Frames can be of fixed or variable size.
• In fixed-size framing, there is no need for defining the
boundaries of the frames; the size itself can be used as
a delimiter.
• In variable-size framing, we need a way to define the
end of one frame and the beginning of the next. Two
approaches were used for this purpose: a character-
byte

oriented approach and a bit-oriented approach.

5
It has been said

Character-Oriented Framing
• In character-oriented (or byte-oriented) framing, data to
be carried are 8-bit characters from a coding system
such as ASCII.

• The header, which normally carries the source and


destination addresses and other control information.
• The trailer, which carries error detection redundant bits.
• An 8-bit (1-byte) flag is added at the beginning and the
end of a frame to separate one frame from the next.
• The flag, composed of protocol-dependent special
characters, signals the start or end of a frame.
6
It has been said

Byte Stuffing
• In byte stuffing (or character stuffing), a special byte is
added to the data section of the frame when there is a
character with the same pattern as the flag.
• This byte is usually called the escape character (ESC)
and has a predefined bit pattern.
• Whenever the receiver encounters the ESC character, it
removes it from the data section and treats the next
character as data, not as a delimiting flag.

check and remove esc

remove one esc , can’t have two

7
It has been said

Bit-Oriented Framing
• In bit-oriented framing, the data section of a frame is a
sequence of bits to be interpreted by the upper layer as
text, graphic, audio, video, and so on.
• Most protocols use a special 8-bit pattern flag, 01111110,
as the delimiter to define the beginning and the end of the
frame.

8
It has been said

Bit Stuffing
• If the flag pattern appears in the data, we need to
somehow inform the receiver that this is not the end of the
frame. We do this by stuffing 1 single bit (instead of 1 byte)
to prevent the pattern from looking like a flag. The strategy
is called bit stuffing.
• In bit stuffing, if a 0 and five consecutive 1 bits are
encountered, an extra 0 is added. This extra stuffed bit is
eventually removed from the data by the receiver.

9
It has been said

Flow and Error Control


• Data communication requires at least two devices
working together, one to send and the other to receive.
• Even such a basic arrangement requires a great deal of
coordination for an intelligible exchange to occur.
• The most important responsibilities of the data link layer
are flow control and error control. Collectively, these
functions in addition to framing are known as data link
control.

10
It has been said

Flow Control
• Whenever an entity produces items and another entity
consumes them, there should be a balance between
production and consumption rates.
– If the items are produced faster than they can be consumed, the
consumer can be overwhelmed and may need to discard some
items.
– If the items are produced more slowly than they can be
consumed, the consumer must wait, and the system becomes
less efficient. Flow control is related to the first issue.
• Flow control refers to a set of procedures used to restrict
the amount of data that the sender can send before
waiting for acknowledgment.

11
It has been said

Flow Control Concept


The data-link layer at the sending node tries to push frames
toward the data-link layer at the receiving node. If the
receiving node cannot process and deliver the packet to its
network at the same rate that the frames arrive, it becomes
overwhelmed with frames. Flow control in this case can be
feedback from the receiving node to the sending node to
stop or slow down pushing frames.

12
It has been said

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.
• In the data link layer, the term error control refers primarily
to methods of error detection and retransmission.
• Error control in the data link layer is often implemented
simply: Any time an error is detected in an exchange,
specified frames are retransmitted. This process is called
automatic repeat request (ARQ).

13
It has been said

Flow and Error Control Protocols


• We divide the discussion of protocols into those that can
be used for noiseless (error-free) channels and those
that can be used for noisy (error-creating) channels.

channel with errors


channel without errors

all when having error to correct it , retransmission

14
It has been said

Simplest Protocol
• Simple protocol is a protocol with neither flow nor error
control. The receiver can immediately handle any frame
it receives. The receiver can never be overwhelmed
with incoming frames.

send packet and he doesnt cear

15
It has been said

Stop-and-Wait Protocol
• Stop-and-Wait protocol uses both flow and error control.
• In this protocol, the sender sends one frame at a time and
waits for an acknowledgment before sending the next
one.
• To detect corrupted frames, we need to add a CRC to
each data frame.
• When a frame arrives at the receiver site, it is checked.
 If its CRC is incorrect, the frame is corrupted and silently
discarded.
 Every time the sender sends a frame, it starts a timer. If an
acknowledgment arrives before the timer expires, the timer is
stopped and the sender sends the next frame.
 If the timer expires, the sender resends the previous frame,
assuming that the frame was either lost or corrupted.

16
It has been said

Stop-and-Wait Protocol

start

message i have arrive


stop

there might be duplicated copes

restart

17
It has been said

Sequence and Acknowledgment


Numbers
• Duplicate packets, as much as corrupted packets, need to
be avoided. As an example, assume we are ordering some
item online. If each packet defines the specification of an
item to be ordered, duplicate packets mean ordering an
item more than once.
• To correct this problem, we need to add sequence numbers
to the data frames and acknowledgment numbers to the
ACK frames. However, numbering in this case is very
simple. Sequence numbers are 0, 1, 0, 1, 0, 1, . . . ; the
acknowledgment numbers can also be 1, 0, 1, 0, 1, 0, …

18
It has been said

Stop-and-Wait ARQ
• Stop and wait with ARQ: Automatic Repeat reQuest
(ARQ), an error control method, is incorporated with stop
and wait flow control protocol.
– If error is detected by receiver, it discards the frame and send a
negative ACK (NAK), causing sender to re-send the frame.
– In case a frame never got to receiver, sender has a timer: each
time a frame is sent, timer is set!
• If no ACK or NAK is received during timeout period, it re-sends the
frame.
– Timer introduces a problem: Suppose timeout and sender
retransmits a frame but receiver actually received the
previous transmission! Receiver has duplicated copies.
– To avoid receiving and accepting two copies of same frame,
frames and ACKs are alternatively labeled 0 or 1: ACK0 for
frame 1, ACK1 for frame 0

19
It has been said

Sequence and Acknowledgment Numbers

frames are numbered

receiver discarded
because he has it
already

20
It has been said

Efficiency of Stop-and-Wait ARQ


Assume that, in a Stop-and-Wait ARQ system, the
bandwidth of the line is 1 Mbps, and 1 bit takes 20 ms
to make a round trip. What is the bandwidth-delay
product? If the system data frames are 1000 bits in
length, what is the utilization percentage of the link?
The bandwidth-delay product is
(1 × 106) × (20 × 10−3) = 20,000 bits.

The system can send 20,000 bits during the time it takes for the data
to go from the sender to the receiver and the acknowledgment to
come back. However, the system sends only 1,000 bits. We can say
that the link utilization is only 1,000/20,000, or 5 percent.

For this reason, in a link with a high bandwidth or long delay, the use
of Stop-and-Wait wastes the capacity of the link.

21
It has been said

Sliding Window Protocol

better than go - back - N ARQ

22
It has been said

Sliding Window Protocol


• A universally accepted flow control procedure is the sliding
window protocol.
– Frames and acknowledgements are numbered using sequence
numbers.
– Sender maintains a list of sequence numbers (frames) it is allowed
to transmit, called sending window.
– Receiver maintains a list of sequence numbers it is prepared to
receive, called receiving window
– A sending window of size N means that sender can send up to N
frames without the need for an ACK.
– A window size of N implies buffer space for N frames
– For n-bit sequence number, we have 2n numbers: 0, 1, …, 2n−1, but
the maximum window size N = 2n− 1 (not 2n)
– ACK3 means that receiver has received frame 0 to frame 2
correctly, ready to receive frame 3 (and rest of N frames within
window)

23
It has been said

Sliding Window (continue)

have 3 bit

https://rb.gy/yfd6mx

24
It has been said

Go-Back-N ARQ
• The Go-Back-N protocol simplifies the process at the
receiver. The receiver keeps track of only one variable,
and there is no need to buffer out-of-order packets; they
are simply discarded.
• The basic idea of Go-Back-N error control is: If frame i is
damaged, receiver requests retransmission of all frames
starting from frame i

negative

25
It has been said

Go-Back-N ARQ

2 discarded

https://rb.gy/19a7be

resend all with 2

26
It has been said

Selective Repeat ARQ


• Selective-Repeat protocol, resends only selective packets,
those that are actually lost.

• Selective-Repeat would appear to be more efficient than


Go-Back-N, but it is harder to implement and less used
• The window size is also more restrictive: for n-bit sequence
number, the maximum window size is N =2n/2 to avoid
possible confusion.

27
It has been said

Selective Repeat ARQ - Continue https://rb.gy/tfg2ia

only repeat one with error

2 discarded

28

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