A Note on EDF Schedulingfor Real-Time Energy Harvesting Systems

Energy harvesting is the capture of ambient energy, its conversion into a usable form, and its storage for immediate or future use. Interest in energy harvesting has increased over the last decade because of its environmental friendliness and its ability to power devices without electric wires. This term has been frequently applied in recent years in the context of small autonomous embedded devices such as wireless sensor nodes. In this paper, we address the scheduling problem for a single processor device that executes preemptable time critical tasks. Each one has a certain energy requirement and arrives at an unpredictable time. We ask the question whether the traditional task scheduling algorithm earliest deadline first (EDF) is convenient for energy harvesting environments. The paper shows that EDF has a zero competitive factor but nevertheless is optimal for online non-idling settings.


INTRODUCTION
ENERGY harvesting is a technology that allows to capture otherwise unused ambient energy and convert into electrical energy that can be used immediately or later thanks to a storage unit [20]. This approach extends the life of batteries (or eliminates them entirely) and decreases maintenance. A variety of techniques are available for energy harvesting, including solar and wind powers, ocean waves, piezoelectricity, thermoelectricity, and physical motions. Energy harvesting is a perfect match for wireless devices and wireless sensor networks that otherwise rely on battery power. Some of the main applications include operating as power source for human wearable electronics, supplement battery storage devices, etc.
Another key application that is being investigated in great detail is miniature self-powered sensors in medical implants for health monitoring and embedded sensors in structures such as bridges, buildings for remote condition monitoring. Levels of harvested energy may vary significantly from application to application. Therefore spare usage of available energy is of utmost importance.
The system we target consists of three components (see Fig. 1): a single processing unit with unique voltage and frequency, an energy harvester and a rechargeable energy storage.
We address the problem of scheduling that arises in an energy harvesting system with real-time constraints where tasks have to meet deadlines. Our task processing model exhibits three major assumptions. First, as commonly assumed in the real-time energy harvesting literature [7], [18], the instantaneous power consumption of any task is no less that the incoming power from the harvesting unit. Indoor lighting control systems are one of the systems having such characteristics. Secondly, the energy consumed by a task is not necessarily proportional to its execution time. Thirdly, unlike previous work in this area [18], our approach to task scheduling is preemptive non-idling. So, the question we ask, can be formulated as follows: Is Earliest Deadline First a convenient scheduler for energy harvesting systems under non-idling execution settings?
The rest of the paper is organized as follows: We first present related work. The energy harvesting system model and some assumptions are explained in Section 3. We give background material in Section 4. Optimality analysis of EDF is described in Section 5. Section 6 concludes and describes future work.

RELATED WORK
Most of the work in the area of energy-aware real-time scheduling focuses on either minimizing the energy consumption or maximizing the system lifetime under energy constraints. Research activities, such as dynamic power management (DPM) [13], [17], [19] or dynamic voltage and frequency scaling (DVFS) [14], [23], focus on designing adaptive scheduling and voltage/frequency selection algorithms in order to effectively reduce the power consumption of a device, the limited energy in the battery being exhausted eventually. However, in many applications such as embedded sensors, it is impractical or costly to recharge or replace batteries.
Ideally, an embedded system should be designed to operate perpetually. This objective cannot be achieved when the battery is the only energy source, except by using energy harvesting. The first prototypes that demonstrate the feasibility of this technology are Heliomote [22] and Promotheus [10]. Many technical challenges must be solved to achieve energy autonomy and to make the embedded system work effectively. The energy source is unstable and changing from time to time. This requires to model the harvested power as a time-varying variable. Due to these intrinsic characteristics, energy harvesting systems are subject to new issues not encountered in conventional battery-powered systems.
Real-time scheduling in energy harvesting systems aims to find a schedule in which all the tasks meet their deadlines while consuming only as much energy as harvested. We then say that the system operates in an energy neutral mode [11] (i.e., the system never runs out of energy). The problem of scheduling real-time energy harvesting systems has gained little attention and has been addressed only in the last decade. The proposed scheduling techniques for such systems adapt the performance and power consumption of the application unit at runtime in response to the temporal variation in harvested energy.
Allavena et al. [1] propose an off-line scheduler restricted to a set of independent periodic tasks in a frame. Moreover the power scavenged by the energy source is constant and all tasks consume energy at a constant rate.
Later, the research presented in [18] is a variation of the famous earliest deadline first (EDF) scheduler [12], called lazy scheduling algorithm (LSA). The authors use a similar model of the power source as we do hereafter. However, they assume for every task that its total energy consumption is directly connected to its execution time through the constant power of the processing device. But in a real application, instantaneous power consumed by tasks may vary along time depending on circuitry and devices required by the tasks. LSA was compared with EDF in terms of both schedulability and required capacity of the storage unit. The theory and the simulation study show that LSA outperforms EDF up to 45 percent in terms of achievable capacity savings.
More recently, we proposed another variation of EDF called EDeg [7] that relies on the EDS (Earliest Deadline as Soon as possible) rule initially described in [5].
More research works on real-time scheduling for energy harvesting embedded systems can be found in [15], [16].

