Top Banner
1 Data Link Layer
63

Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

Mar 06, 2018

Download

Documents

phungthuy
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

1

Data Link Layer

Page 2: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

2

Data Link Layer Functionality

Services provided by the link layerFrame creationError detection and/or correctionFlow controlReliable delivery

Creating the illusion of a reliable link

Page 3: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

3

Framing

The data unit at the data link layer is called a “frame”A frame is a group of bits, typically in sequenceIssues:

Frame creationFrame delineation

Page 4: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

4

Frame Delineation

How to tell when a new frame starts:Frame tags with character stuffingFrame tags with bit stuffing

Page 5: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

5

Frame tagging with character stuffing

Use starting and ending characters (tags) to mark boundaries of frameProblem: What if tag characters occur in the data or control portions of the frame?

Frame tags (special characters)

Page 6: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

6

Character stuffing

Insert extra escape characters when a tag appears in data field

STXDLE

ETXDLE

DLEDLE

Start Tag

End Tag

Character Stuffed DLE code

Page 7: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

7

Character Stuffing Example

DLEI am a jerk trying to DLE crash your network! ETX

DLEI am a jerk trying to DLE crash your network! ETXSTXDLE DLE DLE ETXDLE

DLEI am a jerk trying to DLE crash your network! ETX

Tagging and Character Stuffing

Untagging and Character Unstuffing

Page 8: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

8

Character StuffingPPP

PPP = Point-to-Point Protocol, used widely in the InternetPPP uses frame tags with character or byte stuffing

01111110 Control Fields Payload (up to 1500 bytes) Checksum 01111110

PPP Frame Format

Character Frame Tags

Page 9: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

9

Frame tagging with bit stuffing

Bit strings may be used instead of character sequences to delineate framesMore efficient

Page 10: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

10

Bit stuffing

Each frame begins with a start and end bit sequence, e.g., 01111110When sender’s data link layer sees five 1’s in a row, it stuffs a zero bitThe receiver “unstuffs” a zero after five consecutive 1’s.

Page 11: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

11

Bit unstuffing

When a pattern of five 1s appears, examine sixth bitIf the sixth bit is 0, remove it (stuffed bit)If the sixth bit is 1, check seventh bit

If 0, accept as flag (BOF or EOF)If 1, error

Page 12: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

12

Bit Stuffing Example

Tagging and Bit Stuffing

Untagging and Bit Unstuffing

00110010111111100010100

0111111000110010111110110001010001111110

00110010111111100010100

Page 13: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

13

Bit StuffingHDLC

HDLC = High-level Data Link Control. Used in X.25 networksHDLC uses frame tags with bit stuffing

01111110 Control Fields Payload (arbitrarily long) Checksum 01111110

HDLC Frame Format

Character Frame Tags

Page 14: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

14

Error Control

No physical link is perfectBits will be corruptedWe can either:

detect errors and request retransmissionor correct errors without retransmission

Page 15: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

15

Error Detection

Parity bitsPolynomial codes or checksums

Page 16: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

16

Parity bits

Append a single parity bit to a sequence of bitsIf using “odd” parity, the parity bit is chosen to make the total number of 1’s in the bit sequence odd.If “even” parity, the parity bit makes the total number of 1’s in the bit sequence even

Page 17: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

17

Parity bits: Example

00010101 even

01111 even

11111111 odd

10011 odd

TransmittedSequence Parity

ParityBit

Page 18: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

18

Parity Bits

Only detects when there are an odd number of bit errorsDoes not detect an even number of bit errorsIt also has high overhead; it requires 1 extra bit for every several bits transmitted

Page 19: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

19

Checksum

Consider data as 16 bit words.Add all the data values (1s complement of this sum is the checksum)Receiver adds all the words and the checksum. If no errors, then sum is all 1s

Page 20: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

20

Polynomial Codes

Can detect errors on large chunks of dataHas low overheadMore robust than parity bitRequires the use of a “code polynomial”

Example: x2 + 1

Page 21: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

21

Cyclic Redundancy Check

CRC: Example of a polynomial codeProcedure:1. Let r be the degree of the code polynomial. Append r zero

bits to the end of the transmitted bit string. Call the entire bit string S(x)

2. Divide S(x) by the code polynomial using modulo 2 division.3. Subtract the remainder from S(x) using modulo 2 subtraction.

The result is the checksummed message

Page 22: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

22

Generating a CRCExample

Message: 1011 1 x x3 + 0 x x2 + 1 x x + 1 = x3 + x + 1

Code Polynomial: x2 + 1 (101)

Step 1: Compute S(x)

r = 2

S(x) = 101100

Page 23: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

23

Generating a CRCExample (cont’d)

Step 2: Modulo 2 divide

101100101101

001000

01000010010101

1001

Remainder

Page 24: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

24

Generating a CRCExample (cont’d)

Step 3: Modulo 2 subtract the remainder from S(x)

101100- 01101101

Checksummed Message

Page 25: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

25

Decoding a CRC

Procedure1. Let n be the length of the checksummed message

