The Gateway to Computer Science Excellence
+64 votes
Two hosts are connected via a packet switch with $10^7$ bits per second links. Each link has a propagation delay of $20$ microseconds. The switch begins forwarding a packet $35$ microseconds after it receives the same. If $10000$ bits of data are to be transmitted between the two hosts using a packet size of $5000$ bits, the time elapsed between the transmission of the first bit of data and the reception of the last bit of the data in microseconds is ______.
in Computer Networks by
edited by | 13k views
Arjun sir, if u say that 2nd packet is start transmitting after 520 Msec  then 500 Msec required just to transmit its bits to network then further 20 Msec must be required to propogate its bits to switch .sir plz explain this because i didn't got ur point of neglecting Propoagation delay(Packet 2 just follow packet 1) because packet 2 is not present in n/w buffer before 1020 Msec then further 20 msec for pd . Correct me if I m wrong
Doubt :

Time elasped b/w 1st and last bit of data...
Since 1st bit reached at destination at 555microsec,

last bit reached at destination 1575 microsec.


So time elapsed b/w them should be 1575 - 555 = 1020s????
I understood
1st bit transmition start it is saying.

since 1st bit transition start at 0second

so time elasped b/w (Transition of first which is 0) and (Reching of last which is 1575) = 1575us
both of the packets were sent simultaneously one after the other by the 1st host, so the packet delay was added only once. Both of them were stored at the buffer queue of the router.
Transition time of last or second packet + time of first packet to reach the destination from  source = 500 +(500+20+35+500+20)=1575 microsec.
how can we say that "is this cut through switch or store and forward switch"????

if it is cut through switch then transmission time of switch will not be considered..

correct me if i am wrong.


$P1$ $500$ $20$ $35$ $500$ $20$ $=1075$
$P2$ $\times$ $20$ $(Remaining\ 480)$ $35$ $(Remaining\ 445)$ $445+20+35$ $20$  
        P1 will fall on the link and P2 is getting ready to get out of router   P1 has reached but P2 still needs to travel 480+20


awesome explanation

This timing diagram might help.

8 Answers

+79 votes
Best answer

No. of packets sent $=\dfrac{10000}{5000}= 2$.

Time for the first packet to reach switch $=\text{Transmission time + Propagation delay}$ 
$= \left(\dfrac{5000}{10^7}\right)\times {10^6}\mu s+20\mu s$

$= 520\mu s.$

$($Another $520\mu s$ is required for the same packet to reach the destination from the switch and in between there is a forwarding delay of $35\mu s.$ So, first packet is received at destination at $2\times 520+ 35=1075 \mu s. )$

After $520 \mu s,$ the switch can start receiving the second packet and at $520 + 500 = 1020 \mu s,$ second frame is completely received by the switch $($we don't need to add propagation time here as packet $2$ can just follow packet $1 )$.

So, at $1055\mu s$ from the start the switch starts sending the second packet and this will be received at destination after another $520 \mu s=1575 \mu s.$ Since we added transmission time, this ensures that the last bit of data is received at the sender. 


(Alternate solution)

We can think the same question in terms of last packet, argument here is: The moment last packet reaches to destination, all other packets are already reached.

Total time $=\text{Transmission time of all packets + Propagation time for first link}$
$\text{+ Switch Delay + Transmission time of last packet for Switch}$
$\text{+ propagation time for 2nd link}.$

$=\left (\dfrac{10^4}{10^7}sec=1ms=1000\mu s \right) 1000 + 20 + 35 + 500 + 20=1575\mu s.$

edited by
It can simply use a different storage for receiving and sending and copy the packet as soon as it is arrived fully.

@arjun sir

I'm interrested in Packet 2 only

case 1  packet2 moving from sender
Like you said in the beginning 
" (we don't need to add propagation time here as packet 2 can just follow packet 1) " 
You took only 500us
case 2 : packet 2 moving from switch
But while the packet is moving fom switch you did add 20us for propagation delay .

Why it is so ?

in case 1, sender is having all packets ready. So, it just fires them back to back (unlike stop and wait).

In case 2, also you can consider like that. But then we have to calculate from receiver end - 1075+500 = 1575. I calculated from switch - 1055+520 = 1575.
@arjun sir , what is the logic in considring propogation delay in case 2 ? I didn't understand that , I have updated my answer pls check it sir
one of the best trickiest question i have encountered in the "computer network" so far

Sir..2-3 clarifications are needed
At 520 whole first packet will be reached at switch. And at 1020 switch will get bits of 2nd packet?
I used to think tht transmission time is time taken to place the data on the link.
And propagation time is the time data take to travel through the link.
But u said that at 1020 time second frame will be reached at switch..

I think at 1020 second frame completes its transmission and it will take 20micro sec to propagate but that time will be overlapped with the time taken by first frame at switch and further transmission. (So no need to calculate that propagation time.)

Yes, what you were thinking was correct only. So, At 1000, second frame would be "transmitted" rt?
Yes it will start traveling from A to switch.
Very clever solution
U recognized that second packet was stored and forwarded and so u added there transmission delay
Are we assuming store and forward switch here? Otherwise why not start sending from switch towards destination as soon as the queuing 35 seconds finish while we're still receiving bits from source.
@Sachin, I think the alternate solution proposed by you have a flaw if u follow ur given formula:-

Just try this keep all data same except switch's transmission delay 700MicroSec.

And tell me the ans??
bro which formula ?

I may be incorrect, but tell me precisely where i am wrong.
Thnks :)

