0% found this document useful (0 votes)
9 views7 pages

Datalink - Layer 2

The document discusses flow and error control mechanisms in the data link layer, focusing on Stop-and-Wait and Sliding Window protocols. It explains how these protocols manage data transmission and error detection through acknowledgments (ACKs) and negative acknowledgments (NAKs), as well as various Automatic Repeat Request (ARQ) schemes. Additionally, it covers the High-level Data Link Control (HDLC) protocol and Point-to-Point Protocol (PPP) for data transmission over point-to-point links.

Uploaded by

aminu ali lawan
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)
9 views7 pages

Datalink - Layer 2

The document discusses flow and error control mechanisms in the data link layer, focusing on Stop-and-Wait and Sliding Window protocols. It explains how these protocols manage data transmission and error detection through acknowledgments (ACKs) and negative acknowledgments (NAKs), as well as various Automatic Repeat Request (ARQ) schemes. Additionally, it covers the High-level Data Link Control (HDLC) protocol and Point-to-Point Protocol (PPP) for data transmission over point-to-point links.

Uploaded by

aminu ali lawan
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/ 7

Datalink layer: Flow and Error Control Stop-and-wait flow control

• flow control specifies how much data the Sender can transmit before Sender waits for ACK after each frame transmission:
receiving permission to continue from the Receiver
• error control allows the Receiver to tell the Sender about frames damaged
or lost during transmission, and coordinates the re-transmission of those ACK can be a frame
frames by the Sender by itself, or a control
• since flow control provides the Receiver’s acknowledgement (ACK) of field in data frames
correctly-received frames, it is closely linked to error control going from Receiver to
Sender (“piggybacking”)
• basic idea of flow control: even if frames are received error-free, the
Receiver will be forced to drop some of them if the Sender transmits faster Note: wait times may
than the Receiver can process them ⇒ signal the Sender to slow down to a vary for different frame
rate acceptable to the Receiver transmissions, as is the
• this signal can be explicit or implicit (e.g. delay sending ACK to Sender)
case here ⇒ can talk
• basic idea of error control: ACK every correctly-received frame and about average wait time
negatively acknowledge (NAK) each incorrectly-received frame
• Sender keeps copies of un-ACKed Frames to re-transmit if required
• want: packets (inside frames) passed to Receiver’s Network layer in order Advantage: simplicity. Disadvantage: inefficiency (wait times).
1 2

Sliding window flow control Sliding window flow control (cont.)


• Sender can transmit several frames continuously before needing an ACK
• if ACK received by Sender before continuous transmission is finished, Sender Sender’s sliding window:
can continue transmitting if Sender receives
• an ACK can acknowledge the correct receipt of multiple frames at the Receiver e.g. ACK 4, then it
• Frames and ACKs must be numbered: knows Frames up
• each Frame’s number is 1 greater than the previous Frame to and including
• each ACK’s number is the number of the next Frame expected by the Receiver Frame 3 were
correctly received
Number of frames that
can be transmitted
without an ACK
Receiver’s sliding window:
Receiver’s window
represents the number
• Frames may be acknowledged by the Receiver at any time, and may be transmitted of un-ACKed Frames
by the Sender as long as the Window hasn’t filled up
• Frames are numbered modulo-n, from 0 to n-1: 0, 1,…, n-1, 0, 1,…,n-1, 0, 1,…
• Size of the Window is n-1: 1 less than the number of different Frame numbers
3 4
Sliding window flow control: Example (assume no errors) Sliding window flow control: Example (cont.)
Window size = 7
Sender
behaviour

Note: neither Sender nor Receiver has this kind of “global picture”…
5 6

