29,984 views

Station $A$ needs to send a message consisting of $9$ packets to Station $B$ using a sliding window (window size $3$) and go-back-$n$ error control strategy. All packets are ready and immediately available for transmission. If every $5$th packet that $A$ transmits gets lost (but no acks from $B$ ever get lost), then what is the number of packets that $A$ will transmit for sending the message to $B$?

1. $12$
2. $14$
3. $16$
4. $18$

edited by

Some more variation in the given question

Q - The question asked above is same, only the  window size is 4 instead of 3. So now how many transmissions will be there?

Ans - 21

 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21

Notice -->  Increasing window size may perform poor if the given link is faulty.

Thank You  @Nashreen Sultana, @VS and @reena_kandari ji.

There is lot of confusion got created on the question https://gateoverflow.in/230305/slidind-window-protocol#c240121

Can someone clear that

This strategy not work here

I think the most intuitive way to get how Go back N work is to remember this 2 points and try it yourself

1. The window should slide ahead as we go on receiving ack and we will miss ack only for frame which is lost i.e frame 5 according to question

2. We should go back and send frame starting from frame no which was lost till the end of current window size.

Suppose if frame 5th was lot we should resent 5  6 7 because currently these 3 frames are in window.

PS: we should also count frames which were sent but discarded as out of order frame

Let's say we have 9 frames to send

1 2 3 4 5 6 7 8  9

We will send 1 then window will slide and currently 2 3 4 will be frame in the window then we will send 2 window will slide now currently 3 4 5 will be in window snapshot then we will send 3 and window will slide again and current snapshot will have 4 5 6 in window then next 4 will be sent current snapshot will be 5 6 7.

Now point 2 if 5th one is lost then what frames will be sent again well start from 5th and go to end of window that is 7 as window size is 3 so 5 6 7 will be sent again. Try to work it out by using above 2 points plus don't forget to slide the window ahead as you go on sending frame and receive ack. Remember 5 6 7 were sent before as 5 was not received 6 7 were discarded make sure you count then as well

If you get it right the sequence you will get at the end is

1 2 3 4 5 6 7 5 6 7 8 9 7 8 9 9

Good luck

### 1 comment

Very good explanation

Also in GBN protocol, we can send both cumulative and independent ACK, So how to know when to use cumulative and when to go for independent bcoz answer will vary due to this point

In GBN we send entire window again if any frame lost

In case of GBN when any packet is lost we send entire window again.

If the question says $SR$ protocol then we send only lost packet entire not  window.

In GBN if 9 gets lost then the whole window of 9 should be sent. Why does only 9 gets send at last ?

Every packet which is being sent is the first packet of the window. Since 8th packet was the first packet of its window [8,9,-]. 8th being the first packet and 4th transmission, is completely sent and window slides over. Now window is [9,-,-] 9th being the 5th transmission is lost and hence complete window of [9,-,-] is sent again.

by

SInce it is said that Go Back N Protocol is used and the window size is 3 it means that if sender doesnot get an acknowledgment for the given packet then it would resend the packet based on the timeout and here timeout will be 3 packets as Window size is 3.

Now according to the question every 5th packet is lost.

Suppose we have 9 packets named: 1, 2, 3, 4, 5, 6, 7, 8, 9

Now initial 5 packets are send successfully

1, 2, 3, 4, 5

But when 5 is send it gets lost.

So not a problem till now,

Now notice that A will keep sending the packets as it is getting acknowledgment of every packet till 1 to 4 and because packet 5 is lost A will not get it’s acknowlegement.

So when packet 6 would be send there will be no problem when packet 7 will be send there will be no problem but as soon as packet 8 would be ready in the queue for sending to B, A will realize that hey all things are good but where’s the acknowledgement of 5 ?

As soon as A will realize that 5th packet acknowlegment is not received it will start sending packets from 5th packet onward.

Now notice before sending 5th packet again A has already sent packet 6 and packet 7 so in the queue

packet 6, 7, 5, 6 are send again and packet 7 will get lost again as it is the 5th packet in the queue.

As 7 is lost it’s not a problem packet 8 and 9 are sent.but after sending 9 A will realize that hey packet 7 acknowledgement is not yet received and hence need to resend packet 7 again following by packets 8 and 9

Again before sending packet 7, packet 8 and 9 are already in the queue and and now

8, 9, 7, 8, 9 are send

so total packets send are:

1 2 3 4 5 -→ 5th packet lost

6, 7, A realize acknowledgement of 5th packet is not received.

it will again send 5, 6, 7, also 6 and 7 are also in the queue

so queue will be 6, 7, 5, 6 ,7

frame 7 is lost

8 , 9 are send but A will realize 7 acknowledgement is not received.

so it will send again 7, 8, and 9 also 8 and 9 are already in the queue and since 9 is the 5th packet it will get lost and A will resend packet 9 again.

Therefore total packets send = 1, 2, 3, 4, 5, 6, 7, 5, 6 ,7, 8, 9, 7, 8, 9, 9

= 16 packets.