Total time = Transmission time of all packets +  Propagation time for first link + Switch Delay + Transmission time of last packet for Switch + propagation time for 2nd link.

//Consider all data same except below...and solve the given question and tell me ans.

Transmission time for Switch=700 Micro Sec..

Why i am supposed to take $700$ ?
I am not getting..sorry :(

If you strongly feel that i made some mistake, then feel free to edit :)

I think ur approach is working for some cases.(Means not working for all cases)

If i take all data same except Transmission time for Switch=700 Micro Sec

then according to ur approach ans will be:->>1775

But in real if u will analyze by time line diagram with pipelining then ans will be 1975.

(The flaw in ur approach is U r strictly considering only last packet u r not bothering about any packet else last...But the special case i provided here..Ur last packet will go into a wait state of 200MicroSec bcz 1st packet is still in transmitting stage .So unlike 1775 as per ur approach ans will be 1975.

Plz analyze and correct me!!!

Bro, what r is u doing?

U are taking transmission time of switch differently for different packets?

frame me an EXACT question like they ask in GATE. And i will tell u that everything is cool.

@Sachin Plz Solve this question using ur approach(an EXACT question like they ask in GATE):-

Two hosts are connected via a packet switch .The bandwidth of Source to packet switch is 107bps and Packet switch to Destination is $\frac{50}{7}$ Mbps . Each link has a propagation delay of 20 microseconds. The switch begins forwarding a packet 35 microseconds after it receives the same. If 10000 bits of data are to be transmitted between the two hosts using a packet size of 5000 bits, the time elapsed between the transmission of the first bit of data and the reception of the last bit of the data in microseconds is ______.

The second solution is good.It will save from calculation mistake:)
Arjun sir can we do this problem with this approach

For sending 10000bits 1milisecond of time required...

So propogation time is 0.020miliseconds*2+0.035miliseconds

Adding all this value to 1.075miliseconds which 1075microseconds
Total time =Transmission time of all packets + Propagation time for first link=Transmission time of all packets + Propagation time for first link
+ Switch Delay + Transmission time of last packet for Switch+ Switch Delay + Transmission time of last packet for Switch
+ propagation time for 2nd link.,

what modifcation do I need in the formula if I get n packets and there are  n routers in between?
+261 votes

​​​​​$\text{number of packets send }=\frac{10000}{5000}=2$

$\text{Transmission Time }=\frac{5000}{10^{7}}=500$micro seconds

$\text{Propogation Time }=20$micro seconds

packet 1

At t=0
   packet starts from source 
At t=500
packet 1 is fully transmitted by source. Now it is availble in the link

At t=520
     packet 1 is availbe at swich

At t=555
    packet transmission starts from switch after waiting for 35μs
At t= 1055
    packet 1 is fully transmitted by switch . Now it is availble in the link
At t=1075
packet 1 reaches Receiver.

packet 2

At t=500
   packet starts from source

At t=1000
  packet 2 is Now available in the Link. Fully transmitted from source .packet 2 Now, begins to propogate to Switch

At t=1020
packet 2 now reachs switch

At t= 1055
packet transmission starts from switch after waiting for 35μs

At t=1555
packet 2 is fully transmitted by switch . Now it is availble in the link

At t=1575
packet 2 Reaches destination

edited by
yes, timing diagram makes it simple. You can just add what happens at sender, a packet is sent immediately after the first one - no waiting time and whole 500 ms is for sending the first packet (transmission time). That will make the explanation super simple :)
bro you made my day:)
isse achha xplanation ho hi nii skta @pc bhai

" the time elapsed between the transmission of the first bit of data and the reception of the last bit of the data"

Here it is asking the total time from end to end right? But at time 1575 only the first bit of data will have reached the reciever right?

Thanks. Its simplest Explanation.

why packet 2 starts at t=500 ?

Is it because of it was already waiting in buffer?

very nicely explained! Thanks..

Hey, Please Anyone help me, why you start the second packet at=500 microsecond?, But Packet switching theory says that first packet completely reach to the switch then only second packet will start transferring.

So first packet reached to the switch at t=520 microsecond, So second packet start the transmission at t= 520 microsecond.

please correct me if I am wrong?  @Arjun Sir,

Clear explanation indeed...!!!
nice soution
Just select this solution as best why arjun sir answer is selected as this answer get max upvote is GO is biased :D
@Moin If maximum voted answer is always selected as best, most people will never get to IITs :P And GO is indeed biased. If you dont like, please leave the place.
sorry arjun sir I think i should not write previous comment as GO is best in terms of any type of prepration related to computer science. I always promote this.

we have propagation delay only for the first packet

