Louis-Claude Canon

Aurélie Kong

Win Chang

Yves Robert

Frédéric Vivien

Scheduling independent stochastic tasks deadline and budget constraints

Keywords: independent tasks, stochastic cost, scheduling, budget, deadline, cloud platform

This paper discusses scheduling strategies for the problem of maximizing the expected number of tasks that can be executed on a cloud platform within a given budget and under a deadline constraint. The execution times of tasks follow IID probability laws. The main questions are how many processors to enroll and whether and when to interrupt tasks that have been executing for some time. We provide complexity results and an asymptotically optimal strategy for the problem instance with discrete probability distributions and without deadline. We extend the latter strategy for the general case with continuous distributions and a deadline and we design an efficient heuristic which is shown to outperform standard approaches when running simulations for a variety of useful distribution laws.

Ordonnancement de tâches stochastiques indépendantes avec contraintes de budget et d'échéance

Résumé : Ce rapport présente des statégies d'ordonnacement pour le problème suivant: maximiser l'espérance du nombre de tâches indépendantes exécutées sur une plate-forme de type cloud computing, avec une double contrainte de budget et de date d'échéance. Les temps d'exécution des tâches suivent une même loi de probabilité, discrète ou continue. Il faut décider combien de processeurs mettre en oeuvre, et quand interrompre les tâches qui se sont déjà exécutées pendant une certaine durée. Nous donnons des résultats de complexité pour l'instance du problème sans échéance et avec distribution discrète, et proposons une stratégie asymptotiquement optimale. Nous étendons cette stratégie au cas général des distributions continues et avec échéance, et définissons une heuristique qui surpasse les approches usuelles pour une vaste gamme de distribiutions usuelles.

Mots-clés : tâches indépendantes, coût stochastique, stochastic cost, ordonnancement, budget, date d'échéance, cloud platform.

Introduction

This paper deals with the following problem: given an infinite bag of stochastic tasks, and an infinite set of available Virtual Machines (VMs, or processors 1 ), how to successfully execute as many tasks as possible in expectation, under both a budget and a deadline constraint? The execution times of the tasks are IID (independent and identically distributed) random variables that follow a common probability distribution. The amount of budget spent during the execution of a given task is proportional to the length of its execution. At each instant, the scheduler can decide whether to continue the execution (until success) or to interrupt the task and start a new one. Intuitively, the dilemma is the following: (i) continuing execution means spending more budget, and taking the risk of waiting very long until completion, but it capitalizes on the budget already spent for the task; (ii) interrupting the task wastes the budget already spent for the task, but enables starting afresh with a new, hopefully shorter task. Of course there is a big risk here, since the new task could turn out to have an even longer execution than the interrupted one.

In addition to deciding which tasks to interrupt and when, the scheduler must also decide how many processors to enroll (this is the ressource provisioning problem). There is again a trade-off here. On the one hand, enrolling many processors is mandatory when the deadline is small in front of the budget, and it allows us to make better scheduling decisions, because we can dynamically observe many events taking place in parallel2 . On the other hand, enrolling too many processors increases the risk of having many unfinished tasks when budget runs out and/or when deadline strikes.

This difficult scheduling problem naturally arises with many applications in the context of cloud computing and data mining (see Section 2 for a detailed discussion). Informally, the goal is to extract as much information as possible from some big data set, by launching analysis tasks whose execution time strongly depends upon the nature of the data sample being processed. Not all data sample must be processed, but the larger the number of data samples successfully processed, the more accurate the analysis.

The main contribution of this work are the following:

• We provide a comprehensive set of theoretical results for the problem instance with discrete distributions and no deadline. These results show the difficulty of the general scheduling problem under study, and lay the foundations for its analysis; • We design an asymptotically optimal scheduling strategy for the above problem instance (discrete distribution, no deadline) • We design an efficient heuristic, OptRatio, for the general problem. This heuristic extends the asymptotically optimal scheduling strategy for discrete distributions to continuous ones, and accounts for the deadline constraint by enrolling the adequate number of processors. The heuristic computes a threshold at which tasks should be interrupted, which we compute for a variety of standard probability distributions (exponential, uniform, beta, gamma, inverse-gamma, Weibull, absolute normal, and lognormal) • We report a set of simulation results for three widely used probability distributions (exponential, uniform, and lognormal) that demonstrate both the superiority of the OptRatio heuristic over other approaches, and its robustness in front of short deadlines. The rest of the paper is organized as follows. Section 2 surveys related work. We detail the framework and the objective in Section 3. We deal with discrete probability distributions for task execution times in Section 4; in this section, we establish several complexity results and design an asymptotically optimal scheduling policy. In Section 5, we introduce several heuristics for continuous probability distributions that decide when to interrupt tasks based upon various criteria, one of them being based on an extension of the asymptotically optimal scheduling policy for discrete distributions. We compare these heuristics in Section 5.2, assessing their performance for three widely used distributions, exponential, uniform, and lognormal. Finally, we provide concluding remarks and directions for future work in Section 6.

Related work

This work falls under the scope of cloud computing since it targets the execution of sets of independent tasks on a cloud platform under a deadline and a budget constraints. However, because we do not assume to know in advance the execution time of tasks (we are in a non-clairvoyant setting), this work is also closely related to the scheduling of bags of tasks. We survey both topics in Sections 2.1 and 2.2. Finally, in Section 2.3, we survey task models that are closely related to our model.

Cloud computing

There exists a huge literature on cloud computing, and several surveys review this collection of work [START_REF] Bokhari | A survey on cloud computing[END_REF][START_REF] Singh | Cloud resource provisioning: survey, status and future research directions[END_REF][START_REF] Singh | A survey on resource scheduling in cloud computing: Issues and challenges[END_REF]. Singh and Chana published a recent survey devoted solely to cloud ressource provisioning [START_REF] Singh | Cloud resource provisioning: survey, status and future research directions[END_REF], that is, the decision of which resources should be enrolled to perform the computations. Resource provisioning is often a separate phase from resource scheduling. Resource scheduling decides which computations should be processed by each of the enrolled resources and in which order they should be performed.

Resource provisioning and scheduling are key steps to the efficient execution of workflows on cloud platforms. The multi-objective scheduling problem that consists in meeting deadlines and either respecting a budget or minimizing the cost (or energy) has been extensively studied for deterministic workflows [START_REF] Abrishami | Deadline-constrained workflow scheduling algorithms for infrastructure as a service clouds[END_REF][START_REF] Arabnejad | Budget distribution strategies for scientific workflow scheduling in commercial clouds[END_REF][START_REF] Byun | Cost optimized provisioning of elastic resources for application workflows[END_REF][START_REF] Calheiros | Meeting deadlines of scientific workflows in public clouds with tasks replication[END_REF][START_REF] Fard | A truthful dynamic workflow scheduling mechanism for commercial multicloud environments[END_REF][START_REF] Gao | An energy and deadline aware resource provisioning, scheduling and optimization framework for cloud systems[END_REF][START_REF] Malawski | Cost-and deadline-constrained provisioning for scientific workflow ensembles in iaas clouds[END_REF][START_REF] Malawski | Algorithms for cost-and deadline-constrained provisioning for scientific workflow ensembles in iaas clouds[END_REF][START_REF] Wu | End-to-end delay minimization for scientific workflows in clouds under budget constraint[END_REF], but has received much less attention in a stochastic context. Indeed, most of the studies assume a clairvoyant setting: the resource provisioning and task scheduling mechanisms know in advance, and accurately, the execution time of all tasks. A handful of additional studies also consider that tasks may fail [START_REF] Liu | A compromised-time-cost scheduling algorithm in swindew-c for instanceintensive cost-constrained workflows on a cloud computing platform[END_REF][START_REF] Poola | Robust scheduling of scientific workflows with deadline and budget constraints in clouds[END_REF]. Among these articles, Poola et al. [START_REF] Poola | Robust scheduling of scientific workflows with deadline and budget constraints in clouds[END_REF] differ as they assume that tasks have uncertain execution times. However, they assume they know these execution times with a rather good accuracy (the standard deviation of the uncertainty is 10% of the expected execution time). They are thus dealing with uncertainties rather than a true non-clairvoyant setting. The work in [START_REF] Caniou | Budgetaware scheduling algorithms for scientific workflows with stochastic task weights on heterogeneous iaas cloud platforms[END_REF] targets stochastic tasks but is limited to taking static decisions (no task interruption).

