# Leaky-bucket timeline · example 1

Subject: Computer Networks

Exam: TEE

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

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

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 10 fixed-size packets and drains at 2 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 | 8 |
| 2 | 9 |
| 5 | 3 |

## 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 | 8 | 0 | 0 | 8 | 0 | 8 |
| 2 | 9 | 4 | 4 | 6 | 3 | 10 |
| 5 | 3 | 6 | 4 | 3 | 0 | 7 |

#### Step 3. Sum the overflow

Total dropped=3 packets.

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

Last event t=5; queue=7. Time needed=7/2=3.5 s; final empty time=8.5 s.

**Final answer:** 3 packets dropped; queue finally empty at t=8.5 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.
