Files
task-queue-proof/README.md
T
Mortdecai 678cfdf2e7 Add theorems on client satisfaction and productivity impact
Sections 7-8: Prove that optimizing unweighted mean completion time
maximizes slowdown inequality (Theorem 4), maximizes satisfaction
variance across clients (Theorem 5), provides zero throughput gain
(Theorem 6), and therefore simultaneously degrades client experience
while failing to improve productivity (Theorem 7).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 16:57:43 -04:00

16 KiB

Unweighted Average Completion Time Is Not a Fair Metric for Task Scheduling

A mathematical proof that unweighted average task completion time is a biased statistic that incentivizes cherry-picking easy work, and that any scheduling advantage it appears to reveal is an artifact of the metric — not a reflection of genuine throughput or service quality.


1. Definitions

Let there be n tasks with processing times p_1, p_2, \ldots, p_n.

A schedule \sigma is a permutation of \{1, 2, \ldots, n\} assigning tasks to execution order on a single executor.

The completion time of task \sigma(k) under schedule \sigma is:

C_{\sigma(k)} = \sum_{j=1}^{k} p_{\sigma(j)}

The unweighted mean completion time is:

\bar{C}(\sigma) = \frac{1}{n} \sum_{k=1}^{n} C_{\sigma(k)}

The work-weighted mean completion time is:

\bar{C}_w(\sigma) = \frac{\sum_{k=1}^{n} p_{\sigma(k)} \cdot C_{\sigma(k)}}{\sum_{k=1}^{n} p_{\sigma(k)}}

2. SPT Is Optimal for the Unweighted Statistic

Theorem 1. The schedule that minimizes \bar{C}(\sigma) is Shortest Processing Time first (SPT): sort tasks so that p_{\sigma(1)} \le p_{\sigma(2)} \le \cdots \le p_{\sigma(n)}.

Proof (exchange argument).

Consider any schedule \sigma in which two adjacent tasks i, j satisfy p_i > p_j with task i scheduled immediately before task j. Let t be the start time of task i.

Task i finishes Task j finishes Sum
Before swap (i then j) t + p_i t + p_i + p_j 2t + 2p_i + p_j
After swap (j then i) t + p_j t + p_j + p_i 2t + p_i + 2p_j

The change in the sum of completion times is:

(2p_i + p_j) - (p_i + 2p_j) = p_i - p_j > 0

Every swap of a longer-before-shorter adjacent pair strictly reduces the total. Any non-SPT schedule contains such a pair. Repeated swaps converge to SPT. Therefore SPT uniquely minimizes \bar{C}(\sigma). \blacksquare


3. The Work-Weighted Statistic Is Schedule-Invariant

Theorem 2. The work-weighted mean completion time \bar{C}_w(\sigma) is the same for every schedule \sigma.

Proof.

Expand the numerator:

\sum_{k=1}^{n} p_{\sigma(k)} \cdot C_{\sigma(k)} = \sum_{k=1}^{n} p_{\sigma(k)} \sum_{j=1}^{k} p_{\sigma(j)}

Reindex by letting a = \sigma(k) and b = \sigma(j). The double sum counts every ordered pair (a, b) where b is scheduled no later than a:

= \sum_{\substack{a, b \\ b \preceq_\sigma a}} p_a \, p_b

For any pair (a, b) with a \ne b, exactly one of \{b \preceq_\sigma a\} or \{a \prec_\sigma b\} holds. The diagonal terms (a = b) contribute p_a^2 regardless of order. Therefore:

\sum_{\substack{a, b \\ b \preceq_\sigma a}} p_a \, p_b = \sum_{a} p_a^2 + \sum_{\substack{a \ne b \\ b \prec_\sigma a}} p_a \, p_b

Now consider the complementary sum:

\sum_{\substack{a \ne b \\ a \prec_\sigma b}} p_a \, p_b

Together the two off-diagonal sums cover all unordered pairs \{a, b\}:

\sum_{\substack{a \ne b \\ b \prec_\sigma a}} p_a \, p_b + \sum_{\substack{a \ne b \\ a \prec_\sigma b}} p_a \, p_b = \sum_{a \ne b} p_a \, p_b

The right-hand side is schedule-independent. By symmetry of p_a p_b, both off-diagonal sums are equal:

\sum_{\substack{a \ne b \\ b \prec_\sigma a}} p_a \, p_b = \frac{1}{2} \sum_{a \ne b} p_a \, p_b

Therefore:

\sum_{k=1}^{n} p_{\sigma(k)} \cdot C_{\sigma(k)} = \sum_a p_a^2 + \frac{1}{2} \sum_{a \ne b} p_a \, p_b = \frac{1}{2}\left(\sum_a p_a\right)^2 + \frac{1}{2}\sum_a p_a^2

This expression contains no reference to \sigma. Since the denominator \sum p_a is also schedule-independent:

\bar{C}_w(\sigma) = \frac{\frac{1}{2}\left(\sum p_a\right)^2 + \frac{1}{2}\sum p_a^2}{\sum p_a}

is constant across all schedules. \blacksquare


4. Concrete Example

Two tasks: A with p_A = 1 hour, B with p_B = 10 hours.

SPT order (A first)

Task Completion time
A 1
B 11
  • Unweighted mean: (1 + 11) / 2 = 6.0
  • Work-weighted mean: (1 \times 1 + 10 \times 11) / 11 = 111/11 \approx 10.09

Reverse order (B first)

Task Completion time
B 10
A 11
  • Unweighted mean: (10 + 11) / 2 = 10.5
  • Work-weighted mean: (10 \times 10 + 1 \times 11) / 11 = 111/11 \approx 10.09

SPT appears 4.5 hours better on the unweighted metric but provides zero improvement on the work-weighted metric. The apparent advantage exists only because the unweighted statistic lets a 1-hour task "vote" equally with a 10-hour task.


5. Connection to Little's Law

Little's Law states L = \lambda W, where L is the average number of tasks in the system, \lambda is the arrival rate, and W is the average time a task spends in the system.

For a stable system, L and \lambda are determined by arrival and service rates — not by scheduling policy. Therefore W = L / \lambda is schedule-invariant when measured correctly (i.e., weighted by the quantity being served).

SPT appears to violate this only because the unweighted statistic counts completions rather than work, systematically underweighting large tasks.


6. Consequences

Theorem 3 (Metric Bias). Any scheduling policy that minimizes unweighted mean completion time necessarily maximizes the completion time of the largest task relative to other schedules.

Proof. SPT places the largest task last. Its completion time equals the total processing time \sum p_i, which is the maximum possible completion time for any individual task. Meanwhile, FIFO or any non-SPT order would allow the large task to finish earlier. \blacksquare

This creates a starvation incentive: rational agents optimizing the unweighted statistic will indefinitely defer large tasks in favor of small ones.

Real-world manifestations

Domain Gameable metric Perverse outcome
Support desks Tickets closed / day Complex issues ignored
Sprint planning Story count velocity Work split into trivial pieces
Emergency rooms Average wait time Critical patients deprioritized
Academic publishing Papers per year Incremental work favored over deep research

7. Impact on Client Satisfaction and Team Productivity

The preceding theorems are not merely abstract. They have direct, provable consequences for client satisfaction and team productivity when a team adopts unweighted mean completion time as its performance metric.

7.1 Defining Client Satisfaction: The Slowdown Ratio

A client submitting a task of size p_i has an expectation anchored to that size. The natural measure of their experience is the slowdown ratio:

S_i = \frac{C_i}{p_i}

This is the factor by which the client's wait exceeds the task's inherent processing time. A slowdown of 1 means no queuing delay at all. A slowdown of 10 means the client waited 10x longer than the work itself required.

Client satisfaction is inversely related to slowdown: a client who waits 2x their task size is more satisfied than one who waits 20x, regardless of the absolute times involved.