Some works are limited to a particular type of application like MapReduce [START_REF] Hwang | Minimizing cost of virtual machines for deadline-constrained mapreduce applications in the cloud[END_REF][START_REF] Tian | Towards optimal resource provisioning for running mapreduce programs in public clouds[END_REF]. For instance, Tian and Chen [START_REF] Tian | Towards optimal resource provisioning for running mapreduce programs in public clouds[END_REF] consider MapReduce programs and can either minimize the financial cost while matching a deadline or minimize the execution time while enforcing a given budget.

Bags of tasks

A bag of tasks is an application comprising a set of independent tasks sharing some common characteristics: either all tasks have the same execution time or they are instances coming from a same distribution. Several works devoted to bag-of-tasks processing explicitly target cloud computing [START_REF] Grekioti | Scheduling bag-of-tasks applications to optimize computation time and cost[END_REF][START_REF] Oprescu | Stochastic tail-phase optimization for bag-of-tasks execution in clouds[END_REF]. Some of them consider the classical clairvoyant model [START_REF] Grekioti | Scheduling bag-of-tasks applications to optimize computation time and cost[END_REF] (while [START_REF] Casanova | Non-clairvoyant scheduling of multiple bag-of-tasks applications[END_REF] targets a non-clairvoyant setting). A group of authors including A.-M. Oprescu and Th. Kielmann have published several studies focusing on budget-constrained makespan minimization in a non clairvoyant settings [START_REF] Oprescu | Bag-of-tasks scheduling under budget constraints[END_REF][START_REF] Oprescu | Budget estimation and control for bag-of-tasks scheduling in clouds[END_REF][START_REF] Oprescu | Stochastic tail-phase optimization for bag-of-tasks execution in clouds[END_REF]. They do not assume to know the distribution of execution times but try to learn it on the fly [START_REF] Oprescu | Bag-of-tasks scheduling under budget constraints[END_REF][START_REF] Oprescu | Budget estimation and control for bag-of-tasks scheduling in clouds[END_REF]. This work differs from ours as these authors do not consider deadlines. For instance, in [START_REF] Oprescu | Stochastic tail-phase optimization for bag-of-tasks execution in clouds[END_REF], the objective is to try to complete all tasks, possibly using replication on faster machines, and, in case the proposed solution fails to achieve this goal, to complete as many tasks as possible. The implied assumption is that all tasks can be completed within the budget. We implicitly assume the opposite: there are too many tasks to complete all of them by the deadline, and therefore we attempt to complete as many as possible; we avoid replication, which would be a waste of ressources.

Vecchiola et al. [START_REF] Vecchiola | Deadline-driven provisioning of resources for scientific applications in hybrid clouds with aneka[END_REF] consider a single application comprising independent tasks with deadlines but without any budget constraints. In their model tasks are supposed to have different execution times but they only consider the average execution time of tasks rather than its probability distribution (this is left for future work). Moreover, they do not report on the amount of deadline violations; their contribution is therefore hard to assess. Mao et al. [START_REF] Mao | Cloud auto-scaling with deadline and budget constraints[END_REF] consider both deadline and budget constrained provisioning and assume they know the tasks execution times up to some small variation (the largest standard deviation of a task execution time is at most 20% of its expected execution time). Hence, this work is more related to scheduling under uncertainties than to non-clairvoyant scheduling.

Task model

Our task model assumes that some tasks may not be executed. This model is very closely related to imprecise computations [START_REF] Amirijoo | Specification and management of qos in real-time databases supporting imprecise computations[END_REF][START_REF] Chung | Scheduling periodic jobs that allow imprecise results[END_REF][START_REF] Liu | Algorithms for scheduling imprecise computations[END_REF], particularly in the context of real-time computations. In imprecise computations, it is not necessary for all tasks to be completely processed to obtain a meaningful result. Most often, tasks in imprecise computations are divided into a mandatory and an optional part: our work then perfectly corresponds to the optimization of the processing of the optional parts. Among domains where tasks may have optional parts (or some tasks may be entirely optionals), one can cite recognition and mining applications [START_REF] Meng | Best-effort parallel execution framework for recognition and mining applications[END_REF], robotic systems [START_REF] Hassan | Flexible real-time mobile robotic architecture based on behavioural models[END_REF], speech processing [START_REF] Feng | An extended imprecise computation model for time-constrained speech processing and generation[END_REF], and [START_REF] Kobayashi | Rt-frontier: a real-time operating system for practical imprecise computation[END_REF] also cites multimedia processing, planning and artificial intelligence, and database systems. Our task model also corresponds to the overload case of [START_REF] Buttazzo | Handling overload conditions in real-time systems[END_REF] where jobs can be skipped or aborted. Another, related model, is that of anytime tasks [START_REF] Jumel | Management of anytime tasks in real time applications[END_REF] where a task can be interrupted at any time, with the assumption that the longer the running, the higher the quality of its output. Such a model requires a function relating the time spent to a notion of reward. Finally, we note that the general problem related to interrupting tasks falls into the scope of optimal stopping, the theory which consists in selecting a date to take an action, in order to optimize a reward [START_REF] Ferguson | Optimal stopping and applications[END_REF].

Altogether, the present study appears to be unique because it is nonclairvoyant and assumes an overall deadline in addition to a budget constraint.

Problem definition

This section details the framework and scheduling objective.

Tasks We aim at scheduling a set of independent tasks whose execution times are IID (independent and identically distributed) random variables. The common probability distribution of the execution time is denoted as D. We consider both discrete and continuous distributions in this work. Discrete distributions are used to better understand the problem. Continuous distributions are those typically used in the literature, namely exponential, uniform, and lognormal distributions.

Platform The execution platform is composed of identical VMs, or processors. Without lost of generality, we assume unit speed and unit cost for each VM, and we scale the task execution times when we aim at changing granularity. Execution time and budget are expressed in seconds. There is an unlimited number of VMs that can be launched by the user.

Constraints and optimization objective

The user has a limited budget b and an execution deadline d. The optimization problem is to maximize the expectation of the number of tasks that can be completed until: (i) the deadline is reached; and (ii) the totality of the budget is spent. More precisely:

• The scheduler decides how many VMs to launch and which VMs to stop at each second; • Each VM executes a task as soon as it is started;

• Each VM is interrupted as soon as the deadline or the budget is exceeded, whichever comes first; • Each task can be deleted by the scheduler at any second before completion; • The execution of each task is non-preemptive, unless specified otherwise. In a non-preemptive execution, interrupted tasks cannot be relaunched, and the time/budget spent computing until interruption is completely lost. On the contrary, in a preemptive execution, a task can be interrupted temporarily (e.g., for the execution of another task, or until some event on another VM) and resumed later on.