Sliding window flow control: Example (cont.) Error Control: ARQ (Automatic Repeat Request) schemes
• if error(s) detected in received Frame, return NAK to Sender
Receiver • NAK can be explicit or implicit (Sender’s Timeout timer expires)
behaviour
• Sender keeps a copy of each un-ACKed Frame to re-transmit if required
• ACK received by Sender for Frame ⇒ discard copy
• NAK received by Sender for Frame ⇒ decide how to re-transmit Frame
• Sender starts Timeout timer for each Frame when it is transmitted
• appropriate Timeout value = the expected delay for Sender to receive
ACK for the Frame (in practice, set Timeout slightly larger than this…)
• packet is not considered to be delivered successfully to the Receiver’s
Network layer until the Sender knows this (by getting ACK for it)
• 3 types of ARQ scheme:
• Stop-and-wait ARQ – extension of Stop-and-wait flow control
• Sliding window ARQ – extension of sliding window flow control:
• Go-back-n ARQ – Receiver must get Frames in correct order
• Selective repeat ARQ – correctly-received out-of-order Frames are
stored at Receiver until they can be re-assembled into correct order
7 8
Stop-and-wait ARQ, damaged data frame Stop-and-wait ARQ, lost data frame
also known as ABP
(Alternating Bit Protocol)

Frame OK
0

Frame OK Frame OK
0
1

Frame not OK
Know:

0 Frame OK

9 10

Stop-and-wait ARQ, lost ACK Stop-and-wait ARQ: Performance Analysis


• parameters:
• Frame transmission time at Sender is TRANSF
• ACK/NAK transmission time at Receiver is TRANSA
• if ACKs are piggybacked ⇒ TRANSF = TRANSA, assuming Frames
have equal (average) lengths in both directions
0 • link propagation delay is PROP
0
Frame OK • Frame processing time at Sender or Receiver is PROC
• probability of Frame error in Sender-Receiver direction is p
2nd copy
• probability of Frame error in Receiver-Sender direction is q
discarded,
0
even though • Sender times out after TIMEOUT
Frame OK • assume Sender has an endless supply of Network layer packets to transmit, so idle
time at Sender is 0
• error-free packet delivery takes TS = TRANSF + TRANSA + 2*(PROP + PROC)
Q: why does Receiver send ACK 0 for copy of data Frame 1 ? and occurs with probability (1-p)*(1-q)
• errored delivery takes TF and occurs with probability r = p+(1-p)*q
r = 1-(probability of error-free delivery), as expected
11 12
Sender Receiver Sender Receiver

TRANSF TRANSF

PROP PROP

PROC PROC
ACK TRANSA NAK TRANSA
PROP PROP
PROC PROC
Sender knows Sender knows
Frame was Frame must be
received re-transmitted
correctly
TF = TS here
time time time time
13 14

Sender Receiver Sender Receiver

TRANSF TRANSF

lost

TIMEOUT ACK TIMEOUT


lost

Sender knows Sender knows


Frame must be Frame must be
re-transmitted re-transmitted
TF = TRANSF TF = TRANSF
+ TIMEOUT here + TIMEOUT here
time time time time
15 16
Stop-and-wait ARQ: Performance Analysis (cont.) Go-back-n ARQ, damaged data frame
• average number of Frame transmissions to successfully deliver 1 packet to
Receiver is E = 1/(probability of error-free delivery) = 1/[(1-p)*(1-q)] = 1/[1-r]
• therefore average packet delay in ARQ scheme is D = (E-1)*TF + TS NAK 3 means
• therefore average packet throughput = 1/D and efficiency = TRANSF/D re-transmit
Frame 3 (also
• remember: efficiency is the fraction of the time new packets are delivered tells Sender that
all Frames before
• special cases: Frame 3 were
• symmetrical case: p = q ⇒ in this case, E = 1/(1-p)2 received correctly)

• no errors in ACKs/NAKs: q = 0 ⇒ in this case, r = p and E = 1/(1-p)


• optimal choice of TIMEOUT = TRANSA + 2*(PROP + PROC) ⇒ in this
case, TS = TF and therefore D = E*TS
• Sender and Receiver processing time negligible: PROC = 0
Receiver only accepts correctly-received Frames in the correct order
(so Receiver doesn’t have to buffer any Frames and re-order them…)
17 18

Go-back-n ARQ, lost data frame Go-back-n ARQ, lost ACK

} copies
discarded
ACK 3

Frame 3 discarded even though it was correctly received


