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.