21
MIT OpenCourseWare http://ocw.mit.edu 16.36 Communication Systems Engineering Spring 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms .

16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

MIT OpenCourseWarehttp://ocw.mit.edu

16.36 Communication Systems Engineering Spring 2009

For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.

Page 2: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

16.36: Communication Systems Engineering

ARQ Protocols: Go Back N and SRP

Eytan Modiano

Page 3: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Go Back N ARQ(Sliding Window)

• Stop and Wait is inefficient when propagation delay is larger than thepacket transmission time – Can only send one packet per round-trip time

• Go Back N allows the transmission of new packets before earlier onesare acknowledged

• Go back N uses a window mechanism where the sender can send packets that are within a “window” (range) of packets – The window advances as acknowledgements for earlier packets are received

ACK-0 ACK-1 ACK-2 ACK-3 ACK-4 ACK-5 ACK-6 ACK-7 ACK-8

PKT-0 PKT-1 PKT-2 PKT-3 PKT-9PKT-8PKT-7PKT-6PKT-5PKT-4 WINDOW

WINDOW WINDOW

WINDOW

Page 4: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Features of Go Back N

• Window size = N – Sender cannot send packet i+N until it has received the ACK for packet i

• Receiver operates just like in Stop and Wait – Receive packets in order – Receiver cannot accept packet out of sequence – Send RN = i + 1 => ACK for all packets up to and including i

• Use of piggybacking – When traffic is bi-directional RN’s are piggybacked on packets going in the

other direction Each packet contains a SN field indicating that packet’s sequence number and a

RN field acknowledging packets in the other direction

<--Frame Header --------->

SN RN Packet CRC

Page 5: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Go Back N ARQ

• The transmitter has a "window" of N packets that can be sent withoutacknowledgements

• This window ranges from the last value of RN obtained from thereceiver (denoted SNmin) to SNmin+N-1

• When the transmitter reaches the end of its window, or times out, itgoes back and retransmits packet SNmin

Let SNmin be the smallest number packet not yet ACKed

Let SNmax be the number of the next packet to be accepted from the higherlayer (I.e., the next new packet to be transmitted)

Page 6: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Go Back N Sender Rules

• SNmin = 0; SNmax = 0 • Repeat

– If SNmax < SNmin + N (entire window not yet sent) Send packet SNmax ; SNmax = SNmax + 1;

– If packet arrives from receiver with RN > SNmin SNmin = RN;

– If SNmin < SNmax (there are still some unacknowledged packets) and sendercannot send any new packets Choose some packet between SNmin and SNmax and re-send it

• The last rule says that when you cannot send any new packets youshould re-send an old (not yet ACKed) packet – There may be two reasons for not being able to send a new packet

Nothing new from higher layer Window expired (SNmax = SNmin + N )

– No set rule on which packet to re-send Least recently sent

Page 7: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Receiver Rules

• RN = 0; • Repeat

– When a good packet arrives, if SN = RN Accept packet Increment RN = RN +1

• At regular intervals send an ACK packet with RN – Most DLCs send an ACK whenever they receive a packet from the other

direction Delayed ACK for piggybacking

• Receiver reject all packets with SN not equal RN – However, those packets may still contain useful RN numbers

Page 8: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Example of Go Back 7 ARQ

0 2 3 4 5 t

1 6SN

RN

0 1 2 3 4 5

0 0 1 2 3 5 5

Window (0,6) (1,7) (5,11)(2,8) (3,9)

Node A

Node B

Packets delivered

• Note that packet RN-1 must be accepted at B before a framecontaining request RN can start transmission at B

Page 9: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

RETRANSMISSION BECAUSE OF ERRORS FOR GO BACK 4 ARQ

0 2 3 4 1 t

1 2

RN 0 1 1 1 1 1 2

SN

x

3 4

Window

Node A

Node B

(0,3) (1,4) (2,5)

3

Packets 0 1 2 3delivered

• Note that the timeout value here is taken to be the time to send a full window of packets

• Note that entire window has to be retransmitted after an error

Page 10: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

RETRANSMISSION DUE TO FEEDBACK ERRORS FOR GO BACK 4 ARQ

t 2SN

RN 0 1 4 5

x

4 5

6

32

x

5

(4,7) (5,8)

Node A

Node B

Packets delivered

2 3

Window (0,3) (2,5)0 1 2 3 4 5

0 1 4

• When an error occurs in the reverse direction the ACK may still arrive intime. This is the case here where the packet from B to A with RN=2arrives in time to prevent retransmission of packet 0

• Packet 2 is retransmitted because RN = 4 did not arrive in time,however it did arrive in time to prevent retransmission of packet 3 – Was retransmission of packet 4 and 5 really necessary?

Strictly no because the window allows transmission of packets 6 and 7 beforefurther retransmissions. However, this is implementation dependent

Page 11: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

EFFECT OF LONG FRAMES

0 2 3 4 t

1SN

RN 0 1 3 4

3 5

3

1 4

5

Window

Node A

Packets delivered

(0,3) (1,4) (3,6) (4,7)

Node B

0 1 2 4

• Long frames in feedback direction slow down the ACKs – This causes a transmitter with short frames to wait or go back

• Notice again that the retransmission of packets 3 and 4 was notstrictly required because the sender could have sent new packetswithin the window – Again, this is implementation dependent

Page 12: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Efficiency of Go Back N

A

B

• We want to choose N large enough to allow continuous transmissionwhile waiting for an ACK for the first packet of the window,

N > S/ DTP

• Without errors the efficiency of Go Back N is,

E = min{1, N*DTP/S}

packet

ACK

S

DTP DP DTA

DP

S = DTP + 2DP + DTApacket packet packet

N*DTP

Page 13: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Efficiency of Go Back N with transmission errorsApproximate analysis

Assume: N = ⎡⎢⎢⎢

S

DTP

⎤⎥⎥⎥

TO = N*DTP

• When an error occurs the entire window of N packets must beretransmitted

Let X = the number of packets sent per successful transmission

E[X] = 1*(1-P) + (X+N)*P

= 1 + N*P/(1-P)

Efficiency = 1/E[X]

Page 14: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Go Back N Requirements

• Go Back N is guaranteed to work correctly, independent of the detailedchoice of which packets to repeat, if

1) System is correctly initialized2) No failures in detecting errors3) Packets travel in FCFS order4) Positive probability of correct reception5) Transmitter occasionally resends Snmin (e.g., upon timeout) 6) Receiver occasionally sends RN

Page 15: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Notes on Go Back N

• Requires no buffering of packets at the receiver • Sender must buffer up to N packets while waiting for their ACK • Sender must re-send entire window in the event of an error • Packets can be numbered modulo M where M > N

– Because at most N packets can be sent simultaneously • Receiver can only accept packets in order

– Receiver must deliver packets in order to higher layer – Cannot accept packet i+1 before packet i – This removes the need for buffering – This introduces the need to re-send the entire window upon error

• The major problem with Go Back N is this need to re-send the entire window when an error occurs. This is due to the fact that the receiver can only accept packets in order

Page 16: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Selective Repeat Protocol (SRP)

• Selective Repeat attempts to retransmit only those packets that areactually lost (due to errors) – Receiver must be able to accept packets out of order – Since receiver must release packets to higher layer in order, the receiver must

be able to buffer some packets

• Retransmission requests – Implicit

The receiver acknowledges every good packet, packets that are not ACKed before atime-out are assumed lost or in error

Notice that this approach must be used to be sure that every packet is eventuallyreceived

– Explicit An explicit NAK (selective reject) can request retransmission of just one packet This approach can expedite the retransmission but is not strictly needed

– One or both approaches are used in practice

Page 17: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

SRP Rules

• Window protocol just like GO Back N – Window size W

• Packets are numbered Mod M where M >= 2W • Sender can transmit new packets as long as their number is with W of

all un-ACKed packets • Sender retransmit un-ACKed packets after a timeout

– Or upon a NAK if NAK is employed • Receiver ACKs all correct packets • Receiver stores correct packets until they can be delivered in order to

the higher layer

Page 18: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Need for buffering

• Sender must buffer all packets until they are ACKed – Up to W un-ACKed packet are possible

• Receiver must buffer packets until they can be delivered in order – I.e., until all lower numbered packets have been received – Needed for orderly delivery of packets to the higher layer – Up to W packets may have to be buffered (in the event that the first packet

of a window is lost) • Implication of buffer size = W

– Number of un-ACKed packets at sender =< W Buffer limit at sender

– Number of un-ACKed packets at sender cannot differ by more than W Buffer limit at the receiver (need to deliver packets in order)

– Packets must be numbered modulo M >= 2W (using log2(M) bits)

Page 19: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

EFFICIENCY

• For ideal SRP, only packets containing errors will be retransmitted – Ideal is not realistic because sometimes packets may have to be

retransmitted because their window expired. However, if the window size isset to be much larger than the timeout value then this is unlikely

• With ideal SRP, efficiency = 1 - P – P = probability of a packet error

• Notice the difference with Go Back N where

efficiency (Go Back N) = 1/(1 + N*P/(1-P))

• When the window size is small performance is about the same,however with a large window SRP is much better – As transmission rates increase we need larger windows and hence the

increased use of SRP

Page 20: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

Why are packets numbered Modulo 2W?

• Lets consider the range of packets that may follow packet i at thereceiver

i - W +1 i i - W +1

x i i - W +1

Packet i may be followed by the first packet of the window (i -W+1) if itrequires retransmission

i i+1 i+2 i+W

i i - W

Packet i may be followed by the last packet of the window (i+W) if allOf the ACKs between i and i +W are lost

• Receiver must differentiate between packets i -W+1 ... i +W – These 2W packets can be differentiated using Mod 2W numbering

x x x x

Page 21: 16.36 Communication Systems Engineering · Go Back N ARQ (Sliding Window) • Stop and Wait is inefficient when propagation delay is larger than the packet transmission time – Can

STANDARD DLC's

• HDLC, LAPB (X.25), and SDLC are almost the same – HDLC/ SDLC developed by IBM for IBM SNA networks – LAPB developed for X.25 networks

• They all use bit oriented framing with flag = 01111110 • They all use a 16-bit CRC for error detection • They all use Go Back N ARQ with N = 7 or 127 (optional)

SDLC packet flag address control data CRC flag

Multipoint SN,RNcommunication

• Older protocols (used for modems, e.g., xmodem) used stop and waitand simple checksums