System Model
The Energy Harvesting model (referred to hereafter as EH) comprises a system composed of a set of tasks, an energy storage unit and an energy source as described above.

Task Model
We consider a uniprocessor system that consumes negligible energy in idle state. Tasks enter that system and require to execute before deadlines. A four-tuple ðr i ; C i ; E i ; d i Þ is associated with a task t i and gives its release time, worst case execution time (WCET), worst case energy consumption (WCEC) and (absolute) deadline, respectively. We assume that E i is not necessarily proportional to C i [21].

Energy Model
The energy source is characterized by an instantaneous charging rate P r ðtÞ that incorporates all losses. We define E p ðtÞ as the energy produced by such a power source from time 0 to time t. We assume that the energy production times can overlap with the consumption times and the instantaneous power consumed by any task is no less than the instantaneous power drawn from the source. The energy produced on the time interval ½t 1 ; t 2 Þ is denoted E p ðt 1 ; t 2 Þ while the energy consumed by tasks on the same interval is denoted E c ðt 1 ; t 2 Þ.
The energy produced by the source is not considered as controllable and not necessarily predictable. Our system uses an ideal energy storage unit that has a nominal capacity, namely E. Let define EðtÞ as the energy level of the system at time t. The stored energy may be used at any time later and does not leak any energy over time. Energy is wasted if the storage is fully charged at time t (i.e., EðtÞ ¼ E) and we continue to charge it. In contrast, no task can be executed and the application definitively stops if the storage is fully discharged at time t (i.e., EðtÞ ¼ 0). We assume that the energy level of the storage is never increasing every time a task executes.
A task t i can miss its deadline if one of the two following cases occurs: time insufficiency: when the task reaches its deadline at time t, its execution is incomplete since the time required to process the task within its deadline is not sufficient. There is available energy in the storage when the deadline violation occurs (i.e., EðtÞ > 0). energy insufficiency: when the task reaches its deadline at time t, its execution is incomplete since the energy required to process the task within its deadline is not available. The energy in the storage is exhausted when the deadline violation occurs (i.e., EðtÞ ¼ 0).

Terminology
We also include definitions of several well-known quantities and terms here for completeness. Definition 3.4. A scheduling algorithm is idling if it is allowed to keep the processor idle even when there are pending tasks. Otherwise, it is non-idling.

Definition 3.5.
A scheduling algorithm is clairvoyant if it has an a priori knowledge of all the tasks arriving in the system and profile of the energy produced by the source. Otherwise, it is non-clairvoyant.
Definition 3.6. The "value" of a task defines its contribution to the overall system performance. The value obtained is proportional to the computation time of the task. The system obtains the value of a given task if the task completes by its deadline. Otherwise, the system obtains no value for the task [2], [4].
Definition 3.7. The "goodness" of an algorithm is measured by its competitive factor: an on-line algorithm of competitive factor r (0 < r < 1) is guaranteed to achieve a cumulative value at least r times the cumulative value achievable by any clairvoyant algorithm on any sequence of tasks [3].
Definition 3.8. An on-line scheduling algorithm is competitive if it has a constant competitive factor strictly greater than zero. Otherwise, it is non-competitive.

BACKGROUND MATERIAL
The EDF algorithm is the most popular approach for scheduling independent time critical tasks preemptively when there is no energy limitation and no processing overload [8], [12]. EDF is an on-line algorithm which schedules the ready task (i.e., the task that may be processed and is not yet completed) whose deadline is closest to the current time t. On-line scheduling is the only option in a system whose future workload is unpredictable. It can accommodate dynamic variations in user demands and resource availability. EDF is optimal when used to schedule tasks on a processor as long as preemption is allowed and tasks do not contend for resources. If any algorithm can produce a valid schedule, then so can EDF. However, when a processing overload may occur (i.e., the processing required to handle all the tasks exceeds the system capacity), EDF is no longer optimal. In that situation, if we consider the value of a task as proportional to its execution time, Baruah et al. proved that no on-line scheduler-including EDF-can guarantee a competitive factor greater than 0.25 for tasks with uniform density settings [3].

