Docsity

ARQ in Computer Architecture: Stop & Wait, Sliding Window, Selective Repeat, Study notes of Computer Science

Toggle sidebar
bg1
CS/ECpE5516 Computer Architecture
Dr. Abrams, Computer Science Dept, VA Tech
Lecture 5, Spring 1998
1
Lecture 5a - Automatic Repeat Request
(BG 2.4)
Me You
Packet Pipe
Consider DLC & Frame Transmission
(Transport Layer can also use ARQ)
• Issue 1:
- I send a packet
- Packet may be:
-- lost (how do I know this?)
-- corrupted (you can ask me to resend it, but what
if your request is corrupted or lost?)
-- duplicated, due to retransmission of an earlier,
corrupted packet (how do I know this?)
- Thus the DLC protocol must have rules to detect &
recover from losses/corruption.
- (Detecting corruption is via CRC in trailer - subject of
another lecture)
CS/ECpE5516 Computer Architecture
Dr. Abrams, Computer Science Dept, VA Tech
Lecture 5, Spring 1998
2
• Second Issue: Efficiency
What fraction of pipe capacity is consumed by
- Retransmission?
- "Artificial Delay"? (sender waits for an ACK)
- Overhead (non-data bits sent by protocol)
- Assumptions in constructing an ARQ protocol:
-- A1: Each frame undergoes a variable propagation
delay
-- A2: Frame may be lost or corrupted
-- A3: Frames always arrive in order sent
1
ACK
Picture with negligible bit delay
CS/ECpE5516 Computer Architecture
Dr. Abrams, Computer Science Dept, VA Tech
Lecture 5, Spring 1998
3
1
Transmission
Delay
2
Variable
Propagation
Delay
A
1
Corruption
Loss
A
A
12
Re-ordering
violates
A3
1 bit
propagation
delay
Look at notation used in Figure 2.17 in the text.
CS/ECpE5516 Computer Architecture
Dr. Abrams, Computer Science Dept, VA Tech
Lecture 5, Spring 1998
4
• ARQ Protocols
- Stop and Wait (BG 2.4.1)
- Sliding window a.k.a. go back-n (BG 2.4.2)
- Selective Repeat (BG 2.4.3)
pf3
pf4
pf5

Partial preview of the text

Download ARQ in Computer Architecture: Stop & Wait, Sliding Window, Selective Repeat and more Study notes Computer Science in PDF only on Docsity!

Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

Lecture 5a - A utomatic R epeat Re q uest

(BG 2.4)

Me (^) You

Packet Pipe

Consider DLC & Frame Transmission (Transport Layer can also use ARQ)

  • Issue 1:
    • I send a packet
    • Packet may be: -- lost (how do I know this?) -- corrupted (you can ask me to resend it, but what if your request is corrupted or lost?) -- duplicated , due to retransmission of an earlier, corrupted packet (how do I know this?)
    • Thus the DLC protocol must have rules to detect & recover from losses/corruption.
    • (Detecting corruption is via CRC in trailer - subject of another lecture)

Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

  • Second Issue: Efficiency

What fraction of pipe capacity is consumed by

  • Retransmission?
  • "Artificial Delay"? (sender waits for an ACK)
  • Overhead (non-data bits sent by protocol)
  • Assumptions in constructing an ARQ protocol: -- A1: Each frame undergoes a variable propagation delay -- A2: Frame may be lost or corrupted -- A3: Frames always arrive in order sent

ACK

Picture with negligible bit delay

CS/ECpE5516 Computer Architecture Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

1

Transmission Delay

Variable Propagation Delay

A

Corruption

Loss A

A

Re-ordering violates A

1 bit propagation delay

Look at notation used in Figure 2.17 in the text.

CS/ECpE5516 Computer Architecture Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

  • ARQ Protocols
    • Stop and Wait (BG 2.4.1)
    • Sliding window a.k.a. go back- n (BG 2.4.2)
    • Selective Repeat (BG 2.4.3)

Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

  • BG 2.4.1: Stop and Wait
    • Consider 1 - Way traffic:

Me Packet Pipe You

1-way traffic

(sender) (receiver)

  • 3 Packet Types (header bits identify type) -- Data -- ACK -- NACK (sometimes used)

Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

Stop and Wait (without sequence numbers):

  • I do:
    1. Accept packet from layer 3 (possibly waiting for packet to arrive)
    2. Transmit frame containing packet
    3. Start a timer
    4. Wait for event
    5. If ((event == timer pop) or (event==NACK)) then { resend packet and goto 4 } else if (event == receive error free ACK) then { goto 1} else if (event == receive corrupted ACK) then { noop }
  • You do:
    1. Wait for frame from link
    2. If (uncorrupted DATA frame is received) then { send ACK release packet to layer } else {send NACK}

CS/ECpE5516 Computer Architecture Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

Illustration of Time-Out

Data

ACK

NACK

Data Data

Data

Timeout Interval

Me

You

  • Note on timeout value: -- Too short -> lots of unnecessary resends -- Too much artificial waiting reduces pipe capacity -- We set timeout to be a small (e.g., close to 1) multiple of the round trip delay (RTD)
  • For a cross country hop, when ARQ is used at transport layer, estimating RTD is a big problem. Research in early 1990’s successfully addressed this

CS/ECpE5516 Computer Architecture Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

Problem with above algorithm:

Data

ACK

Data Data

Me

You

ACK

Is it 1 or 2?

Is it an ACK for 1 or 2? 2 could be lost, but ACK could be interpreted as for packet 2

  • Solution: Each packet (Data, ACK, NACK) has two sequence numbers :

-- SN = id of packet currently being sent -- RN = id of next packet expected

Each end point maintains SN, RN, too.

Header Data (packet)^ CRC

Type (^) SN RN --- SN = sequence number RN = request number

Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

 fact that packet is delivered w/o corruption with probability q>  Looks at SN, RN as functions of time: SN(t), RN(t)

Alternating Bit Protocol

The proof on pp. 69-71 shows that all sequence numbers can be represented using just 0 & 1, with arithmetic mod 2

(That’s because only packets SN and SN-1 can be received in duplicate. Also, if receiver’s waiting for RN, it could only get RN or RN-1.)

-- The ability to prove a bound on sequence numbers range is critical to selecting number of bits for SN, RN in frame.

Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

Common protocol representation (for A->B)

Can we use one picture to represent the two algorithms?

State = (Node A's SN mod 2, Node B's RN mod 2)

= (packet # being sent, packet # B is awaiting)

B receives packets 0,2,4,...

A receives ACK for packet 0,2,4,...

B receives packet 1,3,5,...

A receives ACK for packet 1,3,5,...

CS/ECpE5516 Computer Architecture Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

Efficiency of Stop-and-wait

In practice, stop & wait rarely used:

For efficiency, you want to keep pipe busy 100% of time in event no errors occur. Long propagation delay reduces efficiency (killer on satellite links -> 2 pkts/sec!).

Stop and Wait vs. Sliding Window

CS/ECpE5516 Computer Architecture Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

(BG 2.4.2) Go-back N

CS/ECpE5516 Computer Architecture Dr. Abrams, Computer Science Dept, VA Tech Lecture 5, Spring 1998

(BG) 2.4.3 Selective Repeat

  • Modification of Go back N:

-- Receiver buffers packets received out of order -- Receive window:

Received and Attached

Unreceived

Discard

-- Typically receiver window size = sender size

  • BG: “Receiver requests retransmission of any packets missing from received sequence.”
  • TCP: Same meaning of RN ACK’s - send upper half of window (wastefully)