Result for online setting
The real complexity is in the online setting, where jobs arrive dynamically and the scheduler must make immediate, irreversible decisions without knowing which jobs will come next. We quantified the performance of an online algorithm through its competitive ratio, which is the worst-case tradeoff between the throughput of our online algorithm and the throughput of an optimal algorithm that is aware of the priority of all jobs.
Standard non-preemptive algorithms fail completely here as their competitive ratio approaches zero. This happens because even a single wrong decision to schedule a longer job can ruin the possibility of scheduling many future smaller jobs. In this example, if you imagine that each completed task brings equal value regardless of its length, then completing several smaller tasks is far more profitable than completing one longer task.
To make the problem solvable online and reflect real-world flexibility, we studied two models that allow an active job to be interrupted when a better opportunity arises (although only jobs restarted and subsequently completed non-preemptively are considered successful).
Interrupted restart
In this model, an online algorithm is allowed to interrupt the currently executing task. While partial work already done on the interrupted task is destroyed, the task itself remains in the system and can be retried.
We found the flexibility provided by allowing restart operations to be extremely beneficial. A variant of Greedy, which iteratively schedules work to complete as quickly as possible, continues to achieve a 1/2-competition ratio while matching results in the offline setting.
interrupt without restart
In this strict model, all work done on the interrupted task is destroyed and the task itself is discarded forever. Unfortunately, we have found that in this strict model, any online algorithm may encounter a sequence of jobs that forces it to make decisions that prevent it from completing more work in the future. Once again, the competitive ratio of all online algorithms is approaching zero. Analyzing the difficult examples above led us to focus on the practical scenario where all jobs share a common deadline (for example, all data processing must finish by the nightly batch run). For such general deadline examples, we design new continuous competitive algorithms. Our algorithm is very intuitive and we describe the algorithm here for simple setting of the entity capacity profile, i.e., we can schedule a single task at any time.
In this setting, our algorithm maintains a tentative schedule By allocating the tasks that have already arrived at different time intervals. When a new job arrives, the algorithm modifies the temporary schedule by applying the first of the following four actions:
