Leaky Bucket Additional Problems With Solutions
Leaky Bucket Additional Problems With Solutions
Problem 1
Computer A has 19.5MB to send on a network and transmits the data in a burst @
6 Mbps. The maximum transmission rate across routers in the network is 4 Mbps.
If Computer A's transmission is shaped using a leaky bucket, how much capacity must the
queue in the bucket hold not to discard any data? (Show your work)
Solution
6 Mb → 1 sec
(19.5MB *8) Mb → ( time for computer to transmit data)??
time for computer to transmit data = total bits / max trans rate
= (19.5 MB * 8 bits/byte) / 6 Mbps
= 156 Mb / 6 Mb/s
= 26 s
4 Mb → 1 sec
actual data sent on network ?? → 26 sec
Problem 2
A leaky bucket is at the host network interface. The data rate on the network is 2MByte/s
and the data rate on the link from the host to the bucket is 2.5Mbyte/s.
A. Suppose the host has 250 Mbytes to send onto the network and it sends the data
in a burst. What should be the minimum capacity of the bucket (in bytes) in order
that no data is lost?
2.5Mbyte → 1 sec
250 Mbytes → ( time for host to transmit data)??
time for computer to transmit data = total bits / max trans rate
= (250 MB* 1 sec) / 2.5 Mbyte
= 100 sec
2 Mbyte → 1 sec
actual data sent on network ?? → 100 sec
B. Suppose the capacity of the bucket is 100M bytes. What is the longest burst time
from the host in order that no data is lost?
bucket size =250 MByte - actual data sent on network in the time the host transmit
all the data
→
2 Mbyte → 1 sec
15o MByte → time for computer to transmit all data ??
Problem 3
You have constructed a Leaky bucket class in Java using a queue of length 4, a thread
and a timer. The token bucket class operates on packets, and replenishes tokens tokens at the
rate of 1token/ms .TheThe maximum token count is 3. If possible, the class replenishes tokens
before any other operations.
A. Given the following packet arrival schedule, fill in the system state: token count,
scheduled departures, and queued packets, at each packet arrival time (if a packet arrives
and is not immediately sent then Queued Packets increments by 1).
The class is fast enough such that you can assume packets are sent instantaneously, if
possible. Initially the Leaky Bucket was full.
Solution
Packet Arrival Time Departure Token Queued
umber (msec) Time Count Packets
0 3 empty
1 1 1 2 empty
2 1.1 1.1 1 empty
3 1.5 1.5 0 empty At t=2 packet 4 depart
4 2 2 0 empty
remove the generated
token
5 2.7 3 0 5
6 2.9 4 0 5,6 At t=3 packet 5 depart
7 3 5 0 6,7 and remove the
8 3.1 6 0 6,7,8 generated token
9 3.2 7 0 6,7,8,9
Note
Here if we use a queue of length 3 → packet 9 will be dropped and discarded because at
t=3.2 the queue was full=6,7,8 and there is no enough space to queued 9th packet.
Problem 4
You have constructed a Leaky bucket class in Java using a queue of length 3, a thread and a
timer. The token bucket class operates on packets, and replenishes tokens at the rate of
1token/ms .The maximum token count is 2. If possible, the class replenishes tokens before any
other operations.
Given the following packet arrival schedule, fill in the system state: token count, scheduled
departures, and queued packets, at each packet arrival time (if a packet arrives and is not
immediately sent then Queued Packets increments by 1). The class is fast enough such that you
can assume packets are sent instantaneously, if possible. Initially the Leaky Bucket was full.
By: Eng.Ola Abd El-
El-LAtif
Leaky Bucket Additional Problems + Solutions By: Eng.Ola Abd El-Latif
Solution
Packet Arrival Time Departure Token Queued
umber (msec) Time Count Packets
0 2 empty
1 1 1 1 empty
2 1.1 1.1 0 empty
3 1.4 2 0 3
4 1.6 3 0 3,4
5 2.3 4 0 4,5
6 2.8 5 0 4,5,6
7 7.1 7.1 1 empty
8 8 8 1 empty
9 8.5 8.5 0 empty
Problem 5
You have constructed a Leaky bucket class in Java using a queue length of 3, two threads and a
timer. The Leaky bucket class operates on packets, one thread reads packets in and writes them
out if tokens are available. A second thread replenishes tokens at the rate of 1 token/2 time slot.
The maximum token count is 2. If possible. Given this packet arrival schedule,
A. fill in the system state: token count, schedule departures, and queue packets, dropped
packets at each packet arrival time. The class is fast enough such that you can assume packets
are sent instantaneously, if possible. Initially the Leaky Bucket was full.
Solution
B. Now consider the generation rate is changed to be 3 token/ time slot. What will differ??
Solution
Time Packets Packets Token count Queue Dropped
slot arrived departure packets
0 1,2,3 1,2 0 3 -
1 4 3,4 0 - -
2 - - 2 - -
3 5,6,7 5,6 0 7 -
4 8 7,8 0 - -
5 - - 2 - -
6 9,10 9,10 0 - -
Problem 6
The following packets arrive at the output port of a switch using a leaky bucket algorithm.
The bucket can contain up to 3000 bytes.
A. The leaky bucket operates on packets, and can send 1 packet every 3 milliseconds.
Assuming no packet arrives past time 10, show when packets leave and what
packet(s) are left in the buffer, if any, at time 10.
By: Eng.Ola Abd El-
El-LAtif
Leaky Bucket Additional Problems + Solutions By: Eng.Ola Abd El-Latif
B. If the leaky bucket operates on bytes, show the departure schedule if the algorithm
can send 1200 bytes every 3 milliseconds.
Solution
400+400=800<1200
400+400+1000=1800>1200
Problem 7
Computer A has 240Mb to send on a network and transmits the data in bursts of
6 Mbps. The minimum sustainable transmission rate across routers in the network is
5 Mbps. If Computer A’s transmission is shaped using a leaky bucket, what is the
minimum size of the queue to prevent lost data? (Show your work)