OPTIMALITY ANALYSIS FOR EDF SCHEDULING ALGORITHM
A task set t is timely-feasible if there exists a valid schedule for t (i.e., all the deadlines of t are met) without considering energy constraints. E tot denotes the total energy needed to complete all the tasks in t. Theorem 5.1 simply states that EDF achieves the best possible performance if the energy storage unit size is sufficient to store the total energy required by all the occurring tasks.
Theorem 5.1. If E tot E, then EDF produces a valid schedule for any timely-feasible task set.
Proof. The storage is fully charged at time zero, i.e., Eð0Þ ¼ E. Sufficient energy is available at time zero for executing all the tasks even if P r ðtÞ ¼ 0 for any time t. So the proof directly follows from the optimality of EDF with no energy considerations [8]. t u It is natural to ask whether the EDF algorithm remains optimal if tasks exhibit energy requirements in energy harvesting settings. Let us restrict the study to the case of non-idling scheduling for proving that EDF is still optimal.
Theorem 5.2. EDF is optimal in the class of non-idling online algorithms for the EH model. Proof. We prove that any valid schedule GðXÞ produced by a nonidling online algorithm X can be transformed into a valid EDF schedule. Let us consider the first place in that schedule where it violates the EDF rule. We consequently find the first interval I 1 in which t i executes. Let t k be the task such that d i ! d k which executes in I 2 according to X and should execute in I 1 according to EDF. The question is: Can we swap t i and t k ?
To prove the theorem, there are two cases to consider. First case: We assume that tasks consume processing time only (i.e. E i ¼ 0, E k ¼ 0). In this case, direct the swap is always possible (as proven by Dertouzos in [8]), either I 1 being shorter than I 2 (Fig. 2a) or I 1 being longer than I 2 (Fig. 2b).
Second case: We assume that tasks consume energy from the energy storage (i.e., E i > 0, E k > 0). We consider that interval I 1 starts at time s 1 . Let E i (respectively E k ) be the energy consumption of t i within I 1 (respectively t k within I 2 ). The processor is continuously busy from s 1 to f 2 and there cannot exist an idle time since X is a non-idling algorithm. Without loss of generality, we may assume that I 1 is as long as I 2 . By hypothesis, the instantaneous consumption power of every task is greater than or equal to the instantaneous power provided by the source. In other terms, the energy storage cannot recharge as the processor is busy executing any task. The difference between the total energy that will be consumed and the total energy that will be produced within ½s 1 ; f 2 is then available initially in the energy storage. In other terms, Eðs 1 Þ ! E c ðs 1 ; f 2 Þ À E p ðs 1 ; f 2 Þ where E c ðs 1 ; f 2 Þ (respectively E p ðs 1 ; f 2 Þ) is the total energy consumed (respectively the total energy produced) between s 1 and f 2 . The swap is consequently always possible either E i being lower than E k (Fig. 3a) or E i being greater than E k (Fig. 3b). Note that for simplicity reasons, E p ðt 1 ; t 2 Þ ¼ 0 and E c ðt 1 ; t 2 Þ ¼ E i C i Ã ðt 2 À t 1 Þ for all 0 t 1 t 2 on the examples depicted in Fig. 3. The result of that swap is that t i and t k are now scheduled with the EDF rule. We repeat this transformation for all pairs of tasks that are not scheduled according to EDF. As every valid schedule produced by a non-idling algorithm can be transformed into an EDF schedule which is valid too, this proves the optimality of EDF in the class of non-idling algorithms.
t u From what precedes, the optimal schedule clearly depends on the knowledge of future arrivals and can be obtained by a clairvoyant scheduling algorithm only. The reason is that once a task has executed, it has consumed more energy than produced which impacts the energy availability for future occurring tasks. Now, let us undertake a competitive analysis of EDF. Theorem 5.3. EDF has a zero competitive factor for the EH model.
Proof. Directly follows from [9, Lemma 1]. The following model is considered: the system has a fixed and limited energy budget. The energy requirement of every task is proportional to its execution time. The value of the task is added to the overall performance metric if and only if it meets its deadline. As EDF is noncompetitive with this more restrictive model, EDF is necessarily non-competitive for the EH model where the energy budget is also initially limited. t u By Theorem 5.3, we show that if an online competitive algorithm exists, it is necessarily non-idling.

DISCUSSION AND CONCLUSIONS
We studied the case of a uniprocessor energy harvesting system that has to schedule a set of real-time tasks. Both time and energy constraints of the tasks are not known in advance. In a previous work, Moser et al. [18] introduced the LSA algorithm which is an  online idling algorithm and proved it to be optimal under restrictive hypotheses: (i) WCEC and WCET of every task are proportional, (ii) the energy drained from the environment in the future is known and (iii) the computing system must be able to continuously adapt its consumption power with respect to the power incoming from the source. The authors relaxed the (i) hypothesis in a more recent study by introducing the EDeg clairvoyant scheduling algorithm whose performance is demonstrated in a simulative study [7]. Nevertheless, this work leaves the proof of its optimality open.
Energy-aware scheduling algorithms exhibit the following drawbacks: They are energy-clairvoyant, i.e., the future harvested energy is assumed to be known precisely. Moreover, their performance in terms of optimality depends on the accuracy of the prediction. They rely on the capability to estimate accurately the remaining energy in the energy reservoir (e.g., battery or supercapacitor). Practical considerations about general implementation aspects and more accurate models for the energy reservoirs can be found in [6]. They make the assumption that, at every time, the incoming power from the environment never exceeds the instantaneous consumption power of the running task. In this paper, we investigated the optimality analysis of the most famous real-time scheduling policy-namely EDF-in the context of energy harvesting with no clairvoyance at all relative to both task arrival times and energy production. We proved that EDF is still optimal for online non-idling settings. Moreover, from a practical point of view, this greedy scheduler has not any specific technological requirement (e.g., additional circuitry for both the estimation and the prediction of the harvested energy). Consequently, EDF clearly remains a class one priority-driven scheduler for energy harvesting applications looking at its simplicity.