in bits2. Divide the checksummed message by the code

polynomial using modulo 2 division. If the remainer is zero, there is no error detected.

Page 26: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

26

Decoding a CRCExample

101101 Checksummed message (n = 6)

1011 Original message (if there areno errors)

101101101101

001000

01000010110100

1001

Remainder = 0(No error detected)

Page 27: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

27

Decoding a CRCAnother Example

When a bit error occurs, there is a large probability that it will produce a polynomial that is not an even multiple of the code polynomial, and thus errors can usually be detected.

101001101101

000000

00000000100001

1000

Remainder = 1(Error detected)

Page 28: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

28

Choosing a CRC polynomial

The longer the polynomial, the smaller the probability of undetected errorCommon standard polynomials:(1) CRC-12: x12 + x11 + x3 + x2 + x1 + 1(2) CRC-16: x16 + x15 + x2 + 1(3) CRC-CCITT: x16 + x12 + x5 + 1

Page 29: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

29

Flow Control

What happens if the sender tries to transmit faster than the receiver can accept?Data will be lost unless flow control is implemented

Page 30: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

30

Controlling the Flow of Data

Slow JoeFast Frank

Page 31: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

31

Some Flow Control Algorithms

Flow control for the ideal networkStop and Wait for noiseless channelsStop and Wait for noisy channelsSliding window protocolsSliding window with error control

– Go Back N– Selective Repeat

Page 32: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

32

Flow control in the ideal network

Assumptions:Error free transmission link,Infinite buffer at the receiver

No acknowledgement of frames necessarySince the data link is error-free and the receiver can buffer as many frames as it likes, no frame will ever

be lost

Page 33: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

33

Flow control in the ideal network (cont’d)

Slow JoeFast Frank

Infinite bucket

Page 34: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

34

Stop and Wait with Noiseless Channels

Assumptions:Error free transmission link,Finite buffer at the receiver

Problem of Buffer overflow at the receiverBuffer overflow may happen at the receiver when the sending router sends frames at a rate faster than the receiving router

Page 35: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

35

Stop and Wait with Noiseless Channels (cont’d)

Slow JoeFast Frank

Finite bucket (once full, ball is lost)

Page 36: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

36

Stop and Wait with Noiseless Channels (cont’d)

Solution: Stop-and-WaitThe receiver sends an acknowledgement frame telling the sender to transmit the next data frame. The sender waits for the ACK, and if the ACK comes, it transmits the next data frame.

Page 37: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

37

Stop and Wait with Noiseless Channels (cont’d)

Data

ACK

Data

Page 38: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

38

Stop and Wait (cont’d)

Note that we assume an error-free transmission link and therefore ACK frames will not be lostIn this flow control protocol, there are two types of frames: data frames and ACK frames. The ACK frames don’t contain any particular information, since only the arrival of the ACK frame at the sender is important.

Page 39: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

39

Stop and Wait for Noisy Channels

Assumptions:Transmission link may cause errors in frames,

Finite buffer at the receiver

ACK frames may now be lost

Page 40: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

40

Problems introduced by a noisy line

Problem 1: Loss of a data or ACK frameSince the transmission link is not error-free, a data or ACK frame may be lost, causing the sender to wait indefinitely for an ACK

Page 41: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

41

Loss of an ACK frame

ACK

Data

error

?

Page 42: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

42

Problems introduced by a noisy line

Can we solve problem 1 by introducing a timeout period for the sender? Yes, but...

Problem 2: Duplicated framesIf the ACK frame for a certain data frame is lost, the sender will retransmit the same frame after a time-out period, and the receiver will then have two copies of the same frame

Page 43: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

43

Duplicated data frames

Data

ACK

Data

TimedOut

Duplicate data

Page 44: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

44

Stop and Wait for Noisy Channels (cont’d)

Solution:The sender uses a timer to retransmit data frames when an ACK has not arrivedThe sender includes a sequence number in each frame to distinguish one frame from another. This way, the receiver knows when it has received duplicate frames.

Page 45: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

45

Stop and Wait for Noisy Channels (cont’d)

Data

ACK

Data1

1

11

TimedOut

receiverknows to discard thisdata

1

Page 46: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

46

Is Stop and Wait the best we can do?

Stop and Wait is an effective form of flow control, but…

It’s not very efficient. 1. Only one data frame can be in transit on the link at

a time2. When waiting for an acknowledgement, the sender

cannot transmit any frames

Better solution? Sliding Window

Page 47: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

47

Sliding Window ProtocolsDefinitions

Sequence Number: Each frame is assigned a sequence number that is incremented as each frame is transmitted

Sender Window: Keeps track of sequence numbers for frames that have been sent but not yet acknowledged

Receiver Window: Keeps track of sequence numbers for frames the receiver is allowed to accept

Maximum Sender Window size: The maximum number of frames the sender may transmit without receiving any acknowledgements

Maximum Receiver Window size: The maximum number of frames the receiver may receive before returning an acknowledgement to the sender

Page 48: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

48

Simple Sliding Window with Window Size of 1

