Beruflich Dokumente
Kultur Dokumente
Introduction
Synchronization
Error Detection
Flow Control
Error Control (via Retransmission)
University of Virginia
Introduction
Main Task of the data link layer:
n Provide error-free transmission over a link
Network Layer
Network Layer
Physical Layer
Physical Layer
University of Virginia
Introduction
n
Example
01111110
8bits
Address
8bits
Control
8bits
Data
>=0
Header
Checksum
16bits
01111110
8bits
Trailer
University of Virginia
Framing
n
n
Data
01111110
Problem:
The sequence '01111110' must not appear in the
data of the frame
University of Virginia
0110111111111111111100
011011111 0111110111110100
Stuffed bits
0110111111111111111100
University of Virginia
Error Control
Two basic approaches to handle bit errors:
Error-correcting codes
-
University of Virginia
Parity Checks
University of Virginia
Parity Checks
General Method:
n Append a parity bit to the end of each character in a
frame such that the total number of '1' in a character
is:
-
Example:
University of Virginia
University of Virginia
10
University of Virginia
Step 1: Prerequisites
n
Modulo-2 Arithmetic:
+
11
University of Virginia
Define:
n M(x) Data block is a polynomial (= Message, Frame)
n P(x) "Generator Polynomial" which is known to both
sender and receiver (degree of P(x) is n)
12
University of Virginia
Note:
13
University of Virginia
Step 3: Encoding
M (x) = x9 + x8 + x6 + x 4 + x3 + x + 1
-
(I)
(II)
(III)
14
University of Virginia
For example,
Sent Message:
1011101
Received Message: 1 1 1 1 0 0 1
______________________________
Error:
0100100
E(x) = x 5 + x 2
Jorg Liebeherr, 1998
15
University of Virginia
16
University of Virginia
= x j (x k+1)
If P(x) does not divide (xk +1) for any k up to the max.
frame length then all double errors can be detected.
P(x)= x15+ x14 +1 will not divide E(x)= x k + 1 for any k 32,768
17
University of Virginia
18
CRC-12:
P(x) = x 12 + x 11 + x 3 + x 2 + x + 1
CRC-16:
P(x) =
CRC-CCITT:
P(x) = x 16 + x 12 + x 5 + 1
x 16 + x 15 + x 2 + 1
CRC-32: P(x) = x 32 + x 26 + x 23 + x 22 + x 16 + x
x 11 + x 10 + x 8 + x7 + x 5 + x 4 + x 2 + x + 1
Jorg Liebeherr, 1998
12
+
19
Stop-and-Wait Protocol
University of Virginia
Flow Control
University of Virginia
20
10
Operations:
University of Virginia
21
University of Virginia
Analysis of Stop-and-Wait
End of Transmit of
ACK
Receiver
propagation
delay
Frame
Frame
transmission
delay
Start Transmit
End Transmit
ACK
ACK
Sender
Last bit of ACK received
22
11
Example:
Frame Size
Data rate of network
University of Virginia
Analysis of Stop-and-Wait
= 1000 bit
= 1 Mbps
23
Example:
Distance
Propagation delay
University of Virginia
Analysis of Stop-and-Wait
300,000 km/sec,
200,000 km/sec
= 1000 km
= 1000 km / (200,000 km/sec)
= 5 msec
24
12
University of Virginia
Analysis of Stop-and-Wait
n
Notation:
C
I
H
D
F
A
F/C
25
University of Virginia
Analysis of Stop-and-Wait
Data frame
header
H
data
D
F
Acknowledgement
a=
Jorg Liebeherr, 1998
ACK
A
propagatio n delay
transmissi on delay
I
F /C
26
13
University of Virginia
Analysis of Stop-and-Wait
n
End ACK
Transmit
F/C +I + A/C
Receiver
Sender
Start Transmit
0
End Transmit
F/C
27
University of Virginia
Analysis of Stop-and-Wait
D /C
D
=
F / C + A / C + 2 I F + A + 2 IC
D
1
=
D + 2 IC
1 + 2a
28
14
University of Virginia
Exercise 1
Satellite Link
-
n
n
29
University of Virginia
Exercise 2
Local Area Network (LAN)
-
n
n
n
30
15
University of Virginia
31
Sending Window:
-
University of Virginia
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6
Frame
sequence
number
Last frame
transmitted
Window shrinks as
frames are sent
Window expands as
acknowledgements are
received
32
16
Receiving Window:
-
University of Virginia
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6
Last frame
acknowledged
Window shrinks as
frames are received
Window expands as
acknowledgements are
sent
33
University of Virginia
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6
34
17
University of Virginia
Receive a single
acknowledgement (ACK 1)
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6
35
University of Virginia
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6
36
18
University of Virginia
Transmit a single
acknowledgement ("ACK 1"):
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6
37
University of Virginia
38
19
University of Virginia
Example
Transmitter
Receiver
0 1 2 3 4 5 6 7 0 1 2 3
F0
F1
F2
0 1 2 3 4 5 6 7 0 1 2 3
0 1 2 3 4 5 6 7 0 1 2 3
0 1 2 3 4 5 6 7 0 1 2 3
ACK4
0 1 2 3 4 5 6 7 0 1 2 3
0 1 2 3 4 5 6 7 0 1 2 3
39
University of Virginia
Example Continued
Transmitter
Receiver
0 1 2 3 4 5 6 7 0 1 2 3
F3
0 1 2 3 4 5 6 7 0 1 2 3
F4
F5
F6
0 1 2 3 4 5 6 7 0 1 2 3
0 1 2 3 4 5 6 7 0 1 2 3
ACK3
0 1 2 3 4 5 6 7 0 1 2 3
0 1 2 3 4 5 6 7 0 1 2 3
40
20
Define:
(Normalization)
41
University of Virginia
Wth frame
received
a+W
...
0
University of Virginia
Receiver
Sender
2a+1
1st ACK
received
42
21
University of Virginia
normalized efficiency = 1
n
W
1 + 2a
43
University of Virginia
44
22
University of Virginia
45
01111110
Address
Control
Data
Checksum
University of Virginia
01111110
46
23
University of Virginia
ARQ Schemes
n
Stop-and-Wait ARQ
Go-Back-N ARQ
47
University of Virginia
Stop-and-Wait ARQ
48
24
ACK 1
0
Frame
0
Frame
ACK 1
University of Virginia
Stop-and-Wait ARQ
Timeout
A
CS 457 - Computer Networks
1
Frame
ACK 0
ACK 0
ACK 1
ACK 0
University of Virginia
1
Frame
1
Frame
49
Jorg Liebeherr, 1998
50
0
Frame
1
Frame
Lost ACK
n
Lost Frame
n
Timeout
Stop-and-Wait ARQ
25
Operations:
51
University of Virginia
Frames 4,5,6
are retransmitted
Lost Frame
ACK 6
NAK 4
ACK 3
6
Frame
5
Frame
4
Frame
6
Frame
5
Frame
4
Frame
3
Frame
2
Frame
1
Frame
0
Frame
Go-Back-N ARQ
n
University of Virginia
Go-Back-N ARQ
B
Frames 5 and 6
are discarded
Jorg Liebeherr, 1998
52
26
University of Virginia
Frames 0-4
are retransmitted
Lost ACK
Timeout
ACK 5
ACK 3
ACK 3
5
Frame
4
Frame
3
Frame
2
Frame
1
Frame
0
Frame
4
Frame
3
Frame
2
Frame
1
Frame
0
Frame
Go-Back-N ARQ
B
Frames 3 and 4 are discarded
Jorg Liebeherr, 1998
53
University of Virginia
Frame
Scenario 1:
A transmits frame i, and B detects error in frame i, but
has received frames i-1, i-2,... correctly
B sends NAKi
Scenario 2:
Frame i is lost or B does not recognize frame i
Assume that A sends frame i+1 and B receives it
B sends NAKi, or A will timeout and
retransmit frame i and all subsequent frames
54
27
University of Virginia
or
A retransmits frame i and all subsequent frames
Scenario 4: NAKi is lost
A will eventually time out
55
University of Virginia
1
2
3
2
3
4
In Go-back-N, if
frames are
correctly delivered,
they are delivered
in the correct
sequence
Therefore, the
receiver does not
need to keep track
of `holesin the
sequence of
delivered frames
Frames
received
ACK2
frame 1 is correct, send ACK 2
NAK2
frame 2 is in error, send NAK2
4
3
2
3
A
4 retransmit frame 2,3,4
56
28
University of Virginia
Selective-Repeat ARQ
n
Disadvantages:
More complexity at sender and receiver
57
University of Virginia
only Frame 4
is retransmitted
Lost Frame
ACK 1
ACK 0
ACK 5
K4
ACK 7
ACK 6,
NA
ACK 4
ACK 3
ACK 2
ACK 1
0
Frame
7
Frame
4
Frame
6
Frame
5
Frame
4
Frame
3
Frame
2
Frame
1
Frame
0
Frame
Selective-Repeat ARQ
B
Frames 5 and 6
are buffered
Jorg Liebeherr, 1998
58
29
University of Virginia
1
2
3
2
3
4
2
3
4
5
Receiver must
keep track of
`holesin the
sequence of
delivered frames
Sender must
maintain one timer
per outstanding
packet
Frames
received
ACK2
frame 1 is correct, send ACK 2
3
NAK2
retransmit frame 2
3
4
59
A number of assumptions:
University of Virginia
60
30
University of Virginia
Parameters:
U= efficiency
Tt= F/C transmission delay of a frame
I= propagation delay
a= I/Tt
P = Probability that a frame is in error
U=
Tt
Tt + 2 I
61
With Errors:
University of Virginia
1
E [ A ] = i P i 1( 1 P ) =
1 P
i =1
Tt
( 1 P ) Tt 1 P
=
=
E [ A ] ( Tt + 2 I )
Tt + 2 I
1 + 2a
62
31
University of Virginia
W Tt > 2I + Tt
W
1+ 2a
W Tt > 2I + Tt
U = 1 P
= 1
W Tt < 2I + Tt
U=
With Errors
W Tt < 2I + Tt
U=
W (1 P )
1 + 2a
63
University of Virginia
64
32
SOH NUM
1byte
CNUM
1
Data
<=128
CKS
1
SOH:
NUM:
CNUM:
Data:
up to 128 bytes
CKS:
65
University of Virginia
XModem
n
NAK:
ACK:
EOT:
Variations of XModem:
XModem-CRC : uses CRC
YModem: allows to send 1,024 bytes of data in a
frame. Also: allows batch file transfers
ZModem
University of Virginia
66
33