Competitive Randomized Algorithms for Nonuniform Problems II: Optimal Competitiveness for the Spin-Block ProblemResearch Paper
Motivation
A process on a shared-memory multiprocessor that finds a lock held must decide what to do while it waits. It can spin, repeatedly testing the lock and occupying its processor, or it can block, giving the processor to another process and paying a fixed context-switch cost to be descheduled and later restored. Spinning is cheap when the lock is released soon; blocking is cheap when the wait is long. The waiting time is not known in advance, so the choice has to be made on-line. This is the spin-block problem, studied by Karlin, Manasse, McGeoch and Owicki in Competitive Randomized Algorithms for Nonuniform Problems (Algorithmica 11, 1994, doi:10.1007/BF01189993), §4. Mathematically it is the continuous form of the ski-rental problem, and the same rent-or-buy structure recurs in power-down policies and in TCP acknowledgement (Karlin, Kenyon, Randall, STOC 2001).
Timeline:
- Karlin, Manasse, Rudolph and Sleator (1988, doi:10.1007/BF01762111) introduced competitive analysis of snoopy caching and showed that is the optimal deterministic factor there. The spin-block analogue is recorded in the 1994 paper (pp. 558–559): spinning for time and then blocking is -competitive, and no deterministic algorithm does better.
- Karlin, Manasse, McGeoch and Owicki (SODA 1990; Algorithmica 1994) found the optimal randomized factors for snoopy caching and spin-block. For spin-block, Theorem 10 (p. 559) gives against an oblivious adversary. Theorem 9 (p. 559) shows that against an adaptive on-line adversary randomization does not help: the factor stays .
Setting
Fix a context-switch cost . A lock wait is described by its release time . An algorithm handling the wait chooses a blocking time : it spins until time and then blocks (: never block). The cost of the wait is
so a lock released exactly at the blocking time costs . The optimal off-line algorithm, which knows , pays .
An input is a finite sequence of lock waits. A deterministic on-line algorithm chooses the blocking time of wait as a function of , the release times it has already observed. Its cost is the sum of the wait costs, and the off-line cost is .
A randomized on-line algorithm is a probability distribution over deterministic on-line algorithms: a probability space and a deterministic algorithm for each , with measurable for every . Its expected cost is . Following §1 of the paper, is -competitive against an oblivious adversary if there is a constant with
The adversary is oblivious: it fixes before the algorithm's random choices are made.
The paper's algorithm blocks at a random time with cumulative distribution
where is the probability of blocking before time .
Formalization targets
Goal: Theorem 10 (p. 559)
For every :
Milestones
- Expected cost of one wait (§4.1, p. 560). For a blocking time with law and release time ,
- The ratio of the paper's distribution (§4.1, p. 560). With the above, for all ,
- Theorem 10, first claim: the lower bound for every -competitive randomized algorithm.
- Theorem 10, second claim: existence of an -competitive randomized algorithm.
Significance
Theorem 10 settles the randomized competitive ratio of the continuous ski-rental problem: is achievable and cannot be improved by any on-line algorithm, randomized or not, against an oblivious adversary. The same constant is the limit of the paper's snoopy-caching ratios as the block size grows, and it recurs in randomized rent-or-buy problems and in on-line primal-dual analyses.
The result is proved in the literature, and the mission's work is to formalize it. The platform has related material but not this statement: Primal-Dual Online Algorithms I: Fractional Ski Rental proves a deterministic, fractional, discrete-day bound (PrimalDualOnline.SkiRental.fractional_competitive), which is a different model and contains no lower bound. A complete formalization produces a reusable model of randomized on-line algorithms with history-dependent decisions and an exact lower bound for them.
Difficulty
The upper bound per lock wait is an explicit computation. The difficulty lies elsewhere. First, the on-line algorithm is allowed to adapt to the release times of all previous waits, so a bound for a single wait does not by itself bound a sequence: the randomized algorithm must be assembled so that each wait is handled with the right blocking law, whatever happened before. Second, the lower bound is a statement about every randomized algorithm and must survive the additive constant : a single hard lock wait proves nothing, because absorbs any bounded loss. It has to be shown that on long sequences of waits every algorithm loses a factor on average. The natural first idea, to exhibit one bad release time for each algorithm, fails for randomized algorithms facing an oblivious adversary.
Formalization scope
All objects live in the namespace NonuniformCompetitive.SpinBlock. Release times are ℝ≥0, blocking times ℝ≥0∞, wait costs ℝ≥0∞, and the off-line cost is real. Committed conventions:
- is a hypothesis of every theorem (the paper's "some large cost "); at blocking at once is free and the lower bound fails.
- A tie costs ; this matches " is the probability that the algorithm blocks sometime before time ".
- Inputs are finite sequences of lock waits and competitiveness carries the additive constant of §1 (p. 543). A formalization with a single wait and no additive constant would be a different, easier lower bound and is ruled out.
- The on-line algorithm sees the release times of earlier waits (the information used by the paper's adaptive algorithms, p. 561). This enlarges the class of algorithms: it strengthens the lower bound and does not affect the upper bound.
- A randomized algorithm is a mixed strategy whose cost on each fixed input is measurable in the random outcome; the expected cost is a lower Lebesgue integral. Without measurability the lower integral would not be the expectation and the upper bound would become easier than the paper's.
- Milestone 1 is stated for every blocking law, not only for the paper's . Milestone 2 keeps the paper's inequality, although equality holds.
Infrastructure a complete development needs: Lebesgue integrals of functions of a random variable (the layer-cake formula), interval integrals of the exponential, the construction of a probability measure on with a prescribed continuous distribution function, and a Yao-type averaging argument over finitely supported input distributions for the lower bound. The model of randomized on-line algorithms with history-dependent decisions is reusable for other rent-or-buy problems. Contributions welcome: proofs of the milestones, and intermediate lemmas such as the discretised lower bound for a fixed step .
Selected references
- A. R. Karlin, M. S. Manasse, L. A. McGeoch, S. Owicki, Competitive Randomized Algorithms for Nonuniform Problems, Algorithmica 11 (1994), 542–571. doi:10.1007/BF01189993
- A. R. Karlin, M. S. Manasse, L. Rudolph, D. D. Sleator, Competitive Snoopy Caching, Algorithmica 3 (1988), 79–119. doi:10.1007/BF01762111
- A. Borodin, R. El-Yaniv, Online Computation and Competitive Analysis, Cambridge University Press, 1998.
- A. R. Karlin, C. Kenyon, D. Randall, Dynamic TCP Acknowledgement and Other Stories about e/(e−1), STOC 2001, 502–509. doi:10.1145/380752.380845
- N. Buchbinder, J. Naor, The Design of Competitive Online Algorithms via a Primal–Dual Approach, Foundations and Trends in Theoretical Computer Science 3 (2009). doi:10.1561/0400000024