Discrete distributions

This section provides theoretical results when execution times follow a discrete probability distribution D = {(p i , w i )} 1≤i≤k . There are k possible execution times w 1 < w 2 < • • • < w k (expressed in seconds) and a task has an execution time w i with probability p i , where k i=1 p i = 1. The w i are also called thresholds, because they represent instants at which we should take decisions: if the current task did not complete successfully, then either we continue its execution (if the remaining budget allows for it), or we interrupt the task and start a new one. Of course the discrete distribution of the thresholds is somewhat artificial: in practice, we have continuous distributions for the execution times of the tasks. With continuous distributions, at any instant, we do not know for sure that the task will continue executing until some fixed delay. On the contrary with discrete distributions, we know that the execution will continue (at least) until the next threshold. However, any continuous distribution can be approximated by a discrete distribution, and the more threshold values, the more accurate the approximation. In Section 5, we use the results obtained for discrete distributions to design efficient strategies for continuous distributions.

In this section, we further assume that there is no scheduling deadline d, or equivalently, that the deadline is equal to the budget: d = b. We reintroduce deadlines when dealing with continuous distributions in Section 5.

To help the reader apprehend the difficulty of the problem, we start with an example in Section 4.1. We discuss problem complexity without deadline in Section 4.2, providing pseudo-polynomial optimal algorithms and comparing three scenarios: sequential, sequential with preemption, and parallel. Then in Section 4.3, we focus on cases where the budget is large and design an asymptotically optimal strategy. This strategy determines the optimal threshold at which to interrupt all yet unsuccessful tasks. This result will be key to the design of a very efficient heuristic for continuous distributions in Section 5.1.

Example

We consider the following example with k = 3 thresholds: D = {(0.4, 2), (0.15, 3), (0.45, 7)}. In other words, with a probability of 40% the execution time of a task is 2 seconds, with a probability of 15% it is 3 seconds, and with a probability of 45% it is 7 seconds. We assume that we have a total budget b = 6 (and recall that there is no deadline, or equivalently d = 6). Because b = 6 < w 3 = 7, no task will ever be executed up to its third threshold. We first define and evaluate the optimal policy with a single processor. Then, we exhibit a policy for two processors that achieves a better performance.

With a single processor Let E(b) denote the optimal expected number of completed tasks when the total budget is equal to b. To define the optimal policy for a budget of 6, we first compute E(b) for the lower values of b that will appear recursively in the expression of E(6).

• E(1) = 0, because w 1 = 2.

• E(2) = p 1 × 1 + (p 2 + p 3 ) × 0 = 0.4: when the budget is equal to 2, the only thing we can do is run the task for two units of time and check whether it completed, which happens with probability p 1 . Otherwise, no task is completed.

• E(3) = (p 1 + p 2 ) × 1 + p 3 × 0 = 0.55.
Once again, we execute the task for two units of time. If it has not succeeded it would be pointless to kill it because the remaining budget is 1 and E(1) = 0 (and if it has succeeded we cannot take advantage of the remaining budget). Hence, if the task has not completed after two units of time, we continue its computation for the remaining unit of time and check whether it has succeeded.

• E(4) = max{p 1 + E(2), p 1 (1 + E(2)) + p 2 (1 + E(1)) + p 3 (0 + E(1))} = 2p 1 = 0.8.
Here, two policies can be envisioned. Either, we decide to kill the first task if it has not completed by time 2 or, if it has not completed, we let it continue up to time 3 where we kill it if it has not completed (we do not have the budget to let it run up to w 3 ). In the second case, we distinguish two sub-cases depending on the acutal task duration. The reasoning will be the same for E [START_REF] Byun | Cost optimized provisioning of elastic resources for application workflows[END_REF].

• E(6) = max{p 1 +E(4), p 1 (1+E(4))+p 2 (1+E(3))} = 3p 1 = 1.2.
Once again, two policies can be envisionned. Either, we decide to kill the first task if it has not completed by time 2 or, if it has not completed, we let it pursue up to time 3 where we kill it if it has not completed (we do not have the budget to let it run up to w 3 ).

Therefore, the optimal expectation with a single processor is to complete 1.2 tasks. The principle used to design the optimal policy will be generalized to obtain Algorithm 1.

With two processors We consider the following policy:

• we start two tasks in parallel;

• if none of them completes by time 2, we let them run up to time 3;

• otherwise, we kill at time 2 any not-yet completed task and start a new task instead.

The following table displays the expected number of completed tasks for each case of execution time of the two tasks initially started:

w 1 w 2 w 3 w 1 2 + p 1 1 + p 1 1 + p 1 w 2 1 + p 1 2 1 w 3 1 + p 1 1 0
For instance, the square at the intersection of the column w 1 and the row w 2 corresponds to the case where the task on the first processor completes in two units of time, where the task on the second processor would have needed 3 units of time. Because of our policy, this second task is killed and at time 2 and we have completed a single task. There remain 2 units of time and we start a third task, which will complete in this budget with probability p 1 . Therefore, the total expected number of completed task in this configuration is 1 + p 1 , and this configuration happens with probability p 1 p 2 . The total expected number of completed tasks is:

E = p 2 1 (2 + p 1 ) + 2p 1 (p 2 + p 3 )(1 + p 1 ) + 2p 2 2 + 2p 2 p 3 = 1.236.

RR n°9178

Therefore, this two-processor policy is more efficient than the optimal single processor policy! Even in the absence of deadline parallelism may help to achieve better performance. This example helps comprehend the difficulty of the scheduling problem under study. The reader may feel frustrated that in the above example, the performance is only improved by 3%. In fact, one of the conclusions of our work is that, in the absence of deadlines, using several processors only marginally improves performance.

Complexity results

This section is the only one in the paper where we allow preemption. We compare the performance of sequential scheduling, without or with preemption, to that of parallel scheduling, for the problem instance without deadline.

We first present optimal algorithms to solve in pseudo-polynomial time the sequential case without preemption (Algorithm 1) and with preemption (Algorithm 2), as well as an exponential algorithm to solve the parallel case (Algorithm 3). We then show (Lemma 4) that the performance of the first two algorithms bound the performance of the optimal parallel algorithm.

Algorithm 1 is a dynamic programming algorithm that computes in pseudo-polynomial time the expected number of tasks that can be completed on a single processor (without preemption) for a given budget. To ease its writing (and that of Algorithm 2 for the case with preemption) we choose to present it as a recursive algorithm without memoization. Nevertheless, it can easily be transformed into a classical dynamic programming algorithm.

Lemma 1. Algorithm 1 computes the optimal expected number of tasks that can be completed on a single processor (without preemption) for a given budget b in time O(kb).

Proof. The main property presiding to the design of Algorithms 1 and 2 is that the only times at which knowledge is gained is when the execution time of a task reaches one of its k thresholds w 1 , ..., w k . (Note that, by definition, a task can only complete at one of these thresholds.) Therefore, it can never be beneficial to stop a non-completed task when its execution time is not equal to a threshold. Therefore, without loss of generality, we focus on algorithms that kill non-completed tasks only at threshold times. Then, the only decision that such an algorithm can take is, when a task reaches a threshold without completing, whether to kill it and start a new task, or continue its execution until the next threshold, where either the task will succeed or a new decision will have to be taken. This is exactly what Algorithm 1 encodes. This algorithm contains at most kb different calls to the function SeqSched; hence, the complexity.

RR n°9178

Algorithm 1: Dynamic programming algorithm to compute the optimal expected number of tasks completed within the budget b on a single processor without preemption.

Function

