CMPE 252A: Computer
Networks
SET 5:
Link Control Protocols
1
Internet Example
HOST
P
R
link-level frames
exchanged among
link interfaces
2
Logical Link Control
MAC protocol provides best effort service.
LLC bridges the gap between service
expected by network layer and service
provided by MAC layer.
LLC uses the header information in MAC
frames if LLC runs over a multiple access
link.
3
Functions at The Link Layer:
Point-to-Point Link
Framing and synchronization
Error checking
Deciding when a link exists or does not
Flow control
Detect or correct errors incurred over link
Retransmission strategy
Link management
Distinguish each frame
Pace the sender to avoid congestion at receiver
No need to name sender and receiver
4
Functions at The Link Layer:
Multiple Access Link
MAC:
Framing and synchronization
Error checking
Naming within LANs (with MAC addresses)
Sharing of medium
Flow control (in some cases)
LLC:
Retransmission strategy
Link management
(deciding when a link exists or does not)
Flow control (in some cases)
5
Types of Service LLC Can
Provide
Unacknowledged connectionless service: Datagram
transmission, no connection exists, no error checking,
framing is the only service provided (e.g., SLIP).
Acknowledged connectionless service: No
connections, each frame is ACKed individually. This service
can be provided as part of the MAC itself
(e.g., IEEE 802.11)
Connection-Oriented Service: Data exchanged within a
connection, provides net layer with a virtual reliable
packet stream (e.g., HDLC, PPP)
6
Framing of Bits
Physical layer provides raw stream of bits to the link layer.
The objective is for the receiver to understand the packets
(frames) sent by the sender when bits may get corrupted
over the channel.
Some approaches:
Character count, not used because it does not work well
with transmission errors.
Character- or byte-oriented framing (e.g., BISYNC, IMPIMP, SLIP, and PPP)
Bit-oriented framing: HDLC
Physical-layer coding violations: Used when encoding on
the PHY contains redundancy.
Example: Data 1 = 10, and Data 0 = 01; then frame control can
be a sequence of “11 and 00”
7
Character-Oriented Framing
CRC
CRC
CRC
ETX
packet payload (header and data)
DLE
STX
DLE
SYN
A frame starts and ends with a predefined sequence of
control bytes or characters, and the occurrence of such
sequence in the packet payload is avoided by byte
stuffing.
Consider the ARPANET IMP-IMP protocol:
SYN
SYN = synchronization
DLE = data link escape
STX = packet start
Character stuffing:
If DLE occurs in packet data, sender substitutes DLE with DLE DLE
Receiver substitutes DLE DLE in packet payload with DLE
In PPP, flag is 01111110 and such pattern in payload is preceded by 01111101
8
Bit-Oriented Framing
The same procedure is used with bits, bits are stuffed to break the
occurrence of control flags.
Bit stuffing consists of adding a bit after the occurrence of a bit
pattern equal to the control flag used to frame the packet.
Assume the control flag is 01111110
If flag pattern occurs in payload, sender must transmit something
different and receiver must be able to get original data.
HOW?...Sender inserts a 0 after 5 1’s, and receiver deletes any 0
received after five 1’s in a bit sequence, and the frame is ended if
after 5 1’s “10” is detected.
Original data:
flag
01111110
…..1011010100111111011000101111110011….
payload with bit stuffing
…..101101010011111010 110001011111010011….
flag
01111110
Receiver then deletes stuffed 0 in any sequence ...1111101 and
obtains original data: …..1011010100111111011000101111110011….
9
Error Control
Majority of protocols use error detection coding
because it requires fewer overhead bits than error
correction coding.
However, error detection is effective only if the
bandwidth-delay product of the link is small, i.e.,
if feedback regarding errors in received packets
can be given quickly to the sender, before it
sends too many bits.
Error detection code used by almost all networks
is the cyclic redundancy code (CRC)
10
CRC
CRC codes detect errors by adding a few bits (redundancy
bits or CRC bits) to each packet.
The attractive features of CRC are that only a few
redundancy bits are needed to protect many bits of
information, and it can be implemented with very simple
hardware.
A message of m bits is transmitted with r redundancy
bits as a transmitted string T = M.R
With the message bits being the most significant bits
transmitted, and given that R occupies r bit positions, we
have
r+m-1
T M 2r R
r
M
r-1
0 bits
R
11
CRC
The procedure to choose R to protect M is remarkably
simple.
A string G of r+1 bits called the generator is agreed upon.
R is chosen so that T = A xG for some A
=> If the received string T’ is not a multiple of G,
then an error has been detected!
T’ equals the (modulo 2) addition of T and an error
pattern E, such that a 0 in the pattern indicates no
error in that bit position.
Now we have:
T M 2 r R A G; therefor e,
R is the remainder of
dividing by G the
shifted M
M 2r A G R
also T ' M 2 r R E
12
CRC
Therefore, to protect M, the sender:
When the receiver obtains T’ :
Computes R by dividing M (shifted r bit positions) by G
Transmits M followed by R
It divides T’ by G
Decides that there is an error if the remainder of the
division is not 0
The trick is then choosing a G for which the
likelihood that T’ contains an error string E that is
divisible by G is very small.
13
CRC
The choice of G is done such that:
First and last bit of G are 1: This ensures that all single
bit errors are detected.
G is a factor of (x+1): To detect any odd number of
errors.
G has a factor with at least three terms: To detect
double-bit errors.
Code detects all burst of errors with fewer than r
bits and most other burst errors.
e.g., Ethernet uses “CRC-32”
14
Functions at The Link Layer
MAC:
Framing
Error checking
Naming within LANs (with MAC addresses)
Sharing of medium
Flow control (in some cases)
LLC:
Retransmission strategy
Link management
(deciding when a link exists or does not)
Flow control (in some cases)
15
Retransmission Strategies
Called Automatic Repeat Request (ARQ)
algorithms or protocols.
Design Issues:
How does a receiver ask for a retransmission?
How does the sender know when to retransmit?
How are packets associated with requests for
retransmissions?
Performance and correctness.
We will assume point-to-point links for simplicity.
16
ARQ Assumptions
The protocol operates at the link layer.
One sender and one receiver.
Links and nodes behave in FIFO order.
Nodes execute ARQ protocol correctly.
Session between sender and receiver is
already initialized and is permanent.
All errors are detected correctly and
framing is done perfectly.
17
Generic ARQ Scheme in FIFO
Channels
SENDER INITIATED
PACKET
SENDER
CRC
SEQ. #
RECEIVER
acknowledge packet
if no errors
TIMEOUT
ACK
retransmit
if no ACK
time
time
18
Generic ARQ Scheme
RECEIVER INITIATED
SENDER
RECEIVER
POLL
PACKET
TIMEOUT
CRC
SEQ. #
ACK/POLL
acknowledge
packet if no
errors; poll
retransmit
if asked
time
time
19
Requirements in ARQ
Sender labels each packet it sends using a linear
sequence-number space.
Receiver ACKs each packet it receives without
errors and numbers each ACK with the sequence
number of the corresponding packet.
Sender times out after not receiving an ACK for
the packet within some finite amount of time, and
retransmits the packet then.
Sender sends up to a certain number on unACKed packets.
20
Stop-and-Wait ARQ
Sender transmits packets labeled 1, 2,…..
Receiver ACKs every packet received correctly
and ACK specified the packet being acknowledged
(or next expected packet).
Receiver passes copy of packet correctly received
to the network layer and drops packets with
errors.
Sender retransmits copy of packet if no ACK
arrives within a timeout interval.
Sender and receiver are initialized to start sending
and receiving packet 1.
21
Stop-and-Wait Protocol (SWP)
Sender’s algorithm:
1. Initialize packet number (PN) to 0 [or1 for example].
2. Wait until packet is received from network layer; assign
PN to packet.
3. Transmit (or retransmit) packet in frame with PN as its
sequence number.
4. Start timeout timer and wait for ACK from receiver.
5. If error-free ACK specifying PN is received within
timeout interval
then set PN = PN+1 and repeat Step 2.
else repeat Step 3
22
Stop-and-Wait Protocol
Receiver’s algorithm:
1. Initialize next packet (NP) to 0 [or 1 for example] and
repeat Step 2 forever
2. If ( packet is received )
then
if (error in packet)
then discard packet
else do
if ( PN=NP )
then give packet to network layer and set
NP = NP+1
send ACK containing PN (or NP)
23
Efficiency of SWP
Consider the case in which no errors occur.
Processing delay
P
SENDER
Q
PACKET
time
ACK
RECEIVER
Q
A
S=minimum time between successive packet transmissions
24
Efficiency of SWP
From the diagram we have:
S P A 2(Q )
However, packets and ACKs may be lost or corrupted in the channel and it takes
much longer to send a packet successfully.
S
timeout
timeout
processing
SENDER
time
x
X
RECEIVER
processing
ACK
processing
ACK
X = total time to transmit a packet and its ACK correctly
25
Efficiency of SWP
Let p be the probability that a packet or its ACK is not
sent correctly over the link.
This implicitly assumes that each attempt to succeed
sending a packet is independent of others.
We have again the geometric random variable!
The number of transmissions needed for success is of
course 1/(1-p).
All the failed transmissions incur one timeout of time, and
all of these occur with probability p.
The last transmission incurs S seconds and occurs with
probability 1-p.
26
Efficiency of SWP
We can apply a simple graphical method.
T = timeout
S = P+A+2Q+2
no transmission error
start
error
S, 1-p
end
T, p
Efficiency
packet time
P
E{X}
E{X}
Too much overhead over noisy links
or links with large b-d products!
E{ X } (1 p) S p(T E{ X })
E{ X } S
pT
1 p
(1 p) P
(1 p) S pT
(1 p) P
; Q0
(1 p)( P A 2 ) pT
27
Selective Repeat ARQ
Motivation:
SWP leaves sender idle for long periods of time
waiting for ACKs.
Solution:
Requirements:
Allow sender to transmit multiple packets while waiting
for the ACK of a given packet.
Sender and receiver can buffer a number (W ) of packets
Sender labels packets using consecutive numbers 1, 2,….
Receiver buffers packets received without error, ACKs them, and delivers
packets to network layer in the correct order
(e.g., if packet P1 is in error and P2 and P3 are received correctly, the
receiver buffers them until it receives P1 correctly)
Sender buffers copies of transmitted packet until it receives the
corresponding ACK.
Sender retransmits a packet when its timeout expires with no ACK.
ACK refers to the sequence number of the packet it acknowledges.
28
How Many Packets Allowed in
Sender’s Buffer?
Assume we allow a maximum of W=4 in buffer
1
S
1
1
1
2
2
2
3
3
3
4
4
1
1
1
1
5
5
5
3
3
6
6
4
4
4
and sender can
keep transmitting
new packets!
timeout
1
X
R
1
3
4
5
1
3
6
time
4
X
2
2
2
2
2
3
3
3
3
4
4
4
5
5
6 overflows
buffer!
29
Solution To Buffer Overflow
Sender can transmit a new packet if the difference in smallest and
largest seq. # in buffer is smaller than W!
ASSUME W=4
1
S
1
1
1
1
2
2
2
3
3
3
3
4
4
4
1
3
X
2
1
4
timeout
timeout
3
1
4
X
2
2
1
5
timeout
1
R
1
time
4
1
1
transmit 1 until
ACK is received
2
2
2
3
3
3
4
4
5
1
30
Efficiency of SRP
Consider the case in which no errors occur.
S P 2( Q) A
WP
with W P S
P
SENDER
RECEIVER
PACKET
PACKET
Q
PACKET
PACKET
ACK
ACK
ACK
ACK
Q
ACK
A
S = minimum time for packet to be ACKed
time
Note the implicit
full duplex
operation!
31
Efficiency of SRP
Efficiency of SRP: SRP
WP
P
PACKET
PACKET
PACKET
PACKET
WP
min
,1
S
With no errors,
sender never stops with S < WP
S
Assume infinite W and T > S, so that sender never retransmits if
there are no errors.
p =P{ transmission error in packet or its ACK}
Y= number of times packet is transmitted
Y is the Geometric r.v.; therefore,
1
E (Y )
1 p
32
Efficiency of SRP
We can also use the graphical method, of course…
We focus on the number of transmissions,
because all transmissions last the same time.
E{Y } (1 p) p(1 E{Y })
no transmission error
start
error
1, 1-p
end
1, p
1
E{Y }
, as expected!
1 p
Let E(X ) be the average time taken to transmit a packet, then E(X)=P E(Y)
Efficiency SRP
SRP
packet time
P
E{X}
E{X}
P
1 p for W
P /(1 p)
Very high efficiency as
long as window is longer
than S !
33
Correctness of SRP
What to prove:
Finite sequence number space: What is the
minimum sequence number space we can use
so that sender and receiver never get confused
with sequence numbers in ACKs and packets.
Safety: Receiver passes packets to the
network layer in sequence, without gaps or
replicas.
Liveness: Deadlocks never occur.
34
Sequence Numbering in SRP
Assume W=4 and sequence numbers are 0 to 4.
sender waits for ACK to pkt 1
S# 0
S PKT
1
1
2
PKT 2
4
0
PKT 5
PKT 6
PKT 7
1
2
3
3
PKT 3
PKT 4
0
0
R
1
ACK
2
ACK
3
ACK
ACK
all packets are
passed
to network layer
1
4
2
PKT 8
4
0
ACK
time
1
ACK
0
1
2
2
ACK
ACK
receiver associates 0
with packet 6… should it?
35
Sequence Numbering in SRP
However, not all packets are successful
timeout for packet 1
sender waits for ACK to pkt 1
S# 0
S PKT
1
1
2
PKT 2
3
PKT 3
0
PKT 4
PKT 1
0
0
R
1
ACK
2
ACK
1
3
ACK
ACK
all packets are passed
to network layer
2
time
3
0
0
ACK
receiver should associate
0 to pkt 1 and NOT pass
it to network
layer (sending ACK)
36
Sequence Numbering in SRP
…and many cases are possible!
timeout for packet 1
sender waits for ACK to pkt 1
S# 0
S PKT
1
1
2
PKT 2
4
0
PKT 5
PKT 6
3
PKT 3
PKT 4
0
1
2
4
time
3
0
0
R
1
ACK
2
ACK
3
ACK
ACK
all packets are passed
to network layer
Note that S could have sent packets 5 and 6!
0
ACK
receiver should
associate 0 to packet 6!
Store it in buffer and send
ACK
37
Sequence Numbering in SRP
timeout for packet 1
sender waits for ACK to pkt 1
S# 0
S PKT
1
1
2
PKT 2
4
0
0
PKT 5
PKT 6
PKT 1
3
PKT 3
PKT 4
0
1
2
4
time
3
0
0
R
1
ACK
2
ACK
3
ACK
ACK
all packets are passed
to network layer
Which case took place?
0
ACK
What should the
receiver do?
Association of packet
to a seq. number is
compromised.
38
Sequence Numbering in SRP
However, receiver can get confused!
timeout for packet 1
sender waits for ACK to pkt 1
S# 0
S PKT
1
1
2
PKT 2
3
PKT 3
PKT 4
4
0
0
PKT 5
PKT 6
PKT 1
time
0
4
X
0
1
2
3
0
ACK
R
all packets are passed
to network layer
Note that S could have sent packets 5 and 6!
receiver does not
know if 0 corresponds
to replica of packet 1 or
packet 6!
PASS TO NETWORK
LAYER???
39
Sequence Numbering in SRP
Is modulo 2W sufficient to identify any packet on the fly or
stored?
Assume that window is W and packets are numbered modulo 2W (from
0 to 2W -1)
Assume that, at time T, packet labeled n is passed to network layer at
the receiver, and is the packet with the highest number that can be
passed to net layer!
R
time
sender sent packet n
<=
=> sender received all ACKs
up to ACK(n-W), because
window is W
=> Smallest sequence
number pending an ACK at
the sender is n-W+1
T
n
=> n+1 has not been
received!
(o.w., it would have been
sent to network layer)
=> ACK(n+1) has not been sent to
sender
=> Largest sequence number
sent by sender is n+W
Given n, the possible range of sequence numbers of packets at the
sender is {n-W+1, n+W} and using modulo 2W sequence number
space works correctly
40
Sequence Numbering in SRP
The same type of argument can be made
for the receiver, assuming that the sender
receives the ACK for packet n for the first
time at time T.
HW:
Left to the student to show that using a
sequence number space modulo 2W does not
confuse the receiver!
Show the same for SWP!
W=1
41
Safety Proof for SRP
By induction on sequence number PN of a packet.
Prove for the first packet:
S and R are initialized with PN =NP = 0.
First packet sent by S is numbered 0.
S must retransmit packet with PN = 0, until it receives an
ACK with NP > 0 or NP = 0 from R.
While packet numbered 0 is not ACKed, S can only send
packets numbered up to PN = W - 1 to R due to window-size.
Due to buffering policy, R must have buffer space to receive
packet 0 and passes it to network layer in sequence when it
is received correctly for the first time.
R does not pass packet 0 to the network layer a second time.
Therefore, SRP is safe for packet 0!
42
Safety Proof for SRP
Assume that SRP is safe for PN = n-1 and
prove for PN = n:
Because R has received packet n - 1, it has set NP = n
R can only accept a packet with PN =NP to be passed
to the network layer, which can be done together with a
set of other packets whose sequence numbers are in
sequence.
When the first error-free copy of packet with PN = n
arrives, R passes it to network layer in sequence and
increases NP. No replica of the same packet is given to
the network layer and no missing packets exist from 0 to
n; therefore, SRP is safe.
Q.E.D.
43
Liveness Proof for SRP
The trick is to identify key events in time ensuring
that the protocol never deadlocks.
In an ARQ protocol, the key events can be stated
with respect to a given packet numbered n:
The first transmission from S of packet with PN = n
occurs at time t1
The first time that R receives an error-free transmission
of a packet with any PN < or = n that makes the
packet with PN = n be in sequence occurs at t2
S receives an error-free transmission of an ACK reporting
NP = or > n+1 at t3
44
Liveness Proof of SRP
t3
SENDER
ACK
PN=i
time
NP > i
NP > or = i +1
PN ≤ i
ACK
RECEIVER
t1
SSN
i
missing missing
HSN
t2
Set of packets in sequence including
packet with PN = i is passed to network
layer
NO DEADLOCKS IF [t1 , t3 ]
45
Liveness of SRP
By definition of SRP, NP(t) and PN(t) are non-decreasing functions of t
Because the channel has a finite propagation delay and t1 is the first time
when S releases a packet with PN = i, given that SRP is safe, it is
impossible for R to release a packet with PN = i before or at t1; therefore,
t2 > t1
Because the probability that any packet and its ACK goes through the
channel correctly is > 0, it follows that [t1, t2] is finite.
Because R releases the first ACK with NP ≥ i at time t2 and because the
channel has a positive propagation delay, it must be true that t3 > t2
Because the probability of receiving an ACK with an NP covering a packet
with PN < NP is non-zero, it follows that [t2, t3] is finite.
Q.E.D.
46
Go-Back-N (GBN) ARQ
SRP requires sender and receiver to have a buffer, which
is not an issue today.
With GBN, the receiver discards any packet it receives out
of order; therefore, it does not need a buffer.
Receiver accepts only those packets received in order.
Receiver ACKs a packet received correctly with the
sequence number of the last packet received in
sequence.
The sender starts a timer for each packet it transmits, and
after the timeout of a packet expires, it retransmits the
packet and all the packets sent after that packet.
Sender can have up to W packets waiting for ACKs.
47
GBN ARQ Example 1
Timeout for pkt 1 (T )
P
S
PKT 1
PKT 2
PKT 3
PKT 4
PKT 5
time
1
R
ACK
Packet 1 is received
correctly; receiver
sends ACK
Sender is able to
transmit four
packets before
timeout for pkt 1
expires
ACK to pkt 1 arrives
before its timeout
expires; sender can
send packet 5.
48
GBN ARQ Example 1
timeout for pkt 2 (T )
S
PKT 1
PKT 2
PKT 3
PKT 4
1
R
ACK
ACK
Packets 2 to 4 arrive
in order at the
receiver; receiver
sends ACKs for them
(asking for packet 5)
PKT 5
PKT 6
time
2
ACK
ACK
ACK to pkt 2 arrives
before its timeout
expires; sender can
send packet 6.
49
GBN ARQ Example 1
timeout for pkt 3 (T )
S
PKT 1
PKT 2
PKT 3
PKT 4
1
R
ACK
ACK
PKT 5
2
ACK
PKT 6
PKT 7
time
3
ACK
ACK to pkt 3 arrives
before its timeout
expires; sender can
send packet 7.
50
GBN ARQ Example 1
timeout for pkt 4 (T )
S
PKT 1
PKT 2
PKT 3
PKT 4
1
R
ACK
ACK
2
ACK
PKT 5
PKT 6
3
4
PKT 7
PKT 8
time
ACK
ACK to packet 4
arrives before its
timeout expires;
sender can send
packet 8, etc.
51
GBN ARQ Example 2
packets 1 to W-1 must
be retransmitted
timeout (T )
P
S
PKT 1
PKT 2
PKT 3
PKT 4
PKT 1
PKT 2
PKT 3
PKT 4
time
X
2
R
ACK
ACK
ACK
3
4
ACK
all packets are
delivered to network
layer but sender does
not know!
ACK to packet 2 arrives after timeout;
sender schedules packets 1 to 4 for
retransmission!
52
GBN ARQ Example 2
S
packets 1 to W-1 must
be retransmitted
timeout (T )
Sender can finally
send packet 5
P
S
PKT 1
PKT 2
PKT 3
PKT 4
PKT 1
PKT 2
PKT 3
PKT 4
PKT 5
4
X
R
ACK
ACK
ACK
ACK
all packets are
delivered to network
layer but sender does
not know!
ACK
ACK
ACK
4
time
4
4
ACK
all packets are
discarded
(out of order)
Note that receiver
keeps sending
a 4 as the last packet
received in sequence
53
GBN ARQ Example 3
packets 1 to W-1 must
be retransmitted
timeout (T )
P
S
PKT 1
PKT 2
PKT 3
PKT 4
X
R
PKT 1
1
ACK
ACK
1
PKT 2
PKT 3
PKT 4
time
1
ACK
No packet can be delivered
to network layer!
They are discarded.
Receiver keeps asking for
packet 1
ACK to packet 2 arrives after timeout;
sender already scheduled packets 1 to 4
for retransmission!
54
GBN ARQ Example 3
packets 1 to W-1 must
be retransmitted
timeout (T )
Sender can finally
send packet 5
P
S
PKT 1
PKT 2
PKT 3
PKT 4
PKT 1
PKT 2
PKT 3
PKT 4
PKT 5
2
X
R
1
ACK
ACK
1
3
time
4
5
1
ACK
No packet can be delivered to
network layer!
They are discarded.
Receiver keeps asking for
packet 1
ACK
ACK
ACK
ACK
all packets are
received in order and Receiver states
passed to network
the last packet
layer.
received in sequence
55
Efficiency of GBN
A packet that is not ACKed wastes a timeout (T )
To simplify our analysis, assume T= S = W x P
We compute the average time needed for the sender to get the ACK
to a given packet n and advance window to n+1
E{ X } (1 p) P p(T E{ X })
no transmission error
n
error
Efficiency
P, 1-p
n+1
T, p
packet time
P
E{ X }
E{ X }
pT
pW
E{ X } P
P1
1 p
1 p
GBN
1
pW
1
1 p
56
Effect of Negative ACKs
We have assumed that packets are retransmitted
after a timeout.
Using negative acknowledgments (NACKs), the
receiver tells the sender about missing packets
and the sender can retransmit after receiving the
NACK. This increases throughput.
NACKs and ACKs can be combined in windows of
ACKs:
last pkt in
sequence
0
1
0
1
…
1
57
SRP with NACKs
S knows R has received up to
packet 2
timeout (T.O. ) for packet 1
P
S
PKT 1
PKT 2
1
PKT 3
2,ACK
4
3
2
X
R
PKT 4
time
3,-
X
ACK
58
SRP with NACKs
S receives NACK for packet
3 before T.O. expires.
T.O. for packet 3
S
PKT 1
PKT 2
1
PKT 3
2,ACK
time
4
3
2
X
R
PKT 4
3,-
3, (1)
X
ACK
ACK
59
SRP with NACKs
S receives NACK for packet
3 before T.O. expires.
T.O. for packet 5
T.O. for packet 3
S
PKT 1
PKT 2
1
PKT 3
2,ACK
PKT 5
3,-
6
3
time
3, (1)
X
ACK
PKT 3
PKT 6
5
4
3
2
X
R
PKT 4
X
ACK
60
SRP with NACKs
S receives NACK for packet 5
before T.O. expires; should not
assume a NACK for packet 3!
T.O. for packet 5
T.O. for packet 3
S
PKT 1
PKT 2
1
PKT 3
PKT 4
X
3,-
PKT 3
PKT 6
5
4
3
2
PKT 5
6
3, (1)
3
PKT 5
PKT 7
7
5
time
3, (101)
5,(1)
2,R
ACK
X
ACK
X
ACK
ACK
ACK
A bit vector set for packet k in the ACK packet should not be
interpreted as a NACK to packet k if the ACK packet is received
during the next packet time after packet k is (re)transmitted.
no retransmit after NACK if “S” for packet has not elapsed!
61
SRP with NACKs
T.O. for packet 3
“S” for packet 3
S
PKT 3
3
time
NACK
Must retransmit after it elapses!
Cannot retransmit before it elapses!
R
Potential time saved with NACK
62
SRP with NACKs
S receives second NACK
for packet 5 before T.O.
expires.
T.O. for packet 5
S
PKT 1
PKT 2
1
PKT 3
PKT 4
X
3,-
PKT 3
PKT 6
5
4
3
2
PKT 5
6
3, (1)
3
PKT 5
PKT 7
PKT 8
time
5
7
3, (101)
5,(1)
2,R
ACK
X
ACK
X
ACK
8,-
5,(11) X
ACK
ACK
ACK
ACK
63
GBN with NACKs
T.O. for packet 1
S
PKT 1
PKT 2
1
PKT 3
3
2
X
1
R
ACK
time
2
X
ACK
to net to net
layer layer
64
GBN with NACKs
T.O. for packet 3
S
PKT 1
PKT 2
1
PKT 3
PKT 4
X
1
R
ACK
2
No 3
X
ACK
time
5
4
3
2
PKT 5
X
ACK
X
to net to net
layer layer
drop
65
GBN with NACKs
T.O. for packet 3
S
PKT 1
PKT 2
1
PKT 3
PKT 4
3
2
X
1
R
ACK
2
PKT 5
5
4
PKT 4
3
ACK
drop
PKT 5
PKT 6
4
5
6
3
4
5
t
No 3
X
X
to net to net
layer layer
6
No 3
X
ACK
PKT 3
PKT 6
ACK
ACK
ACK
ACK
6
ACK
X
drop
to net to net to net to net
layer layer layer layer
Not much is gained with NACKs; it all depends on T.O. and S.
NACKs must be evaluated at the end of a GBN transmission
66
Initializing a Link
Operation of initialization protocol leads to up and
down periods of the link
S and R can have different views of the state of
the link
S and R should not accept packets from prior
incarnations of the link.
We can have a master-slave or peer-to-peer
protocol, which consists of two M-S protocols.
Master sends two types of packets: INIT and
DISC, and must stop for ACKs
This is the same as the SWP (ABP) protocol!
67
Initializing a Link
initializing
S
R
link up
INIT
disconnecting
link down
DISC
ACKI
time
ACKD
link up
link down
68
Initialization of ARQ
The basic problem is that an initialization protocol between
two parties requires feedback.
The simplest scheme is a link-up packet and its ACK used
to set up a link, followed by a link-down packet and its
ACK to tear down the link.
This, however, is just the SWP (ABP), which needs to be
initialized!
Ad hoc approach:
Node starts assuming that link is down, and must wait a long time
period after coming up before it accepts or sends an INIT packet
to the link.
In e-t-e protocols (e.g., TCP) the connection is assigned an ID
randomly.
69
Link Control over Non-FIFO
Channels
Logical link control is often applied over virtual links
running above the link layer (e.g., TCP).
The assumptions we have made about fixed RTTs
(or retransmission time outs) and the FIFO
operation of the link no longer apply when packets
must be sent over networks and take different
routes from source to receiver.
A virtual link may be able to store up to a finite
number of packets in transit.
70
RTT Estimation over Non-FIFO
Link
PACKET
SENDER
CRC
SEQ. #
RTT
RECEIVER
ACK
ACK specifies seq # of packet
time
time
71
RTT Estimation over Non-FIFO
Link
PACKET
SENDER
CRC
SEQ. #
RECEIVER
X
RTO
RTT
ACK
time
time
72
RTT Estimation over Non-FIFO
Link
PACKET
SENDER
CRC
SEQ. #
RECEIVER
RTO
RTT?
ACK
time
time
73
RTT Estimation over Non-FIFO
Link
PACKET
SENDER
CRC
SEQ. #
RECEIVER
RTO
RTT
X
RTT computation
is not safe with
a single sequence
number!
ACK
time
time
74
RTT Estimation over Non-FIFO
Link
Because of storage in the channel, the ACK must be bound to a specific
packet transmission, not just the packet sequence number.
PACKET
SENDER
SEQ. #
ret #
CRC
RECEIVER
X
RTO
RTT
SEQ. #
time
ret #
ACK
CRC
time
75
© Copyright 2026 Paperzz