# 处理器共享

处理器共享（Processor sharing，PS）是一种排队规则：单台服务器将其容量在所有在场作业之间均分，使所有作业都以总服务容量的相同份额同时接受服务。它是轮转分时的理想化模型，广泛用于计算机系统与通信网络的性能分析。

| 关键事实 | 值 |
| --- | --- |
| 服务划分 | 当有 n ≥ 1 个顾客在场时，每个顾客以速率 \( 1/n \) 接受服务 <sup>[1](https://www.sciencedirect.com/science/article/abs/pii/S0167637703000063)</sup> |
| 定义性极限 | 时间片为 Q 的轮转在 Q → 0 时的极限 <sup>[2](https://dl.acm.org/doi/10.1145/321386.321388)</sup> |
| 平稳队列长度（M/G/1-PS） | 当 \( \rho < 1 \) 时，\( P\{n\} = (1 - \rho)\rho^{n} \)，其中 \( \rho = \lambda \cdot E[S] \) <sup>[3](https://www.cs.cmu.edu/~harchol/Papers/massey.pdf)</sup> |
| 条件平均逗留时间 | 对于大小为 \( x \) 的作业，\( E[T(x)] = x/(1 - \rho) \) <sup>[3](https://www.cs.cmu.edu/~harchol/Papers/massey.pdf)</sup> |
| 不敏感性 | 逗留时间仅通过服务需求的值 x 依赖于服务需求，而不依赖其分布 <sup>[3](https://www.cs.cmu.edu/~harchol/Papers/massey.pdf)</sup> |
| 提出 | 克莱因罗克（Kleinrock），《分时系统：一种理论处理》（Time-shared systems: A theoretical treatment），《ACM 杂志》，1967 <sup>[2](https://dl.acm.org/doi/10.1145/321386.321388)</sup> |
| 主要变体 | 区分式处理器共享（DPS）与广义处理器共享（GPS）<sup>[4](https://www.doc.ic.ac.uk/~gcasale/content/pdfs/peva20dps.pdf)</sup>；加权公平排队（WFQ）<sup>[5](https://www.cs.utexas.edu/~lam/396m/papers/PG1994.pdf)</sup>；多级处理器共享（MLPS）<sup>[6](https://dl.acm.org/doi/10.1145/1243401.1243409)</sup> |

## 工作原理

在处理器共享下，只要作业在场，服务器就从不空闲，也从不专门服务某一个作业：若系统中有 n 个作业，则每个作业以基本服务器速率的 \( 1/n \) 接受服务。<sup>[1](https://www.sciencedirect.com/science/article/abs/pii/S0167637703000063)</sup>

PS 是轮转服务在调度时间片收缩到零时的极限。<sup>[2](https://dl.acm.org/doi/10.1145/321386.321388)</sup> 在轮转中，每个顾客依次获得 Q 秒服务，然后被放到队列末尾，因此每个用户每轮获得 Q 秒；当 Q → 0 时，所有顾客实际上同时接受服务。<sup>[2](https://dl.acm.org/doi/10.1145/321386.321388)</sup> 一个算例展示了其机制：两个服务需求分别为 1 和 10 的顾客各以速率 \( 1/2 \) 接受服务，因此一个在时刻 2 离开，此后剩下的顾客以速率 1 接受服务，并在时刻 11 离开。<sup>[7](https://eng.libretexts.org/Bookshelves/Electrical_Engineering/Signal_Processing_and_Modeling/Discrete_Stochastic_Processes_%28Gallager%29/05%3A_Countable-state_Markov_Chains/5.6%3A_Round-robin_and_Processor_Sharing)</sup>

## 计算方式

对于 PS 下稳定的 M/G/1 队列，设泊松到达率为 λ、平均服务需求为 E[S]，则提供负载为 \( \rho = \lambda \cdot E[S] \)。平稳队列长度分布为

\[ P\{Q = n\} = (1 - \rho)\,\rho^{n}, \quad n \geq 0, \]

其中 \( \rho < 1 \)。<sup>[3](https://www.cs.cmu.edu/~harchol/Papers/massey.pdf)</sup> 服务需求为 x 的作业的期望逗留时间为

\[ E[T(x)] = \frac{x}{1 - \rho}, \]

这一结果归功于克莱因罗克。<sup>[3](https://www.cs.cmu.edu/~harchol/Papers/massey.pdf)</sup> 对服务需求分布取平均，当平均需求为 1 时，平均响应时间为 \( 1/(1 - \rho) \)。由于 E[T(x)] 仅与 x 成正比，该结果对服务需求分布的形状不敏感。<sup>[3](https://www.cs.cmu.edu/~harchol/Papers/massey.pdf)</sup> 条件响应时间 T(t) 揭示了以长作业为代价给予短作业的优待 <sup>[8](https://www.lk.cs.ucla.edu/data/files/Kleinrock/Processor%20Sharing%20Queueing%20Models%20of%20Mixed.pdf)</sup>：大小为 x 的作业的期望逗留时间为 \( x/(1 - \rho) \)。<sup>[3](https://www.cs.cmu.edu/~harchol/Papers/massey.pdf)</sup>

逗留时间分布本身已通过若干技术得到研究。科夫曼（Coffman）、蒙茨（Muntz）和特罗特（Trotter）首先给出了 M/M/1 PS 队列中逗留时间分布的[拉普拉斯-斯蒂尔杰斯变换](https://www.edgepedia.org/zh/laplace-stieltjes-transform)的闭式表达式，以服务需求以及到达时看到的顾客数为条件。<sup>[1](https://www.sciencedirect.com/science/article/abs/pii/S0167637703000063)</sup> 该分布也可以表述为自伴算子的谱问题，从而为到达时发现 n 个顾客正在接受服务的顾客给出积分表示 <sup>[9](https://link.springer.com/article/10.1023/A:1013913827667)</sup>；微扰法则给出 M/M/1-PS 与有限容量 M/M/1/K-PS 队列的渐近展开。<sup>[10](https://www.cambridge.org/core/journals/european-journal-of-applied-mathematics/article/abs/sojourn-time-distribution-in-some-processorshared-queues/3CD188612F8EFA5BEF18053959394E46)</sup>

一个值得注意的等价关系将 PS 与随机服务顺序（ROS）联系起来：在 G/M/1 队列中，PS 下的逗留时间与到达非空系统的顾客在 ROS 下的等待时间同分布。该关系为

\[ P\{V_{\mathrm{ps}} > t\} = \frac{1}{\sigma} P\{W_{\mathrm{ros}} > t\}, \quad t \geq 0, \]

其中 \( \sigma \) 是到达瞬间系统非空的概率，\( 1/\sigma \) 是其倒数；该等价关系可推广到 M/M/1/K 队列以及乘积形式网络中的 M/M/1 型节点。<sup>[1](https://www.sciencedirect.com/science/article/abs/pii/S0167637703000063)</sup><sup> • </sup><sup>[17](https://homepages.cwi.nl/~sindo/Reports/SPOR-0201/SPOR-0201.pdf)</sup>

## 起源

处理器共享由[伦纳德·克莱因罗克](https://www.edgepedia.org/zh/leonard-kleinrock)（Leonard Kleinrock）在 1967 年《ACM 杂志》论文《分时系统：一种理论处理》中提出，该文研究了时间片 Q 趋于零的极限下的轮转分时系统。<sup>[2](https://dl.acm.org/doi/10.1145/321386.321388)</sup> 归属上有一个细微之处：克莱因罗克本人后来的综述记载，施拉格（Schrage）在 1966 年也研究了零时间片极限，而针对 Q → 0 情形的“处理器共享”一词可追溯到 1967 年的工作。<sup>[8](https://www.lk.cs.ucla.edu/data/files/Kleinrock/Processor%20Sharing%20Queueing%20Models%20of%20Mixed.pdf)</sup> 公开文献并未确定哪一项贡献应被称为首创。

密切相关的早期工作包括爱德华·G. 科夫曼（Edward G. Coffman）与伦纳德·克莱因罗克（Leonard Kleinrock）的《分时系统的反馈排队模型》（Feedback Queueing Models for Time-Shared Systems，《ACM 杂志》，1968），该文分析了分时系统的反馈调度 <sup>[11](https://doi.org/10.1145/321479.321483)</sup>；以及科夫曼、R. R. 蒙茨（R. R. Muntz）和 H. 特罗特（H. Trotter）在 1970 年的等待时间分析。<sup>[12](https://doi.org/10.1145/321556.321568)</sup>

## 变体

**区分式处理器共享（DPS）** 将 PS 扩展到多个类别：它最初由克莱因罗克提出，用于对具有优先组的分时计算机系统建模；每个类别 k 的作业带有一个权重 \( w_{k} \)，其瞬时服务份额与其权重除以加权作业数成正比。<sup>[4](https://www.doc.ic.ac.uk/~gcasale/content/pdfs/peva20dps.pdf)</sup> DPS 自然地理想化了分时操作系统中为优先任务实现的加权轮转算法。<sup>[4](https://www.doc.ic.ac.uk/~gcasale/content/pdfs/peva20dps.pdf)</sup> 法约尔（Fayolle）、米特拉尼（Mitrani）和亚斯诺戈罗茨基（Iasnogorodski）表明，DPS 下的渐近平均减速比是不敏感的，且与作业类别无关。<sup>[6](https://dl.acm.org/doi/10.1145/1243401.1243409)</sup>

**广义处理器共享（GPS）** 是平等主义 PS 的多类别变体，保证每个正在运行的类别获得服务容量的最低份额。<sup>[4](https://www.doc.ic.ac.uk/~gcasale/content/pdfs/peva20dps.pdf)</sup> 服务 N 个会话的 GPS 服务器由 N 个正实数刻画，这些数给出每个会话的相对服务量；结合漏桶准入控制，GPS 使网络能够对吞吐量和延迟做出一系列广泛的最坏情况保证。<sup>[5](https://www.cs.utexas.edu/~lam/396m/papers/PG1994.pdf)</sup> 该术语的历史有两条脉络：它指一种具有状态相关服务速率的 PS 扩展，但现代惯例遵循 A. K. 帕雷克（A. K. Parekh）和 R. G. 加拉格尔（R. G. Gallager）20 世纪 90 年代关于综合服务网络中流量控制的工作。<sup>[6](https://dl.acm.org/doi/10.1145/1243401.1243409)</sup><sup> • </sup><sup>[13](https://doi.org/10.1109/90.234856)</sup>

**加权公平排队（WFQ）** 是 GPS 的实际对应物。逐包规则 PGPS 紧密近似 GPS，并以加权公平排队之名而闻名；对于小分组尺寸，两种方案的行为几乎相同。<sup>[5](https://www.cs.utexas.edu/~lam/396m/papers/PG1994.pdf)</sup> 因此，GPS 作为理想化的流体参考，用来衡量实际的分组调度器。

**多级处理器共享（MLPS）** 是普通 PS 的一个突出变体，在基于大小的调度中具有核心作用；MLPS 策略优先处理较短的请求，涵盖从严格的 FBPS（仅服务获得服务最少的集合的反馈）到普通 PS 的谱系。<sup>[6](https://dl.acm.org/doi/10.1145/1243401.1243409)</sup>

## 应用

PS 已被用于对计算机操作系统中的基于时间片的 CPU 分时、通信网络中的弹性流量以及 Web 服务器调度进行建模。<sup>[3](https://www.cs.cmu.edu/~harchol/Papers/massey.pdf)</sup> 在通信网络中，单个 DPS 队列已被用于评估互联网中不等带宽共享的流级性能。<sup>[4](https://www.doc.ic.ac.uk/~gcasale/content/pdfs/peva20dps.pdf)</sup> PS 服务站也出现在乘积形式排队网络分析中，其中 PS/ROS 等价关系可推广到乘积形式网络中的 M/M/1 型节点。<sup>[1](https://www.sciencedirect.com/science/article/abs/pii/S0167637703000063)</sup> GPS 这一系列工作为综合服务网络中的最坏情况吞吐量和延迟保证奠定了基础。<sup>[5](https://www.cs.utexas.edu/~lam/396m/papers/PG1994.pdf)</sup>

## 局限与替代方案

由于开销方面的考虑，零时间片理想在实践中很少能够达到；其价值在于分析和结果极其简单。<sup>[8](https://www.lk.cs.ucla.edu/data/files/Kleinrock/Processor%20Sharing%20Queueing%20Models%20of%20Mixed.pdf)</sup> 真实调度器使用有限时间片，而有限处理器共享（对同时接受服务的作业数设置上限）通过重负载极限定理进行分析，这些定理给出稳态队列长度和响应时间分布的显式近似，其质量由仿真支持。<sup>[14](https://link.springer.com/article/10.1007/s11134-008-9095-4)</sup>

PS 并非一律是最佳模型。对于 GI/M/1 队列，处理器共享下逗留时间的方差大于相应的 FCFS 模型下逗留时间的方差。<sup>[15](https://www.cambridge.org/core/journals/journal-of-applied-probability/article/abs/sojourn-time-in-the-gim1-queue-by-processor-sharing/52EEEDDA100CC331F077EFC96D169552)</sup> 对于重尾任务大小分布，主机处的 FCFS 排队结合 SITA-E 任务分配可以显著优于主机处的 PS，通常将平均减速和平均队列长度降低一半，并且在主机足够多时还能产生更低的平均等待时间。<sup>[16](https://open.bu.edu/server/api/core/bitstreams/68c31f66-5559-4c10-8eb1-0c6e0e5fa2f2/content)</sup>

## References

1. [The equivalence between processor sharing and service in random order (Borst, Boxma, Morrison, Núñez Queija, Operations Research Letters, 2003)](https://www.sciencedirect.com/science/article/abs/pii/S0167637703000063)
2. [Time-shared Systems: a theoretical treatment (Kleinrock, J. ACM 1967)](https://dl.acm.org/doi/10.1145/321386.321388)
3. [Fluid and Diffusion Limits for Transient Sojourn Times of Processor Sharing Queues with Time Varying Rates](https://www.cs.cmu.edu/~harchol/Papers/massey.pdf)
4. [Fluid approximation of closed queueing networks with discriminatory processor sharing (Performance Evaluation)](https://www.doc.ic.ac.uk/~gcasale/content/pdfs/peva20dps.pdf)
5. [A generalized processor sharing approach to flow control in integrated services networks: the multiple node case (Parekh & Gallager, IEEE/ACM Transactions on Networking)](https://www.cs.utexas.edu/~lam/396m/papers/PG1994.pdf)
6. [Beyond processor sharing (SIGMETRICS Performance Evaluation Review)](https://dl.acm.org/doi/10.1145/1243401.1243409)
7. [5.6: Round robin and Processor Sharing (eng.libretexts.org)](https://eng.libretexts.org/Bookshelves/Electrical_Engineering/Signal_Processing_and_Modeling/Discrete_Stochastic_Processes_%28Gallager%29/05%3A_Countable-state_Markov_Chains/5.6%3A_Round-robin_and_Processor_Sharing)
8. [Processor Sharing Queueing Models of Mixed Scheduling Disciplines for Time Shared System (Kleinrock, UCLA)](https://www.lk.cs.ucla.edu/data/files/Kleinrock/Processor%20Sharing%20Queueing%20Models%20of%20Mixed.pdf)
9. [Analysis of the M/M/1 Queue with Processor Sharing via Spectral Theory (Queueing Systems)](https://link.springer.com/article/10.1023/A:1013913827667)
10. [Sojourn time distribution in some processor-shared queues (European Journal of Applied Mathematics)](https://www.cambridge.org/core/journals/european-journal-of-applied-mathematics/article/abs/sojourn-time-distribution-in-some-processorshared-queues/3CD188612F8EFA5BEF18053959394E46)
11. [Edward G. Coffman, Leonard Kleinrock (1968). Feedback Queueing Models for Time-Shared Systems. Journal of the ACM.](https://doi.org/10.1145/321479.321483)
12. [E. G. Coffman, R. R. Muntz, H. Trotter (1970). Waiting Time Distributions for Processor-Sharing Systems. Journal of the ACM.](https://doi.org/10.1145/321556.321568)
13. [A.K. Parekh, R.G. Gallager (1993). A generalized processor sharing approach to flow control in integrated services networks: the single-node case. IEEE/ACM Transactions on Networking.](https://doi.org/10.1109/90.234856)
14. [Steady state approximations of limited processor sharing queues in heavy traffic (Queueing Systems)](https://link.springer.com/article/10.1007/s11134-008-9095-4)
15. [The sojourn time in the GI/M/1 queue by processor sharing (Journal of Applied Probability)](https://www.cambridge.org/core/journals/journal-of-applied-probability/article/abs/sojourn-time-in-the-gim1-queue-by-processor-sharing/52EEEDDA100CC331F077EFC96D169552)
16. [To Queue or Not to Queue: When (Boston University open access)](https://open.bu.edu/server/api/core/bitstreams/68c31f66-5559-4c10-8eb1-0c6e0e5fa2f2/content)
17. [homepages.cwi.nl](https://homepages.cwi.nl/~sindo/Reports/SPOR-0201/SPOR-0201.pdf)

---
*Initially written Sep 29, 2026 · Edited: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 人工智能与数据 › Algorithms and computational methods

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/processor-sharing

English original: https://www.edgepedia.org/processor-sharing
