Sliding window protocol, calculation of sequence number bits I am preparing for my exams and was solving problems regarding Sliding Window Protocol and I came across these questions..


  A 1000km long cable operates a 1MBPS. Propagation delay is 10 microsec/km. If frame size is 1kB, then how many bits are required for sequence number?
  A) 3 B) 4 C) 5 D) 6


I got the ans as C option as follows,

propagation time is 10 microsec/km
so, for 1000 km it is 10*1000 microsec, ie 10 milisec
then RTT will be 20 milisec 

in 10^3 milisec 8*10^6 bits
so, in 20 milisec X bits;

X = 20*(8*10^6)/10^3 = 160*10^3 bits

now, 1 frame is of size 1kB ie 8000 bits
so total number of frames will be 20. this will be a window size.

hence, to represent 20 frames uniquely we need 5 bits.


the ans was correct as per the answer key.. and then I came across this one.. 


  Frames of 1000 bits are sent over a 10^6 bps duplex link between two hosts. The propagation time is 
  25ms. Frames are to be transmitted into this link to maximally pack them in transit (within the link).
  
  What is the minimum number of bits (l) that will be required to represent the sequence numbers distinctly? 
  Assume that no time gap needs to be given between transmission of two frames. 
  
  (A) l=2 (B) l=3 (C) l=4 (D) l=5 


as per the earlier one I solved this one like follows,

propagation time is 25 ms
then RTT will be 50 ms 

in 10^3 ms 10^6 bits
so, in 50 ms X bits;

X = 50*(10^6)/10^3 = 50*10^3 bits

now, 1 frame is of size 1kb ie 1000 bits
so total number of frames will be 50. this will be a window size.

hence, to represent 50 frames uniquely we need 6 bits.


and 6 is not even in the option. Answer key is using same solution but taking propagation time not RTT. and their answer is 5 bits. I am totally confused, which one is correct?
Frames of 1000 bits are sent over a 10^6 bps duplex link between two hosts.

When the data is transmitted using a duplex link, Round Trip Time (RTT) do not include the time taken by ACK frame to reach sender from the receiver. This is because the ACK frames are piggybacked with the data frames that are coming from the receiver for the sender (maybe a bit later).
Aforementioned, we must now calculate the number of frames transmitted during propagation time (rather than round trip time)

$No.\ of\ frames = \left(25*10^{-3}*10^{6}\right)/10^3 = 25$

Thus, we will need minimum of $5\ bits$ to represent sequence number distinctly.
HTH