The Gateway to Computer Science Excellence
+9 votes
Token Bucket mechanism is used for congestion control at router. Bucket capacity in 700 Bytes (initially full), token arrival rate is 200 Bytes/sec and maximum output rate is 300 Bytes/sec. The amount of time (in sec) required to transmit 3000 Bytes file is _____.
in Computer Networks by Boss (12.1k points)
edited by | 789 views

1 Answer

+22 votes
Best answer

700B Capacity of bucket which is initially filled.
Tokean Arrival Rate = 200 Bytes/Sec
Max Output Rate= 300 Bytes

Time to transmit 3000 Bytes?

Bursty Traffic Time =
     C + P*S = M*S   (C=Bucket Capacity, P=Token Generating Rate, S=Bursty Time, M=Output Rate)
         700 + 200*S = 300*S
          S = 700/100 = 7 Seconds
For 7 seconds system will generate tokens at full speed of 300 Bytes/Sec, and after that it will switch to 200Bytes/Sec.

In 7 seconds at the speed of 300 Bytes/Sec, 2100 Bytes have been sent and left 900 bytes will be sent at the speed of

200 Bytes/sec which requires further 4.5 seconds.

So, Total time to send 3000 Bytes, it will take 7 + 4.5 = 11.5 Seconds

by Boss (43.8k points)
selected by
why will it switch to 200 Bps after 7 seconds as 200Bps is arrival rate and not the output rate ?

This is the main difference between leaky bucket and token bucket. Token bucket algorithm allows idle hosts to accumulate while leaky bucket doesn't. 
I mean to say here that, when host was idle and not sending data that time 700 bytes were filled in bucket so token bucket will take care of this data, later it will switch to normal and constant rate.

Thanks, I got it. My question is shouldn't the data be output as 300 Bps as it is the output rate ?
"shouldn't the data be output as 300 Bps as it is the output rate" then what is the use of token bucket?
Got it, thank you :)
@Manu Thankur bro from what i  undertsood the maximum output rate is the rate at which u can transfer at maximum and is set as per network the rate initially say for 2seconds is  700+200*2=1100/2 =550 bytes/sec but due to network limitation of max out put rate of 300 bytes/sec we can send only 300 bytes/sec rate and immedeatly the rate doesnt come down to 200 bytes/sec after 7 seconds it takes time infinite amount of time

Lt t---->infinity     (C+R*t)/t = R (input rate of tokens )

i think it is better to use this approach initially 700 bytes can be transmitted at time t=0 itself and for remaining 2300 bytes it takes 2300/200 =11.5 seconds so total 11.5 seconds just check this and correct me if i am wrong
Thanks buddy !

@Nandkishor3939 @Venkat Sai @Manu Thakur

Can you please tell why token generation rate is taken as $300 Bps$, In question it has been given that token generation rate is 200 $BPS$ and from buket output data can go with a rate of $300Bps$.

As shown in the figure, $r$ tokens/sec is the token generation rate which is $200 Bps$ and Remove token rate is $300Bps$

For, the first 7 sec the bucket will be full of tokens.So, it will pump the data at the max O/p rate i.e. 300Bps.

After this 7 sec the tokens will get totally consumed so thenafter the o/p rate will equal to the Token Generation Rate i.e. 200Bps.

{ The Token generation rate is not 300Bps it is 200Bps...but for the first 7 sec (to calculate this time i.e. how long the transmission will be at max o/p rate, we apply the formula  ) the data is transmitted at the max o/p rate , that's it :) }

Hope This Helped ...

@Manu Thakur

if the token bucket is not initially filled then what will be the time?



If the token bucket is initially empty then :

Time to transmit 3000B= 3000/200 sec = 15 sec




so if the token bucket is initially empty then the transmission will not occur at max rate?


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
50,647 questions
56,503 answers
100,865 users