关于「源源不断的任务流:cμ 法则、广义 cμ 与吉廷斯指数」,《瓶颈定焦与价值工时比排程》给出的定量结论是什么?
结论:结果分三档负荷读。负荷 0.70 时,固定让咨询优先的规则每件平均代价 2.560 点,广义 cμ 是 2.769 点,固定规则反而更省;负荷 0.85 时,固定规则 6.022 点,广义规则 6.420 点,仍是固定规则略好;负荷 0.95 时,广义规则 16.998 点,才反超固定规则的 17.348 点。先来先做在三档负荷下都很差,到 0.95 时每件 127.846 点;让出版局任务优先更糟,到 444.840 点。
数据口径:史密斯 1956 年证明,单人面对一张清单,使加权延迟代价最小的次序是按价值除以耗时排序,而不是按价值排序;七件示意任务上,按重要性排比穷举最优多付 0.311。 图形学的视锥剔除与细节层次说明,固定帧预算下不该每件都精做:八件示意任务全部精做只做完三件,总价值只有最优安排的 0.783。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.70, 0.85, 0.95, 127.846, 16.998, 17.348
| mean delay cost per job (illustrative points) | |||||
| rho | FIFO | A first | B first | gen c-mu | best static |
| 0.70 | 4.864 | 2.560 | 11.419 | 2.769 | 2.560 |
| 0.85 | 19.801 | 6.022 | 56.254 | 6.420 | 6.022 |
| 0.95 | 127.846 | 17.348 | 444.840 | 16.998 | 17.348 |
| switch point: serve A once its head has waited 0.5 hours |
查看完整验算程序
# Chapter 2. p22: convex delay cost and the generalised c-mu rule.
# Two streams into one person, non-preemptive, exponential service:
# A questions from paying customers, mu 3 per hour, cost 2 w^2
# B publishing-queue tasks, mu 2 per hour, cost 3 w
# w = hours waited before service starts (illustrative points).
# Each stream carries half the load. Generalised c-mu (van Mieghem 1995):
# when the person frees up, serve the head job with the largest
# mu_k * C_k'(age of that head job). Fixed-seed discrete-event runs.
import collections
import math
import random
MU = {"A": 3.0, "B": 2.0}
def cost(k, w):
return 2.0 * w * w if k == "A" else 3.0 * w
def slope(k, w):
return 4.0 * w if k == "A" else 3.0
def run(policy, rho, n_jobs=60000):
rng = random.Random(37622)
lam = {k: rho / 2.0 * MU[k] for k in MU}
tot = math.fsum(lam.values())
t_arr, free_at = 0.0, 0.0
q = {"A": collections.deque(), "B": collections.deque()}
costs, served = [], 0
arrivals = []
for _ in range(n_jobs):
t_arr += rng.expovariate(tot)
k = "A" if rng.random() < lam["A"] / tot else "B"
arrivals.append((t_arr, k))
i = 0
while served < n_jobs:
while i < n_jobs and arrivals[i][0] <= free_at:
q[arrivals[i][1]].append(arrivals[i][0])
i += 1
if not q["A"] and not q["B"]:
free_at = arrivals[i][0]
continue
heads = [k for k in "AB" if q[k]]
if policy == "FIFO":
k = min(heads, key=lambda h: q[h][0])
elif policy in ("A first", "B first"):
k = policy[0] if q[policy[0]] else heads[0]
else:
k = max(heads, key=lambda h: MU[h] * slope(h, free_at - q[h][0]))
t0 = q[k].popleft()
costs.append(cost(k, free_at - t0))
free_at += rng.expovariate(MU[k])
served += 1
return math.fsum(costs) / n_jobs
print("mean delay cost per job (illustrative points)")
print("rho FIFO A first B first gen c-mu best static")
for rho in (0.70, 0.85, 0.95):
r = {p: run(p, rho) for p in ("FIFO", "A first", "B first", "gcmu")}
st = min(r["A first"], r["B first"])
print("%.2f %6.3f %7.3f %7.3f %8.3f %10.3f" % (
rho, r["FIFO"], r["A first"], r["B first"], r["gcmu"], st))
print("switch point: serve A once its head has waited 0.5 hours")唯一数据源与引用
范雅福(Fan, Y.). (2026). 《阶段瓶颈动态定焦、价值工时比优先级排序与认知视锥渲染加速母典》第 2 章「源源不断的任务流:cμ 法则、广义 cμ 与吉廷斯指数」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-376 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026376,
author = {Fan, Yafu},
title = {Stage-Bottleneck Triage, Weighted Shortest-Processing-Time Scheduling and Level-of-Detail Execution Velocity},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}