data link layer (basic) – no mac sublayer

Post on 31-Jan-2016

31 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Data link layer (basic) – no MAC sublayer. Outline Two functions Error control Flow control. Malathi Veeraraghavan Univ. of Virginia. Some of the figures in this talk are from A. Tanenbaum's book and a few from A. Leon-Garcia and I. Widjaja’s book. Error control. Error detection - PowerPoint PPT Presentation

TRANSCRIPT

1

Data link layer (basic) – no MAC sublayer

• Outline– Two functions

• Error control• Flow control

Malathi Veeraraghavan Univ. of Virginia

Some of the figures in this talk are from A. Tanenbaum's bookand a few from A. Leon-Garcia and I. Widjaja’s book

2

Error control

• Error detection– Parity check– Cyclic Redundancy Code (CRC) or

polynomial codes

• Error correctionAutomatic Repeat reQuest (ARQ)– Forward Error Correction (FEC)

Slides mainly from web site of textbook by A. Leon-Garcia and I. Widjaja(with modifications by M. Veeraraghavan)

3

ARQ error/loss detectionand recovery

• Send a frame• Hold frame in a retransmission buffer at the sender so that if

there is a loss/error, the frame can be resent• Wait for Acknowledgment (ACK) from receiver• If a received frame had errors, the receiver detects the

presence of errors using CRC, and then sends a notification – sender resends errored frame

• But what happens if the frame itself was lost or the receiver's notification of an error is lost?

• Solution:– Start a timer at the sender upon sending a frame– If timer times out before ACK arrives, retransmit frame

4

Error correction:Different ARQ schemes

• Stop-and-Wait• Sliding window

5

CRCInformation

bits

Header

Information frame; also called user data frame Control frame: ACKs

CRCHeader

Error-freeframe

Information frame(user data frame)

Control frame

Transmitter(Process A)

Receiver(Process B)

Stop-and-Wait ARQ

Timer set after each frame

transmission

Transmit a frame, wait for ACK

ACK expected before timer

expires

ACK: Acknowledgment

6

Stop-and-Wait Efficiency

A

B

First frame bit enters channel

Last frame bit enters channel

Channel idle while transmitter waits for ACK

Last frame bit arrives at receiver

Receiver processes frame

and prepares ACK

ACK arrives

First frame bit arrives at receiver

t

t

7

t0 = total time

Stop-and-Wait Model

R

n

R

ntt

ttttt

afprocprop

ackfprocprop

22

220 user data frame size

channel transmission rate

ACK frame size

processing delay

data frameemission

time tf

A

B

tproptack tproc

tprop

tproc

one-way propagation delay

8

Stop-and-Wait efficiency on an error-free channel