-w s ≤ β then if s = k -1 then expectation ← 1 + SeqSched(β -(w s+1 -w s ), 0) else expectation ← p s+1 1-s i=1 ps (1 + SeqSched(β -(w s+1 -w s ), 0)) + 1-p s+1 1-s
Algorithm 2 is a generalization of Algorithm 1 to the case with preemption. In this context, algorithms no longer kill non-completed tasks, but can preempt them with the possibility to restart them later (or not). In the writing of this algorithm, when S is an array, the notation "S + a1 s " means "add a to the entry s of array S". Algorithm 2 has a pseudo-polynomial complexity only if the maximum number of thresholds, k, is fixed. Lemma 2. Algorithm 2 computes the optimal expected number of tasks that can be completed on a single processor with preemption for a given budget b

in time O k-1 s=1 1 + b ws .
Proof. The proof of correctness and optimality of Algorithm 2 both come directly from that of Algorithm 1. A task preempted at threshold s was executed for a time w s and, therefore, there can be at most b ws such tasks in an execution. Therefore, there are at most k-1 s=1 1 + b ws possible values for the array S (a task always completes when it reaches the threshold k). Hence, the complexity. Algorithm 3 computes for parallel machines the optimal expected number of tasks that can be completed within the budget, without premeption. We call progress of a task the total execution time so far of that task. Let ParSchedDecision(β, T 1 , T 2 ) be the expected number of tasks that can be completed with a budget β, knowing the progress of the tasks in the task sets T 1 and T 2 where 1) tasks belonging to T 1 may be interrupted, 2) tasks belonging to T 2 cannot be interrupted, and 3) if the progress of a task is equal to a threshold, that task did not complete at that threshold. Let ParSchedJump(β, T ) be the expected number of tasks that can be completed with a budget β, knowing the progress of the tasks in the task set T . Finally, let ParSchedState(β, T 1 , T 2 ) be the expected number of tasks that can be completed with a budget β, knowing the progress of the tasks in the task sets T 1 and T 2 , where 1) the progress of each task in T 1 is equal to a threshold where the task may have succeeded (we have not yet looked whether this is the case), and 2) the progress of a task in T 2 can only be equal to a threshold if the task failed to complete at that threshold. Intuitively, ParSchedDecision specifies whether to continue, stop or start tasks, while ParSchedJump advances the progress of the tasks, and ParSchedState determines which tasks succeed when a threshold is reached. Lemma 3. Algorithm 3 computes the optimal expected number of tasks that can be completed on parallel processors without preemption for a given budget

b in time O((b + k)b 3 w b k ).
Proof. The proof of correctness and optimality of Algorithm 3 also comes from that of Algorithm

-w s ≤ β then if s = k -1 then expectation ← (1 + PSeqSched(β -w s+1 , S -1 s )) else expectation ← p s+1 1-s i=1 ps (1 + PSeqSched(β -w s+1 , S -1 s )) + 1-p s+1 1-s i=1 ps (PSeqSched(β -w s+1 , S -1 s + 1 s+1 )) bestExpectation ← max{bestExpectation, expectation}
return bestExpectation Let S be an array of size k -1 with S[i] = 0 for all i return PSeqSched(b, S) decides which tasks to continue and whether new tasks must be started. There are at most q = b/w 1 concurrent running tasks. Thus, ParSchedDecision can be called with bq 2 w q k different arguments. Each call requires q calls to ParSchedJump, which can take bqw q k different arguments and takes qk operations. Finally, ParSchedState costs less than ParSchedDecision. Hence, the time complexity is b(q

+ k)q 2 w q k = O((b + k)b 3 w b k ) and the space com- plexity is bq 2 w q k = O(b 3 w b k ).

Relations between problems

Lemma 4 formally states that any algorithm for p processors (using or not preemption) can be simulated on a single processor with preemption. From this property, it immediately follows that the performance of the optimal parallel algorithm on p processors (Algorithm 3) is upper bounded by the performance of Algorithm 2 and lower bounded by the performance of Algorithm 1.

Lemma 4. Any algorithm designed to be executed on p processors with or without preemption can be simulated on a single processor with preemption with the same performance.

Proof. Consider any algorithm A designed to be executed on p processors with preemption. As already stated in the proof of Lemma 1, any meaningful algorithm only takes decisions when a task reaches a threshold. Of course, in a parallel algorithm, a task may be stopped in between two of its thresholds if, at that time, another task reaches one of its own thresholds. On the contrary, no knowledge is gained at a time when no task reaches a threshold, and it is thus suboptimal to kill or to preempt a task at such a time. Without loss of generality, we thus assume that A only kills or preempts tasks at their thresholds.

Without loss of generality, we also assume that all thresholds are integers (otherwise, we just scale the thresholds). Then, we simulate A as follows to obtain a sequential algorithm A * . Assume we have simulated A from time 0 to t. Then A * ran from time 0 to t * (where 0 ≤ t * ≤ t × p) and spent the same amount of time processing the very same tasks than A. We now simulate the work of A for the time-interval [t; t + 1]. Let P 1 , ..., P p be the p ≤ p processors, numbered arbitrarily, that process some work under A during the interval [t; t + 1]. Let T be the task processed by P i during that time under A. Then A * processes T during [t * + (i -1); t * + i]. A * can take this decision because at time t * , A * has processed the exact same work than A at time t. Therefore, at time t * + (i -1), A * has all the necessary knowledge. At time t * + p , A * has processed the exact same work than A at time t + 1 and we can conclude by an immediate induction.

Algorithm 3: Dynamic programming algorithm to compute the optimal expected number of tasks completed within the budget b in parallel.

Function

ParSchedDecision(β, T 1 , T 2 ) Data: The budget β A set T 1 : T 1 [i]
is the progress of a task that may be interrupted A set T 2 : T 2 [i] is the progress of a task that cannot be interrupted if β = 0 then return 0 if T 1 = ∅ then q ← β/w 1 /* In addition to the current progressing tasks, we can start new ones */ return max 0≤i≤q ParSchedJump(β,

T 2 ∪ {0} i ) else /* Task 1 in T 1 is either interrupted or not */ return max(ParSchedDecision(β, T 1 \ {T 1 [1]}, T 2 ), ParSchedDecision(β, T 1 \ {T 1 [1]}, T 2 ∪ {T 1 [1]})) Function ParSchedJump(β, T ) Data: The budget β A set T : T [i]
[i] + d} 1≤i≤|T |,∃l s.t.T [i]+d=w l , {T [i] + d} 1≤i≤|T |, ∃l s.t.T [i]+d=w l ) Function ParSchedState(β, T 1 , T 2 ) Data: The budget β A set T 1 : T 1 [i]
is the progress of a task that has just reached a threshold and may complete A set T 2 : T 2 [i] is the progress of a task, the progress is either not equal to a threshold or it is equal to one but the task did not complete at that threshold if T 1 = ∅ then return ParSchedDecision(β, T 2 , ∅) else

Let l be such that w l = T 1 [START_REF] Abrishami | Deadline-constrained workflow scheduling algorithms for infrastructure as a service clouds[END_REF] /* Either task 1 succeeds or not */ return

p l 1-l-1 i=1 p i (1 + ParSchedState(β, T 1 \ {T 1 [1]}, T 2 )) + (1 - p l 1-l-1 i=1 p i ) ParSchedState(β, T 1 \ {T 1 [1]}, T 2 ∪ {T 1 [1]})
return ParSchedDecision(b, ∅, ∅)

RR n°9178