I used this logic got answer 1535 micro sec. Exactly 40 less when I ignore the Tp of 20 micro sec from sender to switch and from switch to destination. I am not getting that statement that Tp need not be considered as it is following 1st packet. 

absolutely brilliant solution. after struggling for half an hour saw your solution and got it with in half second. Thanks...

Thank you sir !!!

The simplest super explanation i had ever seen.

Just to simplify it, what ever happens to packet1 happens to packet2 after 500microseconds..(since transmission of packet2 starts after transmission of packet 1 is completed) .Here packet1 reaches destination host at 1075 microsec (500+20+35+500+20)from the beginning. So packet 2 reaches the destination 500microsec after that which means it reaches destination at 1575microsec

Transmission of the first bit of data at t=0

Reception of the last bit of the data at t= 1575


The time elapsed between the transmission of the first bit of data and the reception of the last bit of the data = 1575 -0 = 1575

Thank you sir,it was very clear the way you explained:)

Transmission of the first bit of data at t=0

Reception of the last bit of the data at t= 1575

How is this correct? Even if the first bit reaches at the switch at 0 second. Won't it have to wait for 35 microseconds at the switch before it transmits on the link and reaches the destination? @Arjun sir help. 

+5 votes

Transmission time for a packet $\frac{5000}{10^{7}}=500microsec$

Propagation time for a packet $20microsec$

Swithching delay $35microsec$

So, overall transmission time of 1st packet =$2\times 500+2\times 20+35=1075 microsec$...................i

Second packet needs only last transmission $500microsec$..................................................................ii

So, total transmission time $1075+500=1575 microsec$

@srestha Awesome answer, but I have an question, why didn't you take the propagation delays and delay time at switch for 2nd packet? And only the 1*TT for 2nd packet?
propogation time overlop with first transmission time think like pipeline
It work as pipelining in packet switching

Transmission time and processing time  of intermediate switch is not counted for all packet except first packet

Propagation delay also not counted
+4 votes

packet switching  follows pipelining and the main hero is pipelining  in this question. 


@bharti nice .........

+4 votes

Transmission time, Tt = ( 5000 / 10) *106 μs  = 500 μs
Tp= 20 μs, switch delay= 35 μs
Total time to reach destination (For packet1) = (500+20+35+500+20) = 1075 μs

Now, I am going to make it easy for you. Always think like this.
There is a train.
Packet2 -> Packet1->
(Transmission time is time for the train to go to track from the station, the propagation time is to cover the track.)

Just tell me in a train, if 1st Bagi reaches in time x, when will second bagi reach destination? Is it that hard? 2nd bagi (Packet2) is 500 μs apart from Packet1. Because Tt from sender was 500 μs.
So it will reach 500 μs after it. Very simple.

But there is something to think about in this question.
In the way, they stop the train, take a delay of 35 μs. We have included it for bagi1(Packet1).
So do we need to add it to bagi2 too? Will the two bagis get separated due to this?
No. Why?
Before checking, you think yourself.
Because see the time for bagi1 again.  
At time 500, bagi2 started. at 520 bagi1 is at that stoppage.
At time 555 bagi1 left station, it should come to track from the railway station in 1055, For bagi2 transmission time is not over yet. 
at time 1000, bagi2 is at the stoppage. For bagi1 55time left to leave the stoppage station.
During this bagi2 took 35 delay, Bagi 1 has 20more time to leave stoppage station. So Bagi2 is ready too. So after 20 bagi2 will just be connected to bagi1. So there will be no gap in between them. So bagi2 will reach just after 500 μs of bagi1.

So I prefer this way of doing.
By the way, it is not always going to happen that they will be connected always and you will just add Tt, that is the extra time for packet2.
They may get separated in the way. So you can calculate that separation between them, you add it at last.
Here bagi2 covered it's delay when bagi1 was still transmitting. So they did not get separated. If the delay would be more than 55μs then they would get separated and you would have to add that distance too.

Anyway answer is 1075 μs + 500 μs = 1575 μs

+2 votes

Timing diagram

     Timing diagram , I hope now now u can visualises 

+1 vote
First packet takes all the way:-

$500 \mu s+20\mu s+35 \mu s+500\mu s + 20 \mu s=1075\mu s$


Second packet rolls in pipelined fashion. So just consider $T_t$

=> $500 \mu s$

Total: $1575 \mu s$
edited by
0 votes
There are 10000/5000 = 2 packets.

Transmission time for 1 packet = 5000 bits / 10^7 bps = 500 micro sec.

Packet 1 reaches in 500 (transmission from source) + 20 ( propagation to switch) +35 ( switch delay) + 500 (transmission from switch) + 20 (propagation to receiver) = 1075 micro sec.

Since packet 2 starts 500 micro sec after packet 1, the last bit of it reaches in 1075 + 500 = 1575 micro sec.

Correct me if I am wrong.
if 3 pkt instead of 2 pkt what will be the ans
For First packet total delay= 500+20+35+500+20=1075

Last two packets= 2*500

So total delay= 1075+1000=2075

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,315 questions
60,430 answers
95,242 users