SlideShare a Scribd company logo
1 of 5
DATA COMMUNICATION AND
  COMPUTER NETWORKS


  ASSIGNMENT-III



               SUBMITTED BY:

                UMESH GUPTA
               B.TECH (CSE/IT)
CONTENTS

 Leaky Bucket Algorithm
 Token Bucket Algorithm
Leaky Bucket Algorithm
Consider a Bucket with a small hole at the bottom, whatever may be the rate of
water pouring into the bucket, the rate at which water comes out from that small
hole is constant. This scenario is depicted in figure 1(a). Once the bucket is full,
any additional water entering it spills over the sides and is lost (i.e. it doesn’t
appear in the output stream through the hole underneath).

The same idea of leaky bucket can be applied to packets, as shown in Fig. 1(b).
Conceptually each network interface contains a leaky bucket. And the following
steps are performed:

      When the host has to send a packet, the packet is thrown into the bucket.
      The bucket leaks at a constant rate, meaning the network interface
      transmits packets at a constant rate.
      Bursty traffic is converted to a uniform traffic by the leaky bucket.
      In practice the bucket is a finite queue that outputs at a finite rate.

This arrangement can be simulated in the operating system or can be built into
the hardware. Implementation of this algorithm is easy and consists of a finite
queue. Whenever a packet arrives, if there is room in the queue it is queued up
and if there is no room then the packet is discarded




                                         .
            (a)                                  (b)
          Figure 1.(a) Leaky bucket (b) Leaky bucket implementation
Token Bucket Algorithm
The leaky bucket algorithm described above, enforces a rigid pattern at the
output stream, irrespective of the pattern of the input. For many applications it
is better to allow the output to speed up somewhat when a larger burst arrives
than to loose the data. Token Bucket algorithm provides such a solution. In this
algorithm leaky bucket holds token, generated at regular intervals. Main steps of
this algorithm can be described as follows:
       In regular intervals tokens are thrown into the bucket.
       The bucket has a maximum capacity.
       If there is a ready packet, a token is removed from the bucket, and
thepacket is send.
       If there is no token in the bucket, the packet cannot be send.

Figure 2.1 shows the two scenarios before and after the tokens present in the
bucket have been consumed. In Fig. 2.1(a) the bucket holds two tokens, and
three packets are waiting to be sent out of the interface, in Fig. 2.1(b) two
packets have been sent out by consuming two tokens, and 1 packet is still left.
The token bucket algorithm is less restrictive than the leaky bucket algorithm, in
a sense that it allows bursty traffic. However, the limit of burst is restricted by
the number of tokens available in the bucket at a particular instant of time.
The implementation of basic token bucket algorithm is simple; a variable is
used just to count the tokens. This counter is incremented every t seconds and is
decremented whenever a packet is sent. Whenever this counter reaches zero, no
further packet is sent out as shown in Fig. 1.2
Figure 2.1(a) Token bucket holding two tokens, before packets are send out, (b) Token
bucket after two packets are send, one packet still remains as no token is left




                  Figure 2.2 Implementation of the Token bucket algorithm

More Related Content

What's hot

Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSDr. SELVAGANESAN S
 
Congestion on computer network
Congestion on computer networkCongestion on computer network
Congestion on computer networkDisi Dc
 
Congestion control
Congestion controlCongestion control
Congestion controlNithin Raj
 
Congestion control
Congestion controlCongestion control
Congestion controlAman Jaiswal
 
Controlled Access Protocols
Controlled Access ProtocolsControlled Access Protocols
Controlled Access ProtocolsPruthviraj Konu
 
Network layer - design Issues
Network layer - design IssuesNetwork layer - design Issues
Network layer - design Issuesقصي نسور
 
QOS (Quality of Services) - Computer Networks
 QOS (Quality of Services) - Computer Networks QOS (Quality of Services) - Computer Networks
QOS (Quality of Services) - Computer NetworksIIIT Manipur
 
Media Access Control (MAC Layer)
Media Access Control (MAC Layer)Media Access Control (MAC Layer)
Media Access Control (MAC Layer)Meenakshi Paul
 
Multiple Access Protocal
Multiple Access ProtocalMultiple Access Protocal
Multiple Access Protocaltes31
 
switching techniques in data communication and networking
switching techniques in data communication and networkingswitching techniques in data communication and networking
switching techniques in data communication and networkingHarshita Yadav
 
Unit 2 data link control
Unit 2 data link controlUnit 2 data link control
Unit 2 data link controlVishal kakade
 
Computer network switches & their structures
Computer network switches & their structuresComputer network switches & their structures
Computer network switches & their structuresSweta Kumari Barnwal
 