A sliding window with a maximum window size of 1 frame

Window for a 3-bit sequence number

0

1

2

34

5

6

7

Page 49: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

49

Sliding Window example0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7

0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7

Sender window

Receiver window

(a) (b) (c) (d)

(a) Initial state, no frames transmitted, receiver expects frame 0(b) Sender transmits frame 0, receiver buffers frame 0(c) Receiver ACKS frame 0 (d) Sender receives ACK, removes frame 0

Page 50: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

50

Simple Sliding Window withWindow size 1 (cont’d)

This protocol behaves identically to stop and wait for a noisy channel

Page 51: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

51

Sliding Window ProtocolsGeneral Remarks

The sending and receiving windows do not necessarily have the same maximum sizeAny frame whose sequence number falls outside the receiver window is discarded at the receiverThe sender window’s size grows and shrinks as frames are transmitted and acknowledgedUnlike the sender window, the receiver window always remains at its maximum size

Page 52: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

52

Sliding Window ProtocolsPiggybacking Acknowledgements

Since we have full duplex transmission, we can “piggyback” an ACK onto the header of an outgoing

data frame to make better use of the channel

When a data frame arrives at a router, instead of immediately sending a separate ACK frame, the

router waits until it is passed the next data frame to send. The acknowledgement is attached to the

outgoing data frame.

Page 53: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

53

Sliding Window with Maximum Sender Window Size WS

With a maximum window size of 1, the sender waits for an ACK before sending another frame

With a maximum window size of WS, the sender can transmit up to WS frames before “being blocked”

This allows the sender to transmit several frames before waiting for an acknowledgement

Page 54: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

54

Sender-Side Window with WS=2

0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7

0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7

(a) (b) (c) (d)

(e) (f) (g) (h)

(a) Initial window state(b) Send frame 0(c) Send frame 1(d) ACK for frame 0 arrives

(e) Send frame 2(f ) ACK for frame 1 arrives(g) ACK for frame 2 arrives, send frame 3(h) ACK for frame 3 arrives

Page 55: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

55

Pipelining

Sliding window with WS > 1 is also called “pipelined” communication

A B99

data stream51 50

4910

ACK stream

By allowing several frames onto the link before receiving an acknowledgement, pipelining keeps the link from

being idle

Page 56: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

56

Sliding Window with Maximum Receiver Window Size WR

With a maximum window size of 1, the receiver must receive and process every frame in sequence

With a maximum window size of WR, the receiver can receive and process up to WR frames before

acknowledging them

This is useful when frames are lost: the receiver can still accept and buffer frames after the missing frame

Page 57: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

57

Receiver-Side Window with WR=2

0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7

0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7 0

1

2

34

5

6

7

(a) (b) (c) (d)

(e) (f) (g) (h)

(a) Initial window state(b) Nothing happens(c) Frame 0 arrives, ACK frame 0 (d) Nothing happens

(e) Frame 1 arrives, ACK frame 1(f) Frame 2 arrives, ACK frame 2(g) Nothing happens(h) Frame 3 arrives, ACK frame 3

Page 58: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

58

What about Errors?

What if a data or acknowledgement frame is lost when using a sliding window

protocol?

Two Solutions:Go Back N

Selective Repeat

Page 59: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

59

Sliding Window with Go Back N

When the receiver notices a missing or erroneous frame, it simply discards all frames with greater sequence numbers and sends no ACKThe sender will eventually time out and retransmit all the frames in its sending window

Page 60: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

60

Go Back N

Discarded byreceiver

Frame witherror

Timeout intervalAC

K 0

Time

Sender

Receiver

Maximumwindow size = 8

Maximumwindow size = 8

0

0 1

1

ACK

12

E

3

D

4

D

2 3

2

ACK

2

4 5 6

3 4 5

ACK

3

ACK

4

ACK

5

6

ACK

6

Page 61: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

61

Go Back N (cont’d)

Go Back N can recover from erroneous or missing frames

But…

It is wasteful. If there are errors, the sender will spend time retransmitting frames the receiver has already seen

Page 62: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

62

Sliding Window with Selective Repeat

The sender retransmits only the frame with errorsThe receiver stores all the correct frames that arrive following the bad one. (Note that the receiver requires a frame buffer for each sequence number in its receiver window.)When the receiver notices a skipped sequence number, it keeps acknowledging the last good sequence numberWhen the sender times out waiting for an acknowledgement, it just retransmits the one unacknowledged frame, not all its successors.

Page 63: Data Link Layer - Computer Sciencebadri/352dir/Spring04/notes/week2-one.pdf · DLE STX I am a jerk trying to DLE DLE DLE DLE ETX crash your network! DLE ETX ... zPPP uses frame tags

63

Selective Repeat

Buffered byreceiver

Frame witherror

Timeout intervalAC

K 0

Time

Sender

Receiver

Maximumwindow size = 8

Maximumwindow size = 8

0

0 1

1

ACK

12

E

3 4 2 5

2

ACK

4

6

5

ACK

5

6

ACK

6

3 4AC

K 1

ACK

1