data communication netwotks (graduate level) data link...
TRANSCRIPT
![Page 1: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/1.jpg)
Department of Computer and IT Engineering
University of Kurdistan
Data Communication Netwotks (Graduate level)
Data Link Layer
By: Dr. Alireza Abdollahpouri
![Page 2: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/2.jpg)
2
Data Link Layer
![Page 3: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/3.jpg)
Data Link Layer
� Function: � Send blocks of data (frames)
between physical devices
� Regulate access to the physical media
� Key challenge: � How to delineate frames?
� How to detect errors?
� How to perform media access control (MAC)?
� How to recover from and avoid collisions ?
Application
Presentation
Session
Transport
Network
Data Link
Physical
3
![Page 4: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/4.jpg)
Adaptors Communicating
� link layer implemented in
“adaptor” (NIC)
� Ethernet card, PCMCI card, 802.11 card
� sending side:
� encapsulates datagram in a frame
� adds error checking bits, rdt, flow control, etc.
� receiving side
� looks for errors, rdt, flow control, etc
� extracts datagram, passes to receiving node
� adapter is semi-
autonomous
� link & physical layers
sending node
frame
receiving node
datagram
frame
adapter adapter link layer protocol
4
![Page 5: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/5.jpg)
Hop-to-hop delivery
5
![Page 6: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/6.jpg)
6
Service provided by the data link layer for network layer:
Link-Layer Services
• Unacknowledged connectionless service • Acknowledged connectionless service • Acknowledged connection-oriented service
![Page 7: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/7.jpg)
7
Link-Layer Duties
� Framing
� Encapsulating packet into frame, adding header, trailer
� Using MAC addresses, rather than IP addresses
� Error detection and/or correction
� Errors caused by signal attenuation, noise.
� Receiver detecting presence of errors
� Receiver correcting errors without retransmission
� Flow control
� Pacing between adjacent sending and receiving nodes
� Media access control (MAC)
� Pacing between adjacent sending and receiving nodes
![Page 8: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/8.jpg)
8
Framing
![Page 9: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/9.jpg)
9
Framing
Break sequence of bits into a frame
� Typically implemented by the network adaptor
10110101000011001….1000100110101010101
How to define the borders?
![Page 10: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/10.jpg)
Byte Counting (character count)
� Sender: insert length of the data in bytes at the beginning of each frame
� Receiver: extract the length and read that many bytes
Data
132
132
what if the count field gets corrupted?
10
![Page 11: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/11.jpg)
Byte Oriented: Byte stuffing
� Add START and END sentinels to the data
� Problem: what if END appear in the data?
� Add a special DLE (Data Link Escape) character before END
� What if DLE appears in the data? Add DLE before it.
� Used by Point-to-Point protocol, e.g. modem,
DSL, cellular
Data START END END DLE DLE DLE
11
![Page 12: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/12.jpg)
Bit Oriented: Bit Stuffing
� Add sentinels to the start and end of data � Both sentinels are the same
� Example: 01111110 in High-level Data Link Protocol (HDLC)
� Sender: insert a 0 after each 11111 in data � Known as “bit stuffing”
� Receiver: after seeing 11111 in the data… � 111110 � remove the 0 (it was stuffed)
� 111111 � look at one more bit � 1111110 � end of frame � 1111111 � error! Discard the frame
� Disadvantage: 20% overhead at worst
Data 01111110 01111110
12
![Page 13: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/13.jpg)
13
Bit Stuffing- example
![Page 14: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/14.jpg)
14
• The combinations of low-low and high-high which are not
used for data may be used for marking frame boundaries.
• Only applicable if physical layer coding has some
redundancy
Physical Layer Coding Violations
e.g., in Manchester coding
![Page 15: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/15.jpg)
15
Error Control
![Page 16: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/16.jpg)
Transmission Errors
� Transmission errors are caused by: � Thermal noise {Shannon}
� impulse noise (e..g, arcing relays)
� signal distortion during transmission (attenuation)
� crosstalk
� voice amplitude signal compression (companding)
� quantization noise (PCM)
� jitter (variations in signal timings)
� receiver and transmitter out of synch. 16
![Page 17: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/17.jpg)
Packet corruption
� single bit; only 1 bit in the data unit has changed
� burst error; 2 or more bits in the data unit have changed
Example:
0.01 s of burst impulse noise 1200 bps data rate 12 bits of errors
less likely
Types of errors:
17
![Page 18: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/18.jpg)
18
Error Detection
� Error detection
� Transmit extra (redundant) information
� Use redundant information to detect errors
� Extreme case: send two copies of the data
� Trade-off: accuracy vs. overhead
� Techniques for detecting errors
� Parity checking
� Checksum
� Cyclic Redundancy Check (CRC)
![Page 19: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/19.jpg)
Error detection
� Redundancy: adding extra bits for detecting
errors at the destination
19
![Page 20: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/20.jpg)
Error detection techniques
20
![Page 21: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/21.jpg)
Parity bits
� Detects 1-bit errors and some 2-bit errors
� Not reliable against bursty errors
� Idea: add extra bits to keep the number of 1s even
� Example: 7-bit ASCII characters + 1 parity bit
0101001 1 0 1 1 1 1011110 0110100 1101001 0001110
21
![Page 22: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/22.jpg)
Two Dimensional Parity
� Can detect all 1-, 2-, and 3-bit errors, some 4-bit errors
� 14% overhead
0101001 1101001 1011110 0001110 0110100 1011111
1 0 1 1 1 0
1111011 0
Parity bit for
each row
Parity bit for
each column Parity bit for
the parity byte
22
![Page 23: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/23.jpg)
Two Dimensional Parity Examples
0101001 1101001 1011110 0001110 0110100 1011111
1 0 1 1 1 0
1111011 0
Odd number of 1s
Odd Number of
1s
1
23
0101001 1101001 1011110 0001110 0110100 1011111
1 0 1 1 1 0
1111011 0
Odd Number of 1s
1 1
Odd number of
1s
![Page 24: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/24.jpg)
Two Dimensional Parity Examples
0101001 1101001 1011110 0001110 0110100 1011111
1 0 1 1 1 0
1111011 0
1 1
Odd number of
1s
1
24
Odd number of 1s 0101001
1101001 1011110 0001110 0110100 1011111
1 0 1 1 1 0
1111011 0
1 1
1 0
Cannot be detected
![Page 25: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/25.jpg)
Error detection techniques
25
![Page 26: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/26.jpg)
Checksums
� Idea:
� Add up the bytes in the data
� Include the sum in the frame
� Use ones-complement arithmetic
� Lower overhead than parity: 16 bits per frame
� But, not resilient to errors
� Why?
� Used in UDP, TCP, and IP
Data START END Checksum
0101001 1101001= 10010010 +
0 1
26
![Page 27: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/27.jpg)
Checksum
1. The data unit is divided into k sections, each of n bits
2. All sections are added using 1’s complement
3. The sum is complemented
4. The checksum is sent with data
Example:
IP header
27
![Page 28: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/28.jpg)
1’s complement
� Suppose the following block of 16 bits is to be sent using a checksum of 8 bits.
10101001 00111001
� The numbers are added using one’s complement
10101001
00111001 ------------
Sum 11100010
Checksum 00011101
The pattern sent is 10101001 00111001 00011101
28
![Page 29: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/29.jpg)
Checksum (cnt’d)
� Performance
� Can we use this technique to detect an error if 2 corresponding opposite bits in 2 data segments become corrupted?
� An example:
Transmitted sequence: 10101001 00111001
00011101 Received sequence: 00101001 10111001
00011101 29
![Page 30: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/30.jpg)
Error detection techniques
30
![Page 31: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/31.jpg)
Cyclic Redundancy Check (CRC)
� Uses field theory to compute a semi-unique value
for a given message
� Much better performance than previous
approaches
� Fixed size overhead per frame (usually 32-bits)
� Quick to implement in hardware
� Only 1 in 232 chance of missing an error with 32-bit CRC
� Details are in the book/on Wikipedia
31
![Page 32: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/32.jpg)
Cyclic Redundancy Check (CRC)
• Represent a (n+1)-bit message as an n-degree polynomial M(x)
–E.g., 10101101 � M(x) = x7 + x5 + x3 + x2 + x0
• Choose a divisor k-degree polynomial G(x)
• Compute reminder R(x) of M(x)*xk / G(x), i.e., compute A(x) such that
M(x)*xk = A(x)*G(x) + R(x), where degree(R(x)) < k
• Let
T(x) = M(x)*xk – R(x) = A(x)*G(x)
• Then
–T(x) is divisible by G(x)
32
![Page 33: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/33.jpg)
CRC check
� Based on binary division
� CRC added to the data unit so that the resulting data becomes exactly divisible by a predetermined number
� CRC
� exactly 1 less bit than the divisor
1. A string of n zeros added to the data unit
2. New data divided by divisor
3. Replace 0’s by CRC
33
![Page 34: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/34.jpg)
� Modulo-2 division
CRC generator
34
![Page 35: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/35.jpg)
CRC generator (cnt’d)
Name Polynomial Application
CRC-8 x8 + x2 + x + 1 ATM header
CRC-10 x10 + x9 + x5 + x4 + x 2 + 1 ATM AAL
ITU-16 x16 + x12 + x5 + 1 HDLC
ITU-32 x
32 + x26 + x23 + x22 + x16 + x12 + x11 + x10
+ x8 + x7 + x5 + x4 + x2 + x + 1 LANs
35
![Page 36: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/36.jpg)
� CRC can detect
1. all burst errors that affect odd number of bits
2. all burst errors of length ≤≤≤≤ degree of polynomial
3. with high probability burst errors > degree of polynomial
Example:
CRC-12 (degree of 12)
1. OK
2. OK
3. 99.97 %
CRC performance
36
![Page 37: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/37.jpg)
Error correction
1. By retransmission
� flow and error control protocols
2. Forward Error Correction (FEC)
� require more redundancy bits
� should locate the invalid bit or bits
� n-bit code word contains m data bits + r redundancy bits
n=m+r
� m+r+1 bits discoverable by r bits
Example:
� For m=5 data bits can r be 3?
12 ++≥ rmr
37
m r
Code-word
![Page 38: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/38.jpg)
• The Hamming distance is the number of bits that have to
be changed to get from one bit pattern to another.
Example: 10010101 & 10010011 have a hamming
distance of 2
• For any coding whose members have a Hamming
distance of two, any one bit error can be detected.
Why?
Hamming distance
38
![Page 39: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/39.jpg)
x = codewordso = non-codewords
x
x x
x
x
x
x
o
o o
o o
o o
o
o o
o
o x
x x
x
x x
x
o o o
o o
o o o o
o
o
o
A code with poor distance properties
A code with good distance properties
(a) (b)
Hamming distance
39
![Page 40: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/40.jpg)
� To detect d single bit errors, you need a d+1 code distance.
� To correct d single bit errors, you need a 2d+1 code distance.
� In general, the price for redundant bits is too
expensive to do error correction for network
messages.
� Network protocols use error detection and
ARQ.
Error detection/correction
40
![Page 41: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/41.jpg)
Hamming code
Example: 7-bit ASCII code + 4 bit redundancy
� Each r bit is the parity bit for one combination of data bits
r1: bits: 1, 3, 5, 7, 9, 11
r2: bits: 2, 3, 6, 7, 10, 11
r3: bits 4, 5, 6, 7
r4: bits 8, 9, 10, 11
20 1 1 1 1 1 1
21 2 2 2 2 2 2
22 4 4 4 4
23 8 8 8 8
Σ Σ Σ Σ Σ Σ Σ Σ Σ Σ Σ
1 2 3 4 5 6 7 8 9 10 11
41
![Page 42: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/42.jpg)
Hamming code (cnt’d)
Example of redundancy bit calculation (even parity)
42
![Page 43: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/43.jpg)
Hamming code (cnt’d)
Error detection using Hamming code
once the bit is identified the receiver can reverse its value
43
![Page 44: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/44.jpg)
44
Flow Control
![Page 45: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/45.jpg)
Flow Control
Transmission Link
Buffer
The process of managing the rate of data transmission between two nodes to prevent a fast sender from overwhelming a slow receiver
45
![Page 46: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/46.jpg)
Categories of Flow Control
46
![Page 47: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/47.jpg)
Stop-and-Wait Automatic Repeat reQuest
� Simplest flow and error control mechanism
� The sending device keeps a copy of the last frame
transmitted until it receives an acknowledgement
� identification of duplicate transmission (lost or
delayed ACK)
� A damaged or lost frame is treated in the same way
� Timers introduced
� Positive ACK sent only for frames received safe & sound
47
![Page 48: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/48.jpg)
A Simplex Stop-and-Wait ARQ
1. Normal operation
2. The frame is lost
3. The ACK is lost
4. The ACK is delayed
48
![Page 49: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/49.jpg)
Stop-and-Wait ARQ(Normal operation)
� The sender will not send the next piece of data until it is sure that the current one is correctly received
� sequence number necessary to check for duplicated packets
� No NACK – when packet is corrupted – duplicate ACKs instead
49
![Page 50: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/50.jpg)
Stop-and-Wait ARQ(Lost or damaged frame)
roundtrip time + processing in the receiver
Should be as short as possible. Why?
50
![Page 51: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/51.jpg)
Stop-and-Wait ARQ (Lost ACK)
Importance of frame
numbering
51
Numbering frames prevents the retaining of duplicate frames
![Page 52: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/52.jpg)
Stop-and-Wait ARQ (Delayed ACK)
Importance of ACK
numbering
52
Numbered acknowledgments are needed if an acknowledgment is delayed and the next frame is lost.
![Page 53: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/53.jpg)
Duplex Stop-and-Wait ARQ
� Piggybacking
� combine data with ACK (less overhead saves bandwidth)
53
![Page 54: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/54.jpg)
Utilization = dtrans /( dtrans + 2 dprop), error free case
or
Utilization = (1-PE)dtrans /( dtrans + 2 dprop, ) error case
Performance of Stop-and-wait ARQ
dtrans= (Frame size)/Bandwidth
dptop= (Speed of signal)/ (Channel length)
RT
T
54
![Page 55: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/55.jpg)
Stop-and-wait operation
first bit transmitted, t = 0
sender receiver
RTT
last bit transmitted, t = L / R
first bit arrives
last bit arrives, send ACK
ACK arrives, send next frame, t = RTT + L / R
U sender
= .008
30.008 = 0.00027
microsec
L / R
RTT + L / R =
Example: 1 Gbps link, 15 ms prop. delay, 8000 bit frame:
dsmicrosecon8bps10
bits80009
===R
Ld
trans
55
very low
![Page 56: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/56.jpg)
Sliding window (Pipelined) protocols
Pipelining: sender allows multiple, “in-flight”, yet-to-be-
acknowledged frames
� range of sequence numbers must be increased
� buffering at sender and/or receiver
� Two generic forms of pipelined protocols:
Go-Back-N , Selective repeat 56
![Page 57: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/57.jpg)
Sliding Window Protocols
� Sequence numbers � sent frames are numbered sequentially
� number of frames stored in the header � if the number of bits in the header is m than
sequence number goes from 0 to 2m-1
� Sliding window � to hold the unacknowledged
outstanding frames
sequence number
frame
acknowledged frames
57
![Page 58: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/58.jpg)
Question
� What is the consequence of the window size
in the receiver on the order of the received
packets?
Answer:
� Window size 1 means that the packets are
received in order
� This is not the case for the larger window size 58
![Page 59: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/59.jpg)
59
Sliding Window: Retransmission Strategies
How to deal with errors?
• Sender only retransmits frames for which a NAK
is received (the lost or corrupted frames)
(Selective repeat)
• If the ACK is not received then the sender must go back and retransmit earlier frames (from the lost
frame) (Go-Back-N)
![Page 60: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/60.jpg)
Go-back-N (Control variables)
� S- holds the sequence number of the recently sent frame
� SF – holds sequence number of the first frame in the window
� SL – holds the sequence number of the last frame
� R – sequence number of the frame expected to be received
60
![Page 61: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/61.jpg)
The name of Go-back-N: why?
� Re-sending frame
� when the frame is damaged the sender goes back and
sends a set of frames starting from the last one ACKn’d
� the number of retransmitted frames is N
Example: The window size is 4.
A sender has sent frame 6 and the timer expires for frame 3
(frame 3 not ACKn’d). The sender goes back and re-sends
the frames 3, 4, 5 and 6.
61
![Page 62: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/62.jpg)
Go-back-N (normal operation)
� How many frames can be transmitted without acknowledgment?
� ACK1 – not necessary if ACK2 is sent
expected sequence number
62
![Page 63: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/63.jpg)
Go-back-N (damaged or lost frame)
damaged frames are discarded!
Why are correctly received packets not buffered?
What is the disadvantage of this?
63
![Page 64: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/64.jpg)
Go-back-N (sender window size)
sequence number
64
![Page 65: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/65.jpg)
Go-back-N (drawback)
� Inefficient
� all out of order received packets are discarded
� This is a problem in a noisy link
� many frames must be retransmitted -> bandwidth consuming
� Solution
� re-send only the damaged frames
� Selective Repeat ARQ
� avoid unnecessary retransmissions 65
![Page 66: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/66.jpg)
Selective Repeat ARQ
� Processing at the receiver more complex
� The window size is reduced to 2m-1 (at most)
� Both the transmitter and the receiver have the
same window size
� Receiver expects frames within the range of
the sequence numbers
66
![Page 67: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/67.jpg)
Selective Repeat ARQ (lost frame)
67
![Page 68: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/68.jpg)
68
Selective Repeat
![Page 69: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/69.jpg)
Selective Repeat ARQ (sender window size)
69
![Page 70: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/70.jpg)
Frame transmission time is normalized to a value of 1; thus, the propagation time is a.
Sliding window- analysis
70
![Page 71: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/71.jpg)
71
The throughput on the line depends on both the window size W and the value of a
Sliding window- analysis
![Page 72: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/72.jpg)
72
Error free channel
Selective repeat
with error
Go-back-N
with error
Sliding window- utilization
Assum
e a
fra
me is in
Assum
e a
fra
me is in
err
or
with p
robabili
ty P
a =dprop/dtrans
![Page 73: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/73.jpg)
73
How many sequence numbers required?
Receiver window size
Transmitter window size
2 1 1 Stop-and-wait ARQ
1+W 1 W Go-back-N
2W W W Selective repeat
In SR protocol with the window size of 5, how many bits
required to numbering the sequence of frames?
2*5=10 sequence numbers, we need 4 bits
Sequence number and window size
![Page 74: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/74.jpg)
Stop-and-wait utilization (example)
74
A channel has a bit rate of 4 kbps and a propagation delay of 20 ms. For what range of frame sizes does Stop-and-Wait give an efficiency (link utilization) > 50%?
Efficiency will be 50% when the time to transmit the frame
equals the roundtrip propagation delay. At a transmission rate
of 4 bits/ms, 160 bits takes 40 ms. For frame sizes above 160
bits, stop‐and‐wait is reasonably efficient.
![Page 75: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/75.jpg)
75
Seven‐‐‐‐bit sequence numbers are needed
To operate efficiently, the sequence space (actually, the send window size) must be large enough to allow the transmitter to keep transmitting until the first acknowledgement has been received. The propagation time is 18 ms. At T1 speed, which is 1.536 Mbps (excluding the 1 header bit), a 64‐byte frame takes 0.300 msec. Therefore, the first frame fully arrives 18.3 msec after its transmission was started. The acknowledgement takes another 18 msec to get back, plus a small (negligible) time for the acknowledgement to arrive fully. In all, this time is 36.3 msec. The transmitter must have enough window space to keep going for 36.3 msec. A frame takes 0.3 ms, so it takes 121 frames to fill the pipe.
Sliding window utilization (example)
A 3000‐‐‐‐km‐‐‐‐long T1 trunk is used to transmit 64‐‐‐‐byte frames using selective-repeat protocol. If the propagation speed is 6 µsec/km, how many bits should the sequence numbers be?
![Page 76: Data Communication Netwotks (Graduate level) Data Link …eng.uok.ac.ir/abdollahpouri/Data_Communication... · Department of Computer and IT Engineering University of Kurdistan Data](https://reader031.vdocument.in/reader031/viewer/2022020413/5b4467d77f8b9a3c158b54c8/html5/thumbnails/76.jpg)
76
Questions Questions