.)(2

1

10

0

0

f

procprop

f

a

f

oof

eff

n

Rtt

nn

nn

R

t

nn

R

R

bits for header & CRC

0

0

bitsdeliver to timetotal

bits info of no.

t

nnR ofeff

Effect offrame overhead

Effect ofACK frame

Effect ofBandwidth-delay product

Effective transmission rate:

Transmission efficiency:

9

Propagation vs.processing delays

• Propagation delay is determined by speed of light– If distance = 1000km, propagation delay is

on the order of milliseconds

• Processing delays are on the order of micro-seconds

• Therefore, we often ignore tproc

• 2tprop = Round-trip propagation delay

– Because tprop is one-way propagation delay

10

Examples (ignoring processing delay)

1 ms 10 ms 100 ms 1 sec

1 Mbps 103 104 105 106

1 Gbps 106 107 108 109

Round-tripprop.delay

BW = r

Bandwidth-delay product = Round-trip prop. delay x BW = rtprop )2(

In Physical Layer lecture, we learned the word"bandwidth" as H in Hz. We used the word "transmission rate" as rin bits/sec, which determines emission (transmission) delay.On this slide, we are using the word "Bandwidth" for transmission rate, r. Commonly accepted language in networking community.

1 sec x 109 b/s= 109 bits

11

Transmission efficiency, 0

nf = 1250 bytes = 10000 bits

na =no= 25 bytes = 200 bits

1 ms 10 ms 100 ms 1 sec

1 Mbps 88% 49% 9% 1%

1 Gbps 1% 0.1% 0.01% 0.001%

Round-tripprop. delay

BW

The higher the bandwidth-delay product, the lower thetransmission efficiency or effective transmission rate

12

We conclude that

• Stop-and-Wait ARQ solution does not work well on high bandwidth-delay product paths

13

Error correction:Different ARQ schemes

• Stop-and-WaitSliding window

14

Sliding window scheme

Basic operation (no errors/losses)• Relation between sending window size and

sequence number

15

Basic operation• Improve Stop-and-Wait by not waiting!• Keep channel busy by continuing to send

frames

• Transmit a window of Ws frames before waiting for an ACK

• If ACK for oldest frame arrives before window is exhausted (which means before sender has transmitted out Ws frames), then there is no "WAIT" period. Leads to an efficient use of the link.

16

Sequence numbers and ACKs

• Sequence numbers in frame headers– Add a sequence number in each frame header– Use an m-bit sequence number to identify frames

• Example: if m=3, sequence numbers are 0, 1, 2, 3, 4, 5, 6, 7. The next frame will start over with sequence number 0.

• ACK frames– ACK frame carries the sequence number of the next

expected frame• Called cumulative ACK• More efficient to say "I received everything up to this frame and

am expecting this next frame" rather than to ACK every frame one-by-one.

17

New term: outstanding frames

• Means unacknowledged• At any instant of time, there can

be only Ws outstanding frames – these frames were transmitted but

the sender has not yet received an ACK for any of the frames

18

Operation of Sliding Window Scheme

• Sending window vs. permitted-to-send window:– Permitted-to-send window: set of frames that the sender is permitted to

send– Sending window: permitted-to-send frames + outstanding frames (already

transmitted but as-yet unacknowledged frames)

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6

Frames already transmitted and ACK’ed

Window of frames that are permitted to be transmitted

Frame sequence number

Last frame transmitted

Window moves as ACKs arrive

Ws = 7Wp = 7

No outstanding frames at this point in time

sending window size

permitted-to-sendwindow size

19

Operation of Sliding Window

• Operations at the sender:0 1 2 3 4 5 6 7 0 1 2 3 4 5 6

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6

send out frames 6, 7, 0Wp changes to 4 (note Ws is still 7;frames 6, 7, 0 are outstanding)

ACKs not yet received for 6, 7, 0

sending window

permitted-to-send window

Ws = 7Wp = 7

20

Operation of Sliding Window

• Operations at the sender:0 1 2 3 4 5 6 7 0 1 2 3 4 5 6

0 1 2 3 4 5 6 7 0 1 2 3 4 5 6

Receives acknowledgement (ACK 1), which means receiver is expecting the next frame to have a sequence number 1

7

ACK 1 is cumulative ACKIt means frames 6, 7, 0have all been received

Notice how the window slides with time- hence the name "Sliding window"

No more outstandingframes; thereforeWs = Wp = 7

21

Analysis of Sliding Windows

1

...

2 3

Receiver

Sender

?

tprop

W

...

tpropFrame

emission delay

Use nf as size of each frame and R as transmission rateProcessing delays are neglected

22

• If the window size is sufficiently large the sender can transmit packets continuously

• If:

Analysis of Sliding Windows

propf

fprop

f

tR

nW

R

nt

R

nW

2)1(

2

• Ignoring frame header/CRC overhead, ACK frame size and processing delays:– transmission efficiency = 100%

23

Sending window size

• Sending window size, Ws, should be at least as large as W (previous slide) so that no time is wasted waiting for an ACK with the sender idling

12

f

props

s

n

RtW

WW

In most protocols, frames are of variable length, and therefore window size is usually expressed in bytes. For simplicity, in this lecture, we have assumed that all frames are of equal length (size Sf). Under this assumption, Ws should always be an integer, as it represents a number of fixed-length frames.

24

Sliding window scheme outline check

• Basic operation (no errors/losses)Relation between sending window

size and sequence number

25

A

B

fr0

Timefr1

fr2

fr3

fr0

ACK1

Example: m=2 and Ws = 4

ACK0

ACK2

ACK3

Sender timer times out for frame 0 since ACK is not receivedand sender retransmits frame 0

Receiver has Rnext= 0; so it will accept the frame assuming it is a new frame, when in reality it is a duplicate frame

What happens if sending window size Ws = 2m?

Rnext 0 1 2 3 0

Rnext: Sequence number of the next expected frame

ACKslost

26

Conclusion: Maximum Allowable Sending Window Sizemax(Ws) = 2m-1

A

B

fr0

Timefr1

fr2

fr0

ACK1

ACK2

ACK3

Receiver has Rnext= 3 , so it rejects the duplicate frame 0, and sends ACK 3. If this ACK reaches the sender, sender will conclude that frames 0, 1 and 2 were successfully received and it will send frame 3

Rnext 0 1 2 3

Example: m=2 and Ws = 3 Sender timer times out for frame 0 since ACK is not receivedand sender retransmits frame 0

fr3

ACK3

ACKslost

27

Relation between sending window size and sequence number

• Sending window size, Ws

• Sequence number is m-bits long

12 msW

28

Transmitter ReceiverDATA

DATATransmitterReceiver

ACK Piggybacking in Bidirectional Communication

A B

S: Sequence number of frameRnext: Next expected frame at the receiver: ACK number

In normal operation, what can we say about the relation between SB and RA

next?

Frames have sequence numbers; ACKs have numbersPiggybacking means carrying an ACK number within data-carrying frame header

BnextR

AnextR

BS

AS

HeaderTrailer

29

Status check

• Outline– Two functions

• Error controlFlow control

30

Flow control problem

• Rates of the transmitter and receiver at the physical layer are matched. • The flow control problem arises because the layer above the DLL at the

receiver does not deplete the buffer at the same rate at which data is being passed to the DLL at the sender (Rsnd Rrcv)

Data-link layer (DLL) Data-link layer (DLL)

Physical layerPhysical layer

Host Switch or host

Data units Receivebuffer

H

T

T H

H

T

Rsnd Rrcv

transmission rate: r

31

Different rates

• Rsnd: Rate at which the higher layer passes data to the DLL at the sender

• Rrcv: Rate at which the higher layer removes data from the DLL buffer at the receiver

• r: physical-layer transmission rate

32

Techniques for flow control

• Flow control mechanisms prevent buffer overflow by regulating the rate at which source is allowed to send information– Stop-and-wait flow control– ON-OFF flow control– Sliding window flow control– Rate based flow control (skip for this

class)

33

Stop-and-wait flow control

• No problem if ACK is sent back after higher layer depletes the buffer holding the single frame’s payload

34

Sender Receiver

BleftOFF2tprop

Assume that the physical-layertransmission rate, r, is same as Rsnd

Bleft=2tprop(Rsnd – Rrcv)

B

ON /OFF flow control

When should the OFF signal be sent?

Recall:What is Rsnd?What is Rrcv?

Round-trippropagationdelay

35

Sliding Window Flow Control

• Sliding Window Flow Control– Receiver has a receive buffer– Receiver sends reports of available space in

this buffer to the sender• This is called flow window or advertised window

– Sender uses this number to determine the maximum number of frames it can have outstanding (i.e., unacknowledged)

36

Sliding window FC illustrated

Sending bufferIf m=3, i.e. 3-bit sequence number,

then Ws can be 7, why?

Receiving buffer(flow control)

Ws=7

flow window = 11

Receivebuffercanhold11 frames

Receiver notifies thesender as to how muchspace is availablein its receive buffer

37

Sliding window FC illustrated

65

34

210

Sending buffer Receiving buffer

Ws=7

210

flow window = 8; ack 3

Because the receiving buffer has space to hold 8 more packets

Because the receiver is expecting packet with sequence number 3

Since 0, 1, 2 are ACK'ed, they can be removed from the send buffer

38

Flow window

• Flow window is the:– Left-over space in the receiver’s buffer– In previous slide, flow window of 8 is a

report of how much space is left in the receiver’s buffer (enough to hold 8 frames)

• Flow window is also called "advertised window" or "receiver’s window"

39

Sliding window FC illustrated

65

34

Sending buffer Receiving buffer

Ws=7 65

34

210

flow window = 4; ack 2

70

1

70

1

Watch with animation; frames 0, 1, 2 are read outof the receive buffer by the higher-layer, which iswhy the flow window indication is 4

40

At any instant in time, what is the maximum number of frames that the sender is permitted to

send?• Maximum number of outstanding frames at any instant in time is a minimum

of sending window,Ws, and the flow window indicated by the receiver• Three steps:

1. Find X = min (Ws, flow window)

2. Find Y = number of outstanding frames (already sent but unacknowledged)

3. Maximum number of frames that the sender is permitted to send = X- Y

• Result: if X-Y frames are sent, then the number of outstanding frames will become X (which is the max. limit for no. of outstanding frames)

• After the sender receives the indication that flow window = 4 and ACK = 2 as shown on the previous slide, how many frames can the sender send? What are the sequence numbers of the frames that it will send (assume that the higher-layer keeps passing frames down to the DLL at the sender)?

top related