Theorem 10 — the spin-block problem is optimally -competitive against an oblivious adversary
ProvedNonuniformCompetitive.SpinBlock.optimal_ratioConsider the spin-block problem with context-switch cost : for each of a sequence of lock waits, an on-line algorithm chooses how long to spin (cost per unit time) before blocking (cost ), not knowing when the lock will be released; the off-line optimum pays for a lock released at time . Then
- no randomized on-line algorithm is -competitive against an oblivious adversary for any : if for some constant and all input sequences , then ;
- there is a randomized on-line algorithm that is -competitive against an oblivious adversary.
This is Theorem 10 of Karlin, Manasse, McGeoch and Owicki, the continuous (ski-rental) counterpart of their optimal randomized snoopy-caching bound; the deterministic optimum is .
Formalization Note Randomized algorithms are mixed strategies over deterministic on-line algorithms, each of which chooses the next blocking time from the release times of earlier waits; the cost on each fixed input is required to be measurable in the random outcome. Competitiveness carries an additive constant, as defined in §1 of the paper. The hypothesis is the paper's "some large cost "; at blocking at once is free and optimal.
import Mathlib import Definitions.Def_NonuniformCompetitive_SpinBlock_Randomized
namespace NonuniformCompetitive.SpinBlock
/-- Theorem 10 (p. 559): no algorithm for the spin-block problem is competitive against an
oblivious adversary within a factor less than `e/(e − 1)`, and there is a randomized algorithm
that achieves this competitive factor. -/
theorem optimal_ratio (C : ℝ) (hC : 0 < C) :
(∀ (A : RandomizedAlg C) (c : ℝ), A.IsCompetitive c → Real.exp 1 / (Real.exp 1 - 1) ≤ c) ∧
∃ A : RandomizedAlg C, A.IsCompetitive (Real.exp 1 / (Real.exp 1 - 1)) := by sorry
end NonuniformCompetitive.SpinBlock
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.