# Leaky-bucket timeline · example 2

Subject: Computer Networks

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/cn/#tee/practice/congestion/leaky-2

Canonical: https://deep-learning-study-room.vercel.app/read/cn/tee/practice/congestion--leaky-2/

Optional extension · no matching calculation in the two supplied papers

**Optional worked extension.** This calculation format was not found in the supplied December 2025 final or February 2026 re-exam. The numbers and practice marks are authored. Study the core concept and actual-paper questions first; this is extra explanation, not a TEE prediction.

### Practice question. A leaky-bucket data queue holds 12 fixed-size packets and drains at 3 packets/s whenever nonempty. It starts empty. Arrivals are instantaneous at the given times; drain between events, then admit arrivals. Find overflow and final empty time. [7 practice marks]

#### Answer

## Given

| Time (s) | Arrival packets |
| --- | --- |
| 0 | 12 |
| 1 | 7 |
| 3 | 4 |

## To find

Queue after each burst, dropped packets and time the queue finally empties.

## Formula and why



$$
q_{before}=\max(0,q_{previous}-r\Delta t)
$$





$$
a_{accepted}=\min(a,B-q_{before})
$$



This explicit event order separates elapsed-time service from instantaneous admission.

## Step-by-step solution

#### Step 1. Start with an empty queue

q=0 at t=0 before the first arrival; no negative-time service.

#### Step 2. Apply service then admission at each event

| t | Arrive | Drained | Before | Admit | Drop | After |
| --- | --- | --- | --- | --- | --- | --- |
| 0 | 12 | 0 | 0 | 12 | 0 | 12 |
| 1 | 7 | 3 | 9 | 3 | 4 | 12 |
| 3 | 4 | 6 | 6 | 4 | 0 | 10 |

#### Step 3. Sum the overflow

Total dropped=4 packets.

#### Step 4. Drain after the last arrival

Last event t=3; queue=10. Time needed=10/3=3.33333 s; final empty time=6.33333 s.

**Final answer:** 4 packets dropped; queue finally empty at t=6.33333 s.

#### What this result means

A finite queue cannot accept an instantaneous burst beyond its free slots. Inter-event service is capped by available queued data.