Note that the proof also holds if the parallel algorithm is allowed to start using some new processors in the middle of the computation, or is allowed to restart a processor that it previously left idle.

Lemma 5. ParSched is never worse than SeqSched, and can achieve strictly better performance on some problem instances.

Proof. Given Lemma 4, ParSched is least as good as SeqSched. A sequential execution without preemption on a single processor is a special case of a parallel execution where the number of processors is one. Thus, ParSched is at least as good as SeqSched. Now, consider the instance D = {(0.4, 2), (0.15, 3), (0.45, 7)}. The optimal expected number of tasks that can be completed on a single processor with b = 6 is 1.2 without preemption, whereas it is 1.236 on multiple processors. This result was obtained through the study in Section 4.1 and can be checked using Algorithms 1 and 2 on the instance. Hence, there exist instances where ParSched is strictly better than SeqSched. Lemma 6. PSeqSched is never worse than ParSched, and can achieve strictly better performance on some problem instances.

Proof. Given Lemma 4, PSeqSched is always as least as good as ParSched. Consider the instance D = {(0.15, 1), (0.6, 2), (0.15, 3), (0.1, 5)}. The optimal expected number of tasks that can be completed on multiple processors with b = 6 is 2.4372 without preemption, whereas it is 2.4497 with preemption. This result is obtained by executing Algorithms 2 and 3 on the instance.

Asymptotic behavior

In this section, we derive an asymptotically optimal strategy when letting the budget tend to infinity. Because the scheduling strategy described below is applied independently on each processor, we can assume that p = 1 throughout this section without loss of generality. As stated earlier, recall that we assume that there is no deadline. Note that a fixed deadline would make no sense when b → +∞ and p = 1. We first describe the strategy in Section 4.3.1 and show its asymptotic optimality in Section 4.3.2. Throughout this section, we are given a discrete distribution D = {(p i , w i )} 1≤i≤k .

Optimal fixed-threshold strategy

Consider a discrete distribution D = {(p i , w i )} 1≤i≤k . For 1 ≤ i ≤ k, the i-th fixed-threshold strategy, or FTS i , interrupts every unsuccessful task at threshold w i , i.e., when the task has been executing for w i seconds without completing. There are k such strategies, one per threshold. Informally, our criterion to select the best one is to maximize the ratio R = expected number of tasks completed budget = expected number of tasks completed total time spent Indeed, this ratio measures the success rate per time unit, or equivalently, per budget unit (since we have unit execution speed). Formally, we would like to compute

R i (b) = N i (b) b (1)
where N i (b) is the expectation of the number of tasks that are successfully completed when using strategy FTS i that interrupts all unsuccessful tasks after w i seconds, and proceeds until the budget b has been spent. It turns out that we can compute the limit R i of R i (b) when the budget b tends to infinity:

Proposition 1. lim b→∞ R i (b) = R i def = i j=1 p j i j=1 p j w j + (1 -i j=1 p j )w i
Proof. Consider an execution using strategy FTS i and with budget b. We execute n tasks during at most w i seconds until there remains some budget, and maybe there exists a last task that is truncated due to budget exhaustion before it completes. Let b left be the sum of the unused budget and of the budget spent for the truncated task (if any). The execution of the n tasks lasts b -b left seconds, where 0 ≤ b left ≤ w i . For 1 ≤ j ≤ i, let n j denote the number of tasks that have completed successfully in exactly w j seconds.

Then n -i j=1 n j tasks have been unsuccessful and interrupted, and we have

b -b left = n 1 w 1 + • • • + n i w i + (n - i j=1 n j )w i .
Note that n, n j for 1 ≤ j ≤ i, and b left are random variables here. With the notation of Equation 1, we have N i (b) = E( i j=1 n j ) and we aim at showing the existence of the limit lim b→∞ N i (b) b and at computing its value.

When the budget b tends to infinity, so does n, because n ≥ b w i . We now show that n 1 n converges almost surely to the value p 1 : we write n 1 n a.s.

→ p 1 . This means that the convergence to that limit is true, except

RR n°9178
maybe over a set of measure zero. To see this, for the i-th task, let X

(1) i be the random variable whose value is 1 if the task completes in w 1 seconds, and 0 otherwise. By definition

n 1 = X (1) 1 + X (1) 2 + • • • + X (1)
n . The X (1) i are IID and have expectation E(X

(1) i ) = 1.p 1 + 0.(1 -p 1 ) = p 1 , hence X (1) 1 + X (1) 2 + • • • + X (1) n n a.s.
→ p 1 according to the strong law of large numbers [28, p. 212], hence the result. We prove similarly that n j n a.s.

→ p j for 1 ≤ j ≤ i. Then, we have:

i j=1 n j b = i j=1 n j i j=1 n j w j + (n -i j=1 n j )w i + b left = i j=1 n j n i j=1 n j n w j + (1 -i j=1 n j n )w i + b left n a.s. → R i (where R i is defined in Proposition 1), because n j n a.s. → p j for 1 ≤ j ≤ i, b left n a.s.
→ 0 (that convergence is even deterministic because b left is bounded by a constant), and the finite union of sets of measure zero has measure zero. A fortiori when taking the expectations, we have deterministic convergence:

R i (b) = E( i j=1 n j ) b → R i ,
which concludes the proof.

The optimal fixed-threshold strategy FTS opt is defined as the strategy FTS i whose ratio R i is maximal. If several strategies FTS i achieve the maximal ratio R opt , we pick the one with smallest w i (to improve success rate when the budget is limited and truncation must occur). Formally:

Definition 1. FTS opt is the strategy FTS i 0 where i 0 = min 1≤i≤k {i R i = min 1≤j≤k R j }.
To conclude this section, we work out a little example. Consider a distribution D = {(p i , w i )} 1≤i≤3 with 3 thresholds. We have

R 1 = p 1 w 1 , R 2 = p 1 + p 2 p 1 w 1 + (1 -p 1 )w 2
, and

R 3 = p 1 + p 2 + p 3 p 1 w 1 + p 2 w 2 + (1 -p 1 -p 2 )w 3 = 1 p 1 w 1 + p 2 w 2 + p 3 w 3 •
We pick the largest of these three values to derive FTS opt .

RR n°9178

Asymptotic optimality of FTS opt

A scheduling strategy makes the following decisions for each task: when a new threshold is reached, and if the task is not successful at this point, decide whether either to continue execution until the next threshold, or to interrupt the task. In the most general case, these decisions may depend upon the remaining available budget. However, when the budget is large, it makes sense to restrict to strategies where such decisions are taken independently of the remaining budget, independently to past history, and either deterministically or non-deterministically but according to some fixed probabilities.

We formally define such strategies as follows:

Definition 2. A mixed-threshold strategy MTS (q 1 , q 2 , . . . , q k-1 ), where 0 ≤ q j ≤ 1 for 1 ≤ j ≤ k -1 are fixed probabilities, makes the following decision when the execution of a task reaches threshold w i , for 1 ≤ i ≤ k -1, without success: it decides randomly to continue execution until the next threshold with probability q i , and to interrupt the task otherwise, hence with probability

1 -q i .
Of course, the fixed-threshold strategy FTS i coincides with MTS (1, . . . , 1, 0, . . . , 0) where the last 1 is in position i -1: q j = 1 for j < i et q j = 0 for j ≥ i. In this section, we prove our main result for discrete distributions: Theorem 1. FTS opt is asymptotically optimal among all mixed-threshold strategies.

