Skip to content
DeepForgeby svx
All problems
HardDeep Learningdl-447

M/M/1 Queue Delay

Problem

Estimate the expected queueing delay before service in a single-server queue with Poisson arrivals at arrival_rate and exponential service at service_rate: Wq = lambda / (mu * (mu - lambda)). Both rates share a time unit and arrival_rate must be below service_rate for a stable queue.

The signature is mm1_queue_delay(arrival_rate, service_rate). Return the expected delay in the same time unit.

Hint

As utilization approaches 1 the denominator mu - lambda goes to zero and delay explodes.

Test cases

case 1
in: [8,10]
expected: 0.4
case 2
in: [0,10]
expected: 0
case 3
in: [5,10]
expected: 0.1
case 4
in: [9.9,10]
expected: 9.9
case 5
in: [1,2]
expected: 0.5
Starter codePython
def mm1_queue_delay(arrival_rate, service_rate):
    # Your code here
    pass

5 test cases · run your code against them in the editor