0% found this document useful (0 votes)
12 views3 pages

Token Bucket

The Token Bucket Algorithm is a congestion control technique that allows for flexible traffic management in networks by using tokens to regulate packet transmission. Tokens are generated at regular intervals and can be consumed to send packets, with the bucket having a maximum capacity for tokens. This algorithm is less restrictive than the leaky bucket algorithm, enabling higher traffic levels while still controlling congestion.

Uploaded by

m7385809792
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Token Bucket

The Token Bucket Algorithm is a congestion control technique that allows for flexible traffic management in networks by using tokens to regulate packet transmission. Tokens are generated at regular intervals and can be consumed to send packets, with the bucket having a maximum capacity for tokens. This algorithm is less restrictive than the leaky bucket algorithm, enabling higher traffic levels while still controlling congestion.

Uploaded by

m7385809792
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Token bucket

Token bucket algorithm is one of the techniques for congestion control algorithms. When too
many packets are present in the network it causes packet delay and loss of packet which
degrades the performance of the system. This situation is called congestion.
The network layer and transport layer share the responsibility for handling congestions. One
of the most effective ways to control congestion is trying to reduce the load that transport
layer is placing on the network. To maintain this network and transport layers have to work
together.
The Token Bucket Algorithm is diagrammatically represented as follows −

With too much traffic, performance drops sharply.

Token Bucket Algorithm

The leaky bucket algorithm enforces output patterns at the average rate, no matter how busy
the traffic is. So, to deal with the more traffic, we need a flexible algorithm so that the data is
not lost. One such approach is the token bucket algorithm.
Let us understand this algorithm step wise as given below −
 Step 1 − In regular intervals tokens are thrown into the bucket f.
 Step 2 − The bucket has a maximum capacity f.
 Step 3 − If the packet is ready, then a token is removed from the bucket, and the
packet is sent.
 Step 4 − Suppose, if there is no token in the bucket, the packet cannot be sent.

Example

Let us understand the Token Bucket Algorithm with an example −


In figure (a) the bucket holds two tokens, and three packets are waiting to be sent out of the
interface.
In Figure (b) two packets have been sent out by consuming two tokens, and 1 packet is still
left.
When compared to Leaky bucket the token bucket algorithm is less restrictive that means it
allows more traffic. The limit of busyness is restricted by the number of tokens available in
the bucket at a particular instant of time.
The implementation of the token bucket algorithm is easy − a variable is used to count the
tokens. For every t seconds the counter is incremented and then it is decremented whenever a
packet is sent. When the counter reaches zero, no further packet is sent out.
This is shown in below given diagram −

You might also like