395 views

2 Sec?
Ans given with this is 3 sec...

I have only one doubt i. E what does it mean when they are saying that token bucket is initially full?

Does it mean that there are 3 tokens already (15/5) and if so then when will they get empty?

If we assume that yes all 3 tokens get out along with new token then ans is coming out to be right i. E 3 sec.

Explanation:-

here, the token rate is 5 Mbps means the token are filling into the router buffer with a rate of 5 Mbps.

and the token output rate is 20 Mbps means the token are ejecting from the router at a rate of 20 Mbps.

Now if we collectively calculate both rates then we can conclude that tokens are ejecting at a rate of

(Output rate - Input rate) = (20 - 5)Mbps = 15 Mbps

It means in 1 sec when injection and ejection are happening at the same time then 15 Mb of data are ejecting.

In the question given that the buffer is initially full so to empty it 1 second is required

And the total data is of 30 Mb so it will take 2 sec.

So, the total time is = time required to empty + time required to transmit 30 Mb.

total time is = 1 sec + 2 sec

Maximum output rate  * t =  capacity + ( input rate of tokens * t )

20Mbps * t = 15Mb + 5Mbps * t

t = 1s

1s we sent at Maximum output rate 20Mbps = 20Mb data is sent in 1s

Now, Data left to be sent = 30Mb-20Mb = 10Mb

10Mb data can be sent at 5Mbps at rate which token arrives because bucket is empty.

Time taken = 10Mb/5Mbps = 2s

So Total time taken = 1s (20Mb) + 2s(10Mb) = 3s