Log In
14 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
edited by

1 Answer

37 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

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?


After 5 sec it is returning to 200MBPS . Where am I doing wrong??

Related questions

0 votes
1 answer
I want to understand the Token Bucket and Leaky Bucket algorithms in detail. Please provide links to reliable resources. Please do not provide link to Wikipedia, because there it is not explained properly
asked Apr 6, 2019 in Computer Networks Prashant Srivastava 609 views
1 vote
0 answers
A token bucket scheme is used for traffic shaping. a new token is put into the bucket at every 10 micro second. assume each token pick one packet which contain 2B of data. it is observed that initial capacity of bucket is 10 Mb. the computer can transmit at full speed of 8 Mbps for ... ) = MT what is R? is it token arriving rate (0.1M/s) or data transmitted equivalent to token (16bits * 0.1M/s) ?
asked Jan 15, 2019 in Computer Networks Rahul_Rathod_ 668 views
2 votes
0 answers
Consider a token bucket with maximum rate = 20 Mbps. Suppose we want to make sure that maximum rate can only be sent for atmost 5 sec at a time and atmost 150 Mb can be sent over 10 sec window. Computer the required value for token refresh rate?
asked Dec 19, 2017 in Computer Networks Tuhin Dutta 563 views