The McGeoch–Sleator Partition algorithm for randomized paging (H_k-competitiveness) #
This file formalizes the Partition randomized online paging algorithm of
McGeoch and Sleator, A Strongly Competitive Randomized Paging Algorithm
for demand paging (Paging.problem α k, 0 < k) and proves that it is (H_k, 0)-competitive
against an oblivious adversary over any page universe α ([DecidableEq α]) and from any
admissible initial cache s₀ (s₀.card ≤ k), matching the H_k oblivious-adversary lower bound
of CslibFrontier.DataStructure.Paging.RandomizedLowerBound and strictly improving on the 2 H_k
ratio of CslibFrontier.DataStructure.Paging.Marking.
Algorithm #
Controller memory (PartMem α) stores:
- an ordered list
levels : List (PartLevel α)of intermediate labeled levels[(S_1, k_1, M_1), ..., (S_m, k_m, M_m)]from oldest to newest, where each level holds a deterministic page blockS_i, an integer mark quotak_i(1 ≤ k_i < k), and a randomizedi-marked subsetM_i ⊆ S_i ∪ M_{i-1}of cardinalityk_i(withM_0 = ∅andk_i + 1 = |S_i| + k_{i-1}, so there are exactlyk_i + 1i-eligible pages and one is unmarked at each level); and - the newest deterministic block
top : Finset α, whose pages are always resident in the cache.
The observable cache is top ∪ lastMarks levels, which has size |top| + k_m ≤ k (and = k
whenever levels ≠ []). Starting from ⟨[], s₀⟩, on request p : α:
- Hit in
top(p ∈ top): zero cost; state unchanged. - Request in an intermediate block (
p ∈ S_j):pis removed fromS_jand inserted intotop; quotask_j, ..., k_mdecrease by1, and marks are updated upward from leveljby keeping the demoted element if marked or evicting a uniformly random mark otherwise (hitOrPick), preservingM_mon a hit and replacing a single resident page on a miss; finally any prefix up to and including the last level whose quota reaches0is dropped. - Outside request (
p ∉ ⋃ S_i ∪ top): always a miss (stepCost = 1). During warmup (|top| < k,levels = []),pis inserted intotopwithout eviction. When the cache is full (|cache| = k), a uniformly random cached pagee ∈ cacheis evicted, the oldtopbecomes a new level(top, k - 1, cache.erase e)(dropped immediately ifk = 1), andtopbecomes{p}.
Because the algorithm tosses fresh coins at unboundedly many steps, it is packaged as an
Online.BehavioralStrategy (problem α k) (partitionStrategy).
Proof architecture #
- Exact hierarchical mark law (
PartTracker,partLaw,partLaw_bind_partitionStep,expectedCost_partitionStrategy_eq): Conditional onM_{i-1}, eachM_iis uniformly distributed overk_i-subsets of the(k_i + 1)-element eligible setS_i ∪ M_{i-1}. ApplyinguniformOfFinset_powersetCard_hitOrEraselevel-by-level proves thatpartitionSteppreservespartLaw, giving a computable rational recursionpartExpectedCostforexpectedCost. - Harmonic potential (
partExpectedCost_le_harmonic_mul_outsideCount): WithΦ = ∑_i (H_{k_i + 1} - 1), each outside request increasescost + Φby1 + (H_k - 1) = H_k(or1 ≤ H_kduring warmup), while each intermediate request inS_jfaults with probability1 - ∏_{i ≥ j} k_i / (k_i + 1) ≤ ∑_{i ≥ j} 1 / (k_i + 1)and dropsΦby at least∑_{i ≥ j} (H_{k_i + 1} - H_{k_i}) = ∑_{i ≥ j} 1 / (k_i + 1), yieldingE[PARTITION] ≤ H_k · #outside. - Offline deficit lower bound (
outsideCount_le_scheduleCost): Against any valid (not necessarily lazy) offline schedule(problem α k).ValidSchedule s₀ reqs offStates, the suffix deficitmax_{0 ≤ i ≤ m} (|C \ U_i| - k_i)satisfiesisOutside + Δdeficit ≤ ΔOPTat every step, yielding#outside ≤ OPTwith zero additive slack.
Main definitions #
Cslib.DataStructure.Paging.PartLevel,Cslib.DataStructure.Paging.PartMem,Cslib.DataStructure.Paging.ValidPartMem: controller memory and invariant of Partition.Cslib.DataStructure.Paging.partitionStep,Cslib.DataStructure.Paging.partitionStrategy: the McGeoch–Sleator Partition behavioural online strategy forPaging.problem α k.Cslib.DataStructure.Paging.PartBlock,Cslib.DataStructure.Paging.PartTracker,Cslib.DataStructure.Paging.partLaw,Cslib.DataStructure.Paging.partExpectedCost,Cslib.DataStructure.Paging.outsideCount: deterministic partition tracker, exact hierarchical mark distribution, rational expected-cost recursion, and outside-request count.
Main results #
partLaw_bind_partitionStep,expectedCost_partitionStrategy_eq: exact distribution invariant and rational expected-cost formula.partExpectedCost_le_harmonic_mul_outsideCount: harmonic potential boundE[PARTITION] ≤ H_k · #outside.outsideCount_le_scheduleCost: offline lower bound#outside ≤ OPTagainst arbitrary valid offline schedules.partitionStrategy_expectedCost_le,partitionStrategy_isCompetitive,partitionStrategy_expectedCost_toReal_le: Partition is(H_k, 0)-competitive inℝ≥0∞andℝ.partitionStrategy_tight,partitionStrategy_tight_on_fin,partitionStrategy_vs_markingStrategy_fin_four: tightH_krandomized paging characterization on arbitrary universes of size≥ k + 1and strictk = 2, n = 4separation from marking.
References #
Controller memory, deterministic tracker, and structural helpers #
Internal controller memory of the McGeoch–Sleator Partition algorithm: intermediate labeled
levels from oldest to newest together with the deterministic newest block top.
Intermediate labeled levels
(S_1, k_1, M_1), ..., (S_m, k_m, M_m)from oldest to newest.- top : Finset α
Newest deterministic block
S_β, always fully resident in the cache.
Initial deterministic tracker for initial cache s₀.
Generic dropZeroQuota helpers #
Union of all deterministic page blocks stored across bs.
Representation invariant of PartMem for cache capacity k.
Structural invariant of PartTracker for cache capacity k.
Behavioural Partition strategy #
One-step randomized transition of the McGeoch–Sleator Partition algorithm for capacity k
on request p.
The McGeoch–Sleator Partition online strategy ([McGS91]) for
Paging.problem α k (0 < k), packaged as a BehavioralStrategy.
Single-step expected cost of partitionStrategy depends only on whether p is cached.
Deterministic tracker transition and exact rational expected cost #
Deterministic promotion of p from its intermediate block S_j, prior to dropZeroQuota.
Deterministic transition of PartTracker on page request p.
Run stepPartTracker across a request sequence.
Whether request p lies outside every block of tr (including tr.top), i.e., invokes the
outside-page rule (or warmup insertion).
Total number of outside requests encountered from tr along reqs.
Rational miss probability of p across the block list bs when p ∉ top.
Exact rational single-step expected fault cost of Partition from tracker tr on request p.
Exact rational expected fault cost of Partition from tracker tr across reqs.
stepPartTracker preserves ValidPartTracker when 0 < k.
Exact controller-memory distribution associated with deterministic tracker tr.
Exact distribution invariant of McGeoch–Sleator Partition. Stepping partLaw tr by
partitionStep on any request p yields partLaw (stepPartTracker k tr p).
Exact rational single-step and multi-step expected cost #
Single-step expected fault cost of partitionStrategy under partLaw tr equals
ENNReal.ofReal (stepPartCost tr p).
Expected continuation cost of partitionStrategy from partLaw tr equals
ENNReal.ofReal (partExpectedCost k tr reqs).
Exact rational expected cost of McGeoch–Sleator Partition. From any valid initial cache
s₀, (partitionStrategy k hk).expectedCost s₀ reqs equals
ENNReal.ofReal (partExpectedCost k (initPartTracker s₀) reqs).
Harmonic potential bound (E[PARTITION] ≤ H_k · #outside) #
Harmonic potential bound (E[PARTITION] ≤ H_k · #outside). From any admissible initial
cache s₀, the rational expected cost of partitionStrategy is at most harmonic k times the
number of outside requests.
Offline deficit lower bound (#outside ≤ OPT) #
Offline deficit lower bound (#outside ≤ OPT). Against any valid (not necessarily lazy)
offline schedule from s₀, the number of outside requests encountered by stepPartTracker never
exceeds the offline schedule's fault cost.
Main H_k-competitiveness theorems and tightness #
Rational expected cost of partitionStrategy is at most harmonic k * scheduleCost.
McGeoch–Sleator Partition competitiveness (ℝ≥0∞ cost bound) [McGS91]: for
every admissible initial cache s₀ (|s₀| ≤ k), request sequence reqs, and valid offline
schedule offStates from s₀, the expected cost of partitionStrategy is at most H_k times
the offline schedule's cost.
McGeoch–Sleator Partition competitiveness (BehavioralStrategy.IsCompetitive)
[McGS91]: the Partition strategy is (H_k, 0)-competitive for demand paging against an
oblivious adversary over any page universe α.
Real-valued expectation form of McGeoch–Sleator Partition competitiveness.
Tight H_k characterization of randomized oblivious paging: over any page universe
containing a (k + 1)-element subset S (0 < k), partitionStrategy achieves (H_k, 0)-
competitiveness, while no behavioural randomized strategy achieves (c, b)-competitiveness from
∅ for any c < H_k and finite b ≠ ⊤.
Tight H_k characterization on Fin n for every 0 < k < n: partitionStrategy achieves
(H_k, 0)-competitiveness on every finite page universe Fin n, matching the FKLMSY H_k lower
bound whenever k < n (in contrast to markingStrategy, which reaches H_k only for
n ≤ k + 1).
Strict separation between Partition and Marking on Fin 4 at k = 2: partitionStrategy 2
is (H_2, 0)-competitive (H_2 = 3 / 2) on Fin 4, whereas markingStrategy 2 is not
(H_2, b)-competitive for any finite additive constant b ≠ ⊤.