title: Sliding window protocol, calculation of sequence number bits
body: <p>I am preparing for my exams and was solving problems regarding <code>Sliding Window Protocol</code> and I came across these questions..</p>
  
  <blockquote>
    <p>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?<BR><BR>
    A) 3 B) 4 C) 5 D) 6</p>
  </blockquote>
  
  <p>I got the ans as C option as follows,</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>the ans was correct as per the answer key.. and then I came across this one.. </p>
  
  <blockquote>
    <p>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).</p>
    
    <p>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. </p>
    
    <p>(A) l=2 (B) l=3 (C) l=4 (D) l=5 </p>
  </blockquote>
  
  <p>as per the earlier one I solved this one like follows,</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>and 6 is not even in the option. Answer key is using same solution but taking propagation time not RTT for calculation. and their answer is 5 bits. I am totally confused, which one is correct?</p>