Pinwheel scheduling
In mathematics and computer science, the pinwheel scheduling problem is a problem in real-time scheduling with repeating tasks of unit length and hard constraints on the time between repetitions. Definition. The input to pinwheel scheduling consists of a list of tasks, each of which is assumed to take unit time per instantiation. Each task has an associated positive integer value, its minimum repeat time (the minimum time from the start of one instantiation of the task to the next). Only one task can be performed at any given time. The desired output is an infinite sequence specifying  which task to perform in each unit of time. Each input task should appear infinitely often in the sequence, with the largest gap between two consecutive instantiations of a task at most equal to the repeat time of the task. For example, the infinitely repeating sequence "..." would be a valid pinwheel schedule for three tasks "a", "b", and "c" with repeat times that are at least 2, 4, and 4 respectively. Density. If the task to be scheduled are numbered from formula_1 to formula_2, let formula_3 denote the repeat time for task formula_4. Then the "density" of a pinwheel scheduling  problem is formula_5. For a solution to exist, it is necessary that the density is at most formula_1. This condition on density is also sufficient for a schedule to exist in the special case that all repeat times are multiples of each other (for instance, if all are powers of two), because in this case one can solve the problem using a disjoint covering system. Having density at most formula_1 is also sufficient when there are exactly two distinct repeat times. However, it is not sufficient in other cases. In particular, there is no schedule for three items with repeat  times formula_8, formula_9, and formula_10, no matter how large formula_10 may be, even though the density of this system is only formula_12. Every instance of pinwheel scheduling with density at most formula_13 has a solution, and it has been conjectured that every instance with density at most formula_14 has a solution. Every instance with three distinct repeat times and density at most formula_14 does have a solution. Periodicity and complexity. When there exists a solution, the solution can be assumed to be periodic, with a period at most equal to the product of the repeat times. However, it is not  always possible to find a repeating schedule of sub-exponential length. With a compact input representation that specifies, for each distinct repeat time, the number of objects that have that repeat time, pinwheel scheduling is NP-hard. Applications. Applications of pinwheel scheduling include scheduling communications between satellites and a ground station, scheduling maintenance of a collection of objects (such as oil changes for automobiles), computer processing of multimedia data, and contention resolution in real-time wireless computer networks.