Queueing theory studies how jobs arrive, wait, receive service, and depart. We want to find the average backlog, average delay, resource utilization, and probability of a full system.
把场景换成你熟悉的软件:请求进入消息队列,工作线程逐个处理请求。一个请求相当于一个顾客,一个工作线程相当于一个服务器。这里的 server 不一定是一台计算机,也可以是店员、维修工或一台机器。
In software, requests enter a message queue and worker threads process them. A request is a customer; a worker thread is a server. A server may also be a clerk, repair technician, or machine.
学习层次Learning stage
本文件内容Coverage in this handout
学完能做什么Learning outcome
第一层 · 概念Stage 1 · Concepts
第 1—5 节:人数、时间、速率、模型符号Sections 1–5: population, time, rates, and notation
读懂题目,不把速率和时间混淆Read problems and distinguish rates from durations
第二层 · 核心Stage 2 · Core model
第 6—11 节:M/M/1 推导与面包店Sections 6–11: M/M/1 derivations and bakery example
独立计算 π、L、Lq、W、WqCalculate π, L, Lq, W, and Wq independently
Notation: πₙ is the stationary probability of n customers in the system; p(q,j) is the probability of j customers waiting. The slides use qⱼ for the latter. We use a=λ/μ for offered load and ρ=λ/(cμ) for multi-server utilization to keep the meanings distinct.
1.系统、队列、服务器:先把边界画清楚
1. System, queue, and server: define the boundary
Lecture 1 · slides 2, 5–6
等待队列 QueueWaiting queue
顾客 A 顾客 B 顾客 C
Customer A · Customer B · Customer C
尚未开始服务Service has not started
服务器 ServerServer
顾客 D
Customer D
正在服务In service
以上两部分合起来:系统 System(共 4 人)System boundary: both parts together (4 customers)
假设一个店员正在服务 1 人,另外 3 人等待:
Suppose one clerk is serving one customer and three more customers are waiting.
N = 4,Nq = 3,忙碌服务器数 = 1
N = 4,Nq = 3,Busy servers = 1
N 是某个时刻的实际系统人数,是整数;L 是长期平均系统人数,可以是 2.25、3.7 这样的非整数。
N is the actual number in the system at a particular time and is an integer. L is a long-run average and may be a non-integer such as 2.25 or 3.7.
术语Term
英文English
解释Explanation
顾客Customer
Customer
任何需要占用服务资源的对象:人、网络包、磁盘请求、故障机器An object requiring service: a person, network packet, disk request, or failed machine
服务资源Server
Server
同一时刻为顾客提供服务的资源A resource that serves a customer
服务时间Service time
Service time
从开始处理到处理完成的时间Time from service start to service completion
排队规则Queue discipline
Queue discipline
决定下一次轮到谁The rule selecting the next customer
系统容量System capacity
System capacity
正在服务和等待的顾客总数上限Maximum total population, including service and waiting
来源总体Source population
Source population
所有可能产生请求的对象集合The set of all potential request-generating sources
No probability formula is needed here. Given actual arrival times and service durations, calculate each customer's service start, completion, and waiting time. Assume an empty system at 9:00 and first-come, first-served service.
开始时间 Bi = max(到达时间 Ai, 上一位完成时间 Di−1)
Start time Bi = max(Arrival time Ai, Previous completion Di−1)
完成时间 Di = Bi + 服务时长 Si
Completion time Di = Bi + Service duration Si
等待时间 = Bi − Ai;总时间 = Di − Ai
Queue waiting time = Bi − Ai;Total time = Di − Ai
第一人:9:03 到,店员空闲,立刻开始。服务 4 分钟,9:07 完成,等待 0 分钟。
Customer 1 arrives at 9:03 and starts immediately because the clerk is idle. Service takes 4 minutes, ends at 9:07, and involves no waiting.
Customer 2 arrives at 9:05 while customer 1 is still in service. Service begins at 9:07 after a 2-minute wait, takes 1 minute, and ends at 9:08. Total time is 3 minutes.
For these 17 customers, total waiting time is 19 minutes and the sample mean is 1.118 minutes. Total time in the system is 56 minutes and its sample mean is 3.294 minutes.
3.λ、μ 及其倒数:单位必须先统一
3. λ, μ, and their reciprocals: use consistent units
λ (lambda) is the mean arrival rate. μ (mu) is the completion rate of each server while continuously busy. Typical units are customers per hour or jobs per second.
μ is not the number that the system must actually complete every hour. In this stable single-server example with no losses, actual throughput is 15 customers/hour because the clerk is sometimes idle. The rate 20/hour describes capacity while busy.
4.泊松分布与指数分布:数次数,还是量时间?
4. Poisson and exponential distributions: count events or measure time?
Lecture 1 · slide 7;与 Week 6 衔接
设顾客按速率 λ 的泊松过程到达。同一件事情可以问两个不同的问题。
Suppose arrivals follow a Poisson process with rate λ. There are two different questions about this process.
问题Question
随机变量Random variable
分布Distribution
接下来 t 小时来了多少人?How many arrive during the next t hours?
For λ=15 customers/hour, a 4-minute interval is 1/15 hour, so the Poisson parameter is λt=1. The probability of zero arrivals is exp(−1)≈0.3679, and the probability of exactly one arrival is also exp(−1)≈0.3679.
问“下一个人还要等超过 4 分钟才来”的概率,同样是 e−1。两个问题相关,但随机变量不同。
The probability that the next arrival is more than 4 minutes away is also exp(−1). The questions are related, but the random variables differ.
If service always takes exactly 3 minutes and 2 minutes have elapsed, only 1 minute remains. Elapsed service time now affects prediction. Population alone is generally insufficient to specify a continuous-time Markov state.
5.Kendall 命名:M/M/c/N/N 每一项指什么
5. Kendall notation: what does each position mean?
Lecture 1 · slide 7
到达间隔分布 / 服务时间分布 / 服务器数 / 系统容量 / 来源总体大小 / 排队规则
Interarrival distribution / Service-time distribution / Server count / System capacity / Source population size / Queue discipline
符号Symbol
含义Meaning
例子Example
M
指数间隔或指数服务时间(Markovian)Exponential interarrival or service times (Markovian)
M/M/1 means one server, Poisson arrivals, and independent, identically distributed exponential service times independent of the arrival process. Omitted positions normally mean infinite capacity, an infinite source population, and FCFS.
M/M/2/5 表示 2 个服务器,系统最多 5 人。因此最多 3 人等待。
M/M/2/5 means two servers and at most five customers in the system, so at most three can wait.
M/M/3/3 表示 3 个服务器、系统最多 3 人。没有人能站在旁边等待:全部忙时就拒绝新到达。
M/M/3/3 means three servers and capacity for three customers. There is no waiting room; an arrival is rejected when all servers are busy.
M/M/1/N/N 的两个 N 分别是容量与来源大小。最后一个 N 的重要影响是到达速率随当前人数变化。
In M/M/1/N/N, the two N values denote system capacity and source population. The finite source population makes the total arrival rate depend on the current state.
6.四个平均指标,以及 π、B、R、U
6. Four mean measures, plus π, B, R, and U
Lecture 2 · slides 2–3
符号Symbol
英文English
含义Meaning
单位Units
L
Mean number in system
平均系统人数,含服务中的人Mean population in the system, including service
人customers
Lq
Mean number in queue
平均等待人数Mean number waiting
人customers
W
Mean time in system
平均从进入到离开的总时间Mean time from entry to departure
小时或分钟hours or minutes
Wq
Mean waiting time in queue
平均开始服务前的等待时间Mean time before service starts
小时或分钟hours or minutes
πₙ
Stationary probability
系统里恰好 n 人的长期概率Long-run probability of exactly n customers in the system
The relation W=Wq+1/μ assumes each admitted customer completes one service with mean duration 1/μ. This week's standard models satisfy that assumption. Systems with abandonment, rework, or multiple service stages require additional care.
c 个相同服务器、共同队列、只要有顾客就服务时:
For c identical servers sharing a queue, with no server left idle when a customer is waiting:
B = Σn≥0 min(n,c)πn
队列里恰好 j 人的概率:j>0 时,必须已有 c 人接受服务,所以系统总人数是 c+j。
To have exactly j customers waiting, where j>0, all c servers must be occupied. The total system population is therefore c+j.
pq,0 = π0+π1+⋯+πc;pq,j=πc+j(j>0)
7.M/M/1 为什么是生灭过程:状态只记录人数
7. Why M/M/1 is a birth–death process
Lecture 2 · slides 4–5
定义 N(t) 为时刻 t 的系统总人数。若现在有 n 人,到一个新顾客就变成 n+1,完成一次服务就变成 n−1。
Let N(t) be the total population at time t. An arrival increases n to n+1; a service completion decreases n to n−1.
Do not use nμ as the death rate of a single-server queue. Even with ten customers in the system, only one is receiving service, so only one service-completion clock is active.
在非空状态,两种事件竞争:新到达速率 λ,服务完成速率 μ。所以:
In a nonempty state, two event types compete: arrivals at rate λ and completions at rate μ. Thus:
离开当前状态前的平均停留时间 = 1/(λ+μ)
Mean holding time in current state = 1/(λ+μ)
下一次是到达的概率 = λ/(λ+μ);下一次是完成服务的概率 = μ/(λ+μ)
P(next event is an arrival) = λ/(λ+μ);P(next event is a completion) = μ/(λ+μ)
空状态只有到达事件,所以平均停留时间为 1/λ,下一次必然变为状态 1。
In state 0, only an arrival can occur. The mean holding time is 1/λ, and the next state must be 1.
The process spends fraction π₀ of its time in state 0, where arrivals occur at rate λ. The long-run flow from 0 to 1 is λπ₀. The reverse flow from 1 to 0 is μπ₁.
对生灭链,相邻状态之间的稳态流平衡给出:
For a birth–death chain, stationary flow balance between adjacent states gives:
λπ0=μπ1
这不是说 λ=μ,而是说速率乘以处于相应状态的概率之后,两个方向的长期流量相等。
This does not require λ=μ. It equates the long-run directional flows after multiplying each rate by its source-state probability.
第二步:从 π₀ 递推其他概率
Step 2: express the other probabilities in terms of π₀
π1=(λ/μ)π0=ρπ0
λπ1=μπ2,所以 π2=ρπ1=ρ²π0
λπ1=μπ2,therefore π2=ρπ1=ρ²π0
继续递推:πn=ρⁿπ0,其中 ρ=λ/μ
Continue the recursion: πn=ρⁿπ0,where ρ=λ/μ
第三步:利用总概率为 1,求出 π₀
Step 3: use a total probability of 1 to determine π₀
π0+π1+π2+⋯=1
π0(1+ρ+ρ²+⋯)=1
当 0≤ρ<1,括号内是无穷等比级数,总和为 1/(1−ρ)。
For 0≤ρ<1, the infinite geometric series in parentheses sums to 1/(1−ρ).
For ρ≥1, the series 1+ρ+ρ²+… diverges. These weights cannot be normalized into a stationary distribution with total mass 1. This statement applies to an infinite-capacity M/M/1 with fixed rates.
Set the weight of state 0 to 1. The weights are 1, ρ, ρ², … and are not yet probabilities. Divide each by their sum G to obtain probabilities. This method also solves the models in Lecture 3.
小例子:权重 1、2、4 如何变成概率?
Small example: how do weights 1, 2, and 4 become probabilities?
The sum is G=1+2+4=7. Divide by 7 to obtain probabilities 1/7, 2/7, and 4/7. A larger weight means a state is relatively more common; a weight is not itself a probability.
9.从 π 推出 L、Lq、W、Wq:每一步的理由
9. Derive L, Lq, W, and Wq from π
Lecture 2 · slides 7–9
① 平均系统人数 L
① Mean population in the system, L
期望值就是“每种人数 × 该人数的概率,再求和”。
An expectation is the sum of each possible population multiplied by its probability.
L=0π0+1π1+2π2+⋯=Σn=0∞ n(1−ρ)ρⁿ
把与 n 无关的 (1−ρ) 提出来:
Factor out (1−ρ), which does not depend on n.
L=(1−ρ)Σn=0∞ nρⁿ
已知 1+ρ+ρ²+…=1/(1−ρ),两边对 ρ 求导,再乘 ρ:
Start with 1+ρ+ρ²+…=1/(1−ρ). Differentiate with respect to ρ, then multiply by ρ.
1+2ρ+3ρ²+⋯=1/(1−ρ)²
ρ+2ρ²+3ρ³+⋯=ρ/(1−ρ)²
L=(1−ρ)·ρ/(1−ρ)²=ρ/(1−ρ)
如果暂时不熟悉求导,先把这个等比级数结果作为工具使用。关键是理解 L 是人数的加权平均。
If differentiation is unfamiliar, use the geometric-series result as a tool for now. The key idea is that L is a probability-weighted average population.
② 平均等待人数 Lq
② Mean population waiting, Lq
一个服务器要么忙,要么闲。长期忙的概率为 1−π₀=ρ,所以平均正在服务的人数 B=ρ。
A single server is either busy or idle. Its long-run busy probability is 1−π₀=ρ, so the mean number in service is B=ρ.
Lq=L−B=ρ/(1−ρ)−ρ
=[ρ−ρ(1−ρ)]/(1−ρ)=ρ²/(1−ρ)
③ 平均总时间 W
③ Mean total time in the system, W
稳定、没有阻塞和流失时,吞吐率 R=λ。由 Little 公式:
In a stable system without blocking or losses, throughput R=λ. Apply Little's law:
W=L/λ=ρ/[λ(1−ρ)]
代入 ρ=λ/μ,λ 可以消掉:
Substitute ρ=λ/μ and cancel λ.
W=1/[μ(1−ρ)]=1/(μ−λ)
④ 平均等待时间 Wq
④ Mean waiting time, Wq
Wq=W−1/μ=1/(μ−λ)−1/μ
=λ/[μ(μ−λ)]=ρ/[μ(1−ρ)]
10.Little 公式:为什么人数=流量×时间?
10. Little's law: population equals flow rate times time
Check units: customers/hour × hours = customers. Little's law does not require Poisson arrivals or exponential services. Use the same customer population, consistent system boundaries, matching long-run flow and time measures, and well-defined averages.
系统情况System assumptions
应该使用的 RCorrect throughput R
原因Reason
无限容量、稳定、无流失Infinite capacity, stable, no losses
λ
进入的顾客最后都会完成服务All admitted arrivals eventually complete service
外部泊松到达、容量 N、满员拒绝External Poisson arrivals, capacity N, full-state rejection
λ(1−πN)
被拒绝者没有进入系统Rejected customers never enter the system
有限来源、每个系统外来源速率 λFinite sources, each outside source has rate λ
Σ πₙ(N−n)λ
总到达率随状态变化Total arrival rate depends on the state
11.面包店完整例题与“超过 10 分钟”的概率
11. Complete bakery example and probabilities of delays over 10 minutes
Lecture 2 · slides 8–11
题设:泊松到达 λ=15 人/小时,一个店员,指数服务 μ=20 人/小时,容量无限,FCFS。
Assumptions: Poisson arrivals λ=15/hour, one clerk, exponential services μ=20/hour, infinite capacity, and FCFS.
先算利用率和概率
First calculate utilization and state probabilities
ρ=15/20=0.75;π0=0.25;πn=0.25×0.75ⁿ
n:系统人数n: population in the system
πₙ
0
0.250000
1
0.187500
2
0.140625
3
0.105469
4
0.079102
5
0.059326
“系统中至少 3 人”要把 π₃+π₄+…加起来。利用等比级数:
For at least three customers, add π₃+π₄+… . Use the geometric series:
P(N≥k)=ρᵏ;P(N≥3)=0.75³=0.421875
“没有人在排队”包括店里 0 人和店里 1 人:
Nobody is waiting when the store has either zero or one customer.
An arriving customer must wait whenever the server is busy: at least one customer is present. Poisson arrivals see time averages (PASTA), so the waiting probability is ρ=0.75.
再算平均人数和时间
Now calculate mean populations and times
L=0.75/0.25=3;Lq=0.75²/0.25=2.25
W=3/15=0.2 小时=12 分钟
W=3/15=0.2 hours=12 minutes
Wq=2.25/15=0.15 小时=9 分钟
Wq=2.25/15=0.15 hours=9 minutes
核对:9 分钟等待+3 分钟服务=12 分钟总时间;L−Lq=0.75,等于平均忙碌服务器数。
Check: 9 minutes of waiting plus 3 minutes of service equals 12 minutes total. L−Lq=0.75 is the mean number of busy servers.
总时间的分布
Distribution of total time in the system
设随机变量 T 为顾客在系统里的总时间,W=E[T]。在稳态 M/M/1、FCFS 下:
Let T be a customer's total time in the system, with W=E[T]. For a stationary FCFS M/M/1:
T ∼ Exponential(μ−λ);P(T>t)=e−(μ−λ)t
问总时间超过 10 分钟的概率,t=10/60 小时:
For a total time exceeding 10 minutes, substitute t=10/60 hour.
P(T>10 分钟)=e−5×10/60≈0.4346
P(T>10 minutes)=e−5×10/60≈0.4346
纯等待时间的分布
Distribution of queue waiting time
设 Tq 是开始服务前的等待时间。它有一块“完全不用等”的概率,不是普通的纯连续指数分布。
Tq is the time before service starts. It has a positive probability at zero, so it is not an ordinary continuous exponential distribution.
Conditional on having to wait, mean waiting time is 1/(μ−λ)=12 minutes. Averaging over all arrivals gives 0.75×12=9 minutes.
为什么“服务时间相加”能用到泊松次数?
Why can a sum of service times be expressed with a Poisson count?
到达时系统已有 k 人,就需要等 k 个人完成,再完成自己的服务。在指数服务的无记忆性下,这 k+1 段时间独立同分布,总和为 Erlang(k+1, μ)。尚未完成的概率等于在 t 内完成的次数不超过 k:
If k customers are present on arrival, those k must finish before the new customer completes service. Memorylessness gives k+1 independent exponential stages, whose sum is Erlang(k+1,μ). Not finishing by time t means at most k completions have occurred by t.
P(T>t | 到达时有 k 人)=Σi=0k e−μt(μt)ⁱ/i!
P(T>t | k customers present on arrival)=Σi=0k e−μt(μt)ⁱ/i!
再按 k 的概率 πₖ 加权,得到前面的指数尾概率。注意:时间本身是 Erlang;次数才用泊松概率来表示。
Average over k using πₖ to obtain the exponential tail above. The duration is Erlang conditional on k; the completion count is represented with Poisson probabilities.
为什么利用率接近 100% 会等很久?
Why do delays grow sharply near 100% utilization?
μ 固定 20 人/小时μ fixed at 20 customers/hour
ρ
平均总时间 WMean total time W
平均等待 WqMean queue wait Wq
λ=10
50%
6 分钟6 min
3 分钟3 min
λ=15
75%
12 分钟12 min
9 分钟9 min
λ=18
90%
30 分钟30 min
27 分钟27 min
λ=19
95%
60 分钟60 min
57 分钟57 min
λ=19.8
99%
300 分钟300 min
297 分钟297 min
12.有限容量 M/M/1/N:满了以后不再进入
12. Finite-capacity M/M/1/N: reject arrivals when full
Lecture 3 · slides 2–4
假设一个店员,店里最多 N 人,满员时新顾客被拒绝。状态只有 0,1,…,N。状态 N 时没有被接纳的新到达,所以向上的状态转移速率为 0。
One clerk serves at most N customers in the system. Arrivals are rejected when full. States are 0 through N. At N, there are no admitted arrivals, so the upward state-transition rate is zero.
递推关系仍然是 πₙ=ρⁿπ₀,但这次求和到 N 就结束:
The recursion remains πₙ=ρⁿπ₀, but the sum now stops at N.
Unlike an infinite queue, this normalization has finitely many terms. For positive λ and μ, the finite irreducible chain has a stationary distribution even when ρ>1.
例:λ=15,μ=20,容量 N=3
Example: λ=15, μ=20, capacity N=3
ρ=0.75;G=1+0.75+0.5625+0.421875=2.734375
系统人数 nSystem population n
未归一化权重Unnormalized weight
稳态概率Stationary probability
0
1
64/175≈0.365714
1
0.75
48/175≈0.274286
2
0.5625
36/175≈0.205714
3
0.421875
27/175≈0.154286
满员概率为 π₃=27/175。由于外部到达是泊松过程,约 15.43% 的到达顾客被拒绝。
The full-state probability is π₃=27/175. With external Poisson arrivals, about 15.43% of attempted arrivals are rejected.
R=15(1−27/175)=12.685714 人/小时
R=15(1−27/175)=12.685714 customers/hour
L=(1×48+2×36+3×27)/175=201/175≈1.148571 人
L=(1×48+2×36+3×27)/175=201/175≈1.148571 customers
B=1−π0=111/175≈0.634286
Lq=L−B=90/175≈0.514286 人
Lq=L−B=90/175≈0.514286 customers
W=L/R≈5.432432 分钟;Wq=W−3≈2.432432 分钟
W=L/R≈5.432432 minutes;Wq=W−3≈2.432432 minutes
平均等待变短,部分原因是顾客被拒绝。比较方案时还必须同时考虑服务成功率,不能只看等待时间。
The shorter wait partly results from rejecting customers. Compare admission or service success rates as well as waiting times.
平均人数的通式
General formula for the mean population
L=Σn=0N nπn
ρ≠1:L=ρ/(1−ρ) − (N+1)ρN+1/(1−ρN+1)
ρ=1:L=N/2
手算小 N 时,直接求和往往更稳妥。ρ=1 时每个状态等概率,不要把 ρ=1 代入含有 1−ρ 的分母。
For small N, direct summation is often safer by hand. When ρ=1, all states are equally likely; do not substitute ρ=1 into an expression with denominator 1−ρ.
13.M/M/c:多服务器共用一个等待队列
13. M/M/c: multiple servers sharing one queue
Lecture 3 · slide 5
c 是服务器数量,每个服务器服务速率为 μ。总到达速率仍然是 λ。来一个顾客后,若有空闲服务器就立即服务,否则加入共同队列。
There are c servers, each with rate μ, and the total arrival rate is λ. An arrival starts service immediately if a server is free; otherwise it joins the common queue.
a 表示平均服务时长内的到达量,单位可视为 Erlangs。ρ 才是每个服务器的平均利用率。单服务器时 a=ρ,多服务器时二者不同。
a is the mean number of arrivals during one mean service time, also called offered load in Erlangs. ρ is average utilization per server. They coincide with one server but differ with multiple servers.
For n<c, each extra customer activates another server, giving completion rates μ, 2μ, 3μ, and so on. At n≥c, all servers are busy and the rate is capped at cμ. The weight tail is therefore geometric.
等待概率(Erlang C)
Waiting probability: Erlang C
新顾客需要等,当且仅当到达时所有 c 个服务器都忙。该事件包括 n=c,c+1,…:
A new arrival waits exactly when all c servers are busy. This includes states c, c+1, and higher.
C=P(需要等待)=π0(aᶜ/c!)/(1−ρ)
C=P(wait)=π0(aᶜ/c!)/(1−ρ)
Lq=Cρ/(1−ρ);Wq=C/(cμ−λ)
W=Wq+1/μ;L=λW;B=λ/μ=a;U=ρ
完整例题:λ=9/小时,μ=10/小时,c=2
Worked example: λ=9/hour, μ=10/hour per server, c=2
A. M/M/c/N: multiple servers with a total capacity limit
假设 N≥c。最简单可靠的算法是有限权重递推:
Assume N≥c. A reliable method is finite-state weight recursion.
w0=1;wn=wn−1λ/[min(n,c)μ],n=1,…,N
πn=wn/Σk=0Nwk
R=λ(1−πN);L=Σnπn;Lq=Σmax(n−c,0)πn
W=L/R;Wq=Lq/R;U=[Σmin(n,c)πn]/c
有限容量下,λ/(cμ) 是外部提供的负载比,未必等于实际利用率。实际 U 由成功进入的流量决定:U=R/(cμ)。
For finite capacity, λ/(cμ) is the offered-load ratio and need not equal actual utilization. Actual utilization depends on admitted throughput: U=R/(cμ).
Example: λ=9, μ=10, c=2. Then a=0.9 and the sum of weights is 1+0.9+0.405=2.305. Blocking probability is 0.405/2.305≈0.175705, so about 82.43% are admitted. Admitted customers do not wait and receive 6 minutes of service on average.
C.M/M/∞:每个人一到就开始服务
C. M/M/∞: everyone starts service immediately
系统有 n 人,就有 n 个独立服务时钟,总完成速率 nμ。这是生灭过程:出生 λ,死亡 nμ。
With n customers, n independent service clocks run, giving total completion rate nμ. This birth–death process has birth rate λ and death rate nμ.
Example: 15 cars/hour enter a parking facility with ample space, and each stays for 2 hours on average. Then μ=0.5/hour and a=30, giving an average of 30 parked cars. With enough spaces, arrivals park immediately without waiting.
15.有限来源 M/M/1/N/N:故障机器维修模型
15. Finite-source M/M/1/N/N: machine repair
Lecture 3 · slide 10
工厂总共有 N 台机器。正常机器可能故障;坏了的机器进入维修系统,在一名维修工那里等待或维修。每台正常机器独立地以速率 λ 故障,维修时间为参数 μ 的指数分布。
A factory has N machines and one repair technician. A working machine independently fails at rate λ; a failed machine enters the repair system and waits or receives repair. Repair times are exponential with parameter μ.
状态 n 代表有 n 台机器在维修系统中。此时系统外还剩 N−n 台正常机器,因此:
State n means n machines are in the repair system. Only N−n working machines remain outside, so:
到达速率 λn=(N−n)λ;服务速率 μn=μ(n≥1)
Arrival rate λn=(N−n)λ;Service rate μn=μ(n≥1)
这里 λ 是每台正常机器的故障速率,不能当成整个工厂固定的总故障速率。
Here λ is the failure rate of each working machine, not a fixed total failure rate for the factory.
In a common queue, the next customer takes whichever server becomes free. With separate queues, each server has its own line and customers normally remain in their selected line.
With identical independent exponential services and the same total arrival rate, random equal splitting across separate queues can leave one server idle while another queue has customers waiting. A common queue reduces this mismatch.
两台速率 μ 的服务器 vs 一台速率 2μ 的服务器
Two servers of rate μ versus one server of rate 2μ
固定总能力2μ,令 ρ=λ/(2μ)。共同队列 M/M/2 的平均等待人数:
Keep total capacity at 2μ and define ρ=λ/(2μ). For a shared-queue M/M/2, the mean queue length is:
Lq,双服务器=2ρ³/(1−ρ²)
Lq,two servers=2ρ³/(1−ρ²)
一台双速服务器 M/M/1 的平均等待人数:
For one double-speed M/M/1 server, the mean queue length is:
Their ratio is 2ρ/(1+ρ)<1, so the two-server common queue has less queue waiting. However, mean service takes 1/μ with two servers versus 1/(2μ) with the fast server. The fast single server consequently has a smaller mean total time in the system.
课件 Example 6.5 的数值重算
Recalculate Example 6.5 from the slides
方案Alternative
课件成本Cost in slide example
模型与参数 / 小时Model and rates per hour
纯等待 WqQueue wait Wq
总时间 WTotal time W
现状Existing system
$0
M/M/1;λ=9,μ=10
54 分钟54 min
60 分钟60 min
更大载荷Larger loads
$30,000
M/M/1;λ=6,μ=15
2.667 分钟2.667 min
6.667 分钟6.667 min
增加一个站点Another station
$400,000
M/M/2;λ=9,每台 μ=10M/M/2; λ=9, each μ=10
1.524 分钟1.524 min
7.524 分钟7.524 min
再加一部电梯Another elevator
$1,000,000
两条独立 M/M/1;各 λ=4.5、μ=10Two independent M/M/1 queues; each λ=4.5, μ=10
4.909 分钟4.909 min
10.909 分钟10.909 min
这些成本和参数来自课件,仅用于该例的方案比较。课件的 Waiting Time 一列实际给出 W(总时间)。这里把 Wq 和 W 拆开,避免按列名误读。
Costs and parameters are taken from this slide example only. Its Waiting Time column actually reports total time W. We show Wq and W separately to avoid confusing the two.
17.排队规则改变什么?
17. What changes when the queue discipline changes?
FCFS serves the earliest arrival; LCFS serves the latest arrival; RSS selects a waiting customer randomly. Under the comparison assumptions in the slides, mean waiting is the same but its variance differs: lower for FCFS, higher for LCFS, and intermediate for RSS.
Changing the order may redistribute waiting across customers while the server keeps processing the same class of service requirements. FCFS tends to spread waits more evenly; LCFS can leave an early arrival waiting a very long time.
When service durations can be estimated, the slides suggest giving shorter tasks priority. This can change average waiting and is outside the service-time-independent comparison. Real scheduling must also consider starvation of long tasks, fairness, deadlines, and estimation errors.
18.对照课件阅读:页码、疑点与正确用法
18. Reading guide: slide mapping and points to check
三份课件逐页对应
来源Source
页码Slide numbers
本文件对应Corresponding sections
Lecture 1
2
第1、16节:系统结构Sections 1 and 16: system structure
Lecture 1
3–4
第2节:17位顾客的时间表Section 2: timeline for 17 customers
Lecture 1
5–7
第1、4、5节:术语和Kendall符号Sections 1, 4, 5: terms and Kendall notation
Lecture 2
2–3
第6、10节:指标关系与Little公式Sections 6 and 10: measures and Little's law
Lecture 2
4–6、12
第7、8节:生灭链、稳态概率、归一化Sections 7 and 8: birth–death chain, stationary probabilities, normalization
Lecture 2
7–9
第9、11节:人数、等待、总时间分布Sections 9 and 11: populations, waiting, total-time distribution
Lecture 2
10–11
第11节:面包店和利用率Section 11: bakery and utilization
Lecture 3
2–4
第12节:M/M/1/NSection 12: M/M/1/N
Lecture 3
5
第13、14节:多服务器Sections 13 and 14: multiple servers
Lecture 3
6–8
第16节:结构和成本比较Section 16: structure and cost comparison
Lecture 2, slide 4: if P(X=x)=p(1−p)^x for x=0,1,…, the mean is (1−p)/p. The mean 1/p belongs to the version starting at 1. M/M/1 population starts at 0, so L=ρ/(1−ρ).
Lecture 2, slide 9: the k customers must be the total number already in the system, including the customer in service. Counting only those waiting misses one service stage when the system is nonempty.
Lecture 2, slide 9: a sum of k+1 exponential durations is Erlang. Poisson probabilities describe completion counts in time t. Mixing over the population yields the exponential total-time distribution.
Lecture 3, slide 5: the multi-server Lq expression marked as an approximation should not replace exact results in every case. This handout uses the exact Erlang C formula.
Lecture 3, slide 9: use a=λ/μ in the loss and infinite-server formulas, and ρ=λ/(cμ) for multi-server utilization. Check each symbol's definition before substituting.
These notes support reading and calculation without changing the original slides. Mathematical formatting may differ between programs; use the complete formula together with its variable definitions.
19.离线计算器:先选模型,再改参数
19. Offline calculator: choose a model before changing parameters
Enter λ and μ in rates per hour. In the finite-source model, λ is the rate of each source outside the system. Time outputs are in minutes. The calculator uses stationary formulas or finite-state normalization, not random simulation.
Infinite models show the first few state probabilities and a separate remaining tail. For M/M/∞, visible probabilities use recursion; a very large mean can underflow low-state probabilities. Finite models normalize log weights.
20.练习:先自己算,再展开答案
20. Exercises: solve first, then reveal the answer
由本课程概念编写的补充练习
这些题是学习用补充例题,不是老师的原题。先写出模型和单位,再动手算。
These are supplementary learning exercises, not the instructor's original problems. Identify the model and units before calculating.
练习1:一个店员,2人等待。系统人数是多少?
Exercise 1: one clerk is serving and two customers are waiting. How many are in the system?
An empty system has probability π₀=0.2. An empty queue has π₀+π₁=0.2+0.16=0.36. A Poisson arrival waits with probability ρ=0.8. Someone is already waiting at a random time with probability ρ²=0.64.
练习5:λ=12、μ=15,顾客总时间超过10分钟的概率?
Exercise 5: λ=12, μ=15. What is the probability that total time exceeds 10 minutes?
ρ=1. All five states 0–4 have probability 0.2. L=4/2=2. R=10(1−0.2)=8/hour. W=2/8 hour=15 minutes. Mean service is 6 minutes, so Wq=9 minutes. B=0.8 and Lq=1.2.
练习7:M/M/3,λ=24/小时,每台μ=10/小时。有稳态吗?
Exercise 7: M/M/3, λ=24/hour and each μ=10/hour. Does a steady state exist?
Two receive service and at most 5−2=3 wait. When full, the admitted arrival rate is zero. External arrival attempts still occur but do not change the system population.
练习9:M/M/2/2的Wq为0,是否意味着没有顾客受到影响?
Exercise 9: M/M/2/2 has Wq=0. Does that mean every customer is unaffected?
No. Admitted customers do not wait, but arrivals finding both servers busy are rejected. Also calculate blocking probability π₂ and throughput R=λ(1−π₂).
练习10:5台机器,已有2台进入维修系统,单台故障速率0.1/小时。总新故障速率?
Exercise 10: five machines, two already in repair, per-working-machine failure rate 0.1/hour. What is the total new-failure rate?
正常机器还剩5−2=3台,所以λ₂=3×0.1=0.3/小时。不是5×0.1,也不是2×0.1。
Three machines remain working. Thus λ₂=(5−2)×0.1=0.3/hour. Do not multiply the rate by all five machines or by the two failed machines.
练习11:M/M/∞,λ=12/小时,平均服务10分钟。求L、W、Wq。
Exercise 11: M/M/∞, λ=12/hour, mean service 10 minutes. Find L, W, and Wq.
The server serves one customer 60% of the time and none 40% of the time, so B=0.6. Therefore L=Lq+0.6. Having one server does not imply it is always busy.
21.解题清单与公式速查
21. Problem-solving checklist and formula reference
复习页
把顾客、服务器、系统边界说清楚。
Identify the customers, servers, and system boundary.
确定到达是否泊松、服务是否指数,以及独立性等假设。
Check Poisson arrivals, exponential services, independence, and other assumptions.
找出λ、每台μ、c、N;把时间统一为小时或分钟。
Find λ, the per-server μ, c, and N; use one consistent time unit.
无限容量检查λ<cμ;有限容量用有限状态归一化。
For infinite capacity, check λ<cμ. For finite capacity, normalize the finite-state weights.
求π,再求L、Lq、B;或者使用该模型的精确公式。
Find π, then L, Lq, and B, or use the model's exact formulas.
确认实际吞吐率R,使用W=L/R、Wq=Lq/R。
Find actual throughput R and calculate W=L/R and Wq=Lq/R.
核对L=Lq+B、W=Wq+1/μ、概率和为1、结果单位正确。
Check L=Lq+B, W=Wq+1/μ, total probability 1, and the units.
模型Model
稳态人数概率或权重Stationary population probability or weight
关键指标Key measures
M/M/1,ρ=λ/μ<1
πₙ=(1−ρ)ρⁿ
L=ρ/(1−ρ),Lq=ρ²/(1−ρ),W=1/(μ−λ)
M/M/1/N
wₙ=ρⁿ;πₙ=wₙ/Σw
R=λ(1−πN),ρ=1时L=N/2R=λ(1−πN); L=N/2 when ρ=1
M/M/c,ρ=λ/(cμ)<1
wₙ=aⁿ/n!(n<c);尾部为等比wₙ=aⁿ/n! for n<c; geometric tail
C=π₀(aᶜ/c!)/(1−ρ),Wq=C/(cμ−λ)
M/M/c/N
wₙ=wₙ₋₁λ/[min(n,c)μ]
L=Σnπₙ,Lq=Σmax(n−c,0)πₙ
M/M/c/c
wₙ=aⁿ/n!,n≤c
阻塞πc;Wq=0;W=1/μBlocking πc; Wq=0; W=1/μ
M/M/∞
πₙ=e⁻ᵃaⁿ/n!,a=λ/μ
L=a;Wq=0;W=1/μ
M/M/1/N/N
wₙ=[N!/(N−n)!](λ/μ)ⁿ
R=λ(N−L)=μ(1−π₀)
22.原始资料与使用方式
22. Sources and how to use this handout
来源记录
本学习文件依据你提供的以下三份课程课件整理,讲授教师为 Christopher Slon, PhD,课程 ISE/SYS 5517 Statistical Methods in Engineering:
This handout is based on the following ISE/SYS 5517 Statistical Methods in Engineering slides taught by Christopher Slon, PhD.
The 17-customer data, bakery λ=15 and μ=20 example, and Example 6.5 costs and parameters come from the slides. The N=3 finite-capacity example, three-machine repair example, parking example, exercises, and calculator examples are added teaching examples. Section headers identify the corresponding slide numbers.
This single HTML file works offline, including text, formulas, navigation, answers, calculator, and probability bars. Formulas use Unicode and HTML subscripts and superscripts. Open it in Safari, Chrome, or Edge. Printing expands answers and hides interactive controls. Search highlights terms; Enter moves to the next match. Use the language selector for bilingual, Chinese-only, or English-only reading.