
- DCN Tutorial
- Data Comm & Networks Home
- DCN - Overview
- DCN - Computer Network Types
- DCN - Network LAN Technologies
- DCN - Computer Network Topologies
- DCN - Computer Network Models
- DCN - Computer Network Security
- Physical Layer
- DCN - Physical Layer Introduction
- DCN - Digital Transmission
- DCN - Analog Transmission
- DCN - Transmission media
- DCN - Wireless Transmission
- DCN - Multiplexing
- DCN - Network Switching
- Data Link Layer
- DCN - Data Link Layer Introduction
- DCN - Error detection and Correction
- DCN - Data Link Control & Protocols
- Network Layer
- DCN - Network Layer Introduction
- DCN - Network Addressing
- DCN - Routing
- DCN - Internetworking
- DCN - Network Layer Protocols
- Transport Layer
- DCN - Transport Layer Introduction
- DCN - Transmission Control Protocol
- DCN - User Datagram Protocol
- Application Layer
- DCN - Application Layer Introduction
- DCN - Client-Server Model
- DCN - Application Protocols
- DCN - Network Services
- DCN Useful Resources
- DCN - Quick Guide
- DCN - Useful Resources
What is Token Bucket algorithm in computer networks?
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 −
- Related Articles
- What is Leaky Bucket algorithm in computer networks?
- What is IPsec in computer networks?
- What is Tunnelling in Computer Networks?
- What is NAT in computer networks?
- What is bit stuffing in computer networks?
- What is byte stuffing in computer networks?
- What is Hybrid Topology in Computer Networks?
- What is baseband transmission in computer networks?
- What is Traffic Throttling in computer networks?
- What is Pure ALOHA in computer networks?
- What is slotted ALOHA in computer networks?
- What is Ethernet evolution in computer networks?
- What is load shedding in computer networks?
- What is Attenuation Distortion in computer networks?
- What is Delay distortion in computer networks?