Proof. Theorem 1 applies to any fixed number of processors p, but recall that we assume p = 1 w.l.o.g. in this section, because the rate per time/budget unit is computed independently for each processor. Given an arbitrary strategy MTS (q 1 , q 2 , . . . , q k-1 ), consider an execution with budget b and where we execute n tasks according to the strategy until the last seconds, i.e., until some instant b -b left , where 0 ≤ b left ≤ w k . As before, when the budget b tends to infinity, so does n, because n ≥ b w k . In the execution, let n i be the number of tasks whose execution has lasted w i seconds, let m i be the number of tasks whose execution was successful and lasted w i seconds; scaling by n, let α i = n i n and

β i = m i n for 1 ≤ i ≤ k.
As in the proof of Proposition 1, using the strong law of large numbers, we prove the following:

β 1 a.s. → β ∞ 1 = p 1 β 2 a.s. → β ∞ 2 = p 2 1-p 1 (1 -α ∞ 1 ) β 3 a.s. → β ∞ 3 = p 3 1-p 1 -p 2 (1 -α ∞ 1 -α ∞ 2 ) . . . β k-1 a.s. → β ∞ k-1 = p k-1 1-k-2 j=1 p j (1 -k-2 j=1 α ∞ j ) β k a.s. → β ∞ k = p k 1-k-1 j=1 p j (1 -k-1 j=1 α ∞ j ) RR n°9178
and

α 1 a.s. → α ∞ 1 = p 1 + (1 -p 1 )(1 -q 1 ) α 2 a.s. → α ∞ 2 = p 2 1-p 1 + (1 -p 2 1-p 1 )(1 -q 2 ) (1 -α ∞ 1 ) α 3 a.s. → α ∞ 3 = p 3 1-p 1 -p 2 + (1 - p 3 1-p 1 -p 2 )(1 -q 3 ) (1 -α ∞ 1 -α ∞ 2 ) . . . α k-1 a.s. → α ∞ k-1 = p k-1 1-k-2 j=1 p j + (1 - p k-1 1-k-2 j=1 p j ) (1 -q k-1 ) × (1 -k-2 j=1 α ∞ j ) α k a.s. → α ∞ k = 1 -k-1 j=1 α ∞ j
We also prove just as before that b n

a.s. → k j=1 α ∞ j w j
so that the success rate per budget unit does have the following limit when the budget tends to infinity:

k j=1 β j k j=1 α j w j b→∞ → R(α ∞ 1 , α ∞ 2 , . . . , α ∞ q-1 ) def = k j=1 β ∞ j k j=1 α ∞ j w j
The rest of the proof is pure algebra: we have to show that the maximum value of R(α ∞ 1 , α ∞ 2 , . . . , α ∞ q-1 ) over all values 0 ≤ α ∞ j ≤ 1 for 1 ≤ j ≤ k -1, is R opt , obtained when the strategy is some FTS i (i.e., when there exists i with α ∞ j = 1 if j < i and α ∞ j = 0 if j ≥ i). Note that below, to ease the writing, we simply use α j instead of α ∞ j 's of the above equations, and we obtain:

Problem Pb[k](D) : Maximize R(α 1 , α 2 , . . . , α k-1 ) = k i=1 p i 1-i-1 j=1 p j (1-i-1 j=1 α j ) k-1 i=1 α i w i +(1-k-1 i=1 α i )w k Subject to          p 1 ≤ α 1 ≤ 1 p 2 1-p 1 (1 -α 1 ) ≤ α 2 ≤ 1 . . . p k-1 1-k-2 j=1 p j (1 -k-2 j=1 α j ) ≤ α k-1 ≤ 1 and k i=1 p i ≤ 1 (2)
We proceed by induction on k to show that the maximum value of the optimization problem Pb[k](D) is R opt . Note that we do not assume that k i=1 p i = 1 when stating Pb[k](D) but only k i=1 p i ≤ 1. For the base case k = 1, we have a single value p 1 w 1 , which is the ratio R opt of FTS 1 .

RR n°9178

For the case k = 2, we have a single variable α 1 , where

p 1 ≤ α 1 ≤ 1,
and R(α 1 ) =

p 1 + p 2 1-p 1 (1-α 1 )
α 1 w 1 +(1-α 1 )w 2 . We note that the derivative of the function x → f (x) = ax+b cx+d has constant sign (that of ad -bc); hence, the maximum of R(α 1 ) is obtained for one of the two bounds, either α 1 = p 1 , with value

p 1 +p 2 p 1 w 1 +(1-p 1 )w 2 , or α 1 = 1, with value p 1 w 1 .
The first value is the ratio R 2 of FTS 2 , and the second value is the ratio R 1 of FTS 1 , which concludes the proof for k = 2.

Assume that we have shown the result for Pb[k ](D ) for 2 ≤ k ≤ k -1 and all distributions D' with k thresholds, and consider the problem Pb[k](D). First we fix the values of α j , 1 ≤ j ≤ k -2, and view R(α 1 , α 2 , . . . , α k-1 ) as a function of α k-1 . It is again of the form x → f (x) = ax+b cx+d ; hence, the maximum is obtained for one of the two bounds, either

α k-1 = p k-1 1-k-2 j=1 p j (1 -k-2 j=1 α j ), or α k-1 = 1 -k-2 j=1 α j . First case If α k-1 = p k-1 1-k-2 j=1 p j (1 -k-2 j=1 α j ), then, 1 -k-1 j=1 α j = (1 - p k-1 1-k-2 j=1 p j )(1-k-2 j=1 α j ). Hence, p k 1-k-1 j=1 p j (1-k-1 j=1 α j ) = p k 1-k-2 j=1 p j (1- k-2 j=1 α j ). Thus R(α 1 , α 2 , . . . , α k-2 , p k-1 1 -k-2 j=1 p j (1 - k-2 j=1 α j )) = k-1 i=1 p i 1-i-1 j=1 p j (1-i-1 j=1 α j )+ p k 1-k-1 j=1 p j (1-k-1 j=1 α j ) k-2 i=1 α i w i +(1-k-2 j=1 α j ) p k-1 w k-1 +(1-k-1 j=1 p j )w k 1-k-2 j=1 p j . Consider the distribution D = {p i , w i } 1≤i≤k-1 such that p i = p i and w i = w i for 1 ≤ i ≤ k -2, p k-1 = p k-1 + p k and w k-1 = p k-1 w k-1 +(1-k-1 j=1 p j )w k 1-k-2 j=1 p j . The distribution D' has k -1 thresholds. The optimization problem Pb[k -1](D ) writes Maximize R (α 1 , α 2 , . . . , α k-2 ) = k-1 i=1 p i 1-i-1 j=1 p j (1-i-1 j=1 α j ) k-2 i=1 α i w i +(1-k-2 i=1 α i )w k-1
.

Subject to

p i 1-i-1 j=1 p j (1 -i-1 j=1 α j ) ≤ α i ≤ 1, ∀i ∈ {1, . . . , k -2} and k-1 i=1 p i ≤ 1
Replacing p k-1 and w k-1 by their values, we see that

Pb[k](D) when α k-1 = p k-1 1-k-2 j=1 p j (1 -k-2 j=1 α j ) reduces to Pb[k -1](D ). By induc- RR n°9178
tion hypothesis, Pb[k -1](D ) achieves its maximum for some fixedthreshold strategy FTS i , where 1 ≤ i ≤ k -1. The task-to-budget ratios R i for D' are the following:

• R i = R i for 1 ≤ i ≤ k -2 • R k-1 = k-1 j=1 p j k-2 j=1 p j w j +(1-k-2 j=1 p j )w k-1 = k-2 j=1 p j +p k-1 +p k k-2 j=1 p j w j +p k-1 w k-1 +(1-k-1 j=1 p j )w k = R k .
This is the desired result and concludes the analysis for the first case.

