Search code examples
network-programmingpipelininggo-back-n

In relation to GBN protocol, how does a single timer tracks time of sent unacknowledged packets?


In the book on networking "Computer Networking: A Top Down Approach" by James Kurose following is stated: "...sender in ... uses only a single timer, which can be thought of as a timer for the oldest transmitted but not yet acknowledged packet. If an ACK is received but there are still additional transmitted but not yet acknowledged packets, the timer is restarted."

  1. If in a GB3 protocol with sequence numbers 0,1,2,3. Suppose packets 0,1,2 are sent by the sender and a timer is started according to oldest transmitted but not yet acknowledged packet no-0.
  2. The receiver receives all packets in order.
  3. The receiver (with a window size of 1) sends ack 0,1,2 one at a time.
  4. Suppose ack 0 is received at the sender.
  5. Now according to above excerpt from the book, the timer has to be restarted according to packet no-1, which is transmitted but not yet acknowledged.

My Question: How does the sender restart the timer with respect to packet-1 when it has already been sent in the past keeping in view a single timer in GBN protocol?


Solution

  • The timer in Go-Back-N is not specific to a particular packet. It measures the time between two events, i.e, The oldest packet (base) transmitted and the ack received. If within the timeout no ack is received, all the packets from base are retransmitted. For each ack received the timer is restarted. Lets suppose the timer is 3 sec, and ack for packet-0 is received. It restarts the timer, i.e sets 3 sec timer and waits for an ack to receive (Either cumulative ack or individual ack). If the sender fails to receive the ack in the stipulated time, the timer is restarted and packets are retransmitted.