7. data link layer error detection and correction codes - parity and checksum
7. data link layer   error detection and correction codes - parity and checksum7. data link layer   error detection and correction codes - parity and checksum
7. data link layer error detection and correction codes - parity and checksumJAIGANESH SEKAR
 
Go back-n protocol
Go back-n protocolGo back-n protocol
Go back-n protocolSTEFFY D
 
HDLC(High level Data Link Control)
HDLC(High level Data Link Control)HDLC(High level Data Link Control)
HDLC(High level Data Link Control)sonangrai
 

What's hot (20)

Distance vector routing
Distance vector routingDistance vector routing
Distance vector routing
 
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESSComputer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
Computer Networks Unit 2 UNIT II DATA-LINK LAYER & MEDIA ACCESS
 
Congestion on computer network
Congestion on computer networkCongestion on computer network
Congestion on computer network
 
Congestion control
Congestion controlCongestion control
Congestion control
 
Congestion control
Congestion controlCongestion control
Congestion control
 
Controlled Access Protocols
Controlled Access ProtocolsControlled Access Protocols
Controlled Access Protocols
 
Network layer - design Issues
Network layer - design IssuesNetwork layer - design Issues
Network layer - design Issues
 
QOS (Quality of Services) - Computer Networks
 QOS (Quality of Services) - Computer Networks QOS (Quality of Services) - Computer Networks
QOS (Quality of Services) - Computer Networks
 
Media Access Control (MAC Layer)
Media Access Control (MAC Layer)Media Access Control (MAC Layer)
Media Access Control (MAC Layer)
 
Computer networks - Channelization
Computer networks - ChannelizationComputer networks - Channelization
Computer networks - Channelization
 
Multiple Access Protocal
Multiple Access ProtocalMultiple Access Protocal
Multiple Access Protocal
 
switching techniques in data communication and networking
switching techniques in data communication and networkingswitching techniques in data communication and networking
switching techniques in data communication and networking
 
Unit 2 data link control
Unit 2 data link controlUnit 2 data link control
Unit 2 data link control
 
Computer network switches & their structures
Computer network switches & their structuresComputer network switches & their structures
Computer network switches & their structures
 
Congestion control in TCP
Congestion control in TCPCongestion control in TCP
Congestion control in TCP
 
Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...
Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...
Transport layer protocols : Simple Protocol , Stop and Wait Protocol , Go-Bac...
 
Black hole attack
Black hole attackBlack hole attack
Black hole attack
 
7. data link layer error detection and correction codes - parity and checksum
7. data link layer   error detection and correction codes - parity and checksum7. data link layer   error detection and correction codes - parity and checksum
7. data link layer error detection and correction codes - parity and checksum
 
Go back-n protocol
Go back-n protocolGo back-n protocol
Go back-n protocol
 
HDLC(High level Data Link Control)
HDLC(High level Data Link Control)HDLC(High level Data Link Control)
HDLC(High level Data Link Control)
 

Similar to Leaky bucket algorithm

Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion AvoidanceRam Dutt Shukla
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxujjwalmatoliya
 
Congestion control 1
Congestion control 1Congestion control 1
Congestion control 1Aman Jaiswal
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptxujjwalmatoliya
 
Leaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shapingLeaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shapingVimal Dewangan
 
congestion control.pdf
congestion control.pdfcongestion control.pdf
congestion control.pdfJayaprasanna4
 
Congestion control Assignment Help
Congestion control Assignment HelpCongestion control Assignment Help
Congestion control Assignment HelpJosephErin
 
tcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppttcp-wireless-tutorial.ppt
tcp-wireless-tutorial.pptRadwan Mahmoud
 
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...vtunotesbysree
 
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...IEEEFINALSEMSTUDENTSPROJECTS
 
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...IEEEGLOBALSOFTSTUDENTPROJECTS
 
Computer Networks Module 2.pdf
Computer Networks Module 2.pdfComputer Networks Module 2.pdf
Computer Networks Module 2.pdfShanthalaKV
 
High efficient carry skip adder in various multiplier structures
High efficient carry skip adder in various multiplier structuresHigh efficient carry skip adder in various multiplier structures
High efficient carry skip adder in various multiplier structuresIaetsd Iaetsd
 
WAN Technology : ATM - Forouzan
WAN Technology : ATM - ForouzanWAN Technology : ATM - Forouzan
WAN Technology : ATM - ForouzanPradnya Saval
 

Similar to Leaky bucket algorithm (20)

Leakybucketalgorithm
LeakybucketalgorithmLeakybucketalgorithm
Leakybucketalgorithm
 
Conjestion control
Conjestion controlConjestion control
Conjestion control
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
 
A018120105
A018120105A018120105
A018120105
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptx
 
Congestion control 1
Congestion control 1Congestion control 1
Congestion control 1
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptx
 
Leaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shapingLeaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shaping
 
Congestion control
Congestion controlCongestion control
Congestion control
 
congestion control.pdf
congestion control.pdfcongestion control.pdf
congestion control.pdf
 
Congestion control Assignment Help
Congestion control Assignment HelpCongestion control Assignment Help
Congestion control Assignment Help
 
Network layer
Network layerNetwork layer
Network layer
 
tcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppttcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppt
 
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
 
Q010228189
Q010228189Q010228189
Q010228189
 
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
2014 IEEE JAVA NETWORKING PROJECT Receiver based flow control for networks in...
 
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
IEEE 2014 JAVA NETWORKING PROJECTS Receiver based flow control for networks i...
 
Computer Networks Module 2.pdf
Computer Networks Module 2.pdfComputer Networks Module 2.pdf
Computer Networks Module 2.pdf
 
High efficient carry skip adder in various multiplier structures
High efficient carry skip adder in various multiplier structuresHigh efficient carry skip adder in various multiplier structures
High efficient carry skip adder in various multiplier structures
 
WAN Technology : ATM - Forouzan
WAN Technology : ATM - ForouzanWAN Technology : ATM - Forouzan
WAN Technology : ATM - Forouzan
 

More from Umesh Gupta

More from Umesh Gupta (6)

SOFTWARE models
SOFTWARE modelsSOFTWARE models
SOFTWARE models
 
AIDS
AIDSAIDS
AIDS
 
Risk-management
 Risk-management Risk-management
Risk-management
 
Transmission media
Transmission mediaTransmission media
Transmission media
 
Calculating the hamming code
Calculating the hamming codeCalculating the hamming code
Calculating the hamming code
 
Hdlc
HdlcHdlc
Hdlc
 

Leaky bucket algorithm

  • 1. DATA COMMUNICATION AND COMPUTER NETWORKS ASSIGNMENT-III SUBMITTED BY: UMESH GUPTA B.TECH (CSE/IT)
  • 2. CONTENTS Leaky Bucket Algorithm Token Bucket Algorithm
  • 3. Leaky Bucket Algorithm Consider a Bucket with a small hole at the bottom, whatever may be the rate of water pouring into the bucket, the rate at which water comes out from that small hole is constant. This scenario is depicted in figure 1(a). Once the bucket is full, any additional water entering it spills over the sides and is lost (i.e. it doesn’t appear in the output stream through the hole underneath). The same idea of leaky bucket can be applied to packets, as shown in Fig. 1(b). Conceptually each network interface contains a leaky bucket. And the following steps are performed: When the host has to send a packet, the packet is thrown into the bucket. The bucket leaks at a constant rate, meaning the network interface transmits packets at a constant rate. Bursty traffic is converted to a uniform traffic by the leaky bucket. In practice the bucket is a finite queue that outputs at a finite rate. This arrangement can be simulated in the operating system or can be built into the hardware. Implementation of this algorithm is easy and consists of a finite queue. Whenever a packet arrives, if there is room in the queue it is queued up and if there is no room then the packet is discarded . (a) (b) Figure 1.(a) Leaky bucket (b) Leaky bucket implementation
  • 4. Token Bucket Algorithm The leaky bucket algorithm described above, enforces a rigid pattern at the output stream, irrespective of the pattern of the input. For many applications it is better to allow the output to speed up somewhat when a larger burst arrives than to loose the data. Token Bucket algorithm provides such a solution. In this algorithm leaky bucket holds token, generated at regular intervals. Main steps of this algorithm can be described as follows: In regular intervals tokens are thrown into the bucket. The bucket has a maximum capacity. If there is a ready packet, a token is removed from the bucket, and thepacket is send. If there is no token in the bucket, the packet cannot be send. Figure 2.1 shows the two scenarios before and after the tokens present in the bucket have been consumed. In Fig. 2.1(a) the bucket holds two tokens, and three packets are waiting to be sent out of the interface, in Fig. 2.1(b) two packets have been sent out by consuming two tokens, and 1 packet is still left. The token bucket algorithm is less restrictive than the leaky bucket algorithm, in a sense that it allows bursty traffic. However, the limit of burst is restricted by the number of tokens available in the bucket at a particular instant of time. The implementation of basic token bucket algorithm is simple; a variable is used just to count the tokens. This counter is incremented every t seconds and is decremented whenever a packet is sent. Whenever this counter reaches zero, no further packet is sent out as shown in Fig. 1.2
  • 5. Figure 2.1(a) Token bucket holding two tokens, before packets are send out, (b) Token bucket after two packets are send, one packet still remains as no token is left Figure 2.2 Implementation of the Token bucket algorithm