Sliding Window Protocol | Practice Problems

Spread the love

Sliding Window Protocol-

 

Before you go through this article, make sure that you have gone through the previous article on Sliding Window Protocol.

 

We have discussed-

  • Sliding window protocol is a flow control protocol.
  • It allows the sender to send multiple frames before needing the acknowledgements.
  • Go back N and Selective Repeat are the implementations of sliding window protocol.

 

In this article, we will discuss practice problems based on sliding window protocol.

 

PRACTICE PROBLEMS BASED ON SLIDING WINDOW PROTOCOL-

 

Problem-01:

 

A 3000 km long trunk operates at 1.536 Mbps and is used to transmit 64 byte frames and uses sliding window protocol. If the propagation speed is 6 μsec / km, how many bits should the sequence number field be?

 

Solution-

 

Given-

  • Distance = 3000 km
  • Bandwidth = 1.536 Mbps
  • Packet size = 64 bytes
  • Propagation speed = 6 μsec / km

 

Calculating Transmission Delay-

 

Transmission delay (Tt)

= Packet size / Bandwidth

= 64 bytes / 1.536 Mbps

= (64 x 8 bits) / (1.536 x 106 bits per sec)

= 333.33 μsec

 

Calculating Propagation Delay-

 

For 1 km, propagation delay = 6 μsec

For 3000 km, propagation delay = 3000 x 6 μsec = 18000 μsec

 

Calculating Value Of ‘a’-

 

a = Tp / Tt

a = 18000 μsec / 333.33 μsec

a = 54

 

Calculating Bits Required in Sequence Number Field-

 

Bits required in sequence number field

= ⌈log2(1+2a)⌉

= ⌈log2(1 + 2 x 54)⌉

= ⌈log2(109)⌉

= ⌈6.76⌉

= 7 bits

 

Thus,

  • Minimum number of bits required in sequence number field = 7
  • With 7 bits, number of sequence numbers possible = 128
  • We use only (1+2a) = 109 sequence numbers and rest remains unused.

 

Problem-02:

 

Compute approximate optimal window size when packet size is 53 bytes, RTT is 60 msec and bottleneck bandwidth is 155 Mbps.

 

Solution-

 

Given-

  • Packet size = 53 bytes
  • RTT = 60 msec
  • Bandwidth = 155 Mbps

 

Calculating Transmission Delay-

 

Transmission delay (Tt)

= Packet size / Bandwidth

= 53 bytes / 155 Mbps

= (53 x 8 bits) / (155 x 106 bits per sec)

= 2.735 μsec

 

Calculating Propagation Delay-

 

Propagation delay (Tp)

= Round Trip Time / 2

= 60 msec / 2

= 30 msec

 

Calculating Value of ‘a’-

 

a = Tp / Tt

a = 30 msec / 2.735 μsec

a = 10968.921

 

Calculating Optimal Window Size-

 

Optimal window size

= 1 + 2a

= 1 + 2 x 10968.921

= 21938.84

 

Thus, approximate optimal window size = 21938 frames.

 

Problem-03:

 

A sliding window protocol is designed for a 1 Mbps point to point link to the moon which has a one way latency (delay) of 1.25 sec. Assuming that each frame carries 1 KB of data, what is the minimum number of bits needed for the sequence number?

 

Solution-

 

Given-

  • Bandwidth = 1 Mbps
  • Propagation delay (Tp) = 1.25 sec
  • Packet size = 1 KB

 

Calculating Transmission Delay-

 

Transmission delay (Tt)

= Packet size / Bandwidth

= 1 KB / 1 Mbps

= (210 x 8 bits) / (106 bits per sec)

= 8.192 msec

 

Calculating Value of ‘a’-

 

a = Tp / Tt

a = 1.25 sec / 8.192 msec

a = 152.59

 

Calculating Bits Required in Sequence Number Field-

 

Bits required in sequence number field

= ⌈log2(1+2a)⌉

= ⌈log2(1 + 2 x 152.59)⌉

= ⌈log2(306.176)⌉

= ⌈8.25⌉

= 9 bits

 

Thus,

  • Minimum number of bits required in sequence number field = 9
  • With 9 bits, number of sequence numbers possible = 512.
  • We use only (1+2a) sequence numbers and rest remains unused.

 

Problem-04:

 

Host A is sending data to host B over a full duplex link. A and B are using the sliding window protocol for flow control. The send and receive window sizes are 5 packets each. Data packets (sent only from A to B) are all 1000 bytes long and the transmission time for such a packet is 50 μs. Acknowledgement packets (sent only from B to A) are very small and require negligible transmission time. The propagation delay over the link is 200 μs. What is the maximum achievable throughput in this communication?

  1. 7.69 x 106 Bps
  2. 11.11 x 106 Bps
  3. 12.33 x 106 Bps
  4. 15.00 x 106 Bps

 

Solution-

 

Given-

  • Sender window size = Receiver window size = 5
  • Packet size = 1000 bytes
  • Transmission delay (Tt) = 50 μs
  • Propagation delay (Tp) = 200 μs

 

Calculating Bandwidth-

 

We know,

Transmission delay = Packet size / Bandwidth

 

So, Bandwidth

= Packet Size / Transmission delay (Tt)

= 1000 bytes / 50 μs

= (1000 x 8 bits) / (50 x 10-6 sec)

= 160 Mbps

 

Calculating Value of ‘a’-

 

a = Tp / Tt

a = 200 μsec / 50 μsec

a = 4

 

Calculating Optimal Window Size-

 

Optimal window size

= 1 + 2a

= 1 + 2 x 4

= 9

 

Calculating Efficiency-

 

Efficiency (η)

= Sender window size / Optimal window size

= 5 / 9

= 0.5555

= 55.55%

 

Calculating Maximum Achievable Throughput-

 

Maximum achievable throughput

= Efficiency (η) x Bandwidth

= 0.5555 x 160 Mbps

= 88.88 Mbps

= 88.88 x 106 bps or 11.11 x 106 Bps

 

Thus, Option (B) is correct.

 

Problem-05:

 

Station A uses 32 byte packets to transmit messages to station B using a sliding window protocol. The round trip delay between A and B is 80 msec and the bottleneck bandwidth on the path between A and B is 128 Kbps. What is the optimal window size that A should use?

  1. 20
  2. 40
  3. 160
  4. 320

 

Solution-

 

Given-

  • Packet size = 32 bytes
  • Round Trip Time = 80 msec
  • Bandwidth = 128 Kbps

 

Calculating Transmission Delay-

 

Transmission delay (Tt)

= Packet size / Bandwidth

= 32 bytes / 128 Kbps

= (32 x 8 bits) / (128 x 103 bits per sec)

= 2 msec

 

Calculating Propagation Delay-

 

Propagation delay (Tp)

= Round Trip Time / 2

= 80 msec / 2

= 40 msec

 

Calculating Value of ‘a’-

 

a = Tp / Tt

a = 40 msec / 2 msec

a = 20

 

Calculating Optimal Window Size-

 

Optimal window size

= 1 + 2a

= 1 + 2 x 20

= 41 which is close to option (B)

Thus, Option (B) is correct.

 

Next Article- Go Back N Protocol

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.

Summary
Sliding Window Protocol | Practice Problems
Article Name
Sliding Window Protocol | Practice Problems
Description
Practice Problems based on Sliding Window Protocol. Sliding Window Protocols in computer networks are the flow control protocols. Go Back N and Selective Repeat are the implementations of sliding window protocol.
Author
Publisher Name
Gate Vidyalay
Publisher Logo

Spread the love