BECAUSE Receiver was expecting Frame 2 (same for Frame 4)
19 20
Go-back-n ARQ: Performance Analysis Selective repeat ARQ, damaged data frame
• parameters: same as before may be (slightly) more efficient
• assume optimum choice of TIMEOUT = TRANSA + 2*(PROP + PROC) than Go-back-n ARQ, but also
• assume Window is large enough that Sender can transmit continuously if there much more complicated…
are no transmission errors
• can show average packet delay is D = [TRANSF + r*TIMEOUT] / (1-r)
where r = p+(1-p)*q as before
• therefore average packet throughput = (1-r) / [TRANSF + r*TIMEOUT] and error in
efficiency = [(1-r)*TRANSF] / [TRANSF + r*TIMEOUT] Frame 2
• note that as r → 0, efficiency of Go-back-n → 1 (or 100%): this shows that Go- stored at
back-n is capable of continuously delivering packets in the absence of errors
• under these conditions, you can show that the efficiency of Stop-and-wait
Sender must be able to
} Receiver
but cannot
be ACKed (yet)
ARQ is [(1-r)*TRANSF] / [TRANSF + TIMEOUT] select certain Frame(s)
for re-transmission
• Stop-and-wait ARQ efficiency → TRANSF / [TRANSF + TIMEOUT]
as r → 0: this shows the built-in inefficiency of the Stop-and-wait approach When frame 2 received correctly, Receiver can deliver the packets in
Frames 2-5 to its Network layer and send ACK 6 back to Sender.
21 Lost or damaged ACK/NAK handled similarly to Go-back-n ARQ. 22

High-level Data Link Control (HDLC) protocol High-level Data Link Control (HDLC) protocol: Modes
• mode = relationship between 2 communicating devices;
! HDLC standardised
by ISO in 1979 describes who controls the link
! now accepted by most • NRM = Normal Response Mode
other standards bodies • ARM = Asynchronous Response Mode
(ITU-T, ANSI, …)
! X.25 packet-switching networks • ABM = Asynchronous Balanced Mode
use a subset of HDLC called
LAPB (Link Access Procedure,
Balanced) – e.g. in ISDN
! 3 types of end-stations:
• Primary – sends commands
• Secondary – can only respond Any Either
to Primary’s commands
• Combined – can both command • in ARM, a secondary may initiate a transmission if the link is idle, but the
and respond transmission must still be sent to the Primary for relaying to another secondary
as in NRM: only difference is that secondary needs permission from the
! 3 types of configuration Primary in NRM, but doesn’t need permission from the Primary in ARM
(Note: no balanced multipoint)
23 24
High-level Data Link Control (HDLC) protocol: Frames High-level Data Link Control (HDLC) protocol: Frames
Frame format: in back-to-back Frame transmissions, the end-flag of one
!3 types of Frames are Frame can be used as the start-flag of the next Frame
defined (what is it about
the number 3?!?!):
• I-Frame – transports user
data and control info.
about user data (e.g. ACK) flag flag
• S-Frame – supervisory
Frame, only used for Control field: ARQ is Go-back-7 (or Go-back-127 in “extended mode”)
transporting control info. N(S), N(R) 3 bits long
• U-Frame – unnumbered ⇒ window size = 7;
Frame, reserved for in “extended mode”,
system management N(S), N(R) 7 bits long
(managing the link itself) ⇒window size = 127
FCS = Frame Check
Sequence (or Checksum):
2-byte or 4-byte CRC
25 26

Datalink layer in the Internet PPP Example: user wants to send Network layer data
! point-to-point links – 2 main possibilities:
• Serial Line IP (SLIP): defined in 1988
simple, character-oriented transmission: IP packet + framing flag negotiate options for establishing
the link (using LCP packets)
no error detection; no user authentication; only supports IP; doesn’t
support dynamic IP address assignment using some authentication protocol
• Point-to-Point Protocol (PPP): defined in 1994 (e.g. user sends username & password)
character-oriented transmission: HDLC-like framing (similar to X.25),
Link Control Protocol (LCP), Network Control Protocol (NCP) negotiate options for Network
layer activity , then send data
supports: error detection; user authentication; multiple network (using NCP packets)
protocols e.g. IP, IPX, CLNP; dynamic IP address assignment

most LANs have a broadcast


channel ⇒ need Medium
Access Control (MAC) &
Logical Link Control (LLC)
sublayers (details later)
“house-cleaning” for closing
the link (using LCP packets)
27 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