Second case If α k-1 = 1 -k-2 j=1 α j , then R(α 1 , α 2 , . . . , α k-2 , 1 - k-2 j=1 α j ) = k-1 i=1 p i 1-i-1 j=1 p j (1 -i-1 j=1 α j ) k-2 i=1 α i w i + (1 -k-2 j=1 α j )w k-1
.

Consider the distribution D = {p i , w i } 1≤i≤k-1 such that p i = p i and

w i = w i for 1 ≤ i ≤ k -1. The distribution D' has k -1 thresholds. The optimization problem Pb[k](D) when α k-1 = 1-k-2 j=1 α j directly reduces to Pb[k -1](D ). By induction hypothesis, Pb[k -1](D )
achieves its maximum for some fixed-threshold strategy FTS i , where 1 ≤ i ≤ k -1. The task-to-budget ratios for D' are the same as for D: R i = R i for 1 ≤ i k -2. This is the desired result and concludes the analysis for the second case.

Altogether, we have solved the optimization problem Pb[k](D). This concludes the proof of the theorem.

Continuous distributions

In this section, we build upon the previous results and deal with continuous distributions. We do assume to have a fixed budget and a deadline. Thus, in contrast to Section 4, the distribution D is now continuous and has expected value µ D and variance σ 2 D . Let F (x) be its cumulative distribution function and f (x) its probability density function. The objective remains to execute as many tasks as possible given a budget b, a deadline d and a potentially unlimited number of processors.

We start by designing several heuristics in Section 5.1 and then we assess their efficiency through experiments in Section 5.2. The code and scripts used for the simulations and the data analysis are publicly available online [START_REF] Canon | Code for scheduling independent stochastic tasks under deadline and budget constraints[END_REF].

Heuristics

We present below different heuristics, among which an extension of the asymptotically optimal greedy strategy of Section 4.3 to the continuous case. In all cases, we enroll b d machines. The rationale for this choice is that this is the maximum number of machines that can work in parallel and continuously, up to the deadline.

We have three main classes of heuristics:

• MeanVariance(x) is the family of heuristics that kill a task as soon as its execution time reaches µ D + xσ D , where x is some positive or negative constant. • Quantile(x) is the family of heuristics that kill a task when its execution time reaches the x-quantile of the distribution D with 0 ≤ x ≤ 1. • OptRatio is the heuristic inspired by the asymptotically optimal strategy for discrete distributions. OptRatio interrupts all (unsuccessful) tasks at time

l = arg max l R(l)
where

R(l) = F (l) l 0 xf (x)dx + l(1 -F (l))
.

The idea behind OptRatio is that it maximizes the ratio of the probability of success (namely F (l)) to the expected amount of budget spent for a single task when the task is interrupted at time l (i.e., l 0 xf (x)dx for the cases when the task terminates sooner than l and ∞ l lf (x)dx = l(1 -F (l)) otherwise). This is a continuous extension of the approach proposed in Section 4.3, and we expect OptRatio to perform well for large budgets.

We now analyze OptRatio with some classical probability distributions defined on nonnegative values (task execution times need to be nonnegative). For the exponential distribution, which is memoryless, R(l) = λ where λ is the rate of the distribution. In this case, any l can be chosen and the tasks may be interrupted at any moment with OptRatio without modifying the performance. For the uniform distribution (between a and b), R(l) = 2 l-a -l 2 +2bl-a 2 , which takes its maximum value for l = b (R(b) = 2 a+b ). In this case, tasks should never be interrupted to maximize performance. We established these results for exponential and uniform distributions through simple algebraic manipulations.

In addition to the exponential and uniform distributions, Table 1 presents other standard distributions. For these distributions, we provide some code [START_REF] Canon | Code for scheduling independent stochastic tasks under deadline and budget constraints[END_REF] to numerically compute the optimal time l at which tasks should be interrupted. Note that there exist many relations between probability distributions. For instance, the beta distribution with both shape parameters equal to one is the same as the uniform distribution, whereas it has a U-shape with

RR n°9178

Table 1: Probability distributions with their Probability Distribution Function (PDF), parameters and density graph. Supports are [0, ∞) for all distributions except for Uniform, where it is [a, b] and Beta, where it is [0 Figure 1: Efficiency (ratio R of number of tasks successfully executed per budget unit) for different probability distributions. Some distributions have an optimal finite cutting threshold depicted with a vertical red line.

, 1]. Note that B(α, β) = Γ(α)Γ(β) Γ(α+β) . Name PDF Parameters Density Uniform 1 b-a -∞ < a < b < ∞ Exponential λe -λx rate λ > 0 Half-normal √ 2 θ √ π e -x 2
both equal to 0.5, and a bell-shape with both equal to 2. Also, the exponential distribution is a special case of the gamma and Weibull distributions when their shape parameter is one.

Figure 1 shows how R(l) varies as a function of the cutting threshold l, for the probability distributions shown in Table 1. Recall that OptRatio will select the threshold l for which R(l) is maximum. For instance, this threshold is l = 1 for the uniform distribution, meaning that we should never interrupt any task. The threshold can be any value of l for the exponential distribution, and this is due to the memory less property: we can interrupt a task at any moment, without any expected consequence. The threshold is l = ∞ for the half-normal distribution, meaning again that we should never interrupt any task, just as for uniform distributions. Note that the expected value of all distributions is not the same overall, because we use standard parameters in Figure 1, hence ratio values are not comparable across distributions.

We remark that the lognormal distribution, which presents a fast increase followed by a slow decrease with an heavy tail, exhibits an optimal cutting threshold during the execution of a task: on Figure 1, we see that the optimal threshold is l ≈ 1.73 (we computed this value numerically) for the distribution Lognormal(0, 1). We make a similar observation for the inverse-gamma distributions, where the optimal threshold is l ≈ 0.7 for Inv-Gamma(1.5, 0.5) and l ≈ 2.32 for Inv-Gamma [START_REF] Arabnejad | Budget distribution strategies for scientific workflow scheduling in commercial clouds[END_REF][START_REF] Amirijoo | Specification and management of qos in real-time databases supporting imprecise computations[END_REF]. These lognormal and inverse-gamma distributions share the following properties: the density is close to zero for small costs and has a steep increase. On the contrary, the bell-shape beta distribution Beta(2, 2) has a small density for small costs but does not have a steep increase, and tasks should never be interrupted (in other words, the optimal cutting threshold is l = 1 for Beta(2, 2)). Finally, we observe that three distributions are the most efficient when the cutting threshold tends to zero (Beta(0.5, 0.5), Gamma(0.5, 2) and Weibull(0.5, 1/Γ(3))). We point out that it is unlikely that such distributions would model actual execution times in practice.

Experiments

The following experiments make use of three standard distributions: exponential, uniform, and lognormal. The first two distributions are very simple and easy to use, while the latter has been advocated to model file sizes [START_REF] Feitelson | Workload modeling for computer systems performance evaluation[END_REF], and we assume that task costs could naturally obey this distribution too. Moreover, the lognormal distribution is positive, it has a tail that extends to infinity and the logarithm of the data values are normally distributed. Also, this distribution leads to a non-trivial cutting threshold, contrarily to exponential (interrupt anywhere) or uniform (never interrupt), thereby allowing for a complete assessment of our approach.