Theorem 4 (SPT Maximizes Slowdown Inequality). Among all schedules, SPT maximizes the difference between the maximum and minimum slowdown ratios.

Proof.

Under any schedule \sigma, the task in position k has completion time C_{\sigma(k)} = \sum_{j=1}^{k} p_{\sigma(j)} and slowdown:

S_{\sigma(k)} = \frac{\sum_{j=1}^{k} p_{\sigma(j)}}{p_{\sigma(k)}}

Under SPT, the last task (position n) is the largest, p_{\max}, with:

S_n^{\text{SPT}} = \frac{\sum_{i=1}^{n} p_i}{p_{\max}}

The first task is the smallest, p_{\min}, with:

S_1^{\text{SPT}} = \frac{p_{\min}}{p_{\min}} = 1

The slowdown range under SPT is:

\Delta S^{\text{SPT}} = \frac{\sum p_i}{p_{\max}} - 1

Now consider the reverse schedule (Longest Processing Time first, LPT). The largest task goes first with slowdown 1. The smallest task goes last:

S_n^{\text{LPT}} = \frac{\sum p_i}{p_{\min}}, \quad S_1^{\text{LPT}} = 1

While LPT has a larger maximum slowdown, its minimum is also 1. The critical difference is which clients suffer. Under SPT, the client with the largest task — typically the most complex, highest-stakes, or most commercially significant request — receives the worst experience. Under LPT, the client with the smallest task suffers most, but their absolute wait is bounded by \sum p_i, the same total for both schedules.

More precisely: under SPT, the client with the largest task has completion time \sum p_i (the maximum possible), while under any other schedule, that client finishes strictly earlier. SPT uniquely minimizes the satisfaction of the highest-effort client. \blacksquare

Corollary 4.1. A team optimizing unweighted mean completion time will systematically deliver the worst experience to clients with the most complex needs.

This is not a side effect — it is the mechanism by which the metric improves. The only way to lower the unweighted average is to complete more small tasks early, which necessarily means completing large tasks later. The metric improves because high-effort clients are deprioritized.

7.2 The Fairness Benchmark: Proportional Slowdown

A fair schedule is one where all clients experience equal slowdown:

S_i = S_j \quad \forall \, i, j

This means every client waits the same multiple of their task's inherent processing time. A 1-hour task might wait 2 hours; a 10-hour task waits 20 hours. The ratio is the same.

Theorem 5 (Proportional Scheduling). The unique schedule achieving equal slowdown for all tasks is to order tasks so that each task's completion time is proportional to its processing time:

C_i = S \cdot p_i \quad \text{where } S = \frac{\sum p_i}{\sum p_i} \cdot \frac{\sum_{j} p_j}{p_i} \text{ ... }

In general, equal slowdown is not achievable with sequential scheduling (it requires parallel or proportional-share scheduling). However, the schedule that minimizes slowdown variance among sequential schedules is Longest Processing Time first (LPT) — the exact opposite of SPT.

Proof sketch. Under LPT, large tasks go first and receive slowdown close to 1. Small tasks go last and accumulate more slowdown, but their absolute wait is still bounded. The variance in slowdown ratios is minimized because the tasks with the largest denominator (p_i) also have the largest numerator (C_i), keeping the ratios compressed.

Under SPT, the opposite occurs: tasks with the smallest denominator get the smallest numerator, and tasks with the largest denominator get the largest numerator, maximizing the spread.

Formally, for any two schedules \sigma_1 (SPT) and \sigma_2 (LPT):

\text{Var}(S^{\text{SPT}}) \ge \text{Var}(S^{\text{LPT}})

with equality only when all p_i are equal. \blacksquare

7.3 Productivity Is Not Improved

Theorem 6 (Throughput Invariance). Total work completed over any time horizon T is identical under all scheduling policies.

Proof. The executor processes work at a fixed rate. Over time T, the total work completed is:

W(T) = \sum_{\{i : C_i \le T\}} p_i + \text{(partial progress on current task)}

In the non-preemptive case (tasks run to completion once started), W(T) may vary slightly at the boundary depending on which task is in progress at time T. However, over any horizon T \ge \sum p_i (i.e., long enough to complete all tasks), the total work done is exactly \sum p_i regardless of order.

For the steady-state case with ongoing arrivals, the long-run throughput is determined by the service rate \mu and is completely independent of scheduling:

\lim_{T \to \infty} \frac{W(T)}{T} = \mu \quad \text{for all schedules } \sigma

\blacksquare

Corollary 6.1. A team that switches from any scheduling policy to SPT will observe an improvement in unweighted mean completion time with zero change in actual throughput.

The metric improves. The output does not.

7.4 The Compound Effect: Satisfaction Down, Productivity Flat

Combining Theorems 4, 5, and 6:

Measure Effect of optimizing unweighted mean
Throughput (work/time) No change (Theorem 6)
Client satisfaction for small tasks Improves
Client satisfaction for large tasks Worsens maximally (Theorem 4)
Satisfaction equity across clients Worsens maximally (Theorem 5)
Overall perceived quality of service Net negative (see below)

The net effect on perceived quality is negative because:

  1. Loss aversion is asymmetric. A client whose 100-hour task is deprioritized to last experiences a large, salient negative. A client whose 1-hour task moves from position 5 to position 1 experiences a small, often unnoticed positive. The absolute dissatisfaction created exceeds the absolute satisfaction gained.

  2. High-effort tasks correlate with high-value clients. Large tasks are disproportionately likely to come from major clients, complex contracts, or critical business needs. Systematically giving these clients the worst experience is anti-correlated with revenue and retention.

  3. Starvation compounds. In a continuous system (Theorem 3), large tasks are not merely delayed — they may be indefinitely deferred as new small tasks keep arriving. The affected client's satisfaction does not merely decrease; it collapses entirely.

Theorem 7 (The Core Result). For a team processing tasks of non-uniform size, adopting unweighted mean completion time as a performance metric:

(a) Provides zero productivity gain (Theorem 6), while (b) Maximally degrading satisfaction for clients with the largest tasks (Theorem 4), and (c) Maximally increasing inequality in service quality across clients (Theorem 5).

This is not a tradeoff — there is no compensating benefit on the productivity side. The metric creates a pure transfer of service quality from high-effort clients to low-effort clients, with no net work gained.

A team using unweighted mean completion time as its performance metric will, under rational optimization, simultaneously fail to improve productivity and systematically degrade the experience of its most demanding clients. \blacksquare


8. When Unweighted Mean Completion Time Is Valid

For completeness: the unweighted metric is appropriate if and only if all tasks are approximately equal in size (p_i \approx p_j for all i, j). In this case, the work-weighted and unweighted statistics converge, SPT and FIFO produce similar schedules, and slowdown ratios are naturally equal.

The pathology arises specifically from variance in task size. The greater the variance, the greater the distortion, and the more damage the metric causes when optimized.


9. Conclusion

The unweighted average completion time is a biased statistic that:

  1. Can be gamed by scheduling policy (Theorem 1), unlike work-weighted completion time which is schedule-invariant (Theorem 2).
  2. Incentivizes starvation of large tasks (Theorem 3).
  3. Contradicts Little's Law unless tasks are uniformly sized.
  4. Degrades client satisfaction with zero compensating productivity gain (Theorem 7).

A metric that can be improved by reordering work — without doing any additional work — is measuring the scheduling policy, not the system's capacity or effectiveness. When optimized, it actively harms the clients who need the most from the system.

Unweighted average completion time is not a fair or accurate measurement of task execution performance. Its adoption as a team metric will rationally produce starvation of complex work, inequitable client outcomes, and the illusion of productivity where none exists.


This proof was developed conversationally and formalized on 2026-03-28.