SlideShare a Scribd company logo
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
Ad

More Related Content

What's hot (20)

Framming data link layer
Framming data link layerFramming data link layer
Framming data link layer
PREMAL GAJJAR
 
Network layer logical addressing
Network layer logical addressingNetwork layer logical addressing
Network layer logical addressing
Sri Manakula Vinayagar Engineering College
 
Ethernet Computer network
Ethernet Computer networkEthernet Computer network
Ethernet Computer network
miteshppt
 
Wlan architecture
Wlan architectureWlan architecture
Wlan architecture
Vishal Verma
 
Network layer tanenbaum
Network layer tanenbaumNetwork layer tanenbaum
Network layer tanenbaum
Mahesh Kumar Chelimilla
 
Application layer protocols
Application layer protocolsApplication layer protocols
Application layer protocols
JUW Jinnah University for Women
 
IPV4 Frame Format
IPV4 Frame FormatIPV4 Frame Format
IPV4 Frame Format
Aditya Rawat
 
Message and Stream Oriented Communication
Message and Stream Oriented CommunicationMessage and Stream Oriented Communication
Message and Stream Oriented Communication
Dilum Bandara
 
Fields of digital image processing slides
Fields of digital image processing slidesFields of digital image processing slides
Fields of digital image processing slides
Srinath Dhayalamoorthy
 
Congestion control
Congestion controlCongestion control
Congestion control
Aman Jaiswal
 
Network Layer,Computer Networks
Network Layer,Computer NetworksNetwork Layer,Computer Networks
Network Layer,Computer Networks
guesta81d4b
 
Routing algorithm
Routing algorithmRouting algorithm
Routing algorithm
Bushra M
 
Sliding window protocol
Sliding window protocolSliding window protocol
Sliding window protocol
Shehara Abeythunga
 
Ethernet
EthernetEthernet
Ethernet
sijil chacko
 
Flow control and error control
Flow control and error controlFlow control and error control
Flow control and error control
BHUVIJAYAVELU
 
Address resolution protocol (ARP)
Address resolution protocol (ARP)Address resolution protocol (ARP)
Address resolution protocol (ARP)
NetProtocol Xpert
 
Computer networks - Channelization
Computer networks - ChannelizationComputer networks - Channelization
Computer networks - Channelization
Elambaruthi Elambaruthi
 
Wireless transmission
Wireless transmissionWireless transmission
Wireless transmission
Saba Rathinam
 
Transport layer
Transport layer Transport layer
Transport layer
Mukesh Chinta
 
Data Redundacy
Data RedundacyData Redundacy
Data Redundacy
Poonam Seth
 

Similar to Leaky bucket algorithm (20)

Leakybucketalgorithm
LeakybucketalgorithmLeakybucketalgorithm
Leakybucketalgorithm
Hitesh Mohapatra
 
Leaky bucket A
Leaky bucket ALeaky bucket A
Leaky bucket A
Syed Shaheer Gilani
 
Conjestion control
Conjestion controlConjestion control
Conjestion control
Barani Tharan
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
Ram Dutt Shukla
 
A018120105
A018120105A018120105
A018120105
IOSR Journals
 
Unit 2 data link control
Unit 2 data link controlUnit 2 data link control
Unit 2 data link control
Vishal kakade
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptx
ujjwalmatoliya
 
Congestion control 1
Congestion control 1Congestion control 1
Congestion control 1
Aman Jaiswal
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptx
ujjwalmatoliya
 
Leaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shapingLeaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shaping
Vimal Dewangan
 
Congestion control
Congestion controlCongestion control
Congestion control
Krishna Ranjan
 
congestion control.pdf
congestion control.pdfcongestion control.pdf
congestion control.pdf
Jayaprasanna4
 
Congestion control Assignment Help
Congestion control Assignment HelpCongestion control Assignment Help
Congestion control Assignment Help
JosephErin
 
Network layer
Network layerNetwork layer
Network layer
Bathshebaparimala
 
congestion_control: types, uses and application
congestion_control: types, uses and applicationcongestion_control: types, uses and application
congestion_control: types, uses and application
khushboos0911
 
tcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppttcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppt
Radwan Mahmoud
 
Congestion control
Congestion controlCongestion control
Congestion control
Nithin Raj
 
connecting devices part-2: Router and its uses
connecting devices part-2: Router  and  its usesconnecting devices part-2: Router  and  its uses
connecting devices part-2: Router and its uses
khushboos0911
 
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
 
Q010228189
Q010228189Q010228189
Q010228189
IOSR Journals
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
Ram Dutt Shukla
 
Unit 2 data link control
Unit 2 data link controlUnit 2 data link control
Unit 2 data link control
Vishal kakade
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptx
ujjwalmatoliya
 
Congestion control 1
Congestion control 1Congestion control 1
Congestion control 1
Aman Jaiswal
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptx
ujjwalmatoliya
 
Leaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shapingLeaky Bucket & Tocken Bucket - Traffic shaping
Leaky Bucket & Tocken Bucket - Traffic shaping
Vimal Dewangan
 
congestion control.pdf
congestion control.pdfcongestion control.pdf
congestion control.pdf
Jayaprasanna4
 
Congestion control Assignment Help
Congestion control Assignment HelpCongestion control Assignment Help
Congestion control Assignment Help
JosephErin
 
congestion_control: types, uses and application
congestion_control: types, uses and applicationcongestion_control: types, uses and application
congestion_control: types, uses and application
khushboos0911
 
tcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppttcp-wireless-tutorial.ppt
tcp-wireless-tutorial.ppt
Radwan Mahmoud
 
Congestion control
Congestion controlCongestion control
Congestion control
Nithin Raj
 
connecting devices part-2: Router and its uses
connecting devices part-2: Router  and  its usesconnecting devices part-2: Router  and  its uses
connecting devices part-2: Router and its uses
khushboos0911
 
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
 
Ad

More from Umesh Gupta (6)

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

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