Figure 2 shows the number of successfully executed tasks for each heuristic with three distributions (lognormal, uniform, exponential) of same expected value µ = 1 and standard deviation σ = 3, with a budget and deadline b = d = 100. Note that to ensure a given expected value and standard deviation for the lognormal distribution, we set its parameters as follows: α = log(µ) -log(σ 2 /µ 2 + 1)/2 and β = log(σ 2 /µ 2 + 1). Note also that using a standard deviation σ = 3 corresponds to a high level of heterogeneity. To see this intuitively, take a discrete distribution with 11 equally probable costs, 10 of value 0.1 and 1 of value 10: its expected value is µ = 1 while its standard deviation is σ ≈ 2.85. Finally, we note that Figure 2 confirms that tasks with exponentially distributed costs can be interrupted at any time and that tasks with uniformly distributed costs should never be interrupted.

Next, we focus on the lognormal distribution. First, in Figure 3, we assess the impact of three important parameters: the standard deviation, the budget and the deadline, respectively. The expected value is always µ = 1. By default, the standard deviation is σ = 3, and the budget and deadline are set to 100 (b = d = 100), which means that a single machine is enrolled. When we vary the standard deviation (first row in Figure 3), we keep b = d = 100. When we vary the budget (second row of in Figure 3), we maintain the equality b = d. When we vary the deadline (third row of in Figure 3), we keep b = 100, hence more VMs are enrolled (10 VMs when d = 10 and 100 VMs when d = 1). Each heuristic is run 100,000 times for each scenario. The error bars represent an interval from the mean of two standard deviations of the number of successes. For a normal distribution, this means that more than 95% of the values are in this interval. Note that the subfigures with σ = 3, b = 100 and d = 100 in Figure 3 are all the same as the subfigure with the lognormal distribution in Figure 2.

On Figure 3, we see that the higher the standard deviation, the larger the gain of every approach. With a low standard deviation, all approaches perform similarly. Increasing the budget tends to decrease the variability when running several times the same approach (the error bars are narrower with large budgets, which makes the approaches more predictable). This is an consequence of the law of large numbers. However, the expected efficiency (around 2.5 tasks per unit of time) remains similar even for a low budget of 30. Finally, decreasing significantly the deadline prevents some strategies from letting tasks run a long time. Long running tasks are then forced to be interrupted early, which is similar to the behavior of the more efficient approaches.

In all tested situations, the OptRatio algorithm with the optimal threshold achieved the best results.

Finally, Figure 4 depicts the efficiency of OptRatio with small deadlines. Even though our approach extends a strategy that is asymptotically optimal when both the budget and the deadline are large, it does perform well with small deadlines, as long as d is not lower than the cutting thresh- old. In the settings of Figure 4, where the average execution time of a task is equal to 1, this means that as soon as the deadline is equal to 0.1 Op-tRatio achieves its asymptotic performance! (The reader can compare the performance of OptRatio for deadlines of 200 and 0.1 on Figures 2 and4.) Finally note that on Figure 4, b = 100 and that, therefore, OptRatio uses 1,000 processors. This confirms that neither the budget, nor the deadline need to be large for OptRatio to reach its best efficiency, and that this heuristic is extremely robust.

Conclusion

This paper deals with scheduling strategies to successfully execute the maximum number of a bag of stochastic tasks on VMs (Virtual Machines) with a finite budget and under a deadline constraint. We first focused on the problem instance with discrete probability distributions and no deadline. We proposed three optimal dynamic programming algorithms for different scenarios, depending upon whether tasks may be preempted or not, and whether multiple VMs may be enrolled or only a single one. We also introduced an asymptotically optimal method that computes a cutting threshold that is independent of the remaining budget. Then we extended this approach to the continuous case and with deadline. We designed OptRatio, an efficient heuristic which we validated through simulations with classical distributions such as exponential, uniform, and lognormal. Tests with several values of the deadline, leading to enroll different numbers of VMs, also confirm the relevance and robustness of our proposition. Future work will be dedicated to considering heterogeneous tasks (still with stochastic costs), as well as heterogeneous VMs. Typically, cloud providers provide a few different categories of VM with different computer power and nominal cost, and it would be interesting (albeit challenging) to extend our study to such a framework. Another interesting direction would be to take into account start-up costs when launching a VM, thereby reducing the amount of parallelism, because fewer VMs will likely be deployed.

α 1 Γ

 1 ∈ (-∞, ∞) and β > 0 Betax α-1 (1-x) β-1 B(α,β)shape α > 0 and shape β > 0Gamma (k)θ k x k-1 e -x θ shape k > 0 and scale θ > 0 Weibull k θ k x k-1 e -( x θ ) k shape k > 0 and scale θ > 0 Inverse-gamma θ k Γ(k) x -k-1 e -θ xshape k > 0 and scale θ > 0

  Q) MeanVariance (MV) OptRatio(OR)

Figure 2 :

 2 Figure 2: Number of successfully executed tasks for each heuristic with three distributions (Lognormal, Uniform, Exponential) of same expected value µ = 1 and standard deviation σ = 3, with a budget and deadline b = d = 100 (which means that a single machine is enrolled). Each heuristic is run 100,000 times for each scenario. The error bars are computed with the mean plus/minus two standard deviations of the number of successes.The lognormal distribution has parameters α ≈ -1.15 and β ≈ 1.52 to have an expected value µ = 1 and a standard deviation σ = 3, and the optimal cutting threshold for OptRatio is l ≈ 0.1). The exponential distribution has shape λ = 1 and the cutting threshold is arbitrarily set to l = 2. The uniform distribution has parameters a = 0 and b = 2, and the cutting threshold is l = 2.

  Q) MeanVariance (MV) OptRatio(OR)

Figure 3 :Figure 4 :

 34 Figure 3: Number of successfully executed tasks for each heuristic, with lognormal costs and expected value µ = 1. Unless otherwise specified, the standard deviation is σ = 3, and the budget and deadline are b = d = 100. Each heuristic is run 100,000 times for each scenario. The error bars are computed with the mean plus/minus two standard deviations of the number of successes. The lognormal distribution has parameters α ≈ -1.15 and β ≈ 1.52 by default (to have µ = 1 and σ = 3) (the cutting threshold for OptRatio is l ≈ 0.1). They are α ≈ -0.35 and β ≈ 0.83 when σ = 1 (l ≈ 2.1) and α ≈ -0.8 and β ≈ 1.27 when σ = 1 (l ≈ 0.34).

  Dynamic programming algorithm to compute the optimal expected number of tasks completed within the budget b on a single processor with preemption.

	Algorithm 2:
	RR n°9178

1. Any time a threshold is reached, ParSchedState is called and determines which tasks succeed or not. Then, ParSchedDecision Function PSeqSched(β, S) Data: The budget β An array S of size k: S[i] is the number of tasks preempted at state i bestExpectation ← 0 /* If the budget allows it, we can attempt to start a new task */ if β ≥ w 1 then bestExpectation ← p 1 (1 + PSeqSched(β -w 1 , S)) + (1p 1 )(PSeqSched(β -w 1 , S + 1 1 )) for s = 1 to k -1 do /* If there was a task preempted at threshold s and if the budget allows it, we can try to restart one such task */ if S[s] > 1 and w s+1

Throughout the text, we use both terms VM and processor indifferently.

See the examples of Section 4.1 for an illustration. RR n°9178

RR n°9178

i=1 ps (SeqSched(β -(w s+1 -w s ), s + 1)) bestExpectation ← max{bestExpectation, expectation} return bestExpectation return SeqSched(b, 0) RR n°9178

Publisher Inria Domaine de Voluceau -Rocquencourt BP 105 -78153 Le Chesnay Cedex inria.fr ISSN 0249-6399