14,461 views

A computer on a $10\text{Mbps}$ network is regulated by a token bucket. The token bucket is filled at a rate of $2\text{Mbps}$. It is initially filled to capacity with $16\text{Megabits}$. What is the maximum duration for which the computer can transmit at the full $10\text{Mbps}$?

1. $1.6$ seconds
2. $2$ seconds
3. $5$ seconds
4. $8$ seconds

Ok, Thanks.

$\\ Max\ rate=\dfrac{c+rt}{t}\\ \\ 10Mbps=\dfrac{16Mb+2Mbps\times t}{t}\\ \\ 10Mbps\times t-2Mbps\times t=16Mb\\ \\ 8Mbps\times t=16Mb\\ \\ t=2sec$

Ans: 2sec

I had the same confusion but here is the explanation:

Intuitively speaking, at t = 1 sec , you have 8 Mb of tokens in the bucket, so either you can fill 2 Mb into the bucket and then transmit 10 Mb of full capacity or else transmit 8 Mb which is not the full capacity.

But the first choice is made, the reason being that the the bucket is not full currently, you want to transmit at full capacity and currently you have 2 Mb less than the full capacity and hence you will prefer to first fill the bucket completely and then transmit. Hence 2 Mb is first put in which takes 1 second and then at t = 2 sec, you transmit the complete 10 Mb.

New tokens are added at the rate of $r$ bits/sec which is $2\;\text{Mbps}$ in the given question.

Capacity of the token bucket $(b) = 16\;\text{Mbits}$
Maximum possible transmission rate $(M) = 10\;\text{Mbps}$
So, the maximum burst time $= b/(M-r) = 16/(10-2) = 2 \;\text{seconds}$
Here is the animation for token bucket hope this will help us to understand the concept.

Correct Answer: $B$

Yes, it is not working now, unfortunately!

TIME TOKEN IN BUCKET TOKEN SEND LEFT IN BUCKET
First sec 16Mb+ 2Mb =18Mb 10Mb 8Mb
next sec 8Mb+2Mb 10Mb 0Mb

Hence for 2 seconds we can send the tokens at 10 Mbps.

by

### 1 comment

Capacity of the bucket is mention is 16Mb, so how it can hold 18Mb token in 1st second?

It's 'kind of' aptitude question:

packets leaving bucket at 10Mbps   &&   packets entering bucket at 2Mbps.

So "actual rate" of bucket being empty is 10-2=8Mbps.

so (capacity/transmission rate) = 16/8 =2seconds.

### 1 comment

Why did you subtract 8 from 10 and please do interpret the question?
• I/P rate of tokens=2 Mega bps. 2 Megabits tokens come 1 sec
• O/P rate of tokens=10 Mega bps. 10 Megabits tokens comes out in 1 sec
• Capacity of the bucket=16 megabits
• At t=0, bucket=16 Megabits
• At t=1, 10 Megabits tokens comes out(as it is filled so first tokens have to pulled out then it will be filled), 2 Megabits tokens come in, (16-10+2)=8 Megabits tokens. At t=1 bucket has 8 Megabits tokens
• At t=2, bucket has 8 Megabits tokens(it is not full no first tokens will come in then pulled out), 2 Megabits tokens comes in, bucket=8+2=10 Megabits. 10 Megabits tokens will come out. Now bucket has 0 Megabits tokens
• At t=3, bucket has 0 tokens, 2 Megabits tokens comes in and 2 Megabits tokens goes out. So here tokens are send at the rate of 2 Mega bps and this will continue
• In t=1 sec 10 Megabits tokens comes out
• At t=2, 10 Megabits tokens come out
• So till 2 sec we're able to send tokens at 10 Mega bps
by

Just correct the last second line. You missed to write 10 there .

I think rate of adding tokens to bucket and rate of consuming tokens from bucket happens according to the capacity of Bucket (for example, it takes 1 sec to consume a token and 2 sec to add a token, then for every 2 sec - 2 tokens are used and 1 token is added).

Correct me, if i am wrong.