The Gateway to Computer Science Excellence

+22 votes

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

- $1.6$ seconds
- $2$ seconds
- $5$ seconds
- $8$ seconds

+8

Its not related to token ring . It is a congestion control algorithm in network layer (falls under traffic shaping).

+1

__Confusion in the analysis of the problem__.

at $t = 0$ | Bucket occupancy $= 16 \ Mb$ |

between $t = 0 \text{ and } t = 1$ |
$10 \ Mb$ worth of token (and packet data) is drained out. $2 \ Mb$ worth of token is added to the bucket. |

at the end of $t = 1$ | Bucket occupancy $= (16 - 10 + 2) \ Mb = 8 \ Mb$ |

between $t = 1 \text{ and } t = 2$ | What will happen here? |

__My understanding__: $2$ possibilities

- $2 \ Mb$ worth of token is
**first**added to the bucket. And**then**, $10 \ Mb$ worth of token is removed. This leaves bucket occupancy $= 0 \ Mb$. This gives a full rate transmission time of $2$ seconds. - $8 \ Mb$ worth of token is
**first**drained out of the bucket, and**then**, $2 \ Mb$ worth of token is added. This leaves bucket occupancy $= 2 \ Mb$. This gives a full rate transmission time of $1$ second.

As per the discussions here, it is evident that the former approach is preferred over the latter. But, intuitively, I do not see any reason for doing this.

- Why would the transmitter wait for the bucket to fill again with $2 \ Mb$ worth of token (possibility $1$) when it already has $8 \ Mb$ worth of token in the bucket and can use it to transmit $8 \ Mb$ data?

I would appreciate an intuitive explanation, rather than using the formula $T_{trans} = \frac{16 \ Mb}{(10 - 2) \ Mbps}$

+36 votes

Best answer

New tokens are added at the rate of $r$ bits/sec which is

$2$ $Mbps$ in the given question.

Capacity of the token bucket (b) = $16$ $Mbits$

Maximum possible transmission rate (M) = $10$ $Mbps$

So, the maximum burst time = b/(M-r) = $16$/($10$-$2$) = $2$ $seconds$

Here is the animation for token bucket hope this will help us to understand the concept.

Correct Answer: $B$

+5

That animation link is not working. Those who are interested to see that: http://webmuseum.mi.fh-offenburg.de/index.php%3Fview=exh&src=8.html

+5

check this archived version-

https://web.archive.org/web/20161109022643/webmuseum.mi.fh-offenburg.de/index.php?view=exh&src=8

+4

working link for animation: https://mi-learning.mi.hs-offenburg.de/Webmuseum/Anim/8-trafficShaping/index.html

+25 votes

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.

+15 votes

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.

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.

+3 votes

- 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

+2 votes

Simple way :

Token rate into bucket = 2 Mbps

Output rate of bucket = 10 Mbps

Effective rate = 10-2 = 8 Mbps

Bucket capacity is full, 16 Mb

So, at effective rate bucket will drain in 16/8 = 2s

In these 2s, output capacity of bucket will be 10Mbps, after bucket gets empty, it's capacity will reduce to effective rate of 8Mbps.

Token rate into bucket = 2 Mbps

Output rate of bucket = 10 Mbps

Effective rate = 10-2 = 8 Mbps

Bucket capacity is full, 16 Mb

So, at effective rate bucket will drain in 16/8 = 2s

In these 2s, output capacity of bucket will be 10Mbps, after bucket gets empty, it's capacity will reduce to effective rate of 8Mbps.

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.4k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.4k
- Admissions 595
- Exam Queries 573
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,737 questions

57,380 answers

198,528 comments

105,321 users