Mr Mr Hakan Daniel Aydin

Mrs Maryline Mossé

Mr Chetto

Pautet Laurent

Mrs Yasmina Abdeddaïm

Mr Rob Davis

Keywords: Scheduling 1, 4, Scheduling Algorithms 1, 5, Scheduling Analysis

In this thesis, we are interested in the real-time fixed-priority scheduling problem of energy-harvesting systems.

An energy-harvesting system is a system that can collect the energy from the environment in order to store it in an energy storage device and then to use it to supply an electronic device. This technology is more and more used in small embedded systems that are required to run autonomously for a very long lifespan. Wireless sensor networks and medical implants are typical applications of this technology.

Moreover, most of devices that work with energy-harvesting have to execute many recurrent tasks within a limited time. Thus, these energy-harvesting devices are subject to real-time constraints where the correctness of the system depends not only on the correctness of the results but also on the time in which they are delivered.

This thesis addresses the real-time scheduling layer of this kind of systems. More specifically, it focuses on a specific family of real-time scheduling: the preemptive fixed-task-priority scheduling for monoprocessor platforms. In this approach, each task of the system is assigned a static priority. Then, at any moment, the scheduler executes first the active task with the highest priority.

The problematic of such a scheduling approach for energy-harvesting systems is to find efficient scheduling algorithms and their associated schedulability analysis. The responsibility of a scheduling algorithm is to produce a valid and perpetual schedule where all the tasks respect their timing and energy constraints. In other words, all the deadlines must be met and the system must never run out of energy. Whereas a schedulability analysis provides schedulability tests and conditions that guarantee the schedulability or the unschedulability of a given task set in a given energy configuration. Furthermore, to guarantee such schedulability, the energy storage unit capacity must be sufficient to avoid energy wasting. Then, for each scheduling algorithm and schedulability analysis, we must specify the minimum battery capacity that keeps the schedulability of a given task set.

This dissertation starts with a brief state of the art of the existing real-time scheduling theory for energy-harvesting systems including energy-aware scheduling solutions that add more idle periods to replenish energy, and dynamic processor voltage and frequency scaling approaches that reduce the consumption rate of the processor. In this part, we show that in the case of energy-aware scheduling approach, the fixed-task-priority scheduling for energy-harvesting systems was not deeply studied.

The first contribution of this thesis is the proposition of the P F P ASAP scheduling algorithm. It is an adaptation of the classical fixed-task-priority scheduling to the energy-harvesting context. It consists of executing tasks as soon as possible whenever the energy is sufficient to execute at least one time unit and replenishes otherwise. The 14

Résumé

Dans cette thèse nous nous intéressons à la problématique de l'ordonnancement temps réel à priorité fixe des systèmes embarqués récupérant leur énergie de l'environnement.

Ces derniers collectent l'énergie ambiante de l'environnement et la stockent dans un réservoir d'énergie afin d'alimenter un appareil électronique. Cette technologie est de plus en plus utilisée dans les petits systèmes embarqués qui nécessitent une longue autonomie et une longue durée de vie. Les réseaux de capteurs et les implants médicaux sont des applications typiques de cette technologie.

De surcroît, dans la majorité des cas, les systèmes qui opèrent avec cette technologie doivent exécuter des tâches récurrentes dans un temps imparti. Ainsi, ces systèmes sont soumis à des contraintes dites temps réel où le respect des contraintes temporelles est aussi important que l'exactitude des résultats.

Cette thèse traite l'ordonnancement temps réel de ce genre de systèmes. Plus précisément, Nous nous intéressons à une famille spécifique de l'ordonnancement temps réel : l'ordonnancement préemptif à priorité fixe sur des plateformes monoprocesseur. Dans cette approche, chaque tâche se voit attribuer une priorité statique qui ne change pas tout au long de son cycle de vie. Ainsi, l'ordonnanceur exécute à tout moment la plus prioritaire des tâches actives.

La problématique d'ordonnancement sur les systèmes qui récupèrent l'énergie de l'environnement est de trouver des algorithmes performants ainsi que les outils d'analyses d'ordonnançabilité associés. L'algorithme d'ordonnancement est responsable de produire un ordonnancement perpétuel valide où toutes les contraintes temporelles et énergétiques sont respectées. En d'autres termes, les échéances de toutes les tâches doivent être respectées et le niveau du réservoir d'énergie ne doit jamais descendre en dessous de son seuil minimal. Une analyse d'ordonnançabilité fournit des tests et des conditions qui garantissent l'ordonnaçabilité d'un système de tâches donné dans une configuration d'énergie donnée. De plus, pour garantir une telle ordonnançabilité, la capacité du réservoir d'énergie doit être suffisante pour satisfaire sans perte la demande d'énergie des tâches. Pour cela, on doit pouvoir calculer pour chaque algorithme et pour chaque condition d'ordonnançabilité la taille minimale du réservoir associée.

Cette thèse commence par un bref état de l'art de la théorie existante de l'ordonnancement temps réel des systèmes décrits plus haut. Cela inclut deux approches : la première consiste à introduire des temps d'inactivité supplémentaires afin de recharger, la deuxième consiste à baisser la fréquence et/ou la tension du processeur afin de réduire le taux de consommation. Dans cette partie, Nous montrons que dans le cas de la première approche, l'ordonnancement à priorité fixe n'a pas été suffisamment étudié. Les résultats de cette thèse contribuent à apporter des éléments de réponse aux problématiques de cette famille d'ordonnancement.

Résumé

La première contribution de cette thèse est la proposition de l'algorithme d'ordonnancement P F P ASAP . Il s'agit d'une adaptation de l'ordonnancement préemptif classique à priorité fixe au modèle des systèmes qui récupèrent l'énergie de l'environnement. Cela consiste à exécuter les tâches au plus tôt dès que l'énergie est suffisante pour exécuter au moins une unité de temps et laisser le réservoir se recharger le cas échéant. La particularité ici est que les périodes de rechargement sont aussi longues que nécessaire pour pouvoir exécuter une seule unité de temps. Cet ordonnancement peut aussi être vu comme l'équivalent "énergie" de l'ordonnancement non-oisif à priorité fixe classique où le processeur ne peut pas être en mode inactif alors qu'il reste encore des tâches en attente et que l'énergie est suffisante pour exécuter. On prouve à travers cette dissertation que P F P ASAP est optimal dans la classe d'algorithmes à priorité fixe mais uniquement dans le cas des systèmes dits non-concrets où la date de la première activation des tâches et le niveau initial du réservoir d'énergie ne sont connus qu'au moment de l'exécution, et quand toutes les tâches consomment plus d'énergie pendant leur exécution que le système n'en collecte. Une condition d'ordonnançabilité nécessaire et suffisante pour ce type de systèmes est également proposée. Il s'agit d'une analyse de temps de réponse des tâches qui calcule le plus long temps de réponse possible de chaque tâche qui se produit dans le pire scénario (l'instant critique). Nous prouvons aussi que ce scénario correspond à l'activation synchrone de toutes les tâches quand le niveau du réservoir d'énergie est au plus bas.

Malheureusement, si l'on relâche l'hypothèse sur le profil de consommation d'énergie des tâches, en considérant des tâches qui consomment plus que le rechargement et d'autres qui consomment moins, l'algorithme P F P ASAP n'est plus optimal et l'activation synchrone des tâches n'est plus le pire scénario ce qui rend la condition d'ordonnançabilité précédemment citée seulement nécessaire. Pour contourner cet obstacle, nous proposons dans une seconde contribution de borner le pire temps de réponse des tâches afin de construire des conditions suffisantes au lieu des tests exacts. Nous proposons deux bornes supérieures construites sur des scénarios virtuels qui maximisent le nombre des interférences et le temps de rechargement nécessaire.

Concernant la possibilité de trouver un algorithme optimal, nous explorons à travers ce manuscrit différentes idées et approches d'ordonnancement dans le but de construire un algorithme optimal pour le modèle général des systèmes à priorité fixe en considérant tous les types de systèmes de tâches et tous les profils de consommation d'énergie. Nous montrons avec quelques contre exemples la difficulté de trouver un tel algorithme et aussi que la plupart des idées intuitives n'aboutissent pas à des algorithmes optimaux. Par la suite, nous discutons la possibilité de trouver un tel algorithme.

Dans le but de mieux comprendre la problématique d'ordonnancement à priorité fixe des systèmes collecteurs d'énergie, nous proposons d'explorer les solutions proposées pour des problématiques d'ordonnancement similaires, en particulier celles où le retardement des exécutions est parfois nécessaire pour respecter certaines contraintes. L'ordonnancement avec contraintes thermiques est l'une de ces problématiques. Cette dernière consiste à exécuter les tâches de telle sorte qu'une certaine température maxi-

Introduction

Computing is one of the sciences that have revolutionized the world during the last century. Humans invented electronic computers for the first time during World War II. Using the Turing Machine model, these computers were able to perform complicated encryption/decryption computations. A computer is a device that can be programmed to perform a set of arithmetic or logical operations. Since a sequence of operations can be changed, the computer can solve more than one kind of problem.

Conventionally, a computer consists of at least one processing element, typically a Central Processing Unit (CPU) and some form of memory. The processing element carries out arithmetic and logic operations, and a sequencing and control unit that can change the order of operations based on stored information. The first computers were the size of a large room, consuming as much power as several hundred modern Personal Computers (PCs).

During the last decades, the use of computers in many applications in the modern life has increased dramatically the demand of processing power and efficiency. The progress of technology allowed modern computers based on integrated circuits to be millions to billions of times more capable than the early machines, and occupy a fraction of the space. Simple computers have become small enough to fit into mobile devices that can be powered by small energy sources. This progress allows new applications to emerge. Nowadays computers are capable to control even critical systems such as nuclear operations or airplane flight control. This kind of computers are mostly embedded in autonomous systems and can be found in many devices from MPEG Audio Layer 3 (MP3) players to spacecrafts and from toys to industrial robots.

The most important issue of these systems is determinism which means that their behavior has to be predictable prior deployment. These systems need predictability not only in term of correctness or prevision of the required results but also in term of the time that the computations take or the date at which the results are delivered. Unfortunately, nowadays computers are not deterministic and thereby they are not fully predictable. To cope with this limitation, the behavior of these systems is studied assuming the worst-case scenario. Therefore, the considered systems must deliver correct results within a bounded interval of time even in the worst-case scenario. Systems that are expected to respect such timing constraints are called Real-Time Systems (RTS).

Furthermore, with the increase of processors speed and the miniaturization of electronic devices, energy and heat management becomes one of the major issues to address. In fact, the aim of small devices is to provide autonomous services for a long lifespan like wireless sensor networks or medical implants. The challenge of such devices is to use the environmental energy to run for a very long time by eliminating maintenance operations, e.g. battery replacement. Many environmental energy sources can be exploited to achieve such an autonomy, e.g. solar, vibration, wind, thermal, etc. Each source is adapted to specific applications. For example, the solar energy can be Chapter 3 contains the state of the art of the different models and solutions available for the real-time scheduling of energy-harvesting systems. In this chapter, we start by defining and specifying the formal model of the targeted real-time energy harvesting systems that set the scope of this thesis and then, we explain the real-time scheduling problematic we are interested in, namely the fixed-priority scheduling. After that, we identify the different scheduling approaches for energy-harvesting systems, then, we list and explain the major real-time scheduling algorithms for energy-harvesting systems that have been proposed in the literature. At the end, we compare these algorithms to each other through simulations and we summarize the strengths and the weaknesses of each algorithm.

Secondly, the contributions part is organized as follows.

Chapter 4 describes in detail the Preemptive Fixed-Task-Priority As Soon As Possible (P F P ASAP ) scheduling algorithm which is the first contribution of this thesis. In this chapter we first present a theoretical study of the algorithm by proving some properties like the optimality, and characterizing some aspects like the the worst-case scenario, the minimum battery capacity and the schedulability condition. Next, we compare P F P ASAP to the algorithms presented in the state of the art through simulation and we discuss its limitations.

Chapter 5 presents a schedulability analysis of the P F P ASAP algorithm where some assumptions are removed. This analysis is based on tasks response time approximation. In this chapter, we propose two upper bounds of tasks response time and we build two schedulability conditions with two levels of precision. Then, we validate this theoretical result with simulations.

Chapter 6 shows the difficulty of finding an optimal algorithm for fixed-priority energy-harvesting systems. We explain with counter examples why the algorithms proposed up to now and the intuitive algorithms are not optimal. We try also to build an optimal algorithm with an exponential complexity.

Chapter 7 studies the fixed-priority scheduling for thermal-aware systems which is a very close model to energy-harvesting's one. In this chapter we use the properties of the P F P ASAP algorithm to build an optimal algorithm for the thermal-aware model and a schedulability analysis.

Chapter 8 presents Yet An Other Real-Time Systems Simulator (YARTISS), the simulation tool used to perform the simulations in this dissertation. In this chapter, we present the architecture of this simulator and we show through some examples how it is extensible.

Finally, we conclude this dissertation by summarizing the contributions of this thesis and discuss the remaining open problems and the possible axes of future development.

Introduction

Nowadays electronic devices are more and more used to control critical operations like nuclear reactions or flight commands. These devices are required to perform computations in order to take decisions. For most of such devices, the time at which the results of these computations are delivered is as important as their correctness.

The most important issue of these systems is determinism which means that the behavior of the considered systems can be predicted totally or partially prior deployment. These systems need predictability not only in term of correctness or prevision of the required results but also in term of the time that the computations take or the date at which the results are delivered. Systems that can guarantee such a predictability are called Real-Time Systems (RTS).

Definition 1.1 (Real-Time Systems).

In computer science, a system is considered as Real-Time if the correctness of the system depends not only on the logical result of the computation but also on the time at which the result is delivered [START_REF] Buttazzo | Hard Real-Time Computing Systems[END_REF].

Although the term of real-time is frequently used in many application fields, it is subject to different interpretations. One can say that an application operates in real-time if it is able to quickly react to external events. For example, one can use real-time video streaming to refer to a video that can be produced and viewed on the flight. This has become possible thanks to the increasing power of computers and telecommunication media. According to this interpretation, a system is considered to be real-time if it is fast. However, the term fast has relative meaning and does not fill the main property that characterizes a real-time system which is time predictability. The considered systems are often subject to environment interaction. Thus, it does not make sense to design a real-time computing system for flight control without considering the timing characteristics of the different critical computation activities of the aircraft. Some people erroneously believe that it is not worth to invest in real-time research because advances in computer hardware will take care of any real-time requirement. Although this advance will improve processing speed, this does not guarantee that the timing constraints of an application will be met. In fact, while the aim of fast computing is to minimize the average response time of a given set of tasks, the aim of real-time computing is to meet the individual timing requirements of each task worst-case scenario. Hence, instead of being fast, a real-time system should be predictable. A safe way to achieve predictability is to investigate and employ new methodologies at every stage of the development of an application, from design to testing.

The main difference between a real-time and a non-real-time task is that a real-time task is characterized by a temporal constraint: the deadline, which is the maximum time before which the task must complete its execution. In critical applications, a result delivered after the deadline is not only late but wrong. Regardless of the application, a well-designed real-time system should eliminate or minimize temporal constraint violations.

Depending on the consequences that may occur because of a missed deadline, real-time systems are usually classified in two families hard and soft.

In a hard real-time system no deadline misses are tolerated because the penalty or the damage caused by missing a deadline may be catastrophic, e.g., danger for human health or the environment. For a hard real-time system to be temporally correct, each computation or task must successfully complete prior its deadline whatever the scenario the system can cross. The system must be tested in the worst-case scenario. Finding the worst-case scenario by testing all the possible scenarios may not be possible in practice. Instead, formal analysis techniques are necessary to ensure that the considered system is correct and predictable.

In contrast, in a soft real-time system, missing a deadline does not compromise the safety or the integrity of the system but degrades the Quality of Service (QoS). Therefore, the goal of a soft real-time system is to maximize the quality of service by minimizing deadline violations. In this kind of real-time systems, formal analysis can be applied to prove a certain quality of service instead of feasibility.

For a system to be proven temporally correct, three aspects of a real-time system must be considered in the formal analysis:

1. Real-Time Workload: the computation performed by the real-time system that must complete before its deadline. Usually, the workload is modeled using the notion of recurring tasks. A recurring task requests the execution of infinite sequential pieces of code called jobs. Each requested job is associated to a deadline.

2. Processing Platform: the set of hardware resources where the jobs of the workload are executed. These resources include the processor(s) (CPUs), the memories, the caches and the interconnection between them, etc. The architecture of the platform is very important because its performance influences directly the temporal behavior of the system.

3. Scheduling Algorithm: if the workload is composed of one task, there is not a scheduling problem because there is no concurrence between tasks. However, when the system is composed of several tasks with different deadlines, many jobs may by ready for execution at the same time and need to be executed as soon as possible to meet their deadlines. In this case, a scheduling algorithm is needed to decide, at any time, which jobs are executed on the processing platform. The choice of the scheduling policy is one of the main factors that impacts the temporal behavior of the system. The aim of this chapter is to present the main concepts and definitions needed to understand the contributions of this dissertation. The remainder of this chapter is organized as follows, Section 1.2 formally describes the common models of real-time workload. Section 1.3 introduces briefly the processing platforms considered in this dissertation. Then, Section 1.4 enumerates the most common scheduling algorithms for real-time systems and some of their properties. Finally, the main formal analyses of the temporal correctness of real-time systems are presented in Section 1.5.

Chapter 1. Real-time Scheduling

a i,1 d i,1 f i,1 R i,1 R i =R i,2 { 0 τ i J i,1 J i,2 T i T i D i D i C i C i O i a i,2 d i,2 f i,2 R i,2 time

Workload Model

To ensure the predictability required for real-time systems, it is primordial to specify the parameters and the hypotheses of the considered systems. The task model or the workload model is the first aspect to be specified for a real-time system. It consists of setting the temporal parameters of each task, the relationship between them and the assumptions of the model.

A task is a software entity that performs computation for a specific function, e.g. checking sensors values or activating actuators. It consists of executing a sequence of instructions on the processing platform. These sequence of instructions provided by the task can be executed multiple times.

Most of real-time tasks have a cyclic structure in a way that they execute some code and then they block waiting for a periodic or a sporadic timer. For this reason, real-time tasks are usually modeled as a sequence of recurrent jobs. Hence, a job is in instance of a real-time task associated to a temporal deadline relative to its arrival time.

Since the seminal paper addressing real-time recurrent tasks, i.e. the work of Liu and Layland in [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF], a real-time task τ i is characterized by the following parameters.

• Offset O i : the first time where task τ i is activated, it coincides with the request 1.2. Workload Model time of the first job of the task. It is also called start time or first release time. When all the tasks composing the system are started at the same time, i.e. ∀i O i = 0, we say that the tasks are synchronous, and asynchronous otherwise,

• Execution Time C i : the computation time required by each job of τ i . Tasks may have variable execution times between different jobs. This is due to the fact that the path and the duration of instructions executions depend on many parameters like the type of the used memory (structure of caches) or the branches resulting of conditional instructions and loops. This makes the problem of keeping a constant execution time very difficult. Some studies have observed that effective execution times can vary up to 87% relative to their worst-case execution time [START_REF] Mueller | A Comparison of Static Analysis and Evolutionary Testing for the Verification of Timing Constraints[END_REF]. This variation may compromise the global temporal predictability of the system when dealing with hard real-time systems. To cope with this problem, the notion of Worst Case Execution Time (WCET) was proposed, it consists of considering only the longest possible execution time.

In order to use, the WCET, the must guarantee some sustainability properties which means that if it works in the worst-case it must work in a more favorable case as well. Therefore, it is safe to study the real-time system with the WCET.

The WCET is actually computed with different methods, it can be estimated simply by getting the longest value given by empirical measurement on the targeted platform, e.g. benchmarks, or formally by analyzing the code of the task to find the longest path of possible branches and loops in the worst state of memory and input data size. The computation of the exact WCET is one of the most important and active research fields within the real-time scheduling community. Many contributions are yielded every year to improve WCET predictability [START_REF] Hardy | Static Probabilistic Worst Case Execution Time Estimation for Architectures with Faulty Instruction Caches[END_REF][START_REF] Nowotsch | Multi-core Interference-Sensitive WCET Analysis Leveraging Runtime Resource Capacity Enforcement[END_REF][START_REF] Betts | Estimating the WCET of GPU-Accelerated Applications Using Hybrid Analysis[END_REF]. Nevertheless, in soft real-time systems, the average execution time is sometimes used instead of WCET to make the formal analysis less pessimistic,

• Period T i : this parameter models the recurrent aspect of real-time tasks, it represents the inter-arrival time between two successive jobs. According to the considered task model, this parameter can be fully specified with a constant value, partially with a lower bound, or not specified at all. The periodicity model has an important impact on the complexity of the scheduling problem, this point will be discussed in Section 1.5.2 on page 43,

• Relative Deadline D i : the time allocated to task τ i to complete a job execution. Each job has exactly D i time units to finish executing after being activated. Exceeding this amount of time, the job violates its temporal constraint. The deadline is the parameter that characterizes real-time systems because it models their temporal constraints. A relative deadline is not an absolute time, it is the difference between a job's activation time and its absolute deadline. Relative deadline is usually associated to tasks and absolute deadline to jobs, • Worst Case Response Time R i : the longest job response time of task τ i , i.e. R i = max ∀j (R i,j ), where R i,j is the response time of the j th job of task τ i , i.e. the amount of time needed to complete its execution including potential blocking or waiting times caused by interferences and preemptions. Formally, it is the difference between the job's activation time and its termination time.

Regarding jobs, J i,j denotes the j-th job of task τ i and is characterized with the following parameters.

• Arrival time a i,j : the time at which job J i,j becomes ready for execution, it is also called request time or release time. This time depends on the periodicity model of the task,

• Absolute Deadline d i,j : the effective time of the job's deadline, it can be obtained by adding D i to its arrival time,

• Termination time f i,j : the time at which job J i,j finishes its execution,

• Response time R i,j : is the difference between job's completion time and its request time, i.e. R i,j = f i,j -a i,j .

Figure 1.1 on page 30 illustrates these parameters.

Task Life Cycle

During the life span of a real-time system, multiple jobs of a task can be released. At a given moment of a task life cycle, it can be in one of the following states:

• Ready: refers to the state in which the job has been activated but not yet executed.

• Running: refers to the state in which the job is being executed on the processing platform.

• Blocked: refers to the state in which the job is stopped by the system. This can happen in some real-time systems where there is for example shared resource with mutual exclusion, the job is stopped until it gets the access to the resource.

• Inactive: in this state the job is not yet requested or has already finished its execution.

Figure 1.2 on the facing page shows the transitions between these states. In some simple real-time systems, it may be possible to completely specify the parameters of each job prior to system run-time (i.e. the system designer has complete knowledge of each job J i,j ). However, in systems with a large (or infinite) number of jobs or systems that have dynamic behaviors, explicitly specifying each job, prior to system run-time, may be impossible or unreasonable. Based on this characteristic, we can classify task models as either completely specified or partially-specified. We now discuss the differences between these two types of systems.

Completely-Specified Recurrent Task Model

A real-time system is completely specified if the exact values of the temporal parameters and constraints of all jobs can be determined off-line or prior to system runtime. Formally, when the arrival-time and the absolute deadline of each job are known off-line. This implies that jobs offsets and inter-arrival times can also be determined prior to run-time. Typically, completely-specified task models are appropriate for hard real-time applications that have completely predictable executions. For example in an avionic control system, the control system will process the pilot's input command at strict time intervals to ensure that flight control does not degrade. Completely-specified systems are sometimes called concrete systems.

Periodic Task Model

In many real-time control applications, periodic activities represent the major computational demand in the system. Periodic tasks typically arise from sensory data acquisition, control loops, action planning and system monitoring. Such activities need to be cyclically executed at specific rates which can be derived from the application requirements. The periodic task model was proposed for the first time by Liu and Layland in 1973 [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF]. It allows the specification of homogeneous sets of jobs that occur at strict intervals. A periodic task τ i is specified by the temporal parameters described earlier, i.e. (O i ,C i ,T i ,D i ), where the inter-arrival time between two successive jobs T i is set to a constant value. The first job of task τ i is released at O i , the second at O i + T i and the j-th one at O i + (j -1) × T i . Then, the time of jobs arrival and their deadlines are fully predictable. Periodic tasks are also known as time-triggered tasks because their jobs arrival times are determined only by time.

Partially-Specified Recurrent Systems

For many real-time systems, it is not possible to know beforehand how many jobs will be generated by the system during run-time. Furthermore, completely specified systems such as periodic task systems are not able to handle changes of real-time workloads because of the restrictive constraint that jobs must be released at strict periodic intervals. Thus, for systems where the arrival times between jobs could change dynamically, e.g. packets in a network application, the periodic model may not be suitable. To cope with the inflexibility of completely-specified systems, one may instead consider partially-specified ones. The execution of the same partially-specified task set for the same period of time may lead to different workload with different job arrival times. Nevertheless, the specification of a partially-specified system includes a set of constraints that any execution must satisfy in order to ensure predictability. Partially-specified task systems are sometimes called non-concrete systems.

In this subsection, we will introduce more general models for partially-specified task systems: the sporadic and the aperiodic models. These general task models can be used to represent more complex applications than the restrictive periodic task model.

Sporadic Task Model

The sporadic task model proposed by Liu and Layland in [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF] removes the restrictive assumption of the periodic task model where the jobs of a task are released at a strict periodic time interval. In addition, the offset parameter O i is not specified and the inter-arrival parameter is lower bounded. Then, a sporadic task τ i can be characterized by a tuple (C i ,T i ,D i ) where C i is its worst-case execution time, D i its relative deadline and T i is the minimum inter-arrival time between two successive jobs of τ i , i.e. ∀ (J i,j , J i,j+1 ), a i,j+1 -a i,j ≥ T i (note that T i denoted the exact inter-arrival time for periodic tasks). Then, at run-time, the number of jobs released during the same interval of time can vary according to dynamic inter-arrival time of jobs.

Aperiodic Task Model

Unlike periodic and sporadic task models that set some hypothesis on jobs interarrival times, the aperiodic task model removes completely the notion of period or inter-arrival time. The jobs can arrive at any time as well as non-predictable events. For this reason, aperiodic task systems are also called event-triggered systems. Then, an aperiodic task is characterized only with two parameters, namely the WCET, C i , and the deadline D i . Even though the aperiodic task model is the most general one, it is the less predictable model. Indeed, when dealing with unspecified jobs inter-arrival times, the time analysis of tasks worst-case response time is impossible because the amount 1.3. Processing Platform of workload within any time interval is neither known nor bounded which prevents the behavior of the system to be temporally predictable. Therefore, the aperiodic task model is not suitable for hard real-time systems that need a full temporal predictability. However, it could be very interesting to model some soft real-time applications that aim to increase the utilization of platforms with a certain QoS or mixed systems that are composed of periodic, sporadic and aperiodic tasks.

Tasks Independence

One of the most common hypotheses in real-time systems is tasks independence. This means that the only resource on which tasks are in concurrency is the computation units, i.e. the processors. Nevertheless, in many real-time applications, the tasks composing the system may be directly or indirectly dependent to other tasks. Indeed, tasks may be subject to input data dependency constraints, i.e. a task τ 1 may require the results produced by an other task τ 2 , and thus, τ 1 cannot start executing until τ 2

has not yet finished. Dependencies between tasks could be modeled with a graph of jobs, e.g. Directed Acyclic Graphs (DAG) task model [START_REF] Baruah | A Generalized Parallel Task Model for Recurrent Real-time Processes[END_REF]. Furthermore, tasks dependency can also come from resource sharing (other resources than the computation units). Indeed, when some resources that cannot be accessed simultaneously are shared between tasks, the task that holds the resource blocks the execution of other tasks. Then, the execution duration of the waiting tasks depends on how long the task holding the resource will keep it. Therefore, concurrency and resource sharing may lead to indirect dependency between tasks.

In the case of several shared resources, deadlocks can occur if tasks are waiting for each other. This leads to a concurrency issue which is one of the widely discussed topics within the real-time systems community [START_REF] Buttazzo | Hard Real-Time Computing Systems[END_REF]. The common solutions consist of bounding the blocking time and including it in the WCET.

The remainder of this dissertation focuses only on types of systems that are predictable and can be formally verified. We study especially periodic and sporadic independent systems for the basic model, then, other constraints and parameters will be added in order to study real-time scheduling for energy-harvesting systems.

Processing Platform

In contrast with real-time workload which is the software part of real-time systems, the processing platform is the computer hardware where real-time applications are executed. It consists of a collection of physical elements that constitutes the computer responsible of running the application such as the processor or the CPU, Input/Output devices, the different levels of memory and caches, etc. It is crucial for real-time applications design to consider the different components of the processing platform because they are part of the model and their performance and architecture influence directly the temporal behavior of the system.

The process of determining a task worst-case execution parameters is called timing analysis. Timing analysis must account for worst-case cache behavior, memory access time, program structure and worst-case execution paths.

The analysis for determining the contribution of each of these factors to the worstcase execution time depends on the specific system and the program. Other factors that can increase the worst-case execution time are job preemptions (i.e. a job is suspended while a different job is executing, and then, its execution is resumed at a later time). The context switch and scheduling algorithm overhead contribute to increase jobs response times. The total preemption cost is typically dependent on the processor architecture and the used scheduling algorithm.

In this dissertation, we will assume that the worst-case execution time of each task has already been determined. We will consider only monoprocessor platforms that has a unique speed. We will assume also that jobs are preemptable with a negligible cost.

Scheduling Algorithms

The role of a real-time scheduling algorithm within a real-time application is to determine which active jobs are executed on the processing platform at every time instant. In other words, it determines the intervals of execution for jobs on the processing platform. The sequence of execution intervals of a task set is known as a schedule. The goal of a real-time scheduling algorithm is to produce a schedule that ensures that every job is allocated processor slots (i.e. executes) to finish executing before its deadline.

In this section, we discuss the classification of real-time scheduling algorithms.

Online/Offline Scheduling

Scheduling real-time jobs is the responsibility of the scheduler, which can be part of the software layer that composes the real-time operating system or part of the hardware layer. The scheduler can be seen as a specific task that takes scheduling decisions by following a scheduling policy or a scheduling algorithm.

If the sequence of real-time jobs is specified prior to run-time or generated by a completely-specified task set, a scheduling algorithm can generate and store the schedule prior to run-time. This approach is called static or offline scheduling. In contrast, for systems that are partially-specified or have a schedule too large to be stored in the system's memory, an online algorithm is appropriate for this case. At time t, the online real-time scheduling algorithm decides the set of jobs to execute at time t based on the status of jobs released at or prior to t. An online scheduling algorithm does not have specific information about the release of jobs after time t (i.e. future jobs arrival times are unknown). This dissertation focuses on deterministic online real-time scheduling algorithms.

Work-Conserving/Non-work-conserving Scheduling

A real-time scheduling algorithm can produce a non-work-conserving schedule, i.e. a schedule where the processor is inactive while at least one job is ready for execution. This may seem as a counter-productive property, however, it can be very useful for adaptive scheduling algorithms that may delay jobs execution to avoid future failures as for energy-harvesting systems. In contrast, a work-conserving schedule does not allow the processor to be inactive while ready jobs are waiting for execution.

Preemptive/Non-Preemptive Scheduling

When several tasks are ready to be executed at the same time on a monoprocessor platform, two approaches can be applied: the preemptive or the non-preemptive approach. In the non-preemptive approach, when a task starts executing, it cannot be interrupted until it finishes its execution. With this approach, there is at most one context switch, i.e. the scheduler replaces the execution context of the finishing job with starting one. These context switches have a cost that has to be considered in the schedulability analysis, although the hypothesis of an negligible cost is often considered. In a preemptive scheduling, the scheduler can preempt a job to execute an other one. The advantages of this approach are reducing the response time of higher priority jobs, a best use of the processor and better rate of schedulability. With this approach, jobs are executed concurrently on the processor. In this dissertation, we focus only on preemptive scheduling algorithms.

Optimal Scheduling

The term of optimality in real-time theory is used for different properties. Here we are interested in the optimality of scheduling algorithms form schedulability point of view. For this sake, we use the definition proposed by Buttazzo in [START_REF] Buttazzo | Hard Real-Time Computing Systems[END_REF]:

"A real-time scheduling algorithm is said to be optimal for a specific class of algorithms if it minimizes some given cost function defined over the task set. When no cost function is defined and the only concern is to achieve a valid schedule, then an algorithm is said to be optimal if it always finds a valid schedule whenever there exists a valid one. In other words, an algorithm is said to be optimal if it may fail to produce a valid schedule for a given task sets only if no other algorithms of the same class can do it."

In contrast, a non optimal algorithm may fail to schedule a given task set while a valid schedule exists.

Furthermore, the schedulability of a task set according to an optimal algorithm is a necessary and sufficient feasibility condition for the considered class of algorithms. See Section 1.5 on page 40 for more details.

Priority Driven Scheduling Algorithms

A possible approach for an online scheduling algorithm is to assign, at any given time t, each job J i,j a priority P i,j (which is assumed to be a positive integer). A priority-driven scheduling algorithm sorts at each time t the active jobs according to P i,j (in non-decreasing order) and schedules the highest-priority job on the processor.

In this subsection, we describe the classical priority-driven scheduling algorithms. These later differ in the manner that they assign a priority to jobs. In the following, we give three classifications of priority-driven scheduling algorithms. We follow the classification names used in [START_REF] Fisher | Algorithms for Determining the Demand-Based Load of a Sporadic Task System[END_REF]. The three major classes of priority-driven scheduling algorithms are Fixed-Task-Priority (FTP), Fixed-Job-Priority (FJP), and Dinamic Priority (DP).

Fixed Task-Priority Scheduling Algorithms (FTP)

In fixed task-priority scheduling, each task is assigned a static or fixed priority P i prior to run-time and keeps the same value during run-time. Each job generated by that task inherits the same priority value. Thus, for a real-time system with n tasks, there are n distinct priorities (one for each task). We assume that the tasks are indexed in a non-decreasing order of priority. Therefore, for a task set Γ={τ 1 , . . . , τ n }, τ 1 has the highest priority and τ n has the lowest one. In general, the task-priority assignment can be determined by the system designer. However, there are three well-studied task-priority assignment policies for sporadic task systems: Rate Monotonic (RM ), Deadline Monotonic (DM ) and Audsley's Optimal Priority Assignment (OPA).

Task Priority Assignment Policies

The tasks priority assignment has a significant effect on the schedulability of task sets in fixed-task-priority scheduling [START_REF] Davis | Schedulability Analysis for Controller Area Network (CAN) with FIFO Queues Priority Queues and Gateways[END_REF]. Hence, it is important to select the right priority assignment policy. In the following we describe briefly the main priority assignment policies.

Rate Monotonic:

For rate monotonic priority assignment policy [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF], each task τ i is assigned a priority according to its period. The shorter the period is, the higher the priority of the task is. Rate Monotonic is optimal for non-concrete task sets with implicit deadlines, i.e. O i = 0 and D i = T i . The intuition behind this optimality is that tasks can use all the available time because of the implicit deadlines and that high frequency tasks cannot support a lot of interferences in contrast of low frequency tasks. Then, in this case, assigning high priorities to high frequency tasks is the best that we can do. This is proved in [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF].

Deadline Monotonic:

The deadline monotonic policy [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF] assigns to each task τ i a priority according to its relative deadline parameter: the shorter the deadline is, the return unschedulable 9: end for 10: return schedulable higher the priority of the task is. Deadline Monotonic is optimal for non-concrete task sets with constrained deadlines [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF], i.e. O i = 0 and D i ≤ T i . Intuitively this can be explained by the fact that with constrained deadlines tasks with short deadlines can support less interferences than ones with larger deadlines. Then, in this case, assigning high priorities to tasks with short deadlines is the best that we can do. The detailed proof is available in [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF].

Optimal Priority Assignment: Note that the optimality of rate monotonic and deadline monotonic relies on two strong assumptions, namely tasks offsets and deadlines model. If we remove these assumptions RM and DM are no longer optimal for fixedpriority scheduling. To cope with this problem, Audsley proposed in [Aud91; Aud01] an optimal priority assignment OPA algorithm that provides an optimal priority assignment for sporadic task sets with arbitrary-deadlines and concrete offsets. It consists of testing greedily different priority assignments using a necessary schedulability test as shown in Algorithm 1.1. This approach requires at most n(n + 1) tests to determine a schedulable priority assignment whenever such an ordering exists. This tests much less priority assignment than n! that would be otherwise required, using a brute force approach that checks every possible combination.

For a schedulability test to be OPA-Compatible [START_REF] Dais | Priority Assignment for Global Fixed Priority Pre-Emptive Scheduling in Multiprocessor Real-Time Systems[END_REF], it must respect the following rules:

1. the schedulability of a task may, according to the test, be dependent on the set of higher priority tasks, but not on their relative priority ordering, 2. the schedulability of a task may, according to the test, be dependent on the set of lower priority tasks, but not on their relative priority ordering, 3. when the priorities of any two tasks of adjacent priority are swapped, the task being assigned the higher priority cannot become unschedulable according to the test, if it was previously schedulable at the lower priority.

Fixed Job-Priority Scheduling Algorithms (FJP)

For fixed job-priority scheduling, the restriction that a task's jobs have identical priority is removed. Instead, each job J i,j is assigned a single priority P i,j that does not change during its execution. The specific FJP scheduling algorithm determines the priority assignment for jobs. Earliest-Deadline First EDF is a well known FJP scheduling algorithm proposed by Liu and Layland in [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF]. It assigns a priority to each job according to its absolute deadline. The earlier the deadline of the job is, the higher its priority is. In other words, EDF schedules among the set of jobs with remaining execution the job with the nearest deadline.

Dynamic Priority Scheduling Algorithms (DP)

The dynamic priority Scheduling algorithms classification is the most general. It removes the restriction that a job priority does not change. A job J i,j priority P i,j can now vary over time. A well-known example of DP scheduling algorithm is Least Laxity First (LLF ). At time t, the LLF scheduling algorithm assigns a priority to each active job according to to its laxity. The shorter the alxity of the job is, the higher the priority of the job is. The laxity of a job J i,j at time t is (d i,j -t) -c i,j (t), where c i,j (t) is remaining processor cost of job J i,j at time t.

In this dissertation, we focus only on FTP scheduling for energy-harvesting systems.

Scheduling Analysis

To ensure the temporal correctness of a real-time system, it must be validated prior to run-time using formal verification techniques. These techniques must ensure that for all executions of the system, all jobs generated by the system will meet their deadlines. Two fundamental analyses in formal verification for real-time systems are considered: feasibility analysis and schedulability analysis. The feasibility analysis determines whether there exists a valid schedule of the system where all jobs meet their deadlines irrespective to the used scheduling algorithm. The schedulability analysis determines whether a given scheduling algorithm will always meet all jobs deadlines.

The remainder of this section first sets some definitions then it introduces the main feasibility and schedulability analysis techniques applied to the previously mentioned scheduling algorithms.

Definitions

In this subsection we define some properties and quantities to simplify the understanding of the schedulability analysis that follows.

Definition 1.2 (Valid Schedule).

The schedule S produced by scheduling algorithm A is considered as valid if and only if all the deadlines are infinitely met.

Definition 1.3 (Worst-Case Scenario).

The worst-case scenario of task τ i is the configuration of the system that leads to the longest response time of τ i . This configuration includes tasks parameters such as first release times and periods.

Definition 1.4 (Task Processor Utilization).

The processor utilization of task τ i denoted U i is the ratio of time spent in the execution of τ i 's jobs. It can be obtained by Equation 1.1.

U i = C i T i (1.1)
Definition 1.5 (System Processor Utilization).

The system processor utilization denoted U is the ratio of time spent in the execution of the whole task set. It is the sum of all tasks processor utilization.

U = n i=1 U i (1.2)
Definition 1.6 (Task Density). The task density denoted Λ i is an upper bound of the ratio of time spent in the execution of task τ i jobs.

Λ i = C i min(D i , T i ) (1.3)
Definition 1.7 (System Density).

The system processor density denoted Λ is an upper bound of the percentage of time spent in the execution of the task set. It is the sum of all tasks processor densities.

Λ = n i=1 Λ i (1.4)
W (t 1 , t 2 ) = τ i ∈Γ W i (t 1 , t 2 ) (1.5)
Tasks workload functions depend on the used scheduling algorithms. In the literature there are two main task workload functions usually used in schedulability and feasibility analysis: the request bound function and the demand bound function.

DBF i (t) = max t -O i -D i T i + 1, 0 × C i (1.7)
Definition 1.12 (Busy-Period).

A busy-period is an interval of time [t 1 , t 2 ] where the processor is continuously executing jobs while there are waiting jobs. It starts from time t 1 when the processor is idle for the last time and ends at time t 2 when all waiting jobs are finished. It is possible to have consecutive busy-periods since it depends on the waiting jobs and not only the processor.

Definition 1.13 (Hyper-Period (HP)).

The hyper-period of a task set Γ is the smallest interval of time after which the global periodic pattern of all the tasks are repeated. It is typically defined as the Least Common Multiple (LCM) of the periods of all the tasks of the system.

The aim of scheduling analysis is to provide conditions and tests that help designers to determine prior run-time whether a task set is feasible/schedulable or not. We can distinguish three kinds of conditions: necessary conditions, sufficient conditions and necessary and sufficient.

Definition 1.14 (Necessary Condition).

A necessary condition means that a task set that fails the test is definitely not feasible or not schedulable. Though satisfying the condition does not mean that it is certainly feasible, more verification is needed to conclude.

Definition 1.15 (Sufficient Condition).

A sufficient condition means that a task set that succeeds the test is definitely feasible or schedulable. In contrast, failing the test does not mean that task set is certainly not feasible or not schedulable, more verification is needed to conclude.

Definition 1.16 (Necessary and Sufficient Condition).

A sufficient and necessary condition is an exact test that tells with certainty whether the task sets is schedulable/feasible or not.

Feasibility or Schedulability

These two notions have been defined differently in the literature. Some times the term schedulable is used to describe the property feasible and vice versa. Here, we use the definitions proposed by Davis and Burns in [START_REF] Davis | A Survey of Hard Real-time Scheduling for Multiprocessor Systems[END_REF].

A feasibility test is a condition that tells whether at least one valid schedule exists for the given task set or not. This schedule may require a non-clairvoyant scheduler or a clairvoyant scheduler which does not necessarily exist. Feasibility conditions are independent form scheduling algorithms.

In contrast, a schedulability condition is a test that tells whether a valid schedule can be produced by the given algorithm for the given task set or not. In this case, the algorithm must exist.

Note that a feasibility test is more general than a schedulability one. A task set that is schedulable according to a specific algorithm, is necessarily feasible. However, the opposite way is not true: a task set can be feasible but not schedulable with a given algorithm. Indeed, a schedulability test becomes a feasibility one when the used algorithm is optimal because if a solution exists, the optimal algorithm will find it.

Many feasibility and schedulability conditions was proposed in the literature. Most of them are applicable only for specific kinds of task sets with specific assumptions. For example, the relationship between periods and deadlines or tasks first release times. Therefore, it is very important for designers to check the assumptions before using a test. In the following we list some existing tests for fixed-priority and dynamic-priority scheduling.

Schedulability Analysis for Fixed-Task-Priority

This subsection presents the classical feasibility and schedulability conditions for fixed-task-priority scheduling.

Maximum utilization feasibility test

One of the possible ways to check the feasibility or the non feasibility of a task set is to compare its processor utilization to the maximum one that one processor can support or to lower bound the utilization of feasible task sets. It is impossible to schedule a task set with a utilization higher than 1 on one processor whatever are deadlines and offsets models because the time needed to execute the workload of any time interval W (t 1 , t 2 ) is greater than the available time, i.e. t 2 -t 1 . Therefore a necessary feasibility condition for monoprocessor platforms can be obtained with Equation 1.8.

U ≤ 1 (1.8)

Liu and Layland bound

For task sets composed of n periodic tasks with implicit deadlines and Rate Monotonic priority assignment, Liu and Layland proposed in [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF] a sufficient schedulability condition by lower bounding the utilization of feasible task sets. This can be obtained by Equation 1.9.

U = n i=1 C i T i ≤ n 2 1/n -1 (1.9)
This test can be extended to task sets with constrained deadlines and deadline monotonic (DM) priority assignment by comparing the bound to the density instead of the utilization as shown in Equation 1.10.

Λ = n i=1 C i D i ≤ n 2 1/n -1 (1.10)
However, such a test is very pessimistic because it assumes that periods are shorter than the actual ones. The maximum achievable utilization or density with Liu and Layland bound can be obtained by computing its limit when n tends to infinity as show in Equation 1.11.

lim n→∞ n 2 1/n -1 = ln 2 0.69 (1.11)

Hyperbolic bound

For task sets composed of n periodic tasks with implicit deadlines and Rate Monotonic priority assignment, Bini et al. proposed in [START_REF] Bini | Rate Monotonic Analysis: The Hyperbolic Bound[END_REF] a sufficient feasibility condition by refining Liu and Layland bound. This can be obtained by Equation 1.12. n i=1

(U i + 1) ≤ 2 (1.12)
We can also use this bound for task sets with constrained deadlines by using tasks densities Λ i rather than utilizations, however, it is very pessimistic.

Worst-Case Response Time Analysis

Recall that except the maximum utilization feasibility test, all the above conditions are only sufficient. Then, a task set that fails these tests or does not fill the assumptions is not definitely unfeasible. To cope with this problem, the Worst Case Response Time (WCRT) analysis was proposed in the literature. Pandya et al. showed in [START_REF] Mathai | Finding Response Times in a Real-Time System[END_REF] that a necessary and sufficient schedulability test can be obtained by checking if the WCRT of each task is lower than its relative deadline, as expressed by Equation 1.13.

∀ τ i ∈ Γ, W CRT i ≤ D i (1.13)
For non-concrete task sets with constrained or implicit deadlines and deadline monotonic priority assignment, Audsley et al. proposed in [Aud+93] an algorithm to compute the worst-case response time of tasks that can be used to build a necessary and sufficient test. Equation 1.13 describes how to compute the WCRT of priority level-i. The termination time of the first job of task τ i which coincides with the WCRT in the synchronous scenario can be computed with a fixed point iteration on Equation 1.14 using the iterative workload function

W m i .            W 0 i = C i W m+1 i = C i + j<i RBF j (W m i ) W CRT i = min m>0 ∧ W m+1 i =W m i (W m i ) (1.14)
Note that this algorithm assumes that all the tasks are requested simultaneously which is the worst-case scenario for Liu and Layland model. This scenario is also called the critical instant. Furthermore, this algorithm checks only the deadline of the first job. This is sufficient because first, the test considers only constrained or implicit deadlines which avoids the interference between the jobs of the same task, and second, the longest response time happens necessarily in the worst-case scenario. If the first job meets its deadline, the next ones will do also. If we remove the assumptions on deadlines model and tasks offsets, checking the deadline of first jobs in a synchronous activation is no longer sufficient and the test becomes only necessary.

Schedulability Analysis for Dynamic-Priority

This subsection presents the classical feasibility and schedulability conditions for fixed-job-priority and dynamic-priority scheduling.

Maximum utilization feasibility test

A task set cannot be scheduled on only one processor when its utilization ratio is greater than 1. Therefore a necessary feasibility test can be obtained by Equation 1.15.

U ≤ 1 (1.15)

EDF utilization schedulability test

For task sets with implicit deadlines, the previous test become necessary and sufficient for EDF scheduling [START_REF] Liu | Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment[END_REF].

EDF density schedulability test

For task sets with constrained deadlines, Liu [START_REF] Liu | Real-Time Systems[END_REF] proposed a sufficient schedulability test based on the density of the system instead of its utilization as shown by Equation 1.16.

Λ ≤ 1 (1.16)

EDF schedulability Arbitrary Deadlines

For task sets with arbitrary deadlines, Baruah et al. [START_REF] Sanjoy | Algorithms and Complexity Concerning the Preemptive Scheduling of Periodic, Real-Time Tasks on One Processor[END_REF] proposed a sufficient and necessary schedulability test given by Equation 1.17.

∀ t > 0, τ i ∈Γ DBF i (t) ≤ t
(1.17)

Conclusion

In this chapter we introduced the classical theory of real-time systems and the basic state of the art needed to understand the next chapters. We first presented the main task models and their categorizations. Second, we described briefly the processing platforms targeted by this dissertation, namely monoprocessor platforms, and we set hardware assumptions that will be considered along this dissertation. Finally, we presented the main real-time scheduling algorithms, their categorizations and the corresponding feasibility and schedulability conditions.

In the remainder of the dissertation, we focus only on preemptive fixed-task-priority scheduling on monoprocessor platforms with additional constraints.

Introduction

Due to the growing demand for smaller devices with longer battery life, energy management in embedded systems has become one of the most active research areas. Indeed, a naive use of the available energy can lead to failures or a short lifespan. However, most of the targeted embedded applications are required to operate for long time after deployment, for example, wireless sensor nodes. The extended lifespan of these electronic devices is of particular importance when they have limited accessibility. Thus, collecting energy from the ambient environment can be a very interesting solution, which is known as Energy-Harvesting (EH). In this process, energy is drawn from the environment and then converted and stored in order to supply the embedded electronic devices. Compared to classical energy storage devices, the environment proves to be an infinite source of available energy. Furthermore, the use of this kind of energy reduces the need to replace batteries periodically which constitutes a major part of maintenance.

Many environmental sources can be exploited, including thermal, solar, mechanical, fluid, etc. Energy sources should be chosen according to the characteristics of the Chapter 2. Energy-Harvesting Systems targeted application. Self powered sensors for medical implants and remote monitoring sensors in structures such as bridges or buildings are typical examples of possible applications. In addition, the applications running on power-limited systems can be subject to timing constraints. Consequently, real-time and energy-aware features are both highly desirable and sometimes crucial for such systems.

In this chapter, we define what is an energy-harvesting system and we describe in detail its components.

The remainder of this chapter is organized as follows: Section 2.2 introduces and defines formally energy-harvesting systems. Section 2.3 gives an overview of the existing energy-harvesting devices and technologies. Section 2.4 discusses the different types of energy storage units and their usage. Section 2.5 gives some examples of actual energy-harvesting systems. Finally, Section 2.6 summarizes and concludes the chapter.

What is an Energy-Harvesting System ?

In our daily lives, the term harvesting is usually used to refer to the process of gathering different mature corps from the fields at the end of the growing season, or the growing cycle. Using this word for energy may seem a little strange. In fact, in the domain of energy, the term of Energy-Harvesting refers to the process of collecting the ambient energy from the environment and storing it in order to supply low power and small autonomous devices, such as wireless sensor networks, and portable electronic equipments. This process is also known as Energy-Scavenging or Power-Harvesting. Moreover, an Energy-Harvesting System (EHS) is an electronic device that uses an energy-harvesting generator to supply its activity.

Usually, energy-harvesting systems are composed of three main parts as described in Figure 2.1 on the next page: an energy harvester, an energy storage unit and a computing unit.

The energy harvester is the part responsible of collecting the ambient energy. It converts different kinds of environmental energy into electrical energy. Several energy sources and harvesting techniques are possible nowadays, in Section 2.3 on the facing page we present a non exhaustive list of energy sources and their extraction technologies.

The energy storage unit is a device used to store the harvested energy. Usually rechargeable batteries or capacitors are used. The choice of the storage unit type and capacity depends on the targeted application. In Section 2.4 on page 55 we list the main energy storage units available in the industry.

The computing unit is the embedded application or the mission part of the system, it is usually composed of data sensors, a processing unit and a data transmission device. Most of computing units embedded in energy-harvesting systems are real-time systems. In this dissertation, we focus on this part of energy-harvesting systems and we study the real-time scheduling for such systems.

Energy-Harvesting Technologies

Multiple sources are available for energy harvesting, including solar power, ocean waves, wind, vibrations, thermoelectricity, and human motions power. For example, vibration energy can be used to supply wireless monitoring sensors that are plugged inside the industrial machines. Prior research showed that these energy sources are not suitable for all applications, and that the energy sources must be chosen according to the application characteristics. In the following, we describe the main energy sources and their harvesting technologies.

Radiations Energy Harvesting

Solar Energy Conversion

Light is an ambient energy source that is available almost everywhere and can be used to supply electronic devices. Light energy harvesters convert light energy into electricity via photovoltaic cells. In a semi-conductor that is exposed to light, a photon with enough energy can extract an electron and create a gap. Usually, this electron finds quickly an other gap to fill, and the energy brought by the photon is dissipated. The principal of a photovoltaic cell is to put the free electrons in one side of the material and the gaps in the other one instead of filling the gaps of only one side. Therefore, a voltage difference and an electric tension appears like in a battery. The efficiency of power conversion of a photovoltaic cell is given by the ratio between the input of photons energy and the output of the yielded energy. A solar cell of 100 cm 2 can generate 1.3W if the irradiation is 1000 W/cm 2 and the efficiency of such cell is 13 % [START_REF] Mathew | Dye-sensitized solar cells with 13% efficiency achieved through the molecular engineering of porphyrin sensitizers[END_REF]. The applications of photovoltaic cells covers a large specter of energy power, from microwatts for miniaturized applications to several kilowatts for solar power plants. Although the efficiency of commercial photovoltaic cells is still below 20%, there exists some prototypes that can reach 35%. The main limitation of solar energy harvesting is its sensibility to brightness intensity and cells size.

The use of solar energy is the topic of numerous research work and an important progress was done in this field. In [START_REF] Chaara | Review of photovoltaic technologies[END_REF] El Chaara et al propose a full review on the evolution of existing photovoltaic cells technologies in the last 30 years.

Radio Frequency Energy Conversion

The proliferation of radio transmitters in nowadays urban landscape, including mobile telecommunications and transmissions, leads to consider solutions where ambient radio frequency signals can be used as an attractive source of energy for small mobile applications. The most common method of distributing power wirelessly is to use Radio Frequency (RF) radiation [START_REF] Shadrach | Energy Scavenging for Wireless Sensor Nodes with a Focus on Vibration to Electricity Conversion[END_REF]. It is now common to use RF energy-harvesting in passive Radio Frequency Identification (RFID) systems where RF energy is broadcasted to power remote small devices or tags in a range of less than 3 meters. The RFID systems exploit RF induction by using radio backscatter techniques which allow to consume very small power on the RFID tag during transmissions. Figure 2.3 on the preceding page illustrates with a simple drawing the RF energy-harvesting.

Using RF energy is interesting, however, RF energy harvesters have unfortunately limited power and need either large reception surface or to be very close to the transmitter. Yeatman [START_REF] Yeatman | Advances in Power Sources for Wireless Sensor Nodes[END_REF] remind that an electric field of 1 V/m permits harvesting no more than 0.26 µW/cm 2 , however, a maximum electric field close to the transmitter can generate only few Volts per meter.

Vibrations Energy Harvesting Electromagnetic Conversion

Electromagnetic energy-harvesting uses a magnetic field to convert mechanical energy to electrical energy [START_REF] Yildiz | Potential Ambient Energy-Harvesting Sources and Techniques[END_REF]. The conversion technique consists of attaching a coil to an oscillating mass and passing them through a magnetic field, which is established by a stationary magnet to produce electric energy. When the coil moves through a varying magnetic flux, a voltage is induced according to Faraday's law. Figure 2.4 illustrates such a system. Furthermore, the induced voltage is inherently small and therefore must be increased to become a viable source of energy [START_REF] Kulah | An Electromagnetic Micro Power Generator for Low-Frequency Environmental Vibrations[END_REF]. Several techniques exist to increase the induced voltage including using a transformer to increase the number of turns of the coil, or increase the permanent magnetic field [START_REF] Torres | Energy-harvesting chips and the quest for everlasting life[END_REF]. However, each of these parameters is limited by size constraints of the microchip as well as its material properties. Most of the applications of electromagnetic transducers are used to harvest vibrations energy to power wireless sensor networks. Some examples of this method can be found in [Mit+04; Chi+00; VB+06; AC98].

Electrostatic Conversion

To exploit this source of energy, an electrostatic machine or generator is required to leverage the static electric effect. The electrostatic machine is called so because it uses the electrostatic laws in contrast of electromagnetic machines. An electrostatic motor is based on the attraction and repulsion of electric charges. Electrostatic machines are usually the dual of conventional coil-based motors. Figure 2.5 illustrates this energy-harvesting method. Although electrostatic motors were developed since the 18th century, their use as macro generator was not very successful because they generate a very high voltage with small current. However, nowadays electrostatic generators are frequently used in Microelectromechanical Systems (MEMS) where their drive voltages are below 10 volts, and where moving, charged plates are far easier to fabricate than coils and iron cores.

Several conversion techniques of electrostatic energy was proposed in literature from friction machines throw nanotuble nanomotors. The energy conversion principal is summarized in [START_REF] Mitcheson | Architectures for vibration-driven micropower generators[END_REF] and different conversion techniques are summarized in [START_REF] Canby | Histoire de l'électricité[END_REF][START_REF] Meninger | Vibration-to-electric Energy Conversion[END_REF][START_REF] Mitcheson | Architectures for vibration-driven micropower generators[END_REF].

Piezoelectric Conversion

Piezoelectric energy-harvesting devices convert mechanical energy from any type of vibration to electrical energy. It is the most widely used power harvesting techniques for micro-power operations. Strain or deformation of a piezoelectric material causes charge separation across the device, producing an electric field and consequently a voltage drop proportional to the stress applied. Usually, piezoelectric inserts are connected to a mechanical system with a resonance frequency that couples the micro-generator to vibrations source, Figure 2.6 on the facing page illustrates such a configuration. The mechanical part is an oscillating system which is typically a cantilever beam structure with a mass at the unattached end of the lever that provides higher strain for a given Figure 2.6: Piezoelectric energy-harvesting principle input force. The voltage produced varies with time and vibrations frequency which produces an irregular current. Furthermore, piezoelectricity has the ability of some elements such as crystals or some types of ceramics to generate an electric potential from a mechanical stress [START_REF] Mateu | Physics-Based Time-Domain Model of a Magnetic Induction Microgenerator[END_REF]. This process takes the form of separation of electric charge within a crystal lattice. If the piezoelectric material is not short circuited, the applied mechanical stress induces a voltage across the material.

Piezoelectric energy conversion produces relatively higher voltage and power density levels than the electromagnetic system.

Roundy et al [START_REF] Roundy | A Study of Low Level Vibrations As a Power Source for Wireless Sensor Nodes[END_REF] performed a comparison between piezoelectric micro-generators and electrostatic ones. They showed that for a vibration frequency of 120Hz, piezoelectric micro-generators outperforms electrostatic ones with a power density of 250µW/cm 3 against 50µW/cm 3 . An other comparison between piezoelectric micro-generators and electromagnetic ones was performed by Poulin et al in [START_REF] Poulin | Generation of Electrical Energy for Portable Devices: Comparative Study of an Electromagnetic and a Piezoelectric System[END_REF] where they showed the duality of these two technologies and that electromagnetic conversion is suitable for structures with displacement and high speed. Piezoelectric generators work even with small motion amplitudes, their high power density makes them a suitable energy-harvesting technology for small devices. Roundy et al [Rou+03; RW04] realized piezoelectric micro-generator of 1cm 3 that can supply an RF transmitter.

The main limitation of vibration energy-harvesting techniques is that their efficiency depends highly on the resonance frequency. In fact, most of energy-harvesting devices are designed to work with one or few specific frequencies. If the resonance frequency changes, the conversion is no longer optimal and the output energy can fall brutally. Hopefully, piezoelectric energy-harvesting is currently a very active research area and many solutions have been proposed to solve this problem. Two main approaches have been proposed: linear and non linear. In the linear approach the generation of energy is optimal only for several specific resonance frequencies. The systems use frequency tuning technique to follow the frequency changes [You+11; AS+13] and can support up to 40% of frequency variation [AS+13]. In the opposite side, the non linear approach modifies the classical structure of piezoelectric harvesters by replacing the mass by a magnet and adding a permanent magnet at the limit of the beam. This lead the system to behave in an non linear way and increases the bandwidth of optimal resonance Figure 2.7: Operating principle of a thermoelectric generator frequencies [START_REF] Gammaitoni | Sustainable ICT: Micro and Nanoscale Energy Management[END_REF]. This solution allows the harvester to keep a minimum output power and resist to frequency variation.

Thermoelectric Energy Harvesting

The difference of temperature between two points can be used to produce electrical energy by heat transfer. Figure 2.7 illustrates the operating principle of thermoelectric energy-harvesting method. The Carnot Cycle is used to compute the maximum theoretical efficiency of such a conversion. It is the ratio of the difference of temperature relative to the highest temperature (see Equation 2.1).

ef f iciency =

T he maximum temperature -T he minimum temperature T he maximum temperature (2.1) This measure shows the efficiency is very low in the case of a small difference of temperature. For example, between the human body temperature, i.e. 37 • C and an ambient temperature of 20 • C, the efficiency cannot be more than 5.5%.

Still, some micro-generators were developed and their efficiency was lower than 10% for heat transfer from 200 • C to 20 • C and lower than 1% from 40 • C to 20 • C. Toriyama et al realized in [START_REF] Toriyama | Thermoelectric Micro Power Generator Utilizing Self-standing Polysilicon-metal Thermopile[END_REF] a micro-battery that can deliver few µW . Though, some applications with high energy consumption were successfully supplied with thermoelectric generators. Douseki et al [START_REF] Douseki | A batteryless wireless system uses ambient heat with a reversiblepower-source compatible CMOS/SOI DC-DC converter[END_REF] developed an autonomous wireless communication system that harvests its energy from the difference between the ambient temperature and and cold water. For this application, the output power was 1.6 mW . Few industrial applications that use thermoelectric energy-harvesting have been proposed. For example, Seiko Thermo Wristwatch generates enough power to run the clock engine by absorbing body heat through the back of the watch. An other commercial application is Thermo Life [START_REF] Stark | Invited Talk: Thermal Energy Harvesting with Thermo Life[END_REF]. It is a small thermoelectric generator that can provide 10µA at 3 V with only 5 100 µW/cm 3 only with a thermal gradient of 1 • C.

The above list of exploitable energy sources is not exhaustive, other energy sources can also be exploited, these are the most investigated ones.

Energy Sources Comparison

Recall that the scope of this dissertation is the real-time scheduling for embedded systems working with energy-harvesting. Real-time means predictability, thus, we should carefully select the right energy-harvesting technique to the right application to ensure predictability. In fact, designers should measure the worst energy consumption of the targeted applications and ensure that the selected energy source and its harvesting technology are capable to supply the necessary energy even in the worst case. Solar energy for example cannot be available all the time, then, it is not suitable as main energy source for applications with hard real-time constraints that are expected to run for very long time but can be used as a secondary source. However, piezoelectric energy-harvesting may be a promising harvesting method for small monitoring sensors in manufacturing and petrochemical installations because it has a high power density comparing to the other sources (see Table 2.1) and can resist to vibration frequency variations by capturing a large spectrum of frequencies using tuning and non-linear adaptation approaches.

Energy Storage Technologies

During the last decades, rechargeable batteries have made only moderate improvements in terms of higher capacity and smaller size, has brought about a variety of chemical energy storage devices, each one offers some advantages but none of them provides a fully satisfactory solution. Therefore, we should select the right energy storage technology for the right application.

Energy storage devices are evaluated by means of several factors and metrics, the following list describes the most important ones.

• Energy Density: is the amount of energy stored per unit of mass or volume, it is expressed in W h/m 3 for Volumetric Energy density and W h/kg for Gravimetric Energy Density. The greater energy density is, the better it is.

• Nominal capacity: is the amount of charge expressed in Ampere-hour that can be delivered by an energy storage unit

• Internal resistance: when the storage device delivers current, the measured voltage output is lower than the theoretical voltage. The difference is the voltage drop caused by the internal resistance. Therefore, the lower internal resistance is, the better it is.

• Charge rate: a charge or discharge current of a battery is measured in C-rate. A discharge current of 1C draws a current equal to the rated capacity. For example, a battery rated at 1000 mAh provides 1000 mA for one hour if discharged at 1C rate.

• Cycle life: is the number of charge-discharge cycles that the energy storage device can achieve. • Self-discharge: is the percentage of capacity loss when the storage device is not used.

• Fast charge time: is the shortest time needed to fully replenish the device An ideal energy storage device should be small, light and quickly rechargeable with a long lifespan. Different technologies of energy storage have been investigated and commercialized, we can distinguish two main families of energy storage devices: batteries and capacitors (or super capacitors).

Rechargeable Batteries

Chemistry batteries are the most widely used nowadays as energy-storage technology for electronic devices [START_REF] Casas | Battery Sensing for Energy-Aware System Design[END_REF]. Many materials have been used to develop batteries with different characteristics. In the following we describe briefly the chemistry batteries available in the market: Nickel Cadmium (NiCd): is the oldest technology, research began on a sealed NiCd battery, which recombined the internal gases generated during charge rather than venting them. These advances led to sealed NiCd battery which is in use today. The NiCd supports better fast charge and performs better under rigorous working conditions. Although it supports a high number of charge-discharge cycles, a periodic full discharge is so important that, if omitted, large crystals will form on the cell plates and the NiCd will gradually loses its performance. This phenomena is also known as memory effect. Furthermore, NiCd has relatively a low energy density and has a bad environmental impact due to its toxic metals. Nickel-Metal Hydrid (NiMH): this technology is gradually replacing NiCd because it offers 30-40% higher capacity and a higher energy density. However, both NiMH and NiCd are affected by high self-discharge. The NiCd loses about 10% of its capacity within the first 24 hours, after which the self-discharge settles to about 10%. Moreover, it needs deep charging cycles and does not support high rate of charge-discharge cycles. Lead Acid: this kind of batteries work with flooded lead acid. This technology is used today in automobiles batteries where batteries are all the time in vertical position. Unlike the NiCd, lead acid batteries does not like deep charging cycles. A full discharge causes extra strain and each discharge/charge cycle decreases the battery capacity. This loss is very small while the battery is in good operating conditions, but increases dramatically once the performance drops below 80% of its nominal capacity. Even though, this technology has one of the lowest self discharge rates, it offers a low energy density which limits its usage to stationary applications. Lithium Ion (Li-ion): Lithium is the lightest of all metals, has the greatest electrochemical potential and provides the largest gravimetric energy density. Rechargeable batteries that uses lithium metal are capable of providing both high voltage and excellent capacity, resulting in an extraordinary high energy density. Moreover, it offers a low self-discharge rate about half less than NiCd and NiMH. Though, it requires protection circuits that reduces voltage and current. Li-ion is widely used to supply portable devices like cameras and phones. Figure 2.12 shows an example of commercial Li-ion batteries.

Lithium-ion Polymer (Li-polymer):

Li-polymer batteries use different type of electrolyte, a dry solid polymer electrolyte only. This electrolyte looks like a plastic film that does not conduct electricity but allows an exchange of ions. The polymer electrolyte replaces the traditional porous separator, which is soaked with electrolyte. The dry polymer design offers simplifications with respect to fabrication, ruggedness, safety and thin-profile geometry. There is no danger of flammability because no liquid or gelled electrolyte is used. Unfortunately, the dry Li-polymer suffers from poor conductivity. Internal resistance is too high and cannot deliver the current bursts needed for modern communication devices. Reusable Alkaline : replaces disposable household batteries; suitable for low-power applications. Its limited cycle life is compensated by low self-discharge, making this battery ideal for portable entertainment devices and flashlights.

Supercapacitors

A supercapacitor works like a regular capacitor with the exception that it offers very high capacitance in a small size, resulting in an intermediate energy density between regular capacitors and chemistry batteries. Moreover, the amount of energy a capacitor can hold is measured in microfarads (1 µF = 10 -6 farad). Small capacitors are measured in nanofarads (1000 times smaller than 1 µF ) and picofarads (1 million times smaller than 1 µF ). Supercapacitors are rated in units of 1 farad and higher. The gravimetric energy density is 1 to 10Wh/kg [START_REF] Buchmann | Batteries in a Portable World[END_REF]. This energy density is high in comparison to the electrolytic capacitor but lower than batteries, it is approximately 10% of the one of NiMH battery. A relatively low internal resistance offers good conductivity [START_REF] Buchmann | Batteries in a Portable World[END_REF]. Figure 2.14 illustrates some commercial super capacitors.

The major disadvantage of super capacitors is the extremely high self-discharge rate, however, this may not be an obstacle for small devices since a supercapacitor is fully discharged after several days. Some supercapacitors can retain the charged energy longer. Their capacity drops from full charge to 85% in 10 days. In 30 days, the voltage drops to roughly 65% and to 40 % after 60 days [START_REF] Buchmann | Batteries in a Portable World[END_REF].

Supercapacitors have also many advantages, we list hear some of them.

• Unlimited cycle life: not subject to the wear and aging experienced by the electrochemical battery,

• Low impedance: enhances pulse current handling by paralleling with an electrochemical battery, • Rapid charging: low-impedance supercapacitors charge in seconds,

• Simple charge methods: voltage-limiting circuit compensates for selfdischarge, no full-charge detection circuit needed.

Supercapacitors may be interesting energy storage devices for energy-harvesting systems since they are continuously charging and almost continuously supplying electronics components which fits with their advantages and avoid their drawbacks. Table 2.2 summarizes the differences between all the presented technologies.

Energy-Harvesting Applications

Researchers are more and more interested by energy issues in ICT 1 . This interest is due to the disproportional progress between the computing part and energy part in modern embedded systems. Research is leaded by a growing demand of miniaturized and autonomous devices from industries and users. Therefore, several companies which are focusing energy issues of small embedded systems have emerged. Companies like AdaptiveEnergy, EnOcean, Cymbet and Perpetium, among others are specialized in energy-harvesting systems. The main applications developed by these companies are mainly concentrated on military fields (e.g. battlefield surveillance, recognition of enemies and drones attacks, etc.), environment issues (e.g. animals movement tracking, Figure 2.15: Energy-Harvesting forest fire detection, pollution monitoring, etc.), manufacturing industries (engines monitoring, etc.) and health issues (e.g. medical implants, health monitoring, etc.).

Conclusion

In this chapter, we introduced energy-harvesting systems and their components. After stating the notion of energy-harvesting, we presented a non-exhaustive list of different renewable energy sources that can be exploited and their extraction methods. We observed that energy from solar and vibration sources is the most efficiently extracted thanks to piezoelectric and photovoltaic technologies.

After that, we investigated the different types of energy storage devices and we compared their strengths and weaknesses. We noticed that the market of energy storage is dominated by chemical batteries especially by Lithium-ion batteries whose recent models offer high capacity, high energy density and long lifespan. Nevertheless, the second family of energy storage units, which is supercapacitors, is more and more competitive comparing to batteries. Recent supercapacitors have much higher energy density and capacity than regular capacitors, and offer a huge cycle life with a longer self-discharge time. These advantages allow supercapacitors to be used as a real energy storage device instead of only short time energy buffers, which makes them more suitable for small and autonomous devices.

For autonomous real-time applications, supercapacitors and adaptive piezoelectric energy-harvesting seem to be the most suitable energy storage devices and energy extraction methods since they allow a high and stable extraction of energy and a flexible and quick storage and use of the extracted energy.

In the next chapter, we focus on the computational part of an energy-harvesting system and we address the real-time scheduling problem that considers the constraints of an energy-harvesting systems.

Introduction

The aim of embedded systems that work with environmental energy is to achieve a set of missions autonomously for very long time. The missions of such applications are mainly sensing operations, data processing and data transmission. These operations are managed by the computational part of an energy-harvesting system as mentioned in Chapter 2. Usually, energy-harvesting embedded systems are constrained by time in order to deliver critical results on time, especially for critical embedded systems such as medical implants or nuclear reaction monitoring devices. Therefore, it is mandatory to guarantee the respect of time and energy constraints of these systems. Then, it is worthy to study the real-time scheduling under renewable energy constraints for systems that consider energy.

A naive approach consists of oversizing the capacity of the components of the system: a very large energy harvester (e.g. a huge solar panel), an overestimated energy storage device capacity and an oversized computation unit that guarantees the validity of the real-time system under pessimistic schedulability analysis. However, this may be very costly and may not fit with the desirable size especially for small applications (e.g. medical implants).

This has motivated researchers to focus on this challenging problem. The crucial issue associated to these systems is to find scheduling mechanisms that can manage their performance and their activity according to the available energy along the system lifespan in order to respect both time and energy constraints. Now, the primary concern is that the energy collected from the environment, and that can be stored, should be fully consumed to maximize system's performance and avoid energy waste.

In this chapter we address the real-time scheduling problem for energy-harvesting systems. After setting the scope of this dissertation by specifying the formal model of the targeted real-time energy-harvesting systems in Section 3.2 and the associated scheduling problematic in Section 3.3, we give a brief overview of the available scheduling approaches in Section 3.4. Then, we focus only on energy-aware scheduling approach and we explore the properties of the different classes of scheduling algorithms that are proposed in the literature from Section 3.5 to Section 3.7. Finally, we present the results of our experiments that compares the algorithms, and then, we summarize their differences in Section 3.8.

Task Model

The task model considered here is an extension of Liu and Layland's model, described in Section 1.2 on page 30, that considers task energy consumption in addition to the classical parameters. Then, we consider a real-time task set in a renewable energy environment defined by a set of n periodic/sporadic and independent tasks {τ 1 , τ 2 , . . . , τ n }. Each task τ i is characterized by its priority P i , its worst-case execution time C i , its period T i , its relative deadline D i and its worst-case energy consumption E i . Therefore, a task τ i releases an infinite number of jobs separated by at least T i time units and each job is executed during C i time units and consumes E i energy units and must finish before D i time units after being requested. Moreover, the deadlines are constrained or implicit and the task set is priority-ordered such that task τ n is the task with the lowest priority.

General Model

An energy-harvesting system being composed of a real-time computational part should be first described as a classical real-time system with a set of recurrent tasks, as explained in Chapter 1, and second as a more complex system by including the energy source and the energy storage constraints described in Chapter 2. In this section we specify the general formal model considered by this dissertation.

Energy Model

We consider an embedded system connected to an energy harvesting device. An energy-harvesting device as described in Section 2.2 on page 48 is a system that collects the ambient energy from the environment using an energy-harvesting technique. The collected energy is then stored in an energy storage unit with fixed capacity (e.g. rechargeable battery or supercapacitor).

Replenishment:

We suppose that the amount of energy that arrives into the storage unit is a function of time which is either known or bounded. Recall that the profile of energy arriving from the harvester depends on the energy source and the harvesting technique. Most of energy sources are unpredictable or predictable with difficulty, for example, solar energy harvesting depends on brightness intensity which cannot be predicted accurately. For this reason, since the scope of this dissertation is hard real-time scheduling for energy-harvesting systems, we consider only energy sources and harvesting techniques that can provide a predictable profile of energy or that can be lower bounded. Hopefully, such energy profiles exist especially with vibration energy source and piezoelectric harvesting technique which seem to be suitable for small embedded systems. It provides a nearly stable output of energy even with a deviation of vibration frequency up to 40% form the optimal one as explained in Section 2.3.2 on page 52.

Therefore, as a first step, we can consider a uniform or a bounded replenishment function which means that the storage unit receives a constant amount of energy every time unit. We denote P r (t) the replenishment function of the battery, then, the energy Chapter 3. Real-time Scheduling for Energy-Harvesting Systems replenished during any time interval [t 1 , t 2 ] denoted as g(t 1 , t 2 ) is given by Equation 3.1.

g(t 1 , t 2 ) = t 2 t 1 .P r (t) dt (3.1)
As mentioned above, we assume that that P r (t) is a constant function, i.e. P r (t) = P r . Then, the energy replenished during any time interval [t 1 , t 2 ] is given by Equation 3.2.

g(t 1 , t 2 ) = (t 2 -t 1 ) × P r (3.2)
In the remainder of this dissertation, we use P r instead of P r (t) to denote the replenishment function and we suppose that it is lesser than or equal to the battery capacity.

Storage:

The replenishment of the storage unit is performed continuously even during jobs execution and the level of the stored energy fluctuates between two thresholds E min and E max where E max is the maximum capacity of the storage unit and E min is the minimum energy level that keeps the system running. The difference between these two thresholds is the part of the battery capacity dedicated to tasks execution. This capacity is denoted C. We suppose that C is sufficient to execute at least one time unit of each task. This means that C must be greater or equal to the maximum instantaneous consumption, i.e. C ≥ max ∀i (E i /C i ), otherwise some tasks cannot be executed. We suppose also that the storage device is carefully selected to ensure regular behavior, i.e. regular replenishment and regular discharge in order to avoid charge/discharge speed variations and capacity losses due to numerous charge/discharge cycles. Recall that supercapacitors can offer these requirements as mentioned in Section 2.4.2 on page 60.

For the sake of clarity, we can consider without loss of generality that E min = 0 and that C = E max . The battery level at time t is denoted as E(t). Below, we use the word "battery" to refer to the energy storage unit in order to simplify the language.

Consumption: Tasks energy cost should actually include not only dynamic and static processor energy consumption but also the consumption of other devices that a task can use, e.g. sensors and data transmission devices. Moreover, even if we consider only processor consumption, the global consumption depends much more on the kind of circuitry used by the code than on the execution duration [START_REF] Jayaseelan | Estimating the Worst-Case Energy Consumption of Embedded Software[END_REF]. For this reason we consider that the execution time C i and the energy consumption E i of a task are fully independent. For example, considering two tasks τ i and τ j that do not use the same devices, then, we can have C i < C j and E i > E j . Furthermore, we consider that energy consumption is function of time that is in reality not necessarily uniform. Actually, since tasks can use different devices, it is difficult to predict the accurate energy profile of tasks. Moreover, the worst energy consumption profile is not known up to now. This is a serious issue for real-time predictability, however, including this constraint to scheduling decisions makes it a hard problem with many parameters to consider. As a first step and for the sake of simplicity, we consider for the scope of this dissertation The second concern is tasks energy consumption profile. If the consumption function is not constant but does not vary much during the execution of the tasks, one can intuitively use the higher boundary as a safe limit. This is still one of the open questions to address.

Although this model is not totally realistic, it is still interesting to study as a first step of this research area because the scheduling problematic for energy-harvesting systems is not easy to handle and contains numerous counter intuitive properties, especially for fixed-priority scheduling.

Definitions

Here we define some new properties and we redefine some properties that we already defined in Section 1.5.1 on page 41 to include energy requirements.

Definition 3.1 (Energy Valid Schedule).

The schedule S produced by scheduling algorithm A is considered as valid only and only if all the deadlines are infinitely met and the battery energy level never falls below E min .

Definition 3.2 (System Energy Utilization).

The system energy utilization denoted U e is the ratio of energy to be consumed by the execution of the task set relative to the energy that can be replenished. In the case of constant replenishment function P r , it can be obtained by Equation 3.3.

U e = n i=1 E i T i × P r (3.3) Definition 3.3 (Energy-Busy-Period).
An energy-busy-period is an interval of time [t 1 , t 2 ] where the system is continuously executing jobs or replenishing energy if the battery level is not sufficient to execute the ready job, i.e. E(t) < E i /C i , while there are waiting jobs. It starts from time t 1 when the processor is idle for the last time and ends at time t 2 when all waiting jobs are finished. It is possible to have consecutive energy-busy-periods since it depends on the waiting jobs and not only the processor or the replenished energy.

Definition 3.4 (Energy-Concrete Systems

). An energy-concrete system is a system whose time and energy parameters are known before run-time. This includes tasks periods, tasks offsets and the initial energy storage level of the storage unit. In the opposite, if all or one of these parameters is known only at run-time, then, the system is said energy-non-concrete.

Definition 3.5 (Energy-Work Conserving).

A scheduling algorithm is classified as energy-work-conserving policy if whenever there are active tasks requiring execution, the scheduling policy leaves the processor idle only if there is no enough energy available to execute at least one time unit of the active task. In contrast, if the scheduling policy authorizes unnecessary idle times, it is classified as non-energy-work-conserving.

Definition 3.6 (Consumming Task).

A task is considered as a consuming one if its energy consumption is greater than the energy replenished during its execution time.

Definition 3.7 (Gaining Task).

A task is considered as a gaining one if its energy consumption is lesser than or equal to the energy replenished during its execution time.

Scheduling Problematic 71

Scheduling Problematic

Throughout this dissertation, we will be interested in the monoprocessor fixedpriority real-time scheduling problem for energy-harvesting systems. In the considered model, the system has to ensure the correctness of results and the respect of deadlines before which results must be delivered. It has also to keep the system running by satisfying all energy requirements.

A key consideration that affects power management in energy-harvesting systems is that instead of minimizing the energy consumption and maximizing the achievable lifetime, as n classical battery operated devices, the system must operate in an energy neutral mode by consuming energy only as much as harvested.

Moreover, the classical scheduling algorithms and their associated feasibility conditions are no longer suitable for the energy-harvesting model because they do not consider energy constraints. In fact, respecting energy constraints, namely tasks energy cost and battery capacity, leads the scheduler to add more idle periods to replenish energy, thus, a classical Fixed-Task-Priority (FTP) scheduling algorithm works only when the battery is overestimated and fully charged. Furthermore, the additional idle periods delay tasks response times which makes the classical response time analysis and feasibility conditions necessary but not sufficient for this model. Figure 3.2 on the next page shows an example where the classical FTP scheduling algorithm leads the system to run out of energy while a feasible schedule is possible by adding greedily replenishment periods. It shows the time chart of the task set described in Table 3.2(a) as well as the battery level chart. We observe that the FTP algorithm executes jobs as soon as possible and consumes energy until the battery runs out of energy (see Figure 3.2(b)). This is because the energy demand of the executed jobs is higher than the available energy, i.e. the replenished and the remaining energy in the battery, during their execution. In contrast, when more idle periods are added, the energy demand is still the same and the available energy is greater, and therefore, a feasible schedule becomes possible (see Figure 3.2(c)). Thus, managing jobs scheduling in energy-harvesting systems is managing the length and the time of replenishment periods.

An other key consideration of managing the scheduling of energy-harvesting systems is the battery capacity. The design of a system with an arbitrary battery capacity may lead to an oversized C, which can be very costly in space, weight and money. Finding the lowest battery capacity that preserves the schedulability of a task set is a very important issue.

Given a feasible task set with C = ∞, the minimum battery capacity issue in energy-harvesting systems is to find the smallest capacity denoted C min that keeps the task set schedulable with the considered algorithm when the system is started with the minimum battery level.

The exact value of C min is difficult to estimate because it depends on the environmental characteristics and the used scheduling algorithm. One can solve the problem partially by bounding C min .

Chapter 3. Real-time Scheduling for Energy-Harvesting Systems

-C i E i T i D i P i τ 1 2 6 8 3

Scheduling Approaches

To summarize, the problems we are interested in can be formulated by the following questions.

1. Scheduling algorithms: How can we schedule a given fixed-priority real-time task set on one processor so to perpetually respect tasks deadlines and satisfy their energy demand while keeping the battery level higher than E min ?

2. Feasibility conditions: Does a necessary and sufficient feasibility condition, that guarantees before run-time the feasibility or the unfeasibility of a given taskset, exist ?

3. Minimum energy storage capacity: What is the minimum battery capacity that keeps the feasibility of a given task set ?

Through this dissertation, we will first explore some solutions and some answers to these questions that have been proposed in the literature, and then, we explain the contributions of this thesis.

Scheduling Approaches

In the last decades, different solutions have been proposed in the literature to deal with energy issues. Most research focused on reducing the global energy consumption of the system. This is due to promising autonomous embedded systems whose lifetime was seriously limited by the capacity of batteries. Later, with the emerging energyharvesting technologies, researchers realized that they should not focus only on energy consumption optimization but also on the management of renewable energy. This kind of energy is collected from the environment with small quantities but with a continuous supply. From this, we can identify two main families of real-time scheduling research that address energy issues: scheduling for energy consumption optimization, mainly represented by Central Processing Unit (CPU) frequency and voltage scaling, and energy-aware scheduling that manages executions and replenishment to operate perpetually.

Dynamic Voltage and Frequency Scaling

The Dynamic Voltage and Frequency Scaling (DVFS) approach consists of slowing down the processor speed by reducing either the voltage or the processing frequency or both in order to reduce the processor energy consumption [START_REF] Pering | The Simulation and Evaluation of Dynamic Voltage Scaling Algorithms[END_REF][START_REF] Weiser | Scheduling for Reduced CPU Energy[END_REF]. This approach relies on the fact that the energy consumption in small embedded systems comes mainly from processor's dynamic energy consumption [START_REF] Dakai Zhu | The Effects of Energy Management on Reliability in Real-time Embedded Systems[END_REF]. The research interest for this approach was amplified when microprocessors manufacturers released processors with DVFS capabilities (e.g. Intel's SpeedStep, AMD's Cool'n'Quiet and PowerNow, etc.). Many solutions propose real-time scheduling schemes that use DVFS capabilities to respect deadlines and to reduce the global energy consumption. When using DVFS, tasks execution times become longer due to slower processing. Then, for real-time scheduling, the slack-time or the available idle time can be used to reduce energy consumption by slowing down the processor and lengthening tasks response times [START_REF] Pering | The Simulation and Evaluation of Dynamic Voltage Scaling Algorithms[END_REF][START_REF] Weiser | Scheduling for Reduced CPU Energy[END_REF]. The challenges of such an approach are to select the right subset of jobs for which are applied frequency scaling and to select the right CPU frequency to apply for each task. Unfortunately, this was proved to be a Non-deterministic Polynomial-time Hard (NP-Hard) problem in [START_REF] Zhu | Energy Management for Real-time Embedded Systems with Reliability Requirements[END_REF], thus, works dealing with this problem focused mainly on proposing adapted heuristics [ZQA07; ZA09]. The main drawback of scaling the voltage and frequency is that it increases the risk of transient errors in Complementary Metal-Oxide-Semiconductor (CMOS) logic circuits [JK95; HS00; Zie14]. To cope with this difficulty, fault tolerance techniques have been used by introducing redundancy. Zhu et al. in [START_REF] Zhu | Energy Management for Real-time Embedded Systems with Reliability Requirements[END_REF] proposed a heuristic that uses slack-time to perform DVFS and reserve time for rollback tasks as fault tolerance method.

The DVFS is an interesting technology to reduce the energy consumption of the system for embedded systems equipped with processors with several CPU frequencies. However, it increases the risk of transient faults which requires the implementation of fault tolerance techniques and may make the gain of consumed energy not worthy. Furthermore, even though it reduces the global energy consumption, it cannot be used alone in an energy-harvesting system especially when the slower frequency is not sufficient to reduce enough the consumed energy. Some adaptations for energyharvesting systems have been proposed, however, most of them are still supposing negligible faults rate and a large number of CPU frequencies.

Energy-Aware Scheduling

In contrast to DVFS, energy-aware scheduling aims to dynamically manage the available energy at any time, i.e. the energy collected from the environment and drained from the battery, rather than optimizing or minimizing the global energy consumption. It consists of selecting the right periods of execution and the right periods for replenishment so to ensure a perpetual operation. This scheduling approach considers only mono-frequency processors, and therefore, only two modes: active mode where the system consumes energy and inactive mode where the system is idle and does not consume energy or consume a negligible amount of energy. In this dissertation we will focus only on this scheduling approach. In the remaining part of this chapter, we explore different scheduling algorithms proposed in the literature for this scheduling approach. For each algorithm, we specify the model for which it was designed and we study some of its properties, e.g. optimality, minimum battery capacity, etc. After that we test these algorithms with the model specified in Section 3.2 on page 67 in order to compare them by simulations, and then, we summarize their strengths and weaknesses.

Other Approaches

There exist other approaches to respect energy and temporal constraints. Some of them use the concept of task reward. In this kind of approaches, each task is characterized with a set of versions, each version represents the a different level of precision or quality of service. The response time of a task is composed of a critical or a mandatory part and a set of less critical or optional parts. Thus, the higher the executed version is, the more energy is consumed and the greater the reward is. The aim of reward-based approaches is to find the right version for each task such that the energy budget is enough and the deadlines are met. Rusu et al. proposed in [RMM03a;[START_REF] Rusu | Multiversion scheduling in rechargeable energy-aware real-time systems[END_REF] such a solution for systems that are powered with rechargeable batteries.

However, if we consider tasks with only one version and a processor with only one frequency, the scheduling problem is reduced to the model described in Section 3.2 on page 67.

Scheduling for Frame-Based Systems

The real-time scheduling for embedded systems with rechargeable batteries was addressed for the first time by Allavena et al. in [START_REF] Allavena | Scheduling of Frame-based Embedded Systems with Rechargeable Batteries[END_REF]. They studied the problem only for the frame-based task model and they proposed a scheduling algorithm for this model.

Frame-Based Model

The aim of Allavena and Mossé in [START_REF] Allavena | Scheduling of Frame-based Embedded Systems with Rechargeable Batteries[END_REF] was to propose a solution for monoprocessor embedded systems with voltage and frequency scaling capabilities. In the first part of the paper, they proposed a scheduling algorithm for monoprocessors with only one voltage and one frequency. In this subsection, we discuss only this case to fit with the objectives of this dissertation. Therefore, the considered model is described as follows.

Task Model

They considered a frame-based task set Γ composed of n independent tasks that share the same period T (also called frame) and the same implicit deadline D = T . Each task takes C i time units and consumes E i energy units at a constant instantaneous rate E i /C i .

Energy Model

The system runs with a rechargeable battery, whose energy level at time t denoted E(t) remains between two boundaries E max and E min . The battery has a capacity C = E max -E min and is replenished with a constant power rate P r even during executions.

Due to the constant nature of consumption and replenishment rates, we can combine them. Then, we can distinguish two groups of tasks, namely gaining tasks denoted Γ g , that consume less energy than replenished, i.e. Γ g = {τ i ∈ Γ, P r -E i /C i ≥ 0}, and dissipating or consuming tasks denoted Γ c that consume more energy than replenished, i.e. Γ c = {τ i ∈ Γ, P r -E i /C i < 0}. Then, the energy gained by the group Γ g in one frame is |Γ g | = τ j ∈Γg P r × C j -E j , and the energy consumed by group Γ c is

|Γ c | = τ j ∈Γc E j -P r × C j .
All the tasks are requested at time t = 0 with a fully charged battery, i.e. E(0) = E max and preemptions are allowed.

Algorithm Description

For the above model, the scheduling algorithm must execute all the tasks within D time units starting with a fully charged battery and ending the frame with the same battery level. The intuition of the proposed algorithm is to execute tasks until the battery goes to the minimum level by running only consuming tasks, and then, replenish as much as possible by executing gaining tasks and adding idle periods if necessary. Thus, the battery level fluctuates between E max and E min and the same schedule is repeated for each frame.

Algorithm's rules

For the sake of clarity, we call this algorithm Frame-Based Algorithm (F BA). It is described by Algorithm 3.1 on the facing page and respects the following rules:

1. if |Γ c | > |Γ g |, an idle period of length idle = |Γc|-|Γg|
Pr is added before the execution of Γ c .

if n

i=1 C i + idle > D, the algorithm cannot schedule the task set and the deadline is missed.

3. Schedule tasks of Γ c until there are no more tasks in Γ c or the battery is fully discharged, i.e. E(t) = E min . The last task being executed can be preempted.

4. Schedule tasks of Γ g until the battery is fully charged. Analogously, it may be necessary to preempt last task being executed.

5. Repeat step 3 and 4 by scheduling first the preempted task of the right group and so on until the end of the frame workload.

Note that the algorithm can operate even if the system is launched with an empty battery or a different initial battery level. Figure 3.3 on page 78 illustrates an example of F BA algorithm schedule under different battery configurations.

Complexity

The F BA algorithm is simple, all the instructions are simple and the only operation that can be costly in time is to compute the set of active tasks which can be optimized to a complexity of O(n) by considering that the tasks are sorted with their consumption rate. Therefore, the global complexity of F BA is O(n).

Minimum Storage Unit Capacity

This property was not addressed in the paper proposing the algorithm but it seems to be obvious due to the simplicity of the model and scheduling schemes. Intuitively, by scheduling all tasks inside one frame with only one request time and one deadline and by following the pattern of gaining-consuming or consuming-gaining tasks, in the worst-case when the battery is empty (E(t) = E min ), the minimum battery capacity that keeps a schedulable task set schedulable is the maximum instantaneous energy consumption of tasks. Instead of having only one cycle of gaining-consuming tasks, we can keep the same response time by splitting it to many small cycles which lowers the maximum reachable battery level, and thus, the battery capacity. Furthermore, on can also add the energy replenished during inactivity periods in order to ensure the same energy level at the beginning of each frame.

Optimality

This question was not addressed in the paper. Though, the algorithm seems to be optimal for the specified model. Intuitively, when all the tasks share the same period and the same deadline the order of tasks is not important if the deadline is met. This algorithm sorts the tasks so to schedule gaining tasks before consuming ones when the minimum energy level is reached to replenish a maximum of energy before executing the consuming tasks which reduces to the maximum the useless replenishment periods. Then, if a deadline is missed, this means that the available energy in one frame is not sufficient. In this case, no algorithm can avoid this deadline miss.

EDF-based Scheduling Algorithms

The following algorithms are adaptations of the classical Earliest Deadline First (EDF ) algorithm described in Section 1.4.7 on page 40. These algorithms propose different strategies to cope with the delays caused by energy-harvesting and energystorage constraints. In this section, we present EDF As Late As Possible (EDL), EDF with energy guaranty (EDeg) and Lazy Scheduling Algorithm (LSA) algorithms.

EDF As Late As Possible Scheduling (EDL)

The EDL algorithm was proposed by Silly in [START_REF] Silly | The EDL Server for Scheduling Periodic and Soft AperiodicTasks with Resource Constraints[END_REF]. It does not consider energy constraints but schedules tasks by respecting EDF rules and delaying executions as long as possible by anticipating all the available slack-time. It can be used in the context of energy-harvesting systems to maximize replenishment periods.

Model Task Model

The model associated to EDL is very close to the one described in Section 3.2 on page 67. In order to be able to compute the exact values of slack-time, only periodic tasks with null offsets (i.e. ∀ τ i , O i = 0) and constrained or implicit deadlines are considered. Then, the arrival times, energy costs and deadlines are known before run-time. The hyper-period, i.e. the least common multiple of tasks periods, is denoted HP .

Energy Model

The slack-time computation used by EDL algorithm does not include energy constants. Therefore, it can theoretically work with any energy source and storage models. In this dissertation we apply EDL to the general model described in Section 3.2 on page 67 and we use it to compare the effect of delaying execution with other algorithms.

Algorithm Description

The main idea of EDL is to differ executions in order to maximize the length of idle periods and thereby replenishment time. When a job is ready to be executed at time t according to EDF rules, EDL computes first the available slack-time time of the system. Then, the ready job is executed only if the slack-time is 0 and the energy is sufficient to execute. Otherwise, it is delayed until the slack-time is fully consumed. The computation of slack-time with EDF scheduling is described in [START_REF] Silly | The EDL Server for Scheduling Periodic and Soft AperiodicTasks with Resource Constraints[END_REF]. The author proposes two approaches: a static offline approach and a dynamic online one. In this section, we give some insights about the static approach. It consists first of identifying in a set denoted K, the time instants when potential idle periods can begin within the hyper-period, and second, computing the length of each of these periods in a set denoted D. Formally:

1. K, the deadlines set is a sorted set of times at which idle times can begin within time interval [0, HP [. It is composed of distinct deadlines of all jobs inside [0, HP [. Then,

K = { k 0 , k 1 , • • • , k i , k i+1 , • • • , k q }, with k i < k i+1 , k 0 = 0 and k q = HP -min 1≤i≤n (x i ), with x i = T i -D i .
We note that q ≤ N + 1 where N denotes the number of jobs requested during [0, HP [.

EDF-based Scheduling Algorithms 81

2. D, the idle periods lengths set contains the lengths of idle periods.

D = {∆ 0 , ∆ 1 , • • • , ∆ i , ∆ i+1 , • • • , ∆ q }
, where ∆ i is the length of the idle period that begins at time k i . It can be calculated by Formula 3.4:

∆ i = min 1≤i≤n (x i ) if i = q ∆ i = max(0, F i ) if 0 ≤ i ≤ q -1 (3.4)
with :

F i = (HP -k i ) - n j=1 HP -x j -k j T j × C j - q k=i+1 ∆ k
Then, EDL uses the set K to decide when to postpone executions and D to know for how long. Figure 3.4 on the following page shows an example where K = { 0, 6, 8, 12, 15, 20, 24, 30, 32, 22 }, and D = { 2, 0, 1, 0, 2, 1, 0, 0, 3, 22 }. Then, for example at time 32, EDL delays executions for 3 units.

Complexity

We note that the schedule of one hyper-period with EDL is achieved in O(N × n) operations in the worst case [START_REF] Silly | The EDL Server for Scheduling Periodic and Soft AperiodicTasks with Resource Constraints[END_REF]. This complexity depends on the periods and deadlines which make it pseudo-polynomial. It may be relatively high when periods are prime integers because it maximizes the hyper-period length and thus the number of jobs N .

Optimality

This algorithm is clearly not optimal for energy-harvesting systems because when E max is reached during an idle period, the surplus of energy is wasted. This wasted energy may be necessary for a future job. Figure 3.4(c) on the next page shows a counter example. It illustrates a situation where energy is wasted at time 8 and 15 which leads the system to run out of energy at time 32 while the slack-time was already consumed. However, EDL seems to be optimal if we consider an infinite battery capacity or if we resume executions when E max is reached. This intuition is based on the fact that when a deadline is missed at time d, the energy balance, i.e. the difference between the available energy until time d and energy demand of time interval [0, d[ is negative. Since EDF is driven by deadlines, if energy is not wasted, it is impossible to schedule the task set because there exists at least one interval where an unavoidable negative energy balance happens.

Minimum Storage Unit Capacity

It is not easy to compute the exact battery capacity needed to schedule a feasible task set with EDL because we need to know the wort-case scenario that needs the highest capacity. However, one can provide a lower bound of the battery capacity by summing the energy collected during all the idle periods of one hyper-period which is the complementary part of the workload of one hyper-period, i.e. E max ≥ (1-U )×HP ×P r . However, it is still an overestimated bound.

-C i E i T i D i τ 1 3

Schedulability Conditions

Without energy constraints, EDL is equivalent to the regular EDF in term of task sets schedulability. When energy constraints are considered, it is difficult to say whether a task set is schedulable with EDL or not because we need to check if all deadlines are met even in the worst-case scenario which is not known up to now. The only conditions that we can check are processor and energy utilizations, i.e. U ≤ 1 and U e ≤ 1 which are only necessary conditions.

EDF with Energy Guarantee Scheduling (EDeg)

In [EGCC11; Che14], Chetto et al. proposed an enhancement of EDL. They proposed an algorithm called EDeg for EDF with energy guarantee. It consists of mixing soon and late scheduling by using clairvoyance or look-ahead calculations.

Model Task Model

The same task model as for EDL is considered: a periodic task set with constrained or implicit deadlines and null offsets.

Energy Model:

The replenishment function P r (t) is not necessarily specified but must be known in order to ensure the predictability needed for correct clairvoyance computations. Furthermore, an ideal energy storage unit is considered, i.e. a battery or a capacitor with a linear charging and discharging rates.

Algorithm Description

The intuition behind EDeg is to run jobs according to EDF rules, but before authorizing a job to execute, EDeg uses the notion of slack-energy to predict eventual future energy failures. If a future deadline miss due to energy lack is detected, the current jobs are delayed as long as possible by consuming the available slack-time to replenish a maximum of energy like EDL does. Furthermore, when E max is reached during an idle period, the algorithm resumes executions in order to avoid energy waste. The slack-energy notion is an extension of the notion of slack-time which means that the maximum amount of idle time that can be used to delay executions without violating deadlines. As described in [START_REF] Hussein El Ghor | A Real-time Scheduling Framework for Embedded Systems with Environmental Energy Harvesting[END_REF] the slack-energy of a job J i,j at time t denoted SE i,j (t) is the maximum amount of energy that can be used to execute while there is ready jobs do while E(t) < E max and ST (t) > 0 do 7:

idle the system to replenish energy 8:

end while

9:
end while 10:

while there is no active jobs do 11:

idle the system 12:

end while 13: end while continuously other jobs from time t to the request time of J i,j while still respecting energy requirements and deadlines. It is the difference between the energy available during interval [t, d i,j ], i.e. E(t) + d i,j t P r (t) dt, and the energy demand of J i,j and higher priority jobs that are requested after a i,j the request time of J i,j and have a deadline earlier than d i,j . This energy demand is denoted A i,j . Before running the job that is ready to be executed at time t, EDeg computes first the system's slack-energy of time t denoted SE(t). The global slack-energy at time t is the minimum of slack-energy of all jobs that are requested after time t and having a deadline earlier than the one of the job being executed at time t. Equation 3.5 summarizes the computation of SE(t).

       A i,j = E i + n J k,l , a i,j <a k,l ≤d k,l ≤d i,j E k SE i,j (t) = E(t) + d i,j t P r (k) dk -A i,j SE(t) = min J k,l , t<a k,l ≤d k,l ≤d i,j (SE k,l ) (3.5)
Therefore, if SE(t) is positive, the ready job is authorized to execute and consume the energy budget SE(t). Otherwise, it is delayed as much as available slack-time without wasting energy. The system's slack-time denoted ST (t) used by EDeg is the same as EDL. Algorithm 3.2 summarizes the scheduling schemes of EDeg.

Figure 3.5 on the facing page illustrates a typical schedule of EDeg. For example at time 15, EDeg decides to execute τ 3 because the slack-energy of the system is positive and sufficient to execute few time units. In fact, at time 15, job J 3,2 has the earliest deadline and is ready to execute. Furthermore, J 1,4 is the only job that is requested after J 3,2 and has a deadline earlier than d 3,2 . Then, the slack-energy of the system at time 15 is equal to the one of J 1,4 , i.e. SE(15

) = SE 1,4 (15) = E(15) + d 1,4 15 P r (t).dt -(E 1 ) = 120 + 50 × (23 -15) -120 = 400 ≥ 0.
With SE(15) = 400, the system can execute jobs J 3,2 and J 1,4 completely. At time 20, it is no necessary to compute the slack-energy again because there are no jobs that interfere with job J 2,3 . Then, the system executes J 2,3 until the battery is not sufficient to execute. At time 21, the battery level is not enough to finish executing, thus, EDeg delays executions as long as there is available slack-time, i.e. ST (20) = 6. Furthermore, in order to avoid energy losses due to over charging the battery, EDeg resumes execution after only 4 units of slack-time. After that, the same behavior is repeated until the end of hyper-period which is 30 time units for this example. We can see that at the end of the hyper-period, the battery is fully charged which means that the task set is schedulable with this configuration of energy.

-C i E i T i D i τ 1 1

Complexity

The complexity of EDeg comes mainly from slack-time and slack-energy computations. As shown in [START_REF] Silly | The EDL Server for Scheduling Periodic and Soft AperiodicTasks with Resource Constraints[END_REF], the slack-time algorithm for EDF scheduling is of O(N × n) where n is the number of tasks and N is the maximum number of jobs requested within a hyper-period. Moreover, the complexity of slack-energy algorithm is also of O(N × n) as shown in [START_REF] Hussein El Ghor | A Real-time Scheduling Framework for Embedded Systems with Environmental Energy Harvesting[END_REF]. Therefore, the complexity of EDeg in the worst-case is pseudo-polynomial which might be a serious drawback in practice.

Optimality

EDeg was proved to be optimal for periodic and synchronous task sets in [START_REF] Chetto | Optimal Scheduling for Real-Time Jobs in Energy Harvesting Computing Systems[END_REF]. This optimality is inherited from the optimality of EDF for Liu and Layland's model. Since EDeg predicts future deadline misses due to energy lack and does not waste energy when delaying executions, it takes advantage of the dynamic priority to schedule the earliest deadline first and maximizes the supportable workload. If a deadline is missed with EDeg, this means the energy is not sufficient which makes the task set unschedulable by any other algorithm.

Minimum Storage Unit Capacity

Intuitively, one can say that the maximum battery capacity needed for EDeg is the same as EDL since we can apply the same reasoning on idle periods. Then, the same pessimistic bound can be applied, i.e. the sum of the energy that can be collected during all idle periods of one hyper-period.

Schedulability Conditions

A schedulability test for EDeg was proposed in [START_REF] Chetto | Optimal Scheduling for Real-Time Jobs in Energy Harvesting Computing Systems[END_REF]. It consists of checking if the energy available during any time interval is sufficient to satisfy the energy demand of the same time interval. Knowing that this can be checked by comparing the energy utilization to 1 for tasks with constrained or implicit deadlines, a task set is said schedulable with EDeg if and only if processor and energy utilizations are lesser or equal to one, i.e. U ≤ 1 and U e ≤ 1. Furthermore, knowing that EDeg is optimal, this test becomes a necessary and sufficient feasibility condition for synchronous periodic task sets with implicit deadlines, and only necessary for task sets with constrained deadlines.

Lazy Scheduling Algorithm (LSA)

The Lazy Scheduling Algorithm (LSA) is one of the main EDF-based algorithms proposed in the literature. It was proposed for the first time by Moser et al. in [START_REF] Moser | Real-Time Scheduling with Regenerative Energy[END_REF] and was revisited in [START_REF] Moser | Lazy Scheduling for Energy Harvesting Sensor Nodes[END_REF][START_REF] Moser | Real-time scheduling for energy harvesting sensor nodes[END_REF]. It is an energy-driven algorithm in contrast to classical algorithms which are time-driven. This means that scheduling decisions are made only according to the available energy, thus, if energy is sufficient, time will be sufficient too. This comes from the fact that all tasks consume energy with the same rate and that tasks execution times depend on the consumption rate authorized by the system. This algorithm is interesting to study because it has a reasonable overhead and is optimal for the considered model.

Model Task Model

The task set considered by LSA is composed by n independent, preemptive and aperiodic tasks. Each task is characterized by its energy cost E i and its relative deadline D i . The tasks drain energy from the storage unit with the same consumption function denoted P D (t). This function is upper bounded by the maximum consumption rate P max . Moreover, it is up to the scheduling algorithm to decide which consumption rate to apply at time t. Knowing that LSA is energy-driven, the execution time C i of a task depends on its energy cost and the applied consumption rate. Then, when the consumption rate is maximized,

C i is minimized, i.e. P D (t) = P max ⇒ C i = E i /P max .
Therefore, as mentioned earlier, the execution time of a task varies from one job to an other depending on the applied consumption rate. Then, a job J i,j that is requested at time a i,j , starts its execution at time s i,j and must finish executing at time f i,j before its deadline d i,j after the energy cost of the job has been consumed, thus, we have

a i,j ≤ s i,j < f i,j ≤ d i,j .

Energy Model

In [Mos+06a; Mos+07], the authors considered the solar energy as energy source. Then, to cope with the fluctuations of the output energy that characterizes a photovoltaic cell, they proposed to use the Energy Variability Characterization Curves (EVCC) that bound the energy harvested in any time interval ∆: l for the lower bound curve. The EVCCs are extracted from actual solar energy traces to provide guarantees on the produced energy. Therefore, the replenishment function denoted P r (t) is lower bounded by a known function, and the energy harvested in a certain time interval [t 1 , t 2 ] denoted g(t 1 , t 2 ) is given by as:

g(t 1 , t 2 ) = t 2 t 1 P r (t).dt ≥ l (t 1 , t 2 )
For the storage unit, they considered an ideal rechargeable battery of capacity C that can be charged and discharged with a linear function. Its energy level at time t is denoted E(t) and must stay between the two thresholds E min and E max with

C = E max -E min .

Algorithm Description

The LSA algorithm is EDF-based, thus, it schedules aperiodic jobs according to earliest deadline first rules. The only difference is the time s i,j when a job J i,j begins effectively its execution. This time is computed such that energy constraints are respected, namely the energy cost and the battery capacity limit. Indeed, knowing that all tasks have the same consumption rate, s i,j is the earliest time at which the system can start executing after a replenishment period. This execution is continuous and includes J i,j and a maximum of eventual higher priority jobs. This execution period execute J i,j with power P D (t) 16: end while ends when the pending workload is executed or when the deadline d i,j is reached. The execution must finish without running out of energy and without exceeding the battery capacity C. Then, if there are no interferences within time interval [a i,j , d i,j ], starting executing J i,j at time s 1 i,j = d i,j -E i /P max is enough. However, knowing that tasks are aperiodic, higher priority jobs can be requested at any moment. Thus, executing as late as possible may lead to miss deadline d i,j which makes s 1 i,j not safe. Then, an earlier s i,j is mandatory, a time from which job J i,j and a maximum of higher priority jobs can be executed before d i,j without running out of energy. We call this time s * i,j , it is the time from which we can execute and consume all the energy available in interval [a i,j , d i,j ]. Equation 3.6 shows how to compute s * i,j .

s * i,j = d i,j - E(a i,j ) + g(a i,j , d i,j ) P max (3.6) Moreover, if E max is reached before s * i,j
, some energy may be wasted. This energy is included in s * i,j but actually wasted which may lead to a lack of energy before d i,j . Therefore, an earlier time is needed for safe executions. Equation 3.7 shows the relationship between s i,j , the time from which starting executing does not lead to a waste of energy, and the other parameters.

g(a i,j , s i,j ) -C = g(a i,j , d i,j ) + (s i,j -d i,j )P max (3.7)
Therefore, the optimal starting time s i,j is the maximum between s i,j and s * i,j , i.e. s i,j = max(s i,j , s * i,j ). The pseudo-code of LSA algorithm is described by Algorithm 3.3. It is based on the following rules.

• Rule 1: EDF scheduling is used with P D (t) = P max when t ≥ s i,j ;

• Rule 2: if E max is reached, jobs are run with P D (t) = P r (t) in order to avoid energy waste

Complexity

The LSA algorithm has the same complexity as EDF since it adds only the computation of s i,j of one job and some verifications, which can be done in O(1). The most costly operation is to select the job to execute. This operation can be done in O(n) in the worst-case where n is the number of tasks. Therefore, the complexity of LSA is O(n).

Optimality

In [START_REF] Moser | Real-time scheduling for energy harvesting sensor nodes[END_REF], the LSA algorithm was proved to be optimal for the specific model described earlier in this section. In fact, the LSA algorithm can miss deadlines only in two possible situations: when the time is not sufficient to satisfy the workload or when the available energy is not sufficient to satisfy the demand of energy.

• A deadline cannot be respected if the time is not sufficient to assign the available energy with the maximum consumption rate P max . In this case, unprocessed energy remains in the storage unit and we have E(d i,j ) > E min .

• A deadline violation occurs also because the required energy is simply not available at the deadline. In this case, the battery is exhausted before deadline, i.e. E(d i,j ) ≤ E min .

These are the insights of LSA optimality, the complete and detailed proof is available in [START_REF] Moser | Real-time scheduling for energy harvesting sensor nodes[END_REF].

Note that the optimality of LSA relies strongly on the assumption of having the same consumption function P D (t) for all the tasks. Then, if we apply different consumption rates to each task, the computation of the starting time s i,j is no longer exact. In fact, if we suppose that each task has its own consumption rate denoted P i (t), considering max 1≤i≤n (P i (t)) as P max leads to a later starting time s i,j than the optimal one. Furthermore, considering min 1≤i≤n (P i (t)) as P max leads to an earlier starting time than the optimal one which may lead to avoidable energy failures or deadline misses. Figure 3.6 on the following page shows a LSA schedule of a task set with different consumption rates where a deadline is missed while a valid schedule is possible. We can see in Figure 3.6(b) on the next page that s 1,1 of job J 1,1 is computed at time 0 with P max = max 1≤i≤n (P i (t)) which gives s 1,1 = 3 -0+3×(3-0) 5 = 2. This value of s 1,1 leads to a deadline miss because the energy demand is overestimated, and therefore, s 1,1 is over delayed. We can see that the consumption rate used to compute s i,j is very important because it influences the earliness or the tardiness of execution starting time. LSA computes precisely s i,j only if all tasks consume energy with the same rate. Otherwise, it is impossible or at least difficult to find the optimal consumption rate to use when tasks consume energy with different rates.

Chapter 3. Real-time Scheduling for Energy-Harvesting Systems

-C i E i T i D i P i (t

Minimum Storage Unit Capacity

When a task set is schedulable with LSA, it is possible to optimize the battery capacity while keeping the task set schedulable. In [START_REF] Moser | Real-Time Scheduling with Regenerative Energy[END_REF], the authors shows how to compute the minimum battery capacity needed to keep the schedulability of the task set with LSA. It consists of the maximum difference between the energy demand and the energy available in a sliding time interval ∆. The energy demand of any interval of time ∆ according to LSA, which is EDF-based algorithm, can be obtained by applying the demand bound function (see Definition 1.11 on page 42) on periodic tasks. Then, the system energy demand of time interval ∆ denoted A(∆) can be obtained by Equation 3.8.

A(∆) = n i=1 dbf i (∆) (3.8)
Moreover, the energy that can be harvested in any time interval ∆ is lower bounded by EVCCs, i.e. l (∆). Therefore, the minimum battery capacity needed to schedule a periodic task set according to LSA rules denoted C min is given by Formula 3.9.

C min = max ∀ ∆≥0 (0, A(∆) -l (∆)) (3.9)
More detailed explanations and proofs are available in [START_REF] Moser | Real-Time Scheduling with Regenerative Energy[END_REF]. Note that in the absence of a worst-case situation, computing C min in practice requires checking A(∆) and l of all possible ∆ intervals which is a serious limitation.

Schedulability Conditions

A schedulability test of LSA was also proposed in [START_REF] Moser | Real-Time Scheduling with Regenerative Energy[END_REF]. Knowing that LSA is EDF-based, it is obvious that the accepted workload is maximized. Then, if a task set is schedulable with EDF without considering energy constraints, then, it remains only to check whether the energy provided by l is sufficient to satisfy the workload energy demand. In [START_REF] Moser | Real-Time Scheduling with Regenerative Energy[END_REF] the authors built an admittance test by comparing the energy demand A(∆) of time window ∆ to the available energy that can be stored in the same time interval, Formula 3.10 describes formally the condition a task set must satisfy to be schedulable wih LSA.

A(∆) ≤ min ∀ ∆≥0 ( l (∆) + C, P max × ∆) (3.10)
Again, this test requires to check all the possible ∆ intervals which is difficult to do in practice.

Fixed-Priority Scheduling

Most of available research addressing real-time scheduling for energy-harvesting systems focuses mainly on EDF-based solutions because of the optimility of EDF for Liu and Layland's model. Nevertheless, some fixed-task-priority algorithms have been proposed in the literature that we describe in this section.

The P F P ALAP Scheduling Algorithm

Preemptive Fixed-Priority As Late As Possible (P F P ALAP ) is a fixed-priority scheduling policy that delays jobs executions as long as possible, i.e. as long as available slack-time, in order to replenish the battery as much as possible before authorizing executions. We studied the properties of this algorithm in [START_REF] Chandarli | The Fixed Priority Scheduling Problem for Energy Harvesting Real-Time Systems[END_REF].

Model

The model applied to this algorithm is the same as for EDL algorithm which is described in Section 3.6.1 on page 80. Since the exact computation of slack-time requires exact knowledge about jobs arrival times and deadlines, only periodic tasks with constrained or implicit deadlines are considered. Moreover, the slack-time computation for fixed-priority does not consider energy constraints, thus, the energy model is not necessarily specified. Therefore, we can adopt the general model described in Section 3.2 on page 67.

Algorithm Description

The Preemptive Fixed-Task-Priority As Late As Possible (P F P ALAP ) algorithm is the fixed-task-priority counter-part of EDL. Its main operation is the dynamic computation of slack-time. The slack-time algorithm used for P F P ALAP is the one proposed by Davis et al. in [START_REF] Davis | Scheduling slack-time in fixed priority pre-emptive systems[END_REF]. Each priority level has its own slack-time at time t denoted ST i (t). For priority level-i, it consists of computing the length of idle periods that can be merged in once within the time window starting from time t and ending at the next deadline of level-i. Algorithm 3.4 on the facing page shows how to compute ST i (t).

Notations:

• d i (t): the next absolute deadline of priority level-i after time t,

• a i (t): the next activation time of priority level-i,

• c i (t): the remaining execution time at time t of the current job of priority level-i,

• idle(t 1 , t 2 ): the amount of time the processor is idle within an interval of time,

• W m i (t): the recurrent workload function.

Fixed-Priority

W m i (t) ← W m+1 i (t) 5: W m+1 i (t) ← t + ST i (t) + ∀j≤i c j (t) + (W m i (t) -a j (t)) 0 T j × C j 6: if W m i (t) = W m+1 i (t) then 7: idle(t, d i (t)) ← min((d i (t)-W m i (t)) 0 , min ∀j≤i W m i (t) -a j (t) T j × T j + a j (t) -W m i (t) 8: ST i (t) ← ST i (t) + idle(t, d i (t))
9:

W m+1 i (t) ← W m+1 i (t) + idle + 10: end if 11: 12: until W m+1 i (t) ≤ d i (t) 13: return ST i (t) Algorithm 3.5 P F P ALAP Algorithm 1: t ← 0 2: loop 3: if ST (t) ≥ 0 then 4:
τ k ← the highest priority active task at time t 5:

execute τ k 6: else 7:

idle the system to replenish energy 8:

end if 9:

t ← t + 1 10: end loop Moreover, the global slack-time of the system at time t denoted ST (t) is the minimum slack-time among all priority levels, i.e. ST (t) = min 1≤i≤n (ST i (t)). Then, before authorizing tasks to be executed according to their priorities, P F P ALAP computes ST (t), and if it is positive, executions are delayed until ST (t) is totally consumed. Otherwise, it executes jobs as the classical FTP scheduler. Algorithm 3.5 shows how does P F P ALAP take scheduling decisions at time t.

Complexity

The complexity of P F P ALAP in the worst-case scenario is the same as the slacktime computation algorithm, which has a complexity of O(m × n) where m is the number of iterations and n is the number of tasks. We note that the number of iterations m depends on the periods and deadlines of the tasks and is bounded by max 1≤i≤n (T i )/ max 1≤i≤n (D i ). Thus, the complexity of P F P ALAP is pseudo-polynomial.

-C i E i T i D i P i τ 1 2 14

Optimality

The idea behind P F P ALAP is that delaying executions as la late as possible maximizes the energy replenished before starting executions which seems to be beneficial for the task set schedulability, especially when the battery capacity is sufficient. Unfortunately, this is one of the counter intuitive ideas in fixed-priority scheduling for energy-harvesting systems. In fact, a counter example can be built by constructing a schedule where a negative energy balance, i.e. difference between available energy and jobs energy demand from time 0 to the absolute deadline of the current job, happens to a lower priority job J i,j . When this job suffers many interferences from higher priority jobs that are requested after J i,j and having deadlines later than J i,j , the late scheduling may anticipate the executions of all higher priority jobs which may lead to an energy failure or a negative energy balance.

Figure 3.7 shows such a counter example. In Figure 3.7(b), the as late as possible schedule is respected, however, at time 13, the energy is not sufficient to finish executing τ 2 and the algorithm delays executions further which leads to a deadline miss. This is due to the fact that the energy balance at time 12 is negative, i.e.

P r ×(d 2,1 -0)-2×E 1 -E 2 =

Fixed-Priority Scheduling

95

-1, and that the slack-time computation does not take into account tasks energy cost. Furthermore, by executing τ 2 earlier, the task set becomes feasible. Therefore, P F P ALAP cannot be optimal.

Minimum Storage Unit Capacity

For the same reasons as EDL algorithm, it is difficult to estimate the minimum battery capacity needed to keep a schedulable task set schedulable. Indeed, the worstcase scenario that maximizes the needed energy storage capacity is not known up to now.

Schedulability Conditions

Without energy constraints, P F P ALAP has the same schedulability as the classical FTP algorithm. However, when energy constraints are considered, it is difficult to check the schedulability of a task set with P F P ALAP algorithm without simulating the schedule for at least a hyper-period. This is due to the fact that it is difficult to find the worst-case scenario that leads to the worst response times of tasks.

Preemptive Fixed-Priority with Slack-Time Algorithm

Among several heuristics proposed by Chetto et al. in [START_REF] Chetto | Fixed Priority Scheduling Strategies for Ambient Energy-Harvesting Embedded systems[END_REF], the Preemptive Fixed-Priority with Slack-Time (P F P ST ) algorithm was the most pertinent and the one with the highest schedulability rate. It alternates classical FTP schedule with the one of P F P ALAP when battery boundaries are reached.

Model

The model considered in [START_REF] Chetto | Fixed Priority Scheduling Strategies for Ambient Energy-Harvesting Embedded systems[END_REF] for Preemptive Fixed-Task-Priority with Slack-Time (P F P ST ) is the same as the one described in Section 3.2 on page 67.

Algorithm Description

The behavior of P F P ST algorithm is simple, it schedules jobs according to their priorities as soon as possible when the battery level is higher than E min . Then, it delays executions as long as available slack-time in order to replenish a maximum of energy before resuming executions. The slack-time algorithm is the same as the one used for P F P ALAP . Moreover, executions are resumed when E max is reached during an idle period in order to avoid energy losses. Algorithm execute jobs according to fixed-priority rules 5:

end while 6:

while E(t) < E max and ST (t) > 0 do 7:

idle the system to replenish energy 8:

end while

9:
end while 10:

while there is no active jobs do 11:

idle the system 12:

end while 13: end while

Complexity

The complexity of P F P ST in the worst-case is the same as P F P ALAP because both use the same slack-time algorithm which is pseudo-polynomial [START_REF] Davis | Scheduling slack-time in fixed priority pre-emptive systems[END_REF]. However, in average, P F P ST behaves better than P F P ALAP because it does not need to compute slack-time every time as P F P ALAP does.

Optimality

Unfortunately, P F P ST is not optimal because it suffers the same problem as P F P ALAP . Since the computation of slack-time does not consider energy constraints, the same counter example can be used to prove its non optimality. Figure 3.8 on the facing page shows the schedule of the task set described in Figure 3.7(a) on page 94 according to P F P ST rules. We can see that the same negative energy balance occurs at time 13 while it is possible to avoid it as shown in Figure 3.8(b) on the facing page.

Minimum Storage Unit Capacity

Since P F P ST behaves in the worst case like P F P ALAP , the minimum battery capacity problem is the same for both algorithms. Therefore, the exact minimum battery capacity is not known up to now.

Schedulability Conditions

The P F P ST algorithm provides a better schedulability rate than P F P ALAP because it avoids energy losses due to overcharging the battery. Unfortunately, it is not easy to provide a schedulability condition without simulating the schedule for at least one hyper-period because, again, the worst-case scenario is not known.

Other Scheduling Heuristics

Other scheduling heuristics have been proposed in [START_REF] Chetto | Fixed Priority Scheduling Strategies for Ambient Energy-Harvesting Embedded systems[END_REF], however, the simulations presented in [START_REF] Chetto | Fixed Priority Scheduling Strategies for Ambient Energy-Harvesting Embedded systems[END_REF] showed that most of them are not pertinent. In this section we describe some of them briefly. EHF P 1 : All jobs are executed as soon as possible according to the fixed-priority (FTP) rules until E min is reached or there are no more tasks ready to be executed. If E min is reached when there is at least one ready task, the processor is switched to idle mode for x time units where x is a parameter of the heuristic. During that period, the energy storage unit replenishes. The simulations showed that the longer x is, the worse schedulability is, and that the best values of x are less than 10. EHF P 2 : All jobs are executed as soon as possible according to FTP. When E min is reached, the processor is switched to idle mode until the battery level reaches a threshold level called E th and given as a parameter of the heuristic. By varying E th , simulations showed that this heuristic is similar to EHF P 1 .

EHF P 5 : For this heuristic, there are two threshold parameters, namely E min th and E max th . All tasks execute as soon as possible according to FTP scheduling. When the battery level reaches E min th , executions are suspended as long as available slack-time and the threshold E max th is not exceeded. Simulations showed that this heuristic increases the number of preemptions and does not improve the schedulability rate. optimal not optimal not optimal E i /C i = f (τ i ) not optimal optimal not optimal optimal not optimal not optimal Periodic E i /C i = Cst not optimal optimal optimal not optimal not optimal not optimal E i /C i = f (τ i ) not optimal optimal not optimal not optimal not optimal not optimal Table 3.1: Algorithms comparison summary

Performance Evaluation and Comparison

We described the main scheduling algorithms available in the state of the art. In this section we evaluate these algorithms through simulations over some metrics in order to show their strengths and weaknesses.

Simulation configuration

In this subsection, we describe the configuration of the experiments, namely the task sets generation, the parameters and the assumptions.

Competitors

• the EDL algorithm described in Section 3.6.1 on page 80,

• the EDeg algorithm described in Section 3.6.2 on page 83,

• the LSA algorithm described in Section 3.6.3 on page 86,

• the F BA algorithm described in Section 3.5 on page 75,

• the P F P ALAP algorithm described in Section 3.7.1 on page 92 with deadline monotonic tasks priority ordering,

• the P F P ST algorithm described in Section 3.7.2 on page 95 with deadline monotonic tasks priority ordering.

Task Models

As mentioned in the above sections, each algorithm is designed for a specific task model. In order to compare them against each other we evaluate them over different task models and assumptions. For this experiment, we select three main models:

• the frame-based model described in Section 3.5 on page 75,

• the periodic task model with implicit deadlines described in Section 3.2 on page 67,

• the periodic task model with constrained deadlines.

For each task model, we run simulations over four energy configurations that cover the main assumptions that make the evaluated algorithms optimal:

• the same consumption rate for all tasks with an infinite battery capacity, i.e.

E i /C i =Constant and E max = ∞,
• the same consumption rate for all tasks with an arbitrary limited battery capacity, i.e. E i /C i =Constant and E max =Constant,

• variable consumption rates with an infinite battery capacity, i.e.

E i /C i = f (τ i ) and E max = ∞,
• variable consumption rates with a limited battery capacity, i.e. E i /C i = f (τ i ) and E max =Constant.

Assumptions

This experiment considers the following hypothesis and assumptions:

• in order to focus only on the impact of energy on task sets schedulability, we consider only time feasible task sets,

• since actual machines cannot handle continuous values, we consider that time and energy are discretized and that the granularity is small enough to avoid decimal values, i.e. time and energy are integers and all scheduling operations are performed before or after one time unit,

• knowing that most of the evaluated algorithms require constant or at least known replenishment functions, we consider only constant charging functions P r (t) = P r in order to make the comparison possible,

• tasks consume energy linearly, i.e. a task consumes E i /C i energy units for each execution time unit.

Task set generation

For each task model, we generate randomly a sample of 15000 task sets using an adapted version of the U-Unifast Discard algorithm proposed in [START_REF] Bini | Measuring the Performance of Schedulability Tests[END_REF]. This algorithm is coupled with the hyper-period limitation technique proposed in [START_REF] Macq | Limitation of the hyper-period in realtime periodic task set generation[END_REF]. In order to cover most of possible task sets, we generate them according to their processor and energy utilizations, i.e. U and U e . Indeed, we vary U and U e within interval [0.2, 1] with steps of 0.05. Then, we obtain 50 distinct task sets for each couple (U, U e ). Tasks are generated by considering a battery capacity of 200 units and a constant energy replenishment rate P r = 15 units.

Metrics

In this experiment we compare the selected algorithms over the following metrics.

• Failure rate: is the percentage of non feasible task sets among all the tested ones. Then, the greater the failure rate is, the lower the algorithm performance are. This metric helps to confirm the optimality or the non optimality of some algorithms.

• Preemption rate: for one simulation, it is the number of preemption events. A preemption event occurs when a job is stopped before finishing its execution. All of the events that occur at the same instant are considered as once. Therefore, the number of possible events is bounded by the number of time units composing the simulation, i.e. the simulation duration. For several simulations, this metric is computed only for feasible task sets and represents the ratio of the average number of preemptions relative to all possible events. Then, the greater the number of preemptions is, the greater the context switch is. Note that this leads to increase the overhead cost and decreases the performance. The shown results represent the percentage of the average number of preemption events among the total number of events.

• Average Energy Level: represents the average energy level of the battery or capacitor at any instant during the simulation. It is the average of the energy level observed for all scheduling events. The best algorithm relative to this criterion is the one that maximizes the average energy level. This means that the algorithm makes the system less energy constrained.

The task sets are launched synchronously with an empty battery, i.e. ∀ τ i , O i = 0 and E(t) = E min which seems to be the closest to the actual worst-case scenario of all the evaluated algorithms.

Results analysis

Figure 3.9 on the next page shows the performances of the tested algorithms on the frame-based task model. As expected most of EDF-based algorithms dominates fixed-priority ones. We can see also that F BA and EDeg have the lower failure rates. This was expected because in frame-based model, all tasks share the same period and the same deadline. Thus, ordering tasks according to deadlines or periods does not change the schedule since the used breakdown rule is to give the priority to jobs with lower energy consumption rate. Note that this rule is not respected when considering only deadlines as P F P ALAP and P F P ST do. Furthermore, we observe that LSA is not optimal for this model especially when the energy consumption rate varies from one task to an other. This is due to the fact that LSA considers only the maximum consumption rate to compute the latest time to execute a job.

Figures 3.10 on page 103 and 3.11 on page 104 show the performances of the algorithms on the periodic model in different energy and deadline configurations. Then, we can see that F BA behaves badly when tasks have different periods and different deadlines. Again, when tasks consumption rates can vary, LSA can take wrong decisions by overestimating the latest time form which starting executing a job does not lead to a deadline miss. Note that the constrained deadlines increase the rate of unfeasible task sets for all algorithms which is expected because constrained deadlines let shorter time to jobs to finish their executions than implicit deadlines.

Globally, EDeg is the algorithm with the lower failure rate and preemptions rate over the tested task models with a good average battery level. This is due to its anticipation • EDL: has a high failure rate when the battery capacity is limited but seems to behave better when the stage unit is infinite. This was expected because EDL does not take into account energy when computing slack-time. The simulations show that EDL has relatively a high preemption rate and average energy level comparing to other algorithms which is due to long idle periods and the interferences within execution windows,

(d) E i /C i = f (τ i ) with E max = 200
• LSA: shows good performances only when all the tasks share the same energy consumption rate,

• F BA: shows good performances only for frame-based task sets, • P F P ALAP : behaves like EDL but with a higher level of failure and preemptions because it is a fixed-priority algorithm,

(d) E i /C i = f (τ i ) with E max = 200
• P F P ST : behaves a little better than P F P ALAP but has the same weaknesses, namely a high failure and preemption rates which are due the slack-time computation that does not consider energy constraints.

Comparison summary

(d) E i /C i = f (τ i ) with E max = 200

Conclusion

In this chapter we introduced the problematic of real-time scheduling for energyharvesting systems. We first described the theoretical model we are interested in and we expressed the problematics linked to this model, namely, finding algorithms, feasibility conditions and the minimum energy storage unit capacity. Second, we discussed the two main scheduling approaches for energy-harvesting systems, namely, real-time scheduling with DVFS and energy-aware scheduling. Third, we detailed this later and we enumerated the main scheduling algorithms available in the literature, namely EDL, EDeg, LSA, F BA, P F P ALAP and P F P ST . Finally we evaluated and compared these algorithms with simulations that showed that EDeg is the best algorithm that keeps its optimality in different task models, i.e. frame-based and periodic, and different energy configurations, i.e. constant and variable tasks energy consumption rates and battery capacity size.

We note that most of the proposed solutions are EDF-based because of its optimality for systems without energy constraints. Furthermore, the EDF scheduling for energyharvesting systems was the most studied in the past. However, real-time scheduling for energy harvesting systems with fixed-task-priority, which are as important as EDF scheduling, was not deeply studied. The algorithms available in the literature are not very efficient and can be widely improved. The aim of this dissertation is to contribute to cover this research area by studying the possibility of adapting some EDF solutions to fixed-priority and by proposing new scheduling algorithms and feasibility conditions that can solve the problematics identified in this chapter.

Introduction

As noticed in the state of the art, the fixed-priority scheduling for energy-harvesting was not very well studied compared to dynamic-priority or EDF-based scheduling. In fact only few fixed-priority algorithms are available in the literature. In reality, even though the earliest deadline first scheduling has proved its optimality for classical real-time systems, it is still not very popular in industry. However, fixed-priority scheduling is widely used in industry because of its simplicity. Therefore, fixed-priority is as important as EDF-scheduling and it is worthy to study this type of scheduling for energy-harvesting systems.

As mentioned in Section 3.3 on page 71, one of the studied problematics is to find fixed-priority scheduling algorithms that respect tasks deadlines and energy-harvesting systems constraints.

The main fixed-priority algorithms available in the literature, namely P F P ALAP and P F P ST which are described in Section 3.7 on page 92, are not optimal and have a great complexity.

This chapter focuses on optimal fixed-priority solution of the considered problem. We propose the Preemptive Fixed-Task-Priority As Soon As Possible (P F P ASAP ) algorithm and we prove its optimality for energy-non-concrete task sets that are composed only of tasks that consume more energy than the replenished during their execution. The work presented in this chapter is the result of a collaboration with Dr. Y. Abdeddaïm and was first published in [START_REF] Abdeddaïm | The Optimality of P F P ASAP Algorithm for Fixed-Priority Energy-Harvesting Real-Time Systems[END_REF].

The remaining part of the chapter is organized as follows. We recall the model in Section 4.2. In Section 4.3 we introduce the P F P ASAP algorithm, and then, we study some of its properties, namely its worst-case scenario, its optimality and its optimal priority assignment. A feasibility condition based on P F P ASAP is also proposed. In Section 4.4, we evaluate the performances of P F P ASAP by simulations and we compare them with the ones the algorithms presented in the state of the art. Finally, we conclude in Section 4.5.

Model

The model considered in this chapter is similar to the one described in Section 3.2 on page 67. The difference here is that we consider only energy-non-concrete task sets which means that tasks offsets and the initial energy level of the battery are known only at run time.

Task Model

We consider a non-concrete real-time sporadic task set in a renewable energy environment defined by a set of n periodic and independent tasks. Each task τ i is characterized by its priority P i , its worst-case execution time C i , its minimum inter-arrival time T i , its relative deadline D i and its worst-case energy consumption E i . Since the considered task set is non-concrete, the offsets denoted as O i are known only at run-time.

Energy Model

The energy model considered in this chapter is exactly the same as the one described in Section 3.2 on page 67. An energy storage with capacity C and a harvester that replenishes the battery continuously with a constant rate P r . The energy level of the storage unit at time t denoted E(t) fluctuates between two thresholds E max the maximum level and E min the minimum level such that C = E max -E min . Knowing that the considered systems are energy-non-concrete, we assume that the initial level of the storage unit is E min . Furthermore, we suppose that P r ≤ C to avoid energy losses. Note that this is not sufficient to avoid energy losses but it is necessary. Moreover, in this chapter we suppose that tasks consume more energy than harvested during a period

Theoretical Study of P F P ASAP

As Soon As Possible Preemptive Fixed-Priority

In [START_REF] Chetto | Fixed Priority Scheduling Strategies for Ambient Energy-Harvesting Embedded systems[END_REF], a set of scheduling heuristics for energy-harvesting systems have been proposed. These heuristics are fixed-priority and take into account tasks energy cost and the battery capacity limit during scheduling operations. One of these heuristics caught our attention. With this heuristic, tasks are executed according to their priority such that whenever there is not enough energy in the battery to execute, jobs executions are suspended to replenish energy for a fixed amount of time x. The authors performed some experiments to evaluate the relevance of this policy by studying the impact of varying the parameter x on the schedulability rate of the policy. They varied x from x = 4 to x = 100 and the best value for their task sets sample was between 4 and 6. However, they did not evaluate the algorithm for the smallest possible value of x, i.e. x = 1. Figure 4.1 shows the results of the same experiment performed in [START_REF] Chetto | Fixed Priority Scheduling Strategies for Ambient Energy-Harvesting Embedded systems[END_REF] but by varying x starting from 1. We can see that the lowest failure rate is reached when x = 1. Adding to this the good performances of this policy comparing to the other ones, this policy becomes very interesting to study deeply, especially its optimality.

In this section we study the case where x = 1 that we call As Soon As Possible Preemptive Fixed-Priority Algorithm ( 4.2(a). In this example E max = 10, E min = 0 and P r = 3. At time t = 0 the battery is empty, therefore, task τ 1 cannot be executed. Then, the battery is replenished until time t = 2, in other words until there is enough energy to execute one time unit of τ 1 , i.e. until E(t) ≥ E 1 /C 1 . After that, the algorithm follows the same scheduling schemes for the rest of the schedule.

Below, we first characterize the worst-case scenario of P F P ASAP , then we discuss

Theoretical Study of P F P ASAP

113

its optimality and finally, we build a necessary and sufficient feasibility condition for the considered family of task sets.

Worst-Case Scenario

The aim of this section is to characterize the worst-case scenario that a task set can encounter during its execution with P F P ASAP algorithm. First, we recall the notion of processor demand or workload function for fixed-priority scheduling, then we extend it to include tasks energy consumption. Definition 4.1 (Processor Demand). The processor demand of the i th priority level at time t denoted as W p i (t), is the amount of time necessary to execute jobs of priority levels 1, . . . , i -1, i requested in the interval of time [0, t[. It can be obtained by formula 4.1.

W p i (t) = j≤i RBF j (t) = j≤i t -O j T j × C j (4.1)
Now we introduce the notion of replenishment demand.

W e i (t) = j≤i t -O j T j × E j -E(0) (4.2)
The intuition behind Formula 4.2 is derived from the notion of processor demand. It is the difference between the energy demand of jobs requested inside interval [0, t[ and the initial battery level. The initial battery level E(0) is removed to fit with the exact amount of energy to be replenished. Therefore, if W e i (t) is negative, then, the energy stored in the battery is sufficient and more replenishment is not needed.

Definition 4.3 (Time Demand).

The time demand of the i th priority level at time t denoted W i (t), is the minimum amount of time necessary to satisfy both of the replenishment and processor demands within time interval [0, t[. This can be obtained by Equation 4.3.

W i (t) = max W e i (t) P r , W p i (t) (4.3)
The fraction W e i (t)/P r gives the number of replenishment time units to charge the replenishment demand W e i (t). Definition 4.4 (P F P ASAP Response Time). The response time of the first job of τ i according to P F P ASAP denoted R i is the termination time of the execution of the i th priority level minus the first release time of the same priority level, i.e. O i . The termination time of the first job of τ i denoted f i,1 is the smallest solution of the system of equations 4.4.

W i (t) = t t ≥ O i (4.4)
Now, we can use these definitions to characterize the worst-case scenario which is expected to be the synchronous activation of all the tasks when the battery is at its minimum level. This intuition is justified by the comparison of all possible activation scenarios as shown in Figure 4.3 on the facing page.

Figure 4.3(a) illustrates the case where all the tasks are requested simultaneously. If at least one higher priority task is requested later, the response time of lower priority tasks decreases as shown in Figure 4.3(b). Then, if higher priority tasks are requested earlier, the response time of lower priority tasks cannot be longer than the one reached in the synchronous scenario as shown in Figures 4.3(c). Moreover, when the initial battery level is higher than E min , the response time of all tasks cannot be longer because the amount of energy available in the battery can directly be used to execute instead of adding more replenishment units that lengthen tasks response times. This case is illustrated by Figure 4.3(d).

Thus, we propose Theorem 4.1.

Theorem 4.1.

Let Γ denote an energy-non-concrete task set composed of n priority-ordered tasks with constrained or implicit deadlines. The P F P ASAP worst-case scenario for any task of Γ occurs whenever this task is requested simultaneously with requests of all higher priority tasks and the battery is at the minimum level E min .

Proof. We compare jobs response times in the scenario described by Theorem 4.1 with all other possible ones. As mentioned in Definition 4.4, the response time of the first job of a task is equal to its termination time minus its offset (first release time). The main key of the proof is to argue with different termination times and offsets by comparing their possible values in different cases of activation scenario and initial battery level. Let {τ 1 , τ 2 , . . . , τ n } be a set of n priority-ordered tasks where τ n is the task with the lowest priority. Let S s i denote the scenario where task τ i and all higher priority tasks are requested simultaneously at the lower battery level E min . The worst-case scenario for a task τ i is the one which maximizes its response time, i.e. the scenario which delays the termination time of the first job of the i th priority level. If S s i is not the worst-case scenario, then, there must be an other scenario that leads to a greater response time for the i th priority level.

Firstly, we consider the scenario where E(0) > E min . In this case there is some amount of energy available at time t = 0. We denote this scenario as S i , its replenishment demand as W e S i i and its response time R S i i . Then, if E(0) > 0, we have:

E(0) > 0 ⇒ j≤i t-O j T j × E j -E(0) < j≤i t-O j T j × E j ⇒ W e S i i (t) < W e S s i i (t) ⇒ W e S i i (t) Pr ≤ W e S s i i (t) Pr ⇒ W e S i i (t) Pr ≤ W e S s i i (t) Pr ⇒ max W e S i i (t) Pr , W p i (t) ≤ max W e S s i i (t) Pr , W p S s i i (t) ⇒ W S i i (t) ≤ W S s i i (t) ⇒ R S i i ≤ R S s i i
Therefore, the system needs less replenishment demand than the scenario where E(0) = 0, i.e. E(0) = E min , and P F P ASAP introduces shorter or equal replenishment periods and leads to shorter or equal response time for all the tasks. This is in contradictory with our hypothesis, thus, such a scenario cannot lead to longer response times.

Secondly, we consider the scenario with different offsets. Let us denote S a i as the scenario where E(0) = E min = 0 and tasks can have different offsets. Let t s denote the termination time of the first job of task τ i in the synchronous scenario S s i and let t a denote the termination time of the same job in the asynchronous scenario S a i . Scenario S a i is worse than scenario S s i implies that t a > t s . We know that:

t s = W s i (t s ) = max W e i (t s ) P r , W p i (t s ) (4.5)
and W e i (t s )/P r ≥ W p i (t s ) because in our model E(0) = 0 and ∀ i, E i ≥ C i × P r . This reveals the fact that in the considered model, we must have replenishment periods

Theoretical Study of P F P ASAP

117

which increase job response time. Then,

t s = W s i (t s ) =          j≤i t s T j × E j P r          (4.6)
Similarly,

t a = W a i (t a ) =          j≤i t a -O j T j × E j P r          (4.7)
Knowing that W a i (t) is strictly increasing in the interval [0, t a ] and t a = W a i (t a ), we obtain:

t s < t a ⇒ t s < W a i (t s ) (4.8)
By replacing t s with W s i (t s ) we obtain

         j≤i t s T j × E j P r          <          j≤i t s -O j T j × E j P r          (4.9)
Finally, we have

j≤i t s T j × E j < j≤i t s -O j T j × E j (4.10) We know that t s ≥ t s -O j because O j ≥ 0. Therefore j≤i t s P r × E j ≥ j≤i t s -O j P r × E j (4.11)
Inequality 4.10 is in contradiction with inequality 4.11. Thus, we prove that t s ≥ t a . Knowing that

R i = f i,1 -O i , we also have R s i ≥ R a i because t s -0 ≥ t a -O i .
Therefore, we prove that the synchronous activation of all tasks when the battery reaches the minimum level is the worst-case scenario that a task set can undergo with P F P ASAP algorithm.

Optimality

In this section we discuss the optimality of P F P ASAP for the model described in Section 4.2 on page 110. Theorem 4.2. The P F P ASAP algorithm is optimal for the scheduling problem of fixed-priority energynon-concrete task sets with constrained or implicit deadlines. As defined in Section 1.4.4 on page 37, this optimality means that if P F P ASAP fails to schedule a given task set, then, no other fixed-priority algorithm can.

Proof. Let Γ denote an energy-non-concrete task set. We suppose that Γ is feasible using a fixed-priority assignment, but not schedulable with P F P ASAP using the same priority assignment. This means that there exists at least one task denoted τ k that misses its first deadline in the worst-case scenario given in theorem 4.1 on page 114. Indeed, it is sufficient to consider only the first job because all tasks have constrained or implicit deadlines, which avoid jobs to overlap (unless not feasible systems), and are requested in the worst-case scenario, which maximizes the interferences and the length of eventual replenishment periods. According to P F P ASAP rules, a deadline miss occurs in the worst-case scenario for the k th priority level only if the energy needed to execute priority levels higher or equal than k is greater than the energy that can be replenished from t = 0 to the first deadline of τ k , Inequality 4.12 summarizes that.

D k × P r < j≤k D k T j × E j (4.12)
If P F P ASAP is not optimal, then, there must exist an other fixed-priority schedule for Γ that makes it feasible. Let us suppose that such a schedule exists. This implies that there exists at least one task that is executed even if the energy is not sufficient. This is impossible because the system cannot execute without energy, therefore, such a schedule cannot exist. Then we prove that P F P ASAP is optimal for energy-non-concrete fixed-priority task sets with constrained or implicit deadlines.

Discussion

Note that the optimality of P F P ASAP relies on the hypotheses set in Section 4.2 on page 110, mainly the assumptions about task consumption and replenishment functions. If we relax some of them P F P ASAP may lose its optimality.

Indeed, if we accept tasks that consume energy less than replenished, i.e. gaining tasks, the worst-case scenario is no longer the same which can lead P F P ASAP to lose its optimality. Figure 4.4(c) on the next page illustrates such a case. We can see that task τ 2 , which is a consuming task is delayed three times, the first one at time 0, the second at time 2 to replenish the battery, and the third time at time 3 to execute τ 1 which is a gaining task. This delay leads to a final response time of 7 time units. However, In .4, we can see that the synchronous request of τ 1 and τ 2 leads to a response time of only 6 units. This proves that when we mix gaining and consuming tasks, the synchronous activation is no longer the worst-case scenario and P F P ASAP is no longer optimal.

Tasks C i E i T i D i P i τ 1 2 2
Moreover, when we consider the energy cost of mode switching from active to idle or the opposite way, P F P ASAP loses also its optimality and behaves badly as shown in [START_REF] Bambagini | Periodic charging scheme for fixed-priority real-time systems with renewable energy[END_REF].

In a more realistic model, the replenishment function is not constant. Therefore Equation 4.12 on the facing page is no longer applicable. Thus, we cannot conclude about P F P ASAP optimality. Finally, we have counter examples that prove the non-optimality of P F P ASAP for concrete task sets. We discuss this point in the next chapter.

Priority Assignment

As mentioned in Section 1.4.6 on page 38, the priorities assigned to tasks are very important in fixed-priority driven scheduling because they are by definition fixed offline which may reduce schedulability if the priorities are not well assigned.

In the classical theory of fixed-priority real-time scheduling, deadline monotonic was proved to be optimal for non-concrete task sets with constrained or implicit deadlines. In this section, we extend this property for energy-non-concrete task sets whose tasks consume more energy than the one replenish during execution time.

Theorem 4.3.

Deadline monotonic is an optimal priority assignment for energy-non-concrete task sets when all the tasks have constrained or implicit deadlines and consume energy more than it is replenished during their execution, i.e. when ∀ i, D i ≤ T i and

E i > C i × P r .
The idea behind Theorem 4.3 is that DM can schedule any task set that is schedulable with an other priority ordering. This means that every valid priority assignment can be transformed into deadline monotonic priority ordering.

Proof. When the task set is composed of only consuming tasks, i.e. ∀ i, E i > C i × P r , the time demand of a priority level-i in the worst-case scenario is the time necessary to replenish the energy demand or the replenishment demand because all tasks need more time than their execution time to replenish the needed energy. Then, the maximum in the right hand side of Equation 4.3 on page 113 is W e i (t)/P r . Therefore, by considering a synchronous release of all the tasks, i.e. ∀ i, O i = 0, and a minimum initial battery level E(0) = E min = 0, the new time demand is obtained by Equation 4.13.

W i (t) = max W e i (t) P r , W p i (t) = W e i (t) P r =          j≤i t T j E j P r          (4.13)
Now, to prove Theorem 4.3 we assume two tasks at adjacent priorities τ A and τ B with

D A ≤ D B ≤ T B .
Given that τ A is schedulable at the lower priority level than τ B , we swap priorities of τ A and τ B and we observe the impact of this change on the schedulability of τ A and τ B . Then, if τ B remains schedulable, this means that deadline priority assignment is optimal as we can keep swapping task priorities from any schedulable priority ordering to get a DM ordering.

1. Assume that τ A is schedulable at lower priority than τ B . Then, the response time of the first job of τ A in the worst-case scenario, denoted R A , is given by Equation 4.14 where X is the response time of the task with the lower priority task, in this case the one of τ A .

X = R A =          R A T A E A + R A T B E B + j<A ∧ j =B R A T j E j P r          (4.14)
Knowing that τ A is schedulable, then, we have R A ≤ D A . Furthermore, in this case, for such value of X, we have respectively

R A /T A E A = E A and R A /T B E B = E B because respectively R A ≤ D A ≤ T A ,
from the fact that we are computing the response time of the first job of τ A , and R A ≤ D A ≤ D B ≤ T B , from the fact that deadlines are constrained or implicit.

2. Now, we swap priorities of τ A and τ B . We consider that the response time of τ B is given by Equation 4.15.

X = R B =          R A T A E A + R A T B E B + j<B ∧ j =A R A T j E j P r          (4.15)
Now, we compare Equations 4.14 on the facing page and 4.15. Thus, we observe that they are the same equation and so the value of X must also be the same when τ B is at a lower priority than τ A . Therefore, τ B is schedulable because

D B ≥ D A .
3. It is obvious that τ A is also schedulable because it is at a higher priority level now.

Then, we show that DM schedules any system that is schedulable with any other priority assignment by swapping adjacent task priorities until we obtain a deadline monotonic priority assignment without loss of schedulability.

Note that this proof relies on the assumptions set on tasks offsets and energy consumption. If we relax one of them, the proof is no longer correct because the worst-case scenario P F P ASAP is no longer the same and the used formulas are no longer valid.

Schedulability Condition

A simple way to build a necessary and sufficient feasibility condition for energynon-concrete task sets is to check if the given task set is schedulable with P F P ASAP in the worst-case scenario, in other words, to check if the first job of each task meets its deadline when it is requested simultaneously with the higher priority tasks while the battery is at its minimum level. It consists of computing the worst-case response time according to P F P ASAP rules for each task and to compare it to its deadline. Algorithm 4.2 on the following page explains how to do this. It is an extension of the classical response time algorithm that considers energy replenishment periods.

The complexity of Algorithm 4.2 is O(m × n) where m is the number of iterations and n is the number of tasks. We note that the number of iterations m depends on the periods and deadlines of the tasks (see line 6 of Algorithm 4.2) and is bounded by max ∀i (D i )/ min ∀i (T i ). Thus, the complexity of Algorithm 4.2 is pseudo-polynomial. We can reduce this complexity by computing estimations for response times rather than the exact values. However, the schedulability test we propose will not be necessary but will remain sufficient.

W m i ← W m+1 i 5: W m+1 i ← max W e i (W m i ) P r , W p i (W m i ) 6: if W m+1 i > D i then 7:
return F alse

Battery Capacity

The algorithm P F P ASAP replenishes the minimum amount of energy needed for only one execution unit, in this case the minimum battery capacity needed to keep the task set schedulable with P F P ASAP is the maximum amount of energy that can be consumed during one time unit, i.e. the maximum instantaneous consumption. In our model all the tasks consume energy linearly. Furthermore, the minimum battery capacity must also take into account the eventual energy losses due to the capacity of the battery. Therefore, the minimum battery capacity C min that keeps the task set schedulable is bounded by max(max ∀i (E i /C i ), P r ).

When launching the system with the minimum battery level, this capacity allows P F P ASAP to keep the same schedule as the case where C ≥ C min and thereby it keeps the same response times and the schedulability of the system. Running the task set with a storage unit with a capacity lower than C min may either lead to energy losses in the case where C < P r which may increase tasks response time and may compromise the schedulability of the task set or may make the executions impossible if C is lesser than tasks consumption rate.

Performance Evaluation

We proved that P F P ASAP is optimal for energy-non-concrete task sets. In this section we study empirically the behavior of P F P ASAP and we compare it to other algorithms by simulations.

Competitors

We compare P F P ASAP to other fixed-priority algorithms that are proposed in the literature for energy-harvesting systems. We selected the following competitors.

Performance Evaluation 123

• P F P ALAP : the fixed-priority scheduling policy described in Section 3.7.1 on page 92. P F P ALAP is not optimal but can be used as a reference for comparison since there is no many algorithms in the state of the art.

• P F P ST : the fixed-priority scheduling policy described in Section 3.7.2 on page 95. We selected P F P ST which is not optimal but has the lowest failure rate according to the experiment presented in Section 3.8 on page 99.

Simulation

In this section, we describe the configuration of the experiments, namely the task sets generation, the parameters and the set assumptions.

To perform such an experiment we used a simulator named YARTISS that we present in Chapter 8.

Task Sets Generation

For these simulations we used an adapted version of the UUniFast-Discard algorithm [START_REF] Bini | Measuring the Performance of Schedulability Tests[END_REF] coupled with a technique for hyper-period limitation [START_REF] Macq | Limitation of the hyper-period in realtime periodic task set generation[END_REF] to generate task sets. The generated task sets respect the following hypotheses:

• All task sets are time feasible without considering energy parameters and constraints.

• Time and energy are discretized, this means that they are integers and all scheduling operations are performed before or after one time unit,

• The charging rate P r is constant, i.e. a constant amount of energy is added to the battery level in every time unit,

• Tasks consume energy linearly, i.e. a task consumes E i /C i energy units for each execution time unit,

• All task sets are composed of consuming tasks, in other words, all tasks consume energy more than what we can replenish during execution times, i.e. ∀ i, E i > C i × P r .

In order to represent most of the possible task sets, we generate them according to their processor and energy utilizations, i.e. U and U e . We vary U and U e in the interval [0.2, 1] to obtain a couple of (U, U e ) for each 0.05 unit of U and U e . Then, we obtain 50 distinct task sets for each couple (U, U e ).

In this experiment, all task sets are simulated in the worst-case scenario described in Section 4.3.2 on page 113.

Simulation Configuration

In order to evaluate the behavior of the compared algorithms, we vary some parameters, namely the battery capacity C and the number of tasks per task set. Firstly, we vary C in six energy scenarios to analyze its effect on the failure rate. Secondly, we vary the number of tasks per task set in several distinct simulations to observe the the scheduling overhead of each algorithm.

We set the remaining parameters to the same values that we used for task sets generation in order to fit with the considered assumptions. For these experiments, we set these parameters as follows, P r = 15 and E min = 0. Furthermore, task sets are run for 2600 time units which corresponds to the longest hyper-period. Thus, if a task set does not miss any deadline during the simulation time, then, the task set is said to be empirically feasible. We use Deadline Monotonic (DM ) policy to assign priorities because of its optimality for the considered model as shown in Section 4.3.4 on page 119.

Several statistical metrics are computed during simulations. These metrics give information about algorithms behavior. For our experiments we selected the following metrics: failure rate, preemption count, average overhead, average idle-period, average busy-period and average energy level.

Metrics

Failure Rate: the percentage of unfeasible task sets among all the tested ones. The greater the failure rate is, the lower the algorithm performance is.

Preemption Count: for one simulation, it represents the number of preemption events. A preemption event occurs when a job is suspended while it is still not finished. All the events that occur at the same instant (e.g. job request, a deadline, etc.) are considered as once. Therefore, the number of possible events is bounded by the number of time units composing the simulation, i.e. the simulation duration. For several simulations, this metric is computed only for feasible task sets and represents the ratio of the average number of preemptions relative to the number of all possible events. The greater the number of preemptions is, the greater the context switch is. A large number of preemptions increases the overhead cost and decreases performance, which makes the algorithm unusable in practice.

Average Overhead: it is the amount of time spent while handling a scheduling event, in other words, the spent by the scheduling algorithm to take a decision. For one simulation, this metric represents the average overhead of all of the scheduling events. Its exact value is difficult to compute and must be computed on a real platform. We simply calculate an estimation by distributing the real simulation time (in milliseconds) on the number of scheduling events. The simulation tool that we use is event-based. Therefore, only the events processing consumes processor time. Thus, it gives us an acceptable estimation of the average overhead. The greater the average overhead is, the greater the timing constraints violation risk is.

Average Idle-Period and Average Busy-Period: represents respectively the average duration of periods when the processor is idle and the average duration of continuous processor activity. For several simulations, we compute the ratio of the average idle-period/average busy-period duration relative to the simulation duration.

The relevance of these two metrics is closely linked to the number of preemptions caused by replenishment periods. The longer the idle/busy periods are, the lesser the number of replenishment preemptions is and the higher the algorithm performance are. Therefore, the longer the idle-periods are, the higher the average energy level is and the lesser energy-constrained the system is. Moreover, grouping idle-periods together is better for batteries that do not support a high rate of charge/discharge cycles.

Average Energy Level: represents the average energy level of the battery at any instant during the simulation. It is the average of the energy level of all scheduling events. The best algorithms relative to this criterion are ones that maximize the average energy level. This means that the algorithm makes the system less energy constrained.

Results Analysis

The Variation of E max Figure 4.5 on the following page presents the results of the comparison of the selected algorithms. In the following part, we analyze the effect of E max variation on the performances of each algorithm for each metric: Failure Rate: Increasing E max reduces the failure rate of all the evaluated algorithms. This result was expected because the more E max is increased the less the system is energy-constrained. We also observe that P F P ALAP has the highest failure rate for all values of E max . Both P F P ASAP and P F P ST have a lower failure while P F P ASAP demonstrates the lowest one. To explain why P F P ST fails to schedule some task sets which are schedulable with P F P ASAP we have to examine its behavior closely. When the battery is at its minimum level, P F P ST suspends the system as long as possible before the next execution while P F P ASAP suspends the system only for one time unit. In this case P F P ST may uselessly postpone executions and may accumulate an unbearable energy load for a future time. This can lead the system to replenish more time than the available slack-time and may lead to miss deadlines. P F P ALAP suffers from the same problem than P F P ST because it postpones execution as long as possible regardless to the battery level. When all jobs are postponed to the maximum and the system incurs a long execution period, it is impossible to introduce more replenishment times. Therefore, deadline misses may occur. At time 8 a long busy period begins and the system has already consumed all the slack-time. The energy replenished during the former idle periods is not sufficient and the system runs out of energy. This lack of energy is due to the anticipated execution of job J 1,2 . The P F P ASAP algorithm prevents from this situation by starting executing jobs immediately.

As shown in Section 4.3.3 on page 118, P F P ASAP is optimal for energy-non-concrete task sets, the simulations show that it has the lowest failure rate in all scenarios. All the task sets that are schedulable with P F P ALAP and P F P ST are still schedulable with P F P ASAP but this is not true in the opposite way. However, the difference in the failure rate between P F P ST and P F P ASAP is relatively small, the study of the other metrics might be crucial.

Preemption Rate:

The simulations show that increasing E max helps to stabilize the number of preemptions. However P F P ASAP demonstrates a very high number of preemptions regardless to E max values. By construction, P F P ASAP executes for one time unit then preempts tasks to check again if there is enough energy, while P F P ST consumes all the slack-time available to replenish energy and avoid preemptions due to a lack of energy. P F P ALAP does the same for each job activation.

Average Overhead: We observe that for every value of E max , P F P ALAP and P F P ST have much higher average overhead than P F P ASAP . This is due to the pseudopolynomial complexity of the slack-time algorithm [START_REF] Davis | Scheduling slack-time in fixed priority pre-emptive systems[END_REF]. P F P ALAP computes slack-time whenever a job is requested and P F P ST does the same but only if there is not enough energy while P F P ASAP only needs to order the activated jobs.

Average Idle-Period and Busy-Period: These two metrics are closely linked to the number of preemptions. The longer the idle or busy periods are, the lower the number of preemptions is. We observe that P F P ASAP has a high number of preemptions because it has short idle and busy periods. P F P ST consumes all available slack-time to replenish energy, then, executes tasks while the battery level is sufficient. This maximizes the duration of both of the idle and the busy periods.

Average Energy Level: regardless to E max values, P F P ALAP has the highest average energy level and P F P ASAP has the lowest one. Knowing that this metric is calculated only for feasible task sets, this result was expected because P F P ALAP replenishes energy during long periods (idle periods) which increase the average battery level.

Varying task set Criminality

The aim of this experiment is to study the effect of the task set cardinal on the average overhead. The results are presented by Figure 4 relative to P F P ASAP . This is explained by the complexity of the slack-time computation algorithm.

Table 4.1 summarizes the performance of the evaluated algorithms. P F P ASAP is optimal for energy-non-concrete task sets and so has the lowest failure rate compared to the other algorithms. Moreover, it needs less battery capacity to operate. However, it increases the number of preemptions and context switches, which could be a serious limitation in practice. P F P ST is not optimal but the simulations show that its failure rate is very close to the one of P F P ASAP . Furthermore, it maximizes the average energy level and reduces the number of preemptions. The pseudopolynomial complexity of stack-time calculation is the main drawback of P F P ST , then, it cannot be used for systems with a large number of tasks. However, one can imagine using a slack-time approximation algorithm rather than an exact computation [START_REF] Davis | Approximate Slack Stealing Algorithms for Fixed Priority Pre-emptive Systems[END_REF].

Regarding P F P ALAP , in addition to its non-optimality, simulations demonstrate very bad performance for all metrics.

Conclusion

In this chapter we studied deeply the P F P ASAP scheduling algorithm. We firstly described in detail its scheduling schemes. Secondly, we presented and proved some of its properties. We proved that the synchronous release of all tasks when the battery is at the minimum level is the worst-case scenario that leads to the longest response time of all tasks. Then, we used this property to prove the optimality of P F P ASAP for energy-non-concrete task sets that consume energy more than the replenishment during their executions. We also proposed a bound of the minimum battery capacity that keeps the schedulability of task set with P F P ASAP . Thirdly, we built a schedulability condition based on P F P ASAP algorithm. This condition is necessary and sufficient for energy-non-concrete task sets. Finally, we presented the results of empirical comparison of P F P ASAP with other algorithms. This experiments showed that P F P ASAP dominates the other algorithms in term of schedulability rate and average overhead. The results showed also that P F P ASAP suffers from high number of preemptions due to its greedy behavior. Then, we conclude that the P F P ASAP is a scheduling algorithm that behaves theoretically well but has a serious limitation in practice. Finally, we can conclude that P F P ASAP is optimal but not applicable for platforms that does not support a high preemption and context switch rates. However, its optimality make it the reference algorithm for fixed-priority energy-harvesting systems.

We will show in the next chapter that P F P ASAP loses its optimility when we relax some energy assumptions, the worst-case scenario and the schedulability test are no longer valid. Removing these assumptions makes the problem more complex and push us to study more scheduling algorithms and to look for more schedulability conditions. This is the topic of the next chapters.

Introduction

Previously, we provided schedulability analysis for P F P ASAP that was restricted to systems where all tasks were consuming tasks (see Section 4.3.5 on page 121). We proved that P F P ASAP is optimal with respect to all fixed-priority algorithms for energy-non-concrete periodic task sets, compliant with that restricted model.

In this chapter, we consider real-time task sets comprising two types of tasks: (i) consuming tasks that have a rate of energy consumption that is higher than the replenishment rate, and (ii) gaining tasks that have a rate of energy consumption that is no more than the replenishment rate. Recall that the results presented in Chapter 4 were obtained considering only consuming tasks. We show that for this more general model, the critical instant leading to the worst-case response time of a task does not necessarily correspond to a synchronous release with all higher priority tasks, and so the analysis presented in Section 4.3 on page 111 is not applicable. For the more general model, we derive two response time upper bounds providing sufficient scheduling tests. We also prove that Deadline Monotonic priority assignment [START_REF] Leung | On the complexity of fixed-priority scheduling of periodic real-time tasks[END_REF] is an optimal priority assignment policy with respect to these sufficient schedulability tests. The work presented in this chapter is the result of a collaboration with Prof. Rob Davis and mainly contains materials previously published in [START_REF] Abdeddaïm | Schedulability Analysis for Fixed Priority Real-Time Systems with Energy-Harvesting[END_REF].

The remainder of the chapter is organized as follows. In Section 5.2 we recapitulate the system model, terminology and notation used in the this chapter. In Section 5.3 we introduce sufficient schedulability analysis for the more general task model with both consuming and gaining tasks. Section 5.4 provides a performance evaluation investigating the effectiveness and the tightness of these schedulability tests. Section 5.5 concludes the chapter.

Models and Notations

The model considered in this chapter is close to the one described in Section 3.2 on page 67. The deference here is that we relax some assumptions on tasks energy consumption and offsets. The considered model includes also concrete task sets.

Task Model

In addition to the notations presented in Chapter 4, the worst-case power consumption (i.e. energy used per unit of execution time) of a task τ i is given by P c i . Thus the worst-case energy consumption equates to executing for the worst-case execution time, at the maximum rate of power consumption (i.e. E i = P c i × C i ). The set of tasks Γ is separated into two distinct subsets Γ c and Γ g . The first one Γ c contains the consuming tasks, the ones that consume more energy than is replenished during their execution, whereas Γ g is composed by the gaining tasks, that consume no more energy than is replenished during their execution. We have

Γ c = {τ i ∈ Γ, E i > P r × C i } and Γ g = {τ i ∈ Γ, 0 ≤ E i ≤ P r × C i }.

Energy Model

The energy model considered in this chapter is exactly the same as the one described in Section 3.2 on page 67.

Schedulability Analysis 133

Schedulability Analysis

In this section, we provide sufficient schedulability tests for systems with both consuming and gaining tasks. First we show that the critical instant for such task sets does not necessarily correspond to synchronous release. Lack of information about the actual worst-case scenario makes the schedulability analysis problem much more difficult. We address this problem by using the concept of priority level-i energy-busy-period. (see Definition 3.3 on page 70). The worst-case response time of task τ i must necessarily occur within such a busy-period. We derive two upper bounds on the maximum length of this busy-period, which we then use to obtain upper bounds on the worst-case response time of the task. We use a similar approach to also derive response time lower bounds.

Worst-case scenario

When we consider only consuming tasks or only gaining tasks, the worst-case scenario (critical instant) occurs when all higher priority tasks are released simultaneously and the battery is at its minimum level. For the case when we have only gaining tasks, the response time analysis is the same as the classical formulation, since there are no delays due to energy considerations.

For the case where we have only consuming tasks, launching the tasks simultaneously with the battery at its minimum level maximizes the idle periods needed for energy replenishment. This increases the time required to complete the execution of higher priority tasks, which leads to the longest response time for each task, given by Equation 4.3 on page 113 as proved in Section 4.3.5 on page 121.

In contrast, when we consider a task set composed of both gaining and consuming tasks the worst-case scenario is not the same for all the tasks, it depends on the composition of the subset of higher priority tasks. If that subset contains both gaining and consuming tasks, then the worst-case scenario is not necessarily the synchronous activation of all the tasks with the minimum battery level.

Figure 5.1 on the following page illustrates a situation where the response time of task τ 2 is longer (R 2 = 7) when a gaining task of higher priority is requested later, than it is with synchronous release (R 2 = 6). This is due to the fact that in the former case, task τ 2 suffers two replenishment delays (at time t = 0 and t = 2), whereas in the later case it suffers only one replenishment delay (at time t = 4). This happens because task τ 1 is a gaining task and there is a net increase in energy as it executes.

Sequences and Energy-busy-periods

We now introduce terminology and concepts that we use in proving key properties about scheduling systems with energy constraints. We use the term execution unit to refer to a non-divisible unit of execution of a job. An execution-unit has the same length as the basic time unit used to describe task execution times, and is of the same length for all tasks.

Tasks C i E i T i D i τ 1 2 2

Definition 5.2 (Replenishment Unit).

We use the term replenishment unit to refer to the minimum indivisible unit of idling time used to replenish energy.

Execution-units and replenishment-units are of the same duration.

Definition 5.3 (Execution Sequence).

An execution sequence is a vector X of execution units from 1 to L X , where L X is the number of execution units in the sequence. Each element X[m] of the sequence indicates the task that the execution unit belongs to. A sequence does not contain replenishment units, and so L X does not necessarily represent the number of time units needed to execute the sequence.

We denote the energy required by execution unit

E * X [m] = q=1...m E X [q] (5.1)
The minimum number of replenishment units I X [m] required to provide sufficient energy to execute X[m] at the end of the subsequence X [1] to X[m] is given by:

I X [m] = max 0, E * X [m] -E(0) P r -m (5.2)
where E(0) is the energy available at the start of the sequence. We note that an earlier execution unit X[k] may require more prior replenishment units than a later one X[m] due to the presence of execution units of gaining tasks between X[k] and X[m], (i.e.

I X [k] > I X [m] where m > k). We use I * X [m]
to denote the minimum number of replenishment units required to execute all of the subsequence X [1] to X[m] in order.

I * X [m] = max k=1...m (I X [k]) (5.
3)

The elapsed time required to execute sequence X is given by L

X + I * X [L X ].
Lemma 5.1.

For a fixed sequence X of execution units, the elapsed time for the sequence is maximised when the initial energy available is minimised, i.e. E(0) = 0.

Proof. Follows directly from Equation 5.2 and the formula for the elapsed time to execute the sequence:

L X + I * X [L X ].
Lemma 5.2.

Any sequence containing only execution units of consuming tasks requires the same elapsed time to execute irrespective of the order of its execution units provided that the set of execution units and the initial energy are the same. Similarly, any sequence containing only execution units of gaining tasks requires the same elapsed time to execute irrespective of the order of its execution units provided that the set of execution units is the same.

Proof. Case (i) sequence X contains solely execution units of consuming tasks. Since all execution units consume energy, then for every element

X[m], we have E X [m] > P r and so E * X [m + 1] > E * X [m] + P r
hence the maximum number of prior replenishment units is required by the last element in the sequence and is given by:

I * X [L X ] = I X [L X ] = E * X [L X ] -E(0) P r (5.4)
Since the total energy E * X [L X ] required by all elements in the sequence is independent of the order of the elements, the elapsed time I * X [L X ] + L X required to execute the sequence is also independent of the order of the elements.

Chapter 5. Approximate Response-Time Analysis for EH Systems

Case (ii) sequence X contains solely execution units of gaining tasks. Since all execution units gain energy, no replenishment units are required and the elapsed time for the sequence equates to its length L X irrespective of the order of the elements. Lemma 5.3. Under P F P ASAP scheduling, for a schedulable task τ i , the worst-case response time R i of the task equates to the longest possible priority level-i energy busy-period. Further, there exists a busy-period of this length that includes a single job of task τ i , begins at the release of this job and ends with the final execution unit of the job. Proof. As task τ i has the lowest priority of any task executing in such a priority level-i energy busy-period, under P F P ASAP scheduling the busy-period necessarily ends with the final execution unit of that task. This is the case because if there were any outstanding higher priority tasks, they would execute in preference to task τ i .

As task τ i has a constrained deadline and is schedulable (by the Lemma), it can only have one job starting from the release time in the busy-period, otherwise the completion of the previous job of task τ i would have to take place after the release of the final job of the task implying (as D i ≤ T i ) that the previous job was unschedulable.

Let X be the sequence of execution units representing all execution in the busyperiod. If the job of task τ i was not released at the start of the busy-period, then we can move its release time back to the start of the busy-period. Since task τ i has the lowest priority of any task in the busy-period, such a change cannot make any difference to the actual order of execution as represented by sequence X and so has no impact on the elapsed time required to execute the sequence. Such a change can therefore only increase the worst-case response time of the job. Lemma 5.3 proves that the worst-case response time for a task τ i occurs in a priority level-i energy busy-period starting with the release of that task. However, as shown in Figure 5.1 on page 134, synchronous release of all higher priority tasks may not result in the worst-case response time for task τ i . In general, we do not know what scenario, or pattern of releases of higher priority tasks will result in the worst-case response time for task τ i ; however, we can derive further information about possible worst-case scenarios.

Lemma 5.4.

The maximum possible number of jobs of a higher priority task τ h causing interference in the longest priority level-i busy-period (characterising the worst-case response time of task τ i ) is given by w/T h where w is the length of the busy-period.

Proof. Lemma 5.3 shows that the busy-period starts (at time t = 0) with the release of task τ i , hence at t = 0, there can be no jobs of higher priority tasks with outstanding execution, other than those also released at t = 0, otherwise the busy-period would have started earlier. It follows that the maximum number of higher priority jobs of task τ h in the busy-period is given by w/T h .

Schedulability Analysis 137

Response Time Upper Bounds

We do not know up to know the precise pattern of releases of higher priority jobs that leads to the worst-case response time for task τ i , we cannot determine the exact worst-case response time. Instead, we derive an upper bound R U B1 i and then a tighter upper bound R U B2 i on the exact worst-case response time R i , where

R U B1 i ≥ R U B2 i ≥ R i .
These upper bounds provide sufficient schedulability tests U B1 and U B2 respectively, where U B2 dominates U B1.

The process we use to obtain these upper bounds is similar to the classic formulation of response time analysis presented in Section 1.5 on page 40. We aim to find the smallest interval w, for which an upper bound on the response time of task τ i , considering the maximum possible interference from higher priority tasks released in that interval, equates to the length of the interval. The value of w then provides an upper bound on the worst-case response time of task τ i .

We require a function F (w) that upper bounds the length of the longest priority level-i energy busy-period formed by a single job of task τ i and jobs of higher priority tasks released during an interval of length w. Provided that F (w) is a monotonically non-decreasing function of w, then we may obtain an upper bound on the worst-case response time of task τ i corresponding to the smallest value of w > 0 that satisfies:

w = F (w) (5.5)
Equation 5.5 may be solved using fixed point iteration starting with w = C i and ending on convergence or when w > D i in which case the task is deemed unschedulable.

Upper Bound R U B1

We now derive a simple upper bound R U B1 i on the worst-case response time of task τ i . First we prove a Lemma used in its derivation.

Lemma 5.5.

Let X be some arbitrary sequence of execution units of tasks of priority i or higher, and Y be the equivalent sequence re-ordered such that all execution units of consuming tasks come before all execution units of gaining tasks. The elapsed time required to complete sequence Y is no shorter than that required to complete sequence X.

Proof. We may obtain sequence Y from sequence X by an iterative process of choosing the first execution unit belonging to any gaining task (at position g) and swapping it with that of the last execution unit of any consuming task (at position k) provided that g < k. Repeating this process until all consuming execution units come before all gaining execution units transforms sequence X into sequence Y . Let the new sequences produced by this process be X 1 = X, X 2 , X 3 . . . X n = Y . Note at most L X /2 swaps are required. We now show that each swap transforming sequence X p into sequence X s where s = p + 1, results in an elapsed time for sequence X s that is no shorter than that for X p , and hence by induction that the elapsed time for sequence Y is no shorter than that for sequence X. Let X p [g] and X p [k] be the elements being swapped where g < k. Since X p [g] is an execution unit of a gaining task and X p [k] is an execution unit of a consuming task, the energy required for these execution units has the relationship

E Xp [g] < E Xp [k]. Recall that E * Xp [m]
is the energy required to execute all execution units in the subsequence from X p [1] to X p [m]. It follows that:

∀m, 1 ≤ m < g E * Xs [m] = E * Xp [m] ∀m, g ≤ m < k E * Xs [m] = E * Xp [m] + E Xs [k] -E Xp [g] ∀m, k ≤ m E * Xs [m] = E * Xp [m] ⇒ E * Xs [m] ≥ E * Xp [m]
Hence the minimum number of replenishment units required to execute the subsequences from the 1st to the m-th element of X p and X s have the following relationship:

I * Xs [m] ≥ I * Xp [m] (see Equations 5.
2 on page 135 and 5.3 on page 135). Since the number of execution units in each sequence (X s and X p ) is the same (i.e. L Xp = L Xs ), we have:

L Xs + I * Xs [m] ≥ L Xp + I * Xp [m].
Thus the elapsed time required to execute sequence X s is no shorter than that required for sequence X p . Induction over at most L X /2 steps proves that the elapsed time required to complete sequence Y is no shorter than that required for sequence X.

Theorem 5.1. An upper bound on the worst-case response time for task τ i for a set of jobs released in a window of length w can be obtained by assuming that there is one job of task τ i and w/T h jobs of each higher priority task τ h . Further, the upper bound is obtained from a sequence Z of the execution units of these jobs where all the consuming execution units are before all the gaining execution units.

Proof. Let X be the sequence of execution units that results in the longest priority level-i energy busy-period under P F P ASAP scheduling, and hence the longest response time for task τ i ), for a set of jobs released in a window of length w. The elapsed time for the sequence is given by L

X + I * X [L X ]
where L X is the length of the sequence and I * X [L X ] is the total number of replenishment units required. Lemma 5.5 on the previous page shows that the elapsed time required to execute a sequence Y is no shorter than that required to execute sequence X, where sequence Y comprises the execution units in X re-ordered such that all execution units of consuming tasks are placed before execution units of gaining tasks. Note that at this point we do not know how many jobs of higher priority tasks are present in sequence X and therefore also in sequence Y ; however, by Lemma 5.4 on page 136 we know that the maximum number of jobs of a higher priority task τ h that could be present is w/T h . Hence we add execution units to sequence Y as necessary to account for any shortfall in the number of jobs in X below this value, thus forming sequence Z. (Consuming execution units are added at the start of the sequence and gaining execution units at the end). We note that such additional execution units cannot reduce the elapsed time required to execute the sequence since all execution units of both consuming and gaining tasks require a positive amount of energy. Sequence Z (as described in the Theorem) therefore requires an elapsed time to execute that is no smaller than that of sequence X.

We use Theorem 5.1 on the preceding page to formulate the workload function

W U B1 i (w) W U B1 i (w) for upper bound R U B1 i
. We assume that the initially available energy is zero, the number of jobs of task τ i and each higher priority task released in an interval of length w is given by w/T h , and that all execution units of consuming jobs are executed before all execution units of gaining tasks. We note that the number of jobs considered equates to synchronous release of all the tasks, with re-release as soon as possible. This is equivalent to the critical instant for classical tasks without energy considerations. Although this is not necessarily the worst-case scenario for tasks that require energy (see Figure 5.1 on page 134 for a counter example), it is the worst-case scenario with respect to how our upper bounds are computed. The workload function for R U B1 i is given by:

W U B1 i (w) =          j≤i ∧ τ j ∈Γc w T j × E j P r          + j≤i ∧ τ j ∈Γg w T j × C j (5.6)
where the first term represents the total time to complete the execution units of consuming tasks, which are in effect energy-bound, and the second term is the time taken to complete the execution units of gaining tasks, which are processing time bound. Observe that W U B1 i (w) is a monotonically non-decreasing function of w since all terms are positive and w only appears in the numerator of ceiling functions. Further

W U B1 i (w) ≥ C i since C i /T i = 1 and if task τ i is a consuming task then E i /P r ≥ C i , hence C i
serves as a valid initial value for fixed point iteration.

We note that in the case where all tasks are gaining tasks and so energy is not a consideration, Equation 5.6 reduces to the exact analysis for classical tasks. Further, in the case where all tasks are consuming tasks Equation 5.6 reduces to the analysis for that case given by Equation 4.3 on page 113.

Upper Bound R U B2

We can refine the first upper bound by considering a more realistic scenario. More precisely, the idea is to take into consideration the fact that some gaining jobs cannot 140 Chapter 5. Approximate Response-Time Analysis for EH Systems be executed after some consuming ones, because of their respective deadlines and releases, which define sub-intervals in which they are forced to run when the system is schedulable. This idea is illustrated in Figure 5.2, which shows three jobs of a consuming task and three jobs of a gaining task. We know that provided the tasks are schedulable, job 1 of the gaining task must run before job 3 of the consuming task. This information can be used to compute a tighter upper bound on the maximum time needed to complete all of the jobs in the interval.

We now derive our second upper bound R U B2 i . The workload function W U B2 i (w) for R U B2 i is derived from a dummy schedule and the sequence of execution units obtained from it. Construction of the dummy schedule is as illustrated in Figure 5.2. The dummy schedule is measured in time units and covers the interval [0, w). It has a timeline for each task of priority i and higher, with one job of task τ i and w/T h jobs of each higher priority task τ h . Jobs of consuming tasks (including task τ i if it is one) are placed in the dummy schedule starting with a release at t = 0, with subsequent releases as soon as possible. These jobs are assumed to execute immediately. For gaining tasks (including task τ i if it is one) we first align the release of the last job at time w -C i this job is assumed to execute immediately. Previous jobs of the gaining task are then released as late as possible respecting the release time of the subsequent job, and assumed to execute as late as possible i.e. just prior to their deadlines. Thus jobs of gaining tasks are added from the end of the dummy schedule working backwards in time, and jobs of consuming tasks are added from the start of the dummy schedule working forwards in time. Note that there may be overlaps between the schedules where more than one task appears to execute at the same time. This is shown in Figure 5.2: intervals [4,5] and [START_REF] Example | [END_REF]10].

From the dummy schedule, we derive a sequence Z of execution units. This sequence is composed by starting at the beginning of the dummy schedule with an empty sequence and appending all gaining tasks with execution in that time unit onto the sequence, followed by all consuming tasks with execution in the same time unit. This process is then repeated for all subsequent time units until all execution units have been collected. Note ties between execution units of two or more gaining tasks or two or more consuming tasks may be broken arbitrarily; however, all execution units of gaining tasks associated with some time unit t are placed into the sequence ahead of all execution units of consuming tasks associated with the same time unit. All execution units associated with a later time unit e.g. t + 1 appear later in the sequence than those associated with an earlier time unit t (We note that clashes may safely be resolved by giving preference to gaining tasks, since those execution units must necessarily take place by that time otherwise a deadline will be missed. Execution units of consuming tasks could and would have been executed earlier in any real schedule that meets all deadlines).

Finally, the workload function W U B2 i (w) is computed giving the elapsed time required to execute sequence Z, assuming that the initial energy is at its minimum. This can be done via simulation, limited to at most a length of time D i .

Theorem 5.2.

An upper bound on the worst-case response time for task τ i for a set of jobs released in a window of length w, where no higher priority jobs miss their deadlines, can be obtained by assuming that there is one job of task τ i and w/T h jobs of each higher priority task τ h , with the upper bound equating to the maximum time required to execute a sequence Z of the execution units of these jobs constructed according to the rules and dummy schedule construction described previously.

Proof. Let X be the sequence of execution units that results in the longest priority level-i energy busy-period under P F P ASAP scheduling (and hence response time for task τ i ) for a set of jobs released in a window of length w where all higher priority tasks meet their deadlines. For each task τ h , let N h be the number of jobs in sequence X. Consider a sequence Y formed by constructing a dummy schedule of length w including N h jobs of each task τ h and one job of task τ i and applying the rules stated above for ordering execution units (Recall from Lemma 5.3 on page 136 that there is only one job of task τ i in the busy-period, and hence in sequence X). Sequence Y and sequence X contain an identical set of execution units. Since no deadlines are missed when sequence X is executed, and the dummy schedule used to construct sequence Y places execution units of gaining jobs as late as possible without missing a deadline, in relation to the execution units of consuming jobs which are placed as early as possible without invalidating minimum inter-arrival constraints. It follows that sequence Y can be obtained from sequence X by a process of swapping earlier gaining execution units for later consuming execution units (Note that re-ordering of sub-sequences consisting of solely gaining execution units or solely consuming execution units may also be needed to obtain precisely the same sequence; however, Lemma 5.2 on page 135 shows that this re-ordering among execution units of the same type has no effect on the elapsed time required to execute the complete sequence). Finally, we compare sequence Z obtained as described in the Theorem, and sequence Y . If sequence Y contains the maximum number of jobs w/T h of each task that may be released in a window of length w, then it is identical to sequence Z. Otherwise, sequence Z may be obtained from sequence Y by adding execution units for any missing jobs where w/T h > N h . Since all execution units require energy, addition of execution units into the sequence at any point cannot decrease the elapsed time required to execute the sequence. Hence the elapsed time required to execute sequence Z is no shorter than that required to execute sequence X.

Theorem 5.2 on the previous page shows that W U B2 i (w) provides a valid upper bound on the worst-case response time for task τ i considering all jobs released in a window of length w. In order to use W U B2 i (w) in a fixed point iteration to determine an upper bound on the worst-case response time of task τ i we must also show that W U B2 i (w) is a monotonic non-decreasing function of w, and that W U B2 i (w) > C i , so that we may use C i as an initial value. The latter is trivially the case since a single job of task τ i is always included in the workload and takes at least time C i to execute. Proof. Consider increasing the length of the window from some arbitrary value w to w + v, comparing the dummy schedules used to derive W U B2 i (w) and W U B2 i (i, w + v) there are two effects: (i) all execution units of gaining jobs move to a later time e.g. t + v rather than t, (ii) new execution units of gaining jobs may be added near the start of the schedule and new execution units of consuming jobs may be added near the end of the schedule. Consider sequence X formed in deriving W U B2 i (w) and sequence Y formed in deriving W U B2 i (i, w + v) but omitting all of the execution units of the new jobs from (ii). Sequences X and Y contain the same set of elements. Since all execution units of gaining jobs are v time units later in the dummy schedule used to construct sequence Y , it follows that sequence Y can be formed from sequence X by swapping later gaining execution units in X for earlier consuming execution elements, and as necessary re-ordering sub-sequences containing solely gaining or solely consuming execution units (Lemma 5.2 on page 135). Hence the elapsed time required to execute sequence Y is no shorter than that required for sequence X. Consider a further sequence Z, if there were no additional jobs from (ii) then sequence Z is identical to sequence Y , otherwise it may be obtained from sequence Y by adding execution units for the missing jobs. Since all execution units require energy, addition of execution units into a sequence at any point cannot decrease the elapsed time required to execute the sequence. Hence the elapsed time required to execute sequence Z is no shorter than that required to execute sequence X.

We now return to the assumption in Theorem 5.2 on the previous page that all deadlines of higher priority tasks are met. This might seem to imply that task schedulability must be checked highest priority first; however, this is not necessarily the case. Consider what happens if we test task schedulability lowest priority first. We tentatively test the schedulability of task τ i on the assumption that all higher priority tasks will later be found to be schedulable. If task τ i is deemed schedulable (caveat this assumption), then we go on to check higher priority tasks. If some higher priority task τ h is subsequently found to be unschedulable, then this undermines the validity of our schedulability test for task τ i ; however, this is now of no consequence, since the task set is in any case unschedulable due to task τ h . If instead, all higher priority tasks are found to be schedulable, then the schedulability test for task τ i is validated (We note that the schedulability or otherwise of a lower priority task τ i has no impact on the schedulability of any higher priority task τ h ).

Theorem 5.4. Schedulability test U B2 dominates test

U B1 i.e R U B1 i ≥ R U B2 i .
Proof. We prove the theorem by showing that W U B2 i (w) ≤ W U B1 i (w). Consider the sequence Y representing W U B1 i (w) and the sequence X representing W U B2 i (w). The sequences contain the same elements; however, in sequence Y all of the consuming execution units are before all of the gaining execution units, hence by Lemma 5.5 on page 137, the elapsed time required to complete sequence Y is no shorter than that required to complete sequence X.

Battery Capacity

We now return to a consideration of the minimum battery capacity C min (we note C U Bi min the minimum battery capacity for U Bi). For the sufficient test U B1 to be valid, we require that. C U B1 min ≥ max(max ∀i (P i ) -P r , P r ). This small battery capacity is sufficient, since in computing an upper bound on the worst-case response time, U B1 assumes that all consuming execution units come before all gaining execution units. The minimum battery capacity needed to execute this sequence without impinging on the elapsed time required is simply enough to execute the most costly unit of execution in terms of energy, which equates to max ∀i (P i ) -P r or max ∀i (E i /C i ) -P r . In addition, the battery capacity cannot be less then P r , the maximum amount of energy replenished during one time unit.

By comparison, for the sufficient schedulability test U B2 to be valid, it suffices to have a minimum battery capacity C min that equates to at least the total net energy required to execute all of the consuming jobs in the longest possible priority level-n energy busy period. Such a store of energy upper bounds that which can ever usefully be deployed to execute consuming jobs in any possible busy period. Having a larger battery capacity than this is equivalent in terms of task response times to having infinite battery capacity Note that by the total net energy required by consuming jobs, we mean the energy they consume less the energy generated while they actually execute. Since the longest possible level-n energy-busy-period cannot be greater than the longest task deadline, otherwise the system would be unschedulable, we can upper bound the battery capacity required as follows:

C U B2 min ≥ max ∀i max ∀j (D j ) T i × max (E i -C i × P r , 0) , P r .

Response Time Lower Bound

In this section, we derive an analytical lower bound R LB1 i ≤ R i on the worst-case response time of task τ i . To obtain the lower bound, we analyse a specific scenario that corresponds to the synchronous release of task τ i along with all higher priority tasks, which are then assumed to be re-released as soon as possible. Further, we assume that the initial energy is a minimum i.e. E(0) = 0. Although this is not necessarily the worst-case scenario, it is a valid scenario and hence suffices to provide a valid lower bound on the longest priority level-i energy-busy-period and hence the worst-case response time of task τ i .

We obtain the lower bound response time R LB1 i via fixed point iteration, using a workload function W LB1 i (w) that is monotonically non-decreasing in w and lower bounds the elapsed time needed to execute all jobs of tasks of priority i or higher released in an interval of length w starting with a synchronous release. Lemma 5.6. Let X be some arbitrary sequence of execution units of tasks of priority i or higher, and Y be the equivalent sequence re-ordered such that all execution units of consuming tasks come after all execution units of gaining tasks. The elapsed time required to complete sequence X is no shorter than that required to complete sequence Y .

Proof. Follows by applying similar reasoning to the proof of Lemma 5.5 on page 137.

Theorem 5.5.

A lower bound on the worst-case response time for task τ i assuming synchronous release with all higher priority tasks resulting in a priority level-i energy busy-period of at least length w, can be obtained by assuming that there is one job of task τ i and w/T h jobs of each higher priority task τ h in the busy-period. Further the lower bound equates to the time required to execute a sequence Z of the execution units of these jobs where all the consuming execution units are after all the gaining execution units, and the initial energy is a minimum. Proof. By the theorem, the busy-period is at least w long, hence under P F P ASAP scheduling all w/T h jobs of each higher priority task τ h released during the interval [0, w) must complete before the single job of task τ i . Let X be the sequence of execution units of all of the jobs under P F P ASAP scheduling. The elapsed time required to execute sequence X lower bounds the worst-case response time of task τ i . Further, let Z be (as per the theorem) the same set of execution units as sequence X re-ordered such that all the consuming execution units are after all the gaining execution units. By Lemma 5.6, the elapsed time to execute sequence Z is no longer than that required to execute sequence X.

We use Theorem 5.5 on the preceding page to formulate our lower bound workload function W LB1 i (w). We assume that the initially available energy is zero, the number of jobs of task τ i and each higher priority task τ h released in an interval of length w is given by w/T h and that all execution units of consuming jobs are executed after all execution units of gaining tasks. Proof. Consider the formula for W LB1 i (w). Since w appears only in the ceiling functions, it follows that X g i , X c i and Y g i are all non-decreasing functions of w. Further, (X g i P r -Y g i ) represents the net energy increase while all the gaining jobs execute. Since every execution unit of a gaining task is by definition energy positive, this quantity is also a non-decreasing function of w. Thus Y c i -(X g i P r -Y g i ) may decrease with increasing w. The largest possible decrease is obtained when Y c i remains at the same value, while (X g i P r -Y g i ) increases, hence (X g i P r -Y g i )/P r decreases. However, such a decrease is always at least compensated for by the increasing value of the first term in Equation 5.7, i.e. X g i . This happens because the additional energy made available by each execution unit of an additional gaining job is no more than that available from a replenishment unit. Hence (X g i P r -Y g i )/P r cannot decrease by more than X g i increases. We note that monotonicity can also easily be seen by considering the sequence Z (in Theorem 5.5 on the preceding page) which can only take a longer elapsed time to execute with the addition of further jobs, since all execution units require a positive amount of energy.

X g i = τ h ∈Γg h∈hep(i) w T h × C h , X c i = τ h ∈Γc h∈hep(i) w T h × C h Y c i = τ h ∈Γc h∈hep(i) w T h × E h , Y g i = τ h ∈Γg h∈hep(i) w T h × E h W LB1 i (w) = X g i + max X c i , Y c i -(X g i × P r -Y g i ) P r (5.7)
We note that a tighter lower bound can be obtained via the simple expedient of simulating the actual schedule of execution starting from synchronous release of task τ i and all higher priority tasks. We return to this point in Section 5.4 on page 147.

Priority Assignment

The DM priority assignment is optimal for fixed-priority preemptive scheduling of constrained deadline tasks conforming to the classical task model where energy is not considered. In Section 4.3.4 on page 119, we extended the optimality of DM to energy-non-concrete task sets that are composed of only consuming tasks. However, when we relax the assumption on tasks energy consumption, i.e. gaining tasks are accepted, the proof provided in Section 4.3.4 is no longer valid. In this section, we show that DM priority assignment is also optimal with respect to our sufficient schedulability tests U B1 and U B2, for energy-constrained systems with both consuming and gaining tasks. This does not mean that DM is optimal for energy-work-conserving scheduling in the general case, but only with respect to the necessary schedulability conditions based on U B1 and U B2.

Definition 5.4 (Optimal Priority Assignment Policy).

A priority assignment policy P is said to be optimal with respect to a schedulability test S, if for every task set τ where there exists some priority assignment Q such that the task set is schedulable according to test S, then τ is also schedulable according to test S with the priority ordering given by policy P .

Theorem 5.7. Deadline Monotonic (DM ) priority assignment is an optimal priority assignment policy with respect to sufficient schedulability test S (U B1 or U B2) for task sets comprising any arbitrary combination of consuming and gaining tasks.

Proof. To prove the theorem, we show that any task set Γ that is schedulable according to test S (U B1 or U B2) under some priority ordering Q remains schedulable according to test S under deadline monotonic priority order P . We do this by transforming priority order Q into priority order P by swapping the priorities of tasks that are adjacent to each other in the priority order, but out of DM order. We show that on every swap the task set remains schedulable according to test S. Let τ A and τ B be two tasks in τ which are at adjacent priorities under the initial, schedulable priority ordering, with D A > D B and τ A at a higher priority k than τ B , which has a priority i = k + 1 (i.e. the tasks are out of DM order). Let the upper bound response time of task τ B according to schedulability test S be R U B i in the initial priority order. We now swap the priorities of the tasks, so that τ B has the higher priority. We consider the following groups of tasks:

(i) hp(k): these tasks have higher priorities than either τ A or τ B and so their upper bound response times, according to test S (U B1 or U B2), are unchanged by the swap.

(ii) lp(i): these tasks have lower priorities than either τ A or τ B and so their upper bound response times, according to test S (U B1 or U B2), are unchanged by the swap, since interference from higher priority tasks does not, according to the test, depend on the relative priority order of those tasks.

(iii) task τ B : now has a higher priority than τ A , and so is only subject to interference from tasks in hp(k), rather than hp(k) ∪ τ A , hence τ B remains schedulable.

(iv) task τ A : is now at priority i with τ B at higher priority. From the previous schedulable priority ordering, we have

R U B i ≤ D B ≤ T B and D B < D A ≤ T A , hence w = R U B i
was computed by test S by including exactly one job of τ A , one job of τ B and w/T h jobs of each higher priority task τ h ∈ hp(k). We observe that the computation of the busy-period length w by test S (U B1 or U B2) depends only on this set of jobs and not on their relative priorities. We now consider w = R U B i as a possible value for the response time of task τ A under the new priority ordering. As R U B i ≤ T B , then there is only one job of task τ B released in an interval of length w, along with w/T h jobs of each higher priority task τ h ∈ hp(k), and the single job of task τ A . Therefore, according to test S, R U B i is also the upper bound response time for task τ A when it is at priority i. Since R U B i ≤ D B < D A , it follows that task τ A is schedulable at priority i.

Recall the exact test for P F P ASAP scheduling with only consuming tasks presented in Equation 4.3 on page 113 which is based on exact response time analysis (see Equation 4.3 on page 113). We note that the U B1 and U B2 tests reduce to Equation 4.3 on page 113 when there are only consuming tasks, and hence it follows from Theorem 5.7 on the preceding page that DM priority assignment is also optimal in that case. Similarly, if all tasks are gaining tasks, then the U B1 and U B2 tests reduce to the classical exact test (Equation 1.14 on page 45) for FTP without energy considerations. DM priority assignment is again optimal in that case [START_REF] Leung | On the complexity of fixed-priority scheduling of periodic real-time tasks[END_REF].

We note that it remains an open question whether Deadline Monotonic priority assignment is optimal with respect to an exact analysis for constrained deadline task sets with both consuming and gaining tasks scheduled by P F P ASAP .

Performance Evaluation

In this section, we present the results of an empirical investigation, examining the effectiveness of the sufficient schedulability tests presented in this chapter.

Taskset generation

To perform these experiments, we randomly generated approximately 40000 task sets, varying the processor utilization, the energy utilization, and the percentage of gaining tasks.

We varied U and U e in the range [0.05, 1] in steps of 0.05. The proportion of gaining tasks was varied from 0% to 100% in steps of 10% for each pair of values (U, U e), hence we obtained 100 distinct task sets for each pair (U, U e). Each tasks set comprised 10 tasks.

The task parameters were randomly generated as follows: task processor utilization (U i = C i /T i ) using the UUnifast Discard algorithm [START_REF] Bini | Measuring the Performance of Schedulability Tests[END_REF], task energy utilization (U e i = E i /T i × P r ) using an adapted version of UUnifast Discard to control the type of task generated (gaining or consuming), and periods randomly generated between 2 and 25200 time units with a hyper-period limitation technique [START_REF] Macq | Limitation of the hyper-period in realtime periodic task set generation[END_REF].Task deadlines were implicit and the rate of energy replenishment P r i was set to 15,

Schedulability tests investigated

We investigated the performance of the following schedulability tests.

• U T Z: the exact test for FTP ignoring energy constraints. This was used to provide a schedulability bound, considering only processing time.

• SIM : is an empirical necessary test based on simulating the schedule of P F P ASAP over more than twice the hyper-period, starting with synchronous release and the minimum energy level. This is not guaranteed to reveal the real worst-case scenario, but can be used as a reference for comparison.

• U B1: the sufficient test presented in Section 5.3.4 on page 137.

• U B2: the sufficient test presented in Section 5.3.5 on page 139.

• LB1: the necessary test presented in Section 5.3.7 on page 144.

Figure 5.3 shows how the percentage of task sets that are deemed schedulable by each of the tests varies with processor utilization. The U T Z test has notionally the highest performance since it ignores energy considerations. When energy is considered, U T Z, LB1 and SIM provide necessary tests, upper bounding the number of task sets that could possibly be schedulable. An exact test considering energy would fall somewhere between SIM and U B2. We observe that the results confirm that U B2 provides a tighter bound than U B1, with a larger improvement at higher utilization levels.

Weighted Schedulability we present a further set of experiments showing how schedulability depends on different parameters, including energy utilization and the proportion of gaining tasks, via the Weighted Schedulability Measure [START_REF] Bastoni | Cache-Related Preemption and Migration Delays: Empirical Approximation and Impact on Schedulability[END_REF]. As well as processor utilization, task set schedulability is dependent on a number of other key parameters, including: energy utilization, and the percentage of gaining tasks. Evaluating all possible combinations of these parameters is not possible, instead, the evaluation in this section varies one parameter at a time, with the results presented in terms of the weighted schedulability measure [START_REF] Bastoni | Cache-Related Preemption and Migration Delays: Empirical Approximation and Impact on Schedulability[END_REF].

The figures in this section show the weighted schedulability measure W y (p) for each schedulability test y as a function of parameter p. For each value of p, this measure combines results for all of the task sets Γ generated for all of a set of equally spaced utilization levels (5% to 100% in steps of 5%).

Let S y (Γ, p) be the binary result (1 or 0) of schedulability test y for a task set Γ with parameter value p:

W y (p) = ∀Γ U Γ × S y (Γ, p) / ∀Γ U Γ (5.8)
where U Γ is the processor utilization of taskset Γ. The weighted schedulability measure reduces what would otherwise be a 3-dimensional plot to 2 dimensions [START_REF] Bastoni | Cache-Related Preemption and Migration Delays: Empirical Approximation and Impact on Schedulability[END_REF].

Weighting the individual schedulability results by task set utilization reflects the higher value placed on being able to schedule higher utilization task sets.

Figure 5.4 on the next page

shows how the weighted schedulability measure for each schedulability test depends on task set energy utilization. The U T Z test ignores energy constraints and hence exhibits minimal variation due to the uniform distribution of U e and U . The tests that consider energy (LB1, SIM , U B2, U B1) all show the same pattern of behaviour as the classical schedulability tests do against processor utilization, i.e. schedulability reduces at high levels of utilization (energy utilization in this case). We note that the performance of the simple sufficient test U B1 degrades with increasing energy utilization because in this case the overestimation of worst-case response times is greater.

Figure 5.5 on the following page shows the impact of task set composition. When the task sets comprise only gaining tasks, then all of the tests give precisely the same performance. This is because no energy replenishment is needed, and in this case all of the tests reduce to the exact test for fixed-priority preemptive scheduling with no energy constraints. Similarly, for task sets comprising only consuming tasks, the worst-case scenario is the synchronous release with the battery level set to the minimum [START_REF] Abdeddaïm | The Optimality of P F P ASAP Algorithm for Fixed-Priority Energy-Harvesting Real-Time Systems[END_REF]. Between these two extremes, the closer the task sets are to an equal mix of consuming and gaining tasks, the more opportunity there is for consuming tasks to make use of the net energy gain from gaining tasks, and hence the more U B1 and U B2 diverge from (SIM ) and LB1. Here, U B2 is less impacted since it takes some account of the net energy gain due to gaining jobs that execute ahead of consuming jobs.

D i -C i is 10% of T i -C i to 100% of T i -C i (i.e. implicit deadlines).
We observe that all of the schedulability tests are influenced by the tightness of deadlines to a similar degree, with heavily constrained deadlines having significant impact on schedulability in all cases.

Conclusions

In this chapter, we addressed the problem of schedulability conditions in real-time energy-harvesting systems, where the respect of both time and energy constraints have to be guaranteed. In such systems, tasks can be classified as gaining or consuming tasks depending on whether or not the system has a net gain or loss of energy when the task executes. In Chapter 4 we showed that the energy work-conserving scheduling policy P F P ASAP is optimal among all fixed-priority algorithms for the case where all tasks are consuming tasks.

The major contributions of this chapter are as follows. We showed that under P F P ASAP scheduling algorithm, the critical instant (worst-case scenario) for task sets with both consuming and gaining tasks is not necessarily synchronous release with all other tasks. While we did not identify the specific worst-case scenario for this more general model, we were able to prove a number of properties that it must have. We used these properties to derive two upper bounds on task response times, thus forming two sufficient schedulability tests. In a similar way, we also derived a lower bound response time, and hence a necessary schedulability test. We proved that Deadline Monotonic is the optimal priority assignment policy for P F P ASAP with respect to our sufficient tests. Finally, we evaluated the performance of the sufficient tests in comparison with a number of necessary tests, including an exact test for fixed-priority preemptive scheduling ignoring energy constraints, and an empirical test based on simulating the schedule for more than a hyperperiod. We found that our tighter upper bound (sufficient schedulability test U B2) provides good performance over a wide range of values of different parameters e.g. energy utilization, proportion of gaining tasks etc. (explored using the weighted schedulability measure).

Chapter 6

Optimal Algorithm Investigation

Introduction

In the precedent chapters we saw that finding efficient scheduling algorithms for fixed-priority energy-harvesting systems is one of the challenges of this research area. In Chapter 4, we presented P F P ASAP which is an optimal scheduling algorithm. Moreover, the optimality of this algorithm relies on two main assumptions: the considered task sets are energy-non-concrete (see Definition 3.4 on page 70), and all the tasks consume more energy than it is replenished. Unfortunately, removing one of these two assumptions leads P F P ASAP to lose its optimality. This is due to the fact that without these assumptions, the worst-case scenario of P F P ASAP is no longer the synchronous activation with the minimum battery capacity. Moreover, without these assumptions, the worst-case scenario is unknown up to now. There exist some counter examples that prove the non-optimality of P F P ASAP (see Figures 6.2 on page 157 and 5.1 on page 134).

The challenge now is to understand why does P F P ASAP lose its optimality and we try to study deeply the fixed-priority scheduling for energy-harvesting systems by attempting to build an optimal algorithm or otherwise to prove the nonexistence of such an algorithm.

In this chapter, we explore different intuitive ideas of scheduling algorithms and we explain why they are not optimal through counter examples. Then, we show the difficulty of finding an optimal algorithm or proving the nonexistence of such an algorithm with a reasonable complexity.

The remainder of this chapter is organized as follows. In section 6.2 we define and prove some properties of fixed-priority scheduling for energy-harvesting systems. After that, we explore in Section 6.3 different ideas of scheduling algorithms and we discuss the existence of an optimal algorithm. Finally, we conclude the chapter with Section 6.4.

Definitions and Notations

In order to facilitate the understanding of the next sections, we first redefine and prove some properties.

Model and Notations

In this chapter we consider the model described in Section 3.2 on page 67. Furthermore, in addition to the notations set in Section 1.2 on page 30, we consider the following ones.

• s i,j : the starting time of job J i,j ,

• a i (t): the next activation time of task τ i after time t,

• c i (t): the remaining execution time of the current job of task τ i at time t. It is equal to 0 if the job is already finished,

• e i (t): the remaining energy cost of the current job of task τ i at time t. It is equal to 0 if the job has finished its execution,

• d i (t): the absolute deadline of the current job of task τ i at time t, it does not exist if the job is not yet activated,

• s i (t): the execution starting time of the current job of task τ i at time t, it is undefined if the job is not yet activated. The energy balance of a job J i,j at time t denoted Ba i (t) is the difference between the energy budget between time t and the deadline of J i,j , and the energy demand of the same priority level and the same time interval. It can be obtained by Equation 6.4.

Definitions

Ba i (t) = Bu(t, d i,j ) -W e i (t, d i,j ) (6.4)

We notice that if the time t does not coincide with a request time of task τ i and the previous job has already finished its execution, we must include the execution of the lower priority jobs between time t and the next request time of priority level-i, i.e. a i (t), because they consume energy before time a i (t) and can change the energy balance at time d i,j as illustrated in Figure 6.1 on the following page. However, these lower priority executions units depend on the used scheduling algorithm, i.e. energy-work-conserving or not. This limitation is discussed in Section 6.3 on page 159.

Energy-Work-Conserving

Without taking into account energy constraints, the work-conserving property in real-time scheduling means that the scheduling algorithm does not add idle times when there is at least one job ready to execute. However, when we consider energy-harvesting constraints, scheduling algorithms may add necessary idle periods to replenish energy. Then, this notion is extended to energy-work-conserving in Definition 3. This definition means that scheduling algorithms do not replenish energy more than needed, otherwise, the algorithm is considered as non-energy-work-conserving.

Unfortunately, P F P ASAP , which is an energy-work-conserving algorithm, loses its optimality when we consider tasks with offsets or an initial battery level higher than E min . Figure 6.2 on the facing page illustrates a counter example. We can see in Figure 6.2(b) on the next page that the lower priority task τ 2 is executed before τ 1 following the energy-work-conserving principle, i.e. as soon as the energy is sufficient to execute, it consumes the energy needed for the higher priority task τ 1 which needs more time than its deadline to replenish the required energy. We can see that in such a situation, executing as early as possible can lead to a deadline miss while delaying the execution of lower priority tasks can avoid missing deadlines as shown in Figure 6.2(c) on the facing page. Following this intuition, we propose Lemma 6.1.

Lemma 6.1. The energy-work-conserving scheduling is not optimal for the scheduling problem of fixed-priority energy-harvesting systems.

Proof. To prove this property we have just to find an example where a valid energywork-conserving schedule is not possible while a valid schedule exists. Let us consider a task set denoted Γ composed of two tasks τ 1 and τ 2 with the following configuration:

Definitions and Notations

157

-O i C i E i T i D i P i τ 1 2 2 12
D 2 = 2 × C 2 + C 1 D 1 = C 1 O 1 > O 2 C 1 + C 2 = O 1 + D 1 E 2 = O 1 0 P r (t).dt E 1 + E 2 > E(0) + O 1 +D 1 0 P r (t).dt E 1 + E 2 ≤ E(0) + D 2 0 P r (t).dt T 1 = T 2 (6.5)
We can see that it is possible to finish executing τ 1 before O 2 according to an energy-work-conserving scheduling. However, it is not possible to schedule both τ 1 and τ 2 inside time interval [0, O 1 + D 1 ] because the available energy is not sufficient (see Condition 6.5). Thus, more delay is needed to harvest more energy. Then, executing τ 1 before τ 2 and delaying τ 2 leads to miss the deadline of τ 2 . Moreover, delaying τ 1 leads to add idle times while there is an active job and enough energy to execute immediately which violates the property of energy-work-conserving scheduling. In this case, it is impossible to produce a valid schedule with an energy-work-conserving scheduling. Then, we prove that energy-work-conserving fixed-priority scheduling cannot be optimal.

Energy-Lookahead Scheduling

In the classical real-time scheduling theory, a lookahead algorithm is an algorithm that is able to predict future job requests, for example in sporadic or periodic task models. However, in energy-harvesting model there is a new parameter subject to fluctuations: the incoming energy or the replenishment function. Therefore, we need to redefine the term of lookahead.

Definition 6.4 (Energy-Lookahead).

A energy-lookahead scheduling algorithm attempts to foresee the effects of a scheduling decision to evaluate the schedulability of future jobs. The aim of lookahead is to chose the best scheduling decision that does not lead to avoidable deadline misses. The clairvoyance includes the battery replenishment function as well as tasks inter arrival times. In the opposite, if the algorithm does not consider the future state of the system, then, it is said non-energy-lookahead. This means that the algorithm has knowledge a priori of the future state of the system, namely jobs activation times and energy replenishment function. The lookahead or clairvoyance consists of computations or scheduling simulation performed over a future interval of time that we call the lookahead window.

Definition 6.5 (Lookahead Window).

The lookahead or clairvoyance window for a priority level-i at time t is the shortest time interval [t, t + L[ such that the scheduling decision of priority level-i at time t does not impact the scheduling decisions of time interval [t + L, ∞).

Using this definition, we propose Conjecture 6.1.

Conjecture 6.1.

No non-energy-lookahead scheduling algorithm is optimal for fixed-priority energyharvesting systems.

Insight. From Lemma 6.1 on page 156 we know that non-work-conserving scheduling is needed for an optimal algorithm. This means that additional delays are needed to ensure meeting deadlines and energy requirements. It is obvious that the optimal length of these delays depends on the available energy and the potential interferences, which means that the replenishment function and the request times of higher priority jobs are needed to compute the right delay for each job. Therefore, delaying execution without any knowledge about the future incoming energy and the future activation times of higher priority jobs may lead to too short or too long idle periods which can compromise the respect of deadlines.

-

O i C i E i T i D i P i τ 1 28

Algorithms

From Lemma 6.1 and Conjecture 6.1, we can consider that an optimal algorithm for fixed-priority energy-harvesting systems must be non-work-conserving and energylookahead. In this section we explore some scheduling algorithms and heuristics that attempt to be optimal. We start by showing a counter example that is feasible with fixed-priority scheduling but is not schedulable with all the fixed-priority algorithms presented until now in this dissertation. Then, we discuss the possibility of finding or building an optimal algorithm.

The task set described in Table 6.1 shows many situations that make the fixedpriority scheduling for energy-harvesting systems difficult. In the following we explain why each scheduling algorithm fails to schedule this task set in this configuration while a feasible schedule exists: Figure 6.3 shows the beginning of such a schedule, and we know that is feasible because there is no deadline miss within twice the hyper-period. P F P ASAP : the first intuitive scheduling algorithm for fixed-priority energy-harvesting systems is to use the classical FTP algorithm and add replenishment periods when E min is reached. The P F P ASAP policy behaves so. As described in Chapter 4, it schedules tasks as soon as possible when the energy is sufficient and replenishes otherwise. The replenishment periods are as long as needed to execute one time unit of the higher priority job ready to execute (see Algorithm Again, P F P ASAP is not optimal because executing as soon as possible maximizes the energy demand within a short interval of time which can lead to a lack of energy and then a deadline miss. As we can see in Figure 6.4, jobs of lower priority than J 2,1 , namely J 3,1 and J 4,1 , are executed at early as possible and consume the energy needed for a higher priority job that is requested few instant later, i.e. J 2,1 . Job J 2,1 misses its deadline while the lower priority jobs, namely J 3,1 and J 4,1 , can be delayed to avoid this situation. P F P ALAP : the second intuitive idea is to schedule jobs prior to their deadlines in order to permit a maximum replenishment of energy before executing. The P F P ALAP algorithm was proposed based on this intuition. As described in Section 3.7.1 on page 92, it postpones jobs executions as long as possible all the time. Whenever there is available slack-time, executions are delayed (see Algorithm 3.5

on page 93).

Unfortunately, this is one of the counter intuitive ideas of fixed-priority scheduling for energy-harvesting systems. In fact, the P F P ALAP algorithm is not optimal also even with an unlimited battery capacity because the computation of slack-time does not consider energy constraints. As we can see in Figure 6.5 on the preceding page, a deadline miss can occur while a feasible schedule exists (Figure 6.3 on page 159). A deadline miss occurs at time 31 when the energy balance of time interval [23, 31] is negative even though there is available slack-time. The energy available until the deadline of job J 2,2 is lesser than the energy demand of the same time interval. This negative energy balance is due to the fact that delaying job too much J 2,2 leads the system to anticipate the execution of the higher priority job J 1,1 which increases the energy demand of time interval [23,31] and leads to an insufficient energy to finish executing J 2,2 before its deadline. This phenomena is due to the fact that the slack-time computation used for this algorithm does not consider the energy requirements of the system.

P F P ST : after P F P ASAP and P F P ALAP one can propose a hybrid algorithm that can behave sometimes as P F P ASAP and sometimes as P F P ALAP . The P F P ST algorithm was built following this intuition. It executes jobs as soon as possible whenever the energy is sufficient to execute and replenishes otherwise. The replenishment periods are as long as the available slack-time (see Algorithm 3.6 on page 96).

Even though this algorithm improves the schedulability rate comparing to P F P ALAP , it is still not optimal because of the same reasons than P F P ALAP and P F P ASAP . Figure 6.6 shows a counter example.

Fixed-Task-Priority Clairvoyant as soon as possible (F P Casap): the computation of slack-time in P F P ALAP and P F P ST algorithms is considered as time clairvoyance or time lookahead because it uses the arrival times of future jobs. However, the energy constraints were not considered, this is why the precedent algorithms fail to schedule some feasible task sets.

Thus, one can add energy clairvoyance to compute the right retardations that lead to t ← t + 1 18: end loop a valid schedule. Following this idea, the As Soon As Possible Clairvoyant Fixed-Priority Algorithm (F P Casap) was proposed in [START_REF] Abdeddaïm | Toward an Optimal Fixed-Priority Algorithm for Energy-Harvesting Real-Time Systems[END_REF]. Before authorizing a job to execute, it simulates the P F P ASAP schedule of the current and the future jobs in a clairvoyance window or a looakahead window.

The F P Casap algorithm inherits the behavior of P F P ASAP and adds clairvoyance capabilities. It schedules jobs as soon as possible whenever the two following conditions are met:

• there is enough energy available in the storage unit to execute at least one time unit,

• the execution of the current job does not lead to a deadline miss of jobs of higher priority which are requested during the clairvoyance window.

If these conditions are not satisfied, then, the algorithm suspends all executions for one time unit and then it tries again. Algorithm 6.1 shows how F P Casap takes scheduling decisions at time t when a job of priority level-i is ready to be executed. The F P Casap algorithm checks first if the execution of jobs of priority level higher or equal than i meet theirs deadlines. Then, it checks if it is possible to delay the current job by comparing its response time at time t + 1 with its deadline (line 7). After that, it repeats the process for higher priority jobs. This prevent delaying the current job uselessly because in the case where it is impossible to delay, if a deadline miss occurs in a higher priority level in the clairvoyance window, the deadline miss cannot be avoided and the system is not schedulable with F P Casap. The length of the clairvoyance window for a job is not proved but can be intuitively defined as the interval of time starting from time t to the absolute deadline d i (t) because the current job of level-i cannot be delayed more than its deadline.

Unfortunately, F P Casap is not optimal because when a future deadline is detected with the clairvoyance algorithm, all the jobs are delayed until the deadline miss disappears and it is too much in certain cases. This delay is from the left to the right following the time increasing axis. When the energy balance is negative at the end of the clairvoyance window, delaying a lower priority job for an unbounded period can lead to a deadline miss when a higher priority job is also delayed to a later time than the deadline of the lower priority job. Computing the response time at time t + 1 of the ready job according to P F P ASAP algorithm is not sufficient because it does not reflect the real response time of the job. Figure 6.7 illustrates a counter example where such a situation occurs. We can see that at time 0 when job J 4,1 is ready to execute, the P F P ASAP lookahead schedule detects a deadline miss in a higher priority level in the looakahead window, i.e. the deadline of job J 2,1 (see Figure 6.4 on page 160), then, it postpones execution for one time unit and then checks again at time 1, 2 and 3 and the same decision is taken. However, from time 3 to time 51, job J 4,1 cannot be executed because of the higher priority interferences and the required replenishments. This example teaches us that when the energy balance is negative, in this case in time interval [0, 44], it is impossible to schedule all the jobs that are requested inside this interval. Thus, the only way is to delay some jobs out of this interval. Moreover, we can see that all the jobs cannot be pushed out of this interval, only the ones that are requested inside the interval and have deadlines outside the interval. We can see that F P Casap takes the wrong decision by delaying the lower priority jobs, in this case J 4,1 , instead of higher priority jobs. t ← t + 1 11: end while Fixed-Task-Priority Lazy Scheduling Algorithm (F P LSA): one of the possible ways to find optimal fixed-priority algorithms is to try to adapt the behavior of some optimal algorithms for EDF scheduling. One can use the concept of the LSA presented in Section 3.6.3 on page 86. It consists of computing the latest time from which jobs can be executed continuously. This algorithm was proved to be optimal for task sets that consume energy with the same rate. To adapt LSA algorithm to fixedpriority scheduling, we assume that all tasks consume energy with the same rate, i.e. ∀ τ i , E i /C i = r. Furthermore, we keep the same scheduling schemes and we use fixed-priority scheduling instead of EDF ones. Therefore, the algorithm becomes as described in Algorithm 6.2 and we call it F P LSA.

The latest job starting time denoted s i,j is computed by Equation 6.6.

         s i,j = max(s i,j , s * i,j ) s * i,j = d i,j - E(a i,j ) + g(a i,j , d i,j ) r g(a i,j , s i,j ) -C = g(a i,j , d i,j ) + (s i,j -d i,j ) × r (6.6)
Unfortunately, this algorithm is not optimal even if we consider the same consumption rate for all tasks. We can see in Figure 6.8 on the facing page that the computation of the starting time s i,j is not adapted to fixed-priority scheduling. In fact, s i,j is the latest time from which we can execute continuously until the deadline d i,j . This works for EDF scheduling because in EDF all higher priority jobs have their request times and deadlines inside interval [t, d i,j ]. However, this is not the case in fixed-priority scheduling which can lead to too long delays. In Figure 6.8 on the next page, we can see that the delay computed at time 3 for job J 3,1 is much longer than the delay computed for job J 4,4 at time 0 which led this later to miss its deadline.

Fixed-Task-Priority As Late As Possible with energy guaranty (F P Leg):

the counter examples of the precedent algorithms show that even with energy and time clairvoyance the above algorithms are still not optimal. In fact, the priorities of The precedent examples show that in the case when the energy balance is negative in a certain interval of time, it is necessary to reduce the energy demand by pushing some jobs out of the interval. Then, the difficulty now is to find the subset of jobs to delay and calculate the lengths of their delays. We showed that delaying all the jobs at the maximum without considering energy like P F P ALAP , delaying all the lower priority jobs when a future deadline miss is detected as F P Casap and delaying jobs to satisfy only energy constraints like F P LSA are not the right decisions to reduce safely the energy demand within a time interval. In fact, the potential jobs to be pushed out of the interval are the ones that are requested inside the interval and have their deadlines outside. These kind of jobs can be delayed by anticipating the execution of lower priority jobs. By doing so, the higher priority jobs to be pushed out need more replenishment time since the energy balance is negative. This leads to push them out of the interval and permits lower priority jobs to have more energy to execute which can help them to meet their deadlines.

The anticipation of lower priority jobs can be done by introducing a kind of virtual deadlines that coincide with request time of the jobs to be pushed out of the considered time interval. Then, once the virtual deadlines are set, we delay all the jobs at the maximum using the new virtual deadlines in the slack-time computation algorithm. Following this intuition we propose the F P Leg algorithm for Fixed-Priority as Late as possible with energy guaranty which is inspired from the EDeg algorithm presented in Section 3.6.2 on page 83.

The idea behind this algorithm is to use the same scheduling schemes as P F P ALAP but by using virtual deadlines that consider energy constraints.

Definition 6.6 (Virtual deadline).

The virtual deadline of a job J i,j denoted vd ij is the earliest time that makes its energy balance positive. This time can be the effective deadline of the job or the request time of

vd i,j ≤ d i,j Bu(t, vd i,j ) ≥ 0
By analyzing the counter example of P F P ALAP shown by Figure 6.5 on page 160, we can see that if the energy balance was positive at time 31, the schedule would be valid and the slack-time time would be correctly calculated. Therefore, using virtual deadlines that makes the energy balance positive may be an interesting idea to build an optimal algorithm. Then, F P Leg behaves as described in Algorithm 6.3. Figure 6.9 illustrates the scheduling schemes of F P Leg algorithm. We can see that the virtual deadline of job J 4,1 was shifted from time 44 to time 28 where the energy balance is positive, i.e. the battery level at time 28 is 0, and then, the as late as possible schedule produced in time interval [0, 28] is valid. However, we notice that this does not solve completely the problem of late scheduling. In fact, using virtual deadlines improves schedulability but there exist some cases where it anticipates the execution of some lower priority jobs that consume the energy needed for other higher priority jobs. This is illustrated by Figure 6.9 on the facing page at time 46. Even though the energy balance was positive at time 28, the missed deadline (time 47) is due to the anticipated execution of job J 3,1 which can be delayed further. Unfortunately, this proves that F P Leg is not optimal and that the fixed-priority scheduling for energy-harvesting systems is subject to many counter intuitive ideas.

Fixed-Task-Priority lookahead (F P lh):

The use of virtual deadlines in F P Leg was a good idea because it helps reducing the energy demand when the energy balance is negative. However, the above counter example shows that having a positive energy balance is not sufficient to check whether the current virtual deadline is the right one or not. Combining the idea of lookahead of F P Casap with the idea of virtual deadlines can be an interesting intuition to achieve an optimal algorithm.

In the following we propose a new algorithm called F P lh for Fixed-Priority lookahead that combines the ideas of virtual deadlines and lookahead. The lookahead computation checks if all future deadlines are met during a bounded window by using the notion of virtual deadlines that guarantees positive energy balances. Therefore, the definition of the virtual deadline should take into account the future higher priority jobs. Moreover, the looakahead computation consists not only of calculating the energy balance of the current job J i,j but also the one of higher priority jobs that are included in the lookahead window. For this reason, we need to generalize the energy balance formula to compute the energy balance of any job at any moment.

Definition 6.7 (Energy Balance).

The energy balance of priority level-i at time interval [t 1 , t 2 [ denoted Ba i (t 1 , t 2 ) is the difference between the energy budget and the energy demand during [t 1 , t 2 [. It can be computed with Equation 6.7.

               A = j>i (DBF j (0, a i (t 1 )) × E j B = (RBF j (0, a i (t 1 )) -DBF j (0, -a i (t 1 ))) × (E j -e j (a i (t 1 ))) Ba i (t 1 , t 2 ) = Bu(t 1 , t 2 ) -W e i (t 1 , t 2 ) = Bu(0, t 2 ) -W e i (0, t 2 ) -A + B (6.7)
where :

• A: is the energy demand of lower priority jobs within time interval [0, a i (t 1 )[, i.e. finished jobs (see Figure 6.1 on page 156),

• B: is the energy demand of lower priority jobs that are probably not yet finished at time a i (t 1 ). To compute this value we need to simulate the execution with P F P ALAP algorithm. Now, we redefine the virtual deadline to include the lookahead computation.

Definition 6.8 (Virtual Deadline).

The virtual deadline vd i,j of a job J i,j is an early deadline that makes the energy balance Ba(t, vd i,j ) positive and does not cause negative energy balances for jobs of higher priority tasks withing the lookahead window that ends at time L. It must respect the following conditions:

• vd i,j ≤ d i,j • Ba i (t, vd i,j ) ≥ 0 • ∀ J k,l ∈ C, Ba k (a k,l , d k,l ) ≥ 0 where C = {J k,l , k < i and a k,l > a i,j and d k,l ≤ L}
The F P lh algorithm is an extension of F P Leg algorithm described above. It postpones executions whenever there is available slack-time like P F P ALAP but the slack-time computation is done using the virtual deadlines. Note that the virtual deadline vd i,j coincides with a request time of a higher priority job that is activated before the deadline of J i,j and has an absolute deadline later than the one of J i,j .

For a job J i,j at time t, we know that the higher priority jobs that have an absolute deadline earlier than d i,j cannot be delayed outside the time interval [t, d i (t)]. Thus, the only jobs that can be pushed totally or partially out of this interval are those that have a deadline later than d i,j . The virtual deadline of J i,j can be the request time of one of these jobs. To find the right virtual deadline, we test all of them starting with the earliest one. This test consists of checking two conditions:

• whether the energy balance of the considered job at this time is positive or not,

• whether there is future deadline misses within the lookahead window.

The length of the lookahead window is one of the problems of lookahead scheduling, it is at least bounded but should be specified carefully. For this algorithm, we consider that the lookahead window begins at time t and ends at time L which is the latest deadline of higher priority jobs that are requested before time d i,j and have their deadlines after d i,j . We choose this length because the jobs to delay cannot be delayed longer than the length of the lookahead window.

The lookahead function consists of checking the energy balance of all the jobs that are requested within the lookahead window as described in Algorithm 6.5 on the next page. end if 6: end for 7: return T rue These rules allow us to be sure that the selected virtual deadlines prevent negative energy balances and future deadline misses, and lead to a correct energy-aware slack-time computation that can give the correct retardations. Figure 6.3 on page 159 shows the correct schedule of the task set that was not feasible with all the precedent algorithms. We can see that the virtual deadline of job J 4,1 was shifted to time 3 which makes the energy balance in time interval [0, 3] positive and ensure that all higher priority jobs included in the lookahead window [0, 70] meet their deadlines in contrast to F P Leg.

After all the precedent intuitions and counter intuitive ideas, we think that this algorithm is optimal or at least dominates than the other algorithms. However, its main issue is its complexity. In fact, the length of the lookahead window and the relationship between jobs deadlines are the main factors that increase the complexity of F P lh. Therefore, the following questions arise:

1. Does the use of virtual deadlines change the set of jobs to check with lookahead computations ?

• Using earlier deadlines can decrease the number of jobs to check because the interval to study is shortened. For example, when a valid virtual deadline is • Using real deadlines may lead to a negative energy balance for a higher priority job, as shown in the counter example of P F P ALAP . Furthermore, computing virtual deadlines by only checking the energy balance of the current job can lead to a wrong virtual deadline as shown in the counter example of F P Leg.

• Then, the virtual deadline computation for a job of priority level-i needs to compute the energy balance Ba i (t, d i (t)) and the energy balances of higher priority jobs within the lookahead window as shown in Definition 6.8 on page 168. Moreover, since a part of the energy demand of lower priority jobs that have already began their execution before the request time of the job whose virtual deadline is being computed is necessary as shown with vertical lines pattern in Figure 6.1 on page 156. Their virtual deadlines are also needed to compute the energy balance of a higher priority job. This means that to compute the virtual deadline of one job, we need both virtual deadlines of higher and lower priority jobs which leads to a kind of cross dependency between the virtual deadlines of different priority levels. Figure 6.11 on the next page illustrates such a situation. We can see that to compute the virtual deadline of job J 4,1 at time 8, we need the one of J 2,1 because it is inside the lookahead window. Moreover, to compute the virtual deadline of job J 2,1 at time 20, we need the real schedule of jobs J 4,1 and J 5,1 which depend on their virtual deadlines. Therefore, there is an interdependence between virtual deadlines computation which makes calculating them one by one impossible. A combination of virtual deadlines is the set of virtual deadlines of the jobs that are included in the lookahead window. Since each job may have several potential virtual deadlines, finding the right one means finding the right virtual deadlines of all the other jobs. Then, to find such correct virtual deadlines, we have to pick one combination and test if it works. We do this until we find a correct combination. In the worst-case we have M N combinations to test which is an exponential complexity, where M is the maximum number of potential virtual deadlines of a job and N is the maximum number of jobs that we can have inside a lookahead window.

2. Are the virtual deadlines necessary to compute the energy balance ?

• The energy demand of higher priority levels is calculated only with requests times, i.e. with request bound function, thus, virtual deadlines of higher priority levels cannot change the final energy demand.

• The energy demand of lower priority jobs that have already finished their execution is calculated only with deadlines, i.e. with demand bound function denoted A in Equation 6.4 on page 155. Then, the use of virtual deadlines of higher priority levels cannot change the final energy demand because they are earlier than the real deadlines.

• The energy demand of lower priority jobs that have not yet finished, denoted B in Equation 6.7 on page 167 depends on the executions done before time a i (t 1 ) with P F P ALAP policy which is based on deadlines. Using virtual deadlines for these jobs can change the final energy demand.

Therefore, virtual deadlines of lower priority jobs are needed for the energy balance computation.

3. Assuming that computing virtual deadlines is an NP-hard problem, are they necessary for an optimal algorithm ?

• If yes, the scheduling problem for fixed-priority energy-harvesting systems is also NP-Hard also,

• Otherwise, it is an open problem.

These insights confirm that the fixed-priority scheduling for energy-harvesting systems is not easy to handle. Moreover, the only algorithm we have up to now that could be optimal has an exponential complexity. Therefore, finding an optimal algorithm with a reasonable complexity or proving that the fixed-priority problem scheduling for energy-harvesting systems is an NP-Hard problem is still an open problem.

Conclusion

In this chapter we explored the possibility of the existence of an optimal scheduling algorithm for energy-harvesting systems. We started by proving that such an algorithm must be both non-energy-work-conserving and lookahead (or clairvoyant). Then, we listed some ideas of scheduling algorithms that seem intuitively optimal and we showed with counter examples why they are not. We showed that the computation of the needed delays, i.e. replenishment periods, must consider jobs deadlines and energy cost as well as the replenished energy. Moreover, we showed also that deciding which job to delay is the main problem of building an optimal algorithm. We know now that considering a late or a lazy scheduling and having a positive energy balance at the deadline of a job is not sufficient. The maximum delay for a job must ensure not only a positive energy balance but also the respect of all deadlines in a bounded lookahead window. This idea is very interesting, however, the exact lookahead computation seems to be complicated and have an exponential complexity. This complexity seems to be difficult to reduce because the computation of the maximum delay of one job, i.e. the computation of the virtual deadline, depends on the maximum delay of the other jobs inside the lookahead window. There is a kind of cross dependency between jobs which complicates the computations. The only investigated solution here is to perform a brute force search for the right combination of jobs delays or virtual deadlines which has an exponential complexity. The conclusion of this chapter is that the correct late scheduling that respects the energy constraints needs earlier deadlines and that the computation of these deadlines has an exponential complexity. Moreover, if an optimal algorithm requires these deadlines, then, the scheduling problem of fixed-priority energy-harvesting systems is a hard problem. Otherwise, we should find an other way to compute the right delays, this is still an open problem.

Chapter 7

Response-Time Analysis for Thermal-Aware Scheduling

Introduction

The main purpose of real-time systems is to guarantee predictable timing behavior for controlled devices. Therefore, the correctness of the results provided by such systems depends not only on the logical correctness of the output but also on the time at which it is yielded. Several formal models of real-time behavior have been proposed up to now (e.g. task models such as sporadic, periodic, aperiodic, Directed Acyclic Graphs (DAG), etc.) as mentioned in Section 1.2 on page 30 and 3.2 on page 67. Prior research in real-time systems have also addressed a wide array of hardware architectures (e.g. monoprocessor, multiprocessors, memory caches, etc). However, for a new generation of real-time systems applications, e.g. medical implants, the physical environment poses additional design challenges.

One such new challenge is the necessity of managing the energy and the thermal behavior of systems. As technology scales, chips power consumption and power density are increasing rapidly. Indeed, the miniaturization of small embedded systems has allowed new real-time applications. Implantable Medical Devices (IMDs) are an example of these new embedded systems where managing the thermal aspect is essential. IMDs are increasingly being used in medical treatments (e.g. pacemakers for heart diseases or neural implants to restore hearing/vision). However, recent studies [Kim+07; Laz05] have shown that the heat generated by IMDs due to the processor activity is nonnegligible. Thus, designing thermal aware IMDs becomes critical as medical research has shown that a temperature increase of even 1 • C can damage tissues [START_REF] Lamanna | Stimulus-activated changes in brain tissue temperature in the anesthetized rat[END_REF] and may cause death in extreme cases [START_REF] Ruggera | In vitro Assessment of Tissue Heating Near Metallic Medical Implants by Exposure to Pulsed Radio Frequency Diathermy[END_REF].

Therefore, thermal-aware real-time systems must respect not only timing constraints, expressed with deadlines, but also thermal constraints which are expressed as a maximum temperature not to be exceeded. For fixed-priority real-time scheduling on monoprocessor platforms, considering this constraint requires the schedulers to add cooling periods. This additional idle times must be taken into account by scheduling algorithms and included in schedulability analysis. Thermal-aware system design presents challenges similar to the design of energyharvesting systems. The later collects the environmental energy to store it and use it to supply real-time systems. The similarities with thermal-aware systems come from the fact that the scheduling for energy-harvesting system has to consider battery replenishment times which are analogous to the cooling periods required in thermal-aware systems. Intuitively, the real-time scheduling problem of energy-harvesting systems seems to be close to the one of thermal-aware systems. Therefore, it is interesting to explore the possible similarities between these two models.

As a first step, we apply some results of energy-harvesting systems to the thermalaware model. In this chapter we use the Preemptive Fixed-Task-Priority As Soon As Possible (P F P ASAP ) scheduling algorithm presented in Section 4.3 on page 111, which was proved to be optimal for energy-non-concrete fixed-priority energy-harvesting systems, to build a thermal-aware scheduling approach and a schedulability analysis based on upper and lower bounds of tasks worst-case response-time.

The work presented in this chapter is the result of a collaboration with Prof. Nathan Fisher from Wayne State University and mainly contains materials published in [START_REF] Chandarli | Response Time Analysis for Thermal-Aware Real-Time Systems Under Fixed-Priority Scheduling[END_REF].

The remainder of this chapter is organized as follows. Section 7.2 gives a brief state of the art about thermal-aware real-time systems. Section 7.3 specifies and describes the model and the scope of this chapter. Section 7.4 describes the thermal-aware version of P F P ASAP scheduling algorithm and proves its optimality for thermal-non-concrete systems. Section 7.5 details an approximate response-time analysis based on upper and

Task Model

We consider a classical non-concrete real-time task set defined by a set of n sporadic and independent tasks {τ 1 , τ 2 , . . . , τ n }. Each task τ i is characterized by its priority P i , its worst-case execution time C i , its minimum inter-arrival time T i , its deadline D i and its first release time O i . Deadlines are constrained or implicit, i.e. ∀ i, D i ≤ T i .

Thermal Model

In our model, the temperature of the system fluctuates due to heat dissipation when real-time tasks are executed on the CPU. The temperature must stay between two thresholds T A and T max where T max is the maximum tolerated temperature and T A is the ambient temperature. The temperature of the system at time t is denoted as T (t). The only way to cool down the system is to temporarily suspend task execution. Furthermore, we consider that the system may be in one of two states at any given time: active (i.e. heating) during which tasks may execute, or inactive (i.e. cooling) during which tasks are not permitted to execute.

Heating Model

The thermal behavior of a processor can be modeled using the Resistance Capacitance circuit (RC) [START_REF] Skadron | Temperature-aware microarchitecture: Modeling and implementation[END_REF] shown in Figure 7.1. In this model, the heating is characterized by the electrical current denoted P (t) passing through a thermal resistance R. The thermal capacitance is denoted C. Using this model, the derivative of the system temperature function with respect to time can be calculated with Fourier's law [START_REF] Wang | Schedulability Analysis in Hard Real-time Systems Under Thermal Constraints[END_REF] given by Equation 7.1.

T (t) = P (t) C - T (t) -T A R × C (7.1)
The current passing through the resistance can be separated into two parts: the dynamic part P D (t) that evolves linearly with the processor frequency, denoted s,

Models

and the part corresponding to the energy leakage P L (t) which is a function of the temperature.

P (t) = P D (t) + P L (t) (7.2)
P D (t) = β 0 s α (7.3) P L (t) = β 1 T (t) + β 2 (7.4)
Equations 7.2 to 7.4 give the formula to compute P (t), where α, β 0 , β 1 and β 2 are system specific constants [START_REF] Wang | Schedulability Analysis in Hard Real-time Systems Under Thermal Constraints[END_REF]. We consider only a monoprocessor with active/inactive modes; thus, during active periods, P D (t) is constant.

Let us denote a

= β 0 s α C , b = 1 R×C -β 1 C and scale T (t) to be T (t) -Rβ 2 -T A Rβ 1 -1 to shift T A to 0.
We can now recognize in Equation 7.1 on the facing page a classical linear differential equation:

T (t) = a -b × T (t) (7.5)
Then, the solution is given by:

T (t) = a b + T (t 0 ) - a b × e -b(t-t 0 ) (7.6)
The heating function only depends on time and constants and is not task specific. Recall that the parameters a and b are processor specific constants. Typical settings for these two variables are b ≈ 0.228, and a > 1 with α ≈ 3 (see [START_REF] Ahmed | Minimizing Peak Temperature in Embedded Real-Time Systems Via Thermal-aware Periodic Resources[END_REF]).

Cooling Model

During the cooling phases, the processor is inactive. We assume for simplicity that the frequency s is 0. However, this can easily be generalized to allow some fixed power dissipation during inactive phases. Then, a = 0 and the formula 7.6 becomes:

T (t) = T (t 0 ) × e -b(t-t 0 ) (7.7)
Again, the cooling function only depends on time and is not task specific, i.e. all tasks consume energy and heat the system following the same pattern. Figure 7.2 on the following page shows the curves of cooling and heating functions. We can see that the cooling function slows down rapidly because of its reverse exponential part. This means that cooling for several short intervals is better for temperature and thereby for tasks response time than few and long ones.

Moreover, we assume that heating is greater than cooling. In other words, temperature cannot decrease while executing.

As we consider non-concrete task sets, we extend the definition to include the thermal aspect of the model. A thermal-concrete system is a system whose time and thermal parameters are known before run-time. This includes tasks periods, tasks offsets and the initial temperature of the system. In the opposite, if one or all of these parameters are known only at run-time, then, the system is said thermal-non-concrete.

Therefore, we consider a thermal-non-concrete system where the initial temperature of the system, the offsets and the exact inter-arrivals times are known only at run-time. In the considered model, the system has to respect all deadlines and thermal constraints. The temperature must never exceed its threshold T max . Thus, a task set is feasible if and only if there is a schedule where all the deadlines are met and the maximum temperature T max is never exceeded.

The P F P ASAP algorithm

In Chapter 4, we presented the energy-harvesting version of P F P ASAP scheduling algorithm. This algorithm is a fixed-priority one which takes into account tasks energy cost and the battery capacity during scheduling operations for energy-harvesting systems. Tasks are executed according to their priority whenever the available energy is enough to execute. Otherwise, the algorithm suspends executions to replenish the battery. These replenishment periods are as long as needed to execute at least one time unit. We proved that this algorithm is optimal for energy-non-concrete fixed-priority energy-harvesting systems. In this section we adapt this algorithm to thermal-aware systems and we explore its optimality for the model described in Section 7.3 on page 176.

With the thermal constraints, the behavior of P F P ASAP becomes as follows: it executes jobs whenever the temperature is below T max enough to execute at least one time unit without exceeding it, then, it idles the system to cool down as long as needed to resume executions.

Below, we will first address the P F P ASAP worst-case scenario, then we will discuss its optimality.

Worst-case scenario

The aim of this section is to prove that the worst-case scenario for thermal-nonconcrete fixed-priority thermal-aware systems is still the synchronous activation of tasks but with T (0) = T max .

Figure 7.3(a) on the following page illustrates the case where all the tasks are requested simultaneously. If at least one higher priority task is requested later, the response time of lower priority tasks decreases as illustrated in Figure 7.3(c) on the next page. Then, if higher priority tasks are requested earlier, the response time of lower priority tasks cannot be larger than the one in the synchronous scenario as shown in Figures 7.3(d) on the following page. Furthermore, if the initial temperature of the system is less than T max , then, less cooling time is needed which leads to a shorter response time for all tasks. Theorem 7.1. Let Γ denote a non-concrete task set composed of n priority-ordered tasks with constraint or implicit deadlines. The P F P ASAP worst-case scenario for any task of Γ occurs whenever this task is requested simultaneously with requests of all higher priority tasks and the system temperature is at the maximum level T max .

To prove this theorem we compare jobs response times in the scenario proposed by the theorem with all other possible ones. The response time of a job is the difference between its termination time and its offset or request time.

Proof. Let {τ 1 , τ 2 , . . . , τ n } be a set of n priority-ordered tasks where τ n is the task with the lowest priority. Let S s i denote the scenario where task τ i and all higher priority tasks are requested simultaneously at the highest temperature level T max . The worst-case scenario for a task τ i is the one that maximizes its response time, i.e. the scenario that maximizes the termination time of the first job of the i th priority level.

If S s i is not the worst scenario, there must exist an other one leading to a greater response time for the i th priority level.

Firstly, we consider the scenario where T (0) < T max . In this case the system is not heated at the maximum. Therefore, the system may need less cooling periods than the scenario where T (0) = T max , and P F P ASAP introduces shorter or equal cooling periods and leads to a shorter response time for all the tasks. This is in contradiction with our hypothesis, thus, such a scenario cannot lead to longer response times. Secondly, we consider the scenario with different offsets. Let us denote S a i as the scenario where T (0) = T max and all tasks have different offsets. In this case we distinguish two possibilities:

1. At least one task of higher priority level than τ i is requested later: knowing that all the tasks consume energy and heat the system following the same pattern, i.e. by considering that the heating comes only from processor energy consumption, and that heating is greater than cooling, task τ i will undergo less higher priority interferences, and then, it may need less cooling to finish executing. Therefore, the final response time of τ i is lesser than or equal to the one given by scenario S s i which is a contradiction. Thus, such a scenario cannot lead to longer response times.

2. At least one task of higher priority than τ i is requested earlier: when τ i is requested later than a higher priority task, it undergoes less interference from this task because, first, a part of it was executed before τ i request time, and second, the increase of temperature due to the higher priority task execution cannot be higher than T max , and finally, if τ i is requested much later than the higher priority tasks, we just shift the landscape and will have case 1. Then, this scenario cannot be worse than S s i .

Therefore, in all possible situations, the response-time of a task τ i is lesser or equal to the one led by a synchronous activation of all higher priority tasks when the temperature is at the maximum level.

The optimality of P F P ASAP

We proved in Section 4.3.3 on page 118 that the P F P ASAP algorithm is optimal for the fixed-priority scheduling problem of energy-non-concrete energy-harvesting systems which is close to the same scheduling problem of thermal-aware systems. In this subsection we extend the optimility of P F P ASAP to thermal-non-concrete systems.

Theorem 7.2. The P F P ASAP scheduling algorithm is optimal for fixed-priority thermal-non-concrete task sets with constrained or implicit deadlines. As defined in Section 1.4.4 on page 37, this optimality means that if P F P ASAP fails to schedule a given task set, then, no other fixed-priority algorithm can.

Proof. Let Γ denote a thermal-non-concrete task set. We suppose that Γ is feasible using a fixed-priority assignment, but not schedulable with P F P ASAP using the same priority assignment. This means that at least one task denoted as τ k misses its deadline in the worst-case scenario (see Theorem 7.1 on page 179). Indeed, it is sufficient to consider only the first job and an initial temperature T (0) = T max because we are dealing only with constrained or implicit deadlines. The jobs of the same task cannot overlap unless for unfeasible tasks.

According to P F P ASAP schemes, a deadline miss can occur in the worst-case scenario only in two cases: 1) the workload is greater than the available time, 2) the workload plus the accumulated cooling time is greater than the available time.

1) If the workload from the critical instant (time 0) to the first deadline of τ k is alone greater than time interval [0, D i ], then, it is obvious that it is impossible to schedule the first job of τ k and higher priority jobs without missing D k , this is not possible even without thermal constrains because the available time is not sufficient to schedule all the workload within [0, D k ]. Then, in this case the task set cannot be feasible with any algorithm and the supposed algorithm cannot exist.

2) If a deadline is missed with P F P ASAP even though the workload is lesser than the available time, then, this means that the sum of workload of time interval [0, D k ] and the needed cooling time is greater than the available time, i.e D k time units. We know that the cooling periods produced by P F P ASAP are as long as needed to execute one time unit which means that they are as short as possible. Furthermore, we know that the cooling function is exponentially decreasing (see Equation 7.7 on page 177), then, the shorter cooling periods are, the shorter the total needed cooling time is. This is true because the longer cooling is, the less efficient it is, as we mentioned in Section 7.3 on page 176. More formally, cooling down the system x times for one time unit is greater than the one of only one cooling period of length x time units because e -bx ≤ xe -b for all x ≥ 1. Thus, Equation 7.7 on page 177) implies Inequality 7.8.

T (0) -T (0) × e -b×x ≥ T (0) -x × T (0) × e -b(1-0) (7.8)
Therefore, any other schedule than the one of P F P ASAP has necessarily cooling periods of same length or longer, then, the response time of τ k produced by the supposed algorithm is necessarily greater than D k . Thus, in this case, no other algorithm can schedule this task set.

Then we prove that P F P ASAP is optimal for non-concrete fixed-priority thermalconstrained task sets with constrained or implicit deadlines.

Response-Time Analysis

This section provides a response-time analysis for the schedule produced by the optimal algorithm P F P ASAP in the worst-case scenario, i.e. the synchronous release of all the tasks when T (0) = T max . We discuss the difficulty of an exact analysis and then we propose an approximate one.

Exact Analysis

The exact analysis provides the exact response time of all tasks. Thus, it must estimate accurately the length of all cooling and heating periods.

However, this cannot be easily achievable with a generic equation. Due to the discrete time, all cooling periods are not of the same length in the actual schedule. Furthermore, without the effective values of parameters, it is hard to estimate the order and the number of long and short cooling periods which have a significant impact on the response time value. Therefore, the only way to get an exact analysis is to simulate the schedule of P F P ASAP in the worst-case scenario and compute the response time of the first job of each task.

Approximate Analysis

The aim of this work is to propose a schedulability analysis for thermal-aware real-time systems. Such an analysis must consider not only the processor workload but also the additional cooling time needed to respect the thermal constraints. To cope with the difficulty of providing an exact analysis, one can propose an approximate one that can be only sufficient instead of necessary and sufficient. This can be achieved by upper bounding tasks worst-case response time produced by P F P ASAP algorithm.

First Upper bound (U B T min ):

Knowing that P F P ASAP cools down the system enough to execute at least one time unit, cooling periods are as short as possible. Furthermore, we know also that the cooling function is exponentially decreasing and the heating one is asymptotically increasing. Then, one can lengthen jobs response times by putting the cooling units together and the heating ones together such that T max is never exceeded. By doing so, the cooling slows down after a while and the system needs more time to cool down. Similarly, the heating accelerates which heats up the system in a shorter amount of time.

Description

The upper bound of task τ i worst-case response time according to U B T min is described by Figure 7.4 on the previous page. It consists of:

• cooling down the system from T max to T min , where T min > T A ,1

• a ceiling function applied to the time from T max to T min to ensure an integer number of time units (this is safe since it only overestimates the time required to reach T min ),

• executing jobs and heating up the system until T max is reached or there is no pending workload,

• repeating cooling-heating cycles until there is no pending workload,

• the last cycle may be shorter because of the remaining workload which can be shorter than a full cycle. The corresponding cooling time is adjusted.

The upper bound of the worst-case response time of task τ i of priority level-i that is requested simultaneously with higher priority tasks with T (0) = T max , denoted R T min i , is given by Equation 7.9

       w n+1 i = N (w n i ) × (∆ c + ∆ h ) + ∆ c + ∆ h R U B T min i = {min t>0 \ w n+1 i = w n i } (7.9)
where:

• N (w) is the number of full cooling-heating cycles needed to execute the workload w without exceeding T max .

N (w) = w ∆ h (7.10)
• w is the workload of time interval [0, w n i [.

w = j≤i w n i T j × C j (7.11)
• ∆ h is the time to execute jobs and heat up the system from T min to T max . (Obtained by solving Equation 7.6 on page 177).

∆ h =         ln b × T min -a b × T max -a b         (7.12)
• ∆ c is the time to cool down the system from T max to T min . (Obtained by solving Equation 7.7 on page 177).

∆ c = ln(T max ) -ln(T min ) b (7.13)
• ∆ h is the remaining execution time of the busy period.

∆ h = w -N (w n i ) × ∆ h (7.14) • ∆ c is the cooling time needed for ∆ h . ∆ c = ln(T max ) -ln(T min ) b (7.15)
• T min is the maximum temperature needed to execute the remaining part of the workload ∆ h without exceeding T max .

T min = (T max -a/b)e b∆ h + a/b (7.16) Theorem 7.3.
An upper bound on the worst-case response time for task τ i in the worst-case scenario described in Section 7.4.1 on page 179 can be obtained from a sequence of execution units of higher priority jobs and the necessary cooling time units where the cooling periods are as long as needed to cool down the system from T max to T min (T min > 0) and the heating periods are as long as needed to reach T max starting from T min , as described by Formula 7.9 on the facing page.

Proof. In the computation of U B T min , the cooling periods are as long as needed to cool down the system from T max to T min and the execution periods are as long as needed to heat up the system from T min to T max . Furthermore, we know that in the actual schedule produced by P F P ASAP algorithm for task τ i in the critical instant, a cooling

T max T min 0 R i c o o l i n g h e a t i n g T 2 T 1 T 3 h c 1 C -1 h 1 Figure 7.5: U B T min proof insight
period is as long as needed to execute at least one time unit. The length of this period is shorter or equal than a cooling period of U B T min , and thus, by repeating these short cooling/heating cycles, it cools down the system faster than fewer and longer cooling periods. Then, to prove Theorem 7.3 on the previous page, we suppose that the actual schedule has at least one short cycle and we compare the two response times by using Fourier's law described by Equation 7.1 on page 176. As described in Figure 7.5, we suppose that the system cools down for one time unit from T max to T 1 (see Equation 7.17), and then heats up for one time unit reaching temperature T 2 (see Equation 7.17). After that, we follow the same schedule as U B T min by finishing the cooling period needed to finish the workload ∆ h -1 and reach T max (see Equation 7.18). The temperature of the system after this cooling period is denoted T 3 (see Equation 7.17).

                                   T 1 = T max × e -b T 2 = a b + T 1 - a b e -b T max = a b + T 3 - a b e -b•(∆ h -1) T 3 = a + (b × T min -a) × e -b b T 3 = T 2 × e -b×∆ c ∆ c = ln(T 2 ) -ln(T 3 ) b (7.17) ∆ c =            ln   a + b × T max × e -b -a × e -b a + (b × T min -a) × e -b   b            (7.18)
Let us now compare the response time given by this assumption and the one given by U B T min . Knowing that the first cooling period, i.e. the first period of of time elapsed between T max and T 1 , is the same for both cases, and supposing that after reaching T max at the end of the first heating cycle, i.e. from temperature T 3 to T max , the actual schedule follows the same pattern as U B T min cycles (see Figure 7.5 on the facing page). If U B T min does not upper bound the actual response time, then the total cooling time needed for ∆ h workload in the actual schedule is greater than the one of U B T min , i.e. ∆ c + 1 > ∆ c . Knowing that ∆ c can be written as Equation 7.19 Therefore, we prove by contradiction that ∆ c + 1 ≤ ∆ c , and then U B T min upper bounds the actual worst-case response time.

∆ c = 1 + ln(T 1 ) -ln(T min ) b = 1 +         ln T max × e -b T min b         (7.19) Therefore, if ∆ c + 1 > ∆ c , then, ∆ c + 1 > ∆ c ⇒           ln   a + b × T max × e -b -a × e -b a + (b × T min -a) × e -b   b           >         ln T max × e -b T min b         ⇒ ln   a + b × T max × e -b -a × e -b a + (b × T min -a) × e -b   > ln T max × e -b T min ⇒ a + b × T max × e -b -a × e -b a + (b × T min -a) × e -b > T max × e -b T min ⇒ a + (b × T min -a) × e -b a + b × T max × e -b -a × e -b < T min T max × e -b ⇒ 1 - b × e -b (T max ė-b -T min ) a + b × T max × e -b -a × e -b < 1 - (T max × e -b -T min ) T max × e -b ⇒ b × e -2b × T max > a + (b × T max × e -b -a) × e -b ⇒ b × e -2b × T max -b × e -2b × T max > a(1 -e -b ) ⇒ e -b >

Parametric Upper bound (U B x ): Description

The idea of this upper bound is to keep the same behavior of the P F P ASAP algorithm by cooling down for some time units and then executing jobs until reaching T max . The approximation comes from the fact that time is discrete and that cooling periods are of a fixed length x (where x ∈ N * ) instead of the minimum length needed to execute at least one time unit. Then, executing or the heating periods may not reach T max in an integer number of time units. Thus, we consider only the integer part of heating periods (with floor function) and that T max is exactly or nearly reached at the end of each heating period which adds additional cooling time than the actual schedule. Figure 7.6 describes the scenario used to obtain U B x . It consists of:

• Cooling down the system for x time units, where x is a positive integer that must be greater or equal to ∆ U Bx c , the minimum time needed to decrease the temperature such that the system can execute at least one time unit, i.e. x ≥ ∆ U Bx c . Equation 7.20 computes ∆ U Bx c ; the ceiling function is used to respect the discrete time and to ensure that the system is cold enough to execute at least one time unit.

∆ U Bx c =         ln bT max (bT max -a)e b + a b         (7.20)
• Then, executing jobs and heating up the system until T max is reached (without exceeding) or there is no pending workload. The length of this period is an integer.

The floor function is used to ensure not exceeding T max .

• Repeating the cooling-heating cycles until there is no pending workload.

• The length of the last cooling period is still the same even if the remaining workload is smaller.

The upper bound according to U B x of task τ i of priority level-i that is requested simultaneously with higher priority tasks with T (0) = T max is given by Equation 7.21.

w n+1 i = N (w n i ) × x + w R U Bx i = w n+1 i = w n i (7.21)
where :

• N (w) is the number of cooling periods needed to execute the workload w without exceeding T max :

N (w) = w ∆ U Bx h • w is the workload of time interval [0, w n i [: w = j≤i w n i T j × C j • ∆ U Bx h
is the time to execute jobs and heat up the system from the temperature reached after x time units of cooling to T max :

∆ U Bx h =         ln b × T max × e -b×x -a b × T max -a b         (7.22)
We choose cooling periods longer or equal to

∆ U Bx c , i.e. x ≥ ∆ U Bx c
, because it is sufficient to execute at least one time unit without exceeding T max which is close the behavior of P F P ASAP algorithm.

To prove that U B x upper bounds the actual response time, we first check the case where x = ∆ U Bx c . We know that in the actual schedule, the accumulation of the temperature gained at the end of each heating period due to the discrete time, is lesser than T max . We denote this difference of temperature δ.Thus, this accumulated temperature can be used at least by one heating period which is supposed to be longer as shown in Figure 7.7 on the next page. Then, we compare the length of the new heating period ∆ h (see Equation 7.23 on the following page) to the one of U B x , i.e. ∆ U Bx h , and the total number of cooling/heating cycles produced by U B x , i.e. N U Bx (w), and the one produced by the actual schedule denoted N (w).

T max

T min h x UBx Proof schedule UB x schedule x ' h UBx T 1 T 2 δ Figure 7.7: U B x proof insight        T max = (a + (b × T 2 -a)e -b×∆ h )/b T 2 = (T max -δ)e -b×x ∆ h =         ln b × (T max -δ) × e -b×x -a b × T max -a b         (7.23) Lemma 7.1. For x = ∆ U Bx c
, each heating interval of the actual schedule ∆ h given by Equation 7.23 is greater than or equal to U B x 's ones, i.e.

∆ U Bx h ≤ ∆ h . Proof. Let us suppose that ∆ U Bx h > ∆ h , then: ∆ U Bx h > ∆ h ⇒       ln b × T max × e -bx -a bT max -a b       >         ln b(T max -δ)e -bx -a bT max -a b         ⇒ ln bT max e -bx -a bT max -a b > ln b(T max -δ)e -bx -a bT max -a b ⇒ bT max e -bx -a bT max -a > b(T max -δ)e -bx -a bT max -a

Response-Time Analysis 191

Knowing that bT max < a, then:

∆ U Bx h > ∆ h ⇒ bT max e -bx -a < b(T max -δ)e -bx -a ⇒ bT max e -bx < b(T max -δ)e -bx ⇒ bT max e -bx < b(T max -δ)e -bx ⇒ T max < T max -δ ⇒ δ < 0 Contradiction because 0 < b < 1, δ ≥ 0 and b × T max < a.
Therefore, we prove by contradiction that

∆ U Bx h ≤ ∆ h Lemma 7.2. For x = ∆ U Bx c
, the number of cooling periods produced by a P F P ASAP actual schedule denoted N (w) is lesser than or equal to the ones produced by U B x , i.e. N (w) ≤ N U Bx (w).

Proof. Let us suppose that N (w) > N U Bx (w). From Lemma 7.1 on the facing page we know that ∆ U Bx h ≤ ∆ h at least for one time. Then:

N (w) = w -∆ h ∆ U Bx h + 1 = w -(∆ U Bx h + δ) ∆ U Bx h + 1
where δ ≥ 0. Then, N (w) can be written as follows:

N (w) = w -δ ∆ U Bx h Therefore, if N (w) > N U Bx (w), then: N (w) > N U Bx (w) ⇒ w -δ ∆ U Bx h > w ∆ U Bx h ⇒ w -δ ∆ U Bx h > w ∆ U Bx h ⇒ δ < 0 Contradiction, because ∆ h ≥ ∆ U Bx h
and δ ≥ 0. Therefore, we prove that N (w) ≤ N U Bx (w) Theorem 7.4. An upper bound on the worst-case response time for task τ i in the worst-case scenario described in Section 7.4.1 on page 179 can be obtained from a sequence of execution units of τ i and those of higher priority jobs and the necessary cooling time units where the cooling periods are of x time units and the heating periods are integers and as long as needed to reach T max (without exceeding) after x time units of cooling, as described by Formula 7.21 on page 189. Proof. To prove this theorem, we have to study the case where x = ∆ U Bx c and the one where x > ∆ U Bx c .

Case where x = ∆ U Bx c : From Lemma 7.1 on page 190 and Lemma 7.2 on the preceding page we know that N (w) ≤ N U Bx (w), then:

N (w) ≤ N U Bx (w) ⇒ N (w n i )x + w n i ≤ N U Bx (w n i )x + w n i ⇒ w i ≤ w U Bx i ⇒ R i ≤ R U Bx i ⇒ R i ≤ R U Bx i Hence, when x = ∆ U Bx c
, U B x is an upper bound of tasks worst-case response time according to P F P ASAP algorithm.

Case where x > ∆ U Bx c : Lengthening cooling periods by increasing the x parameter is expected to increase the pessimism of U B x by increasing tasks response time over estimation given by Equation 7.21 on page 189. To prove that, one can check if the U B x 's response time computation function is increasing. From Equation 7.21 on page 189, the response time function can be written as follows:

w n+1 i =           w     ln b×Tmax×e -b×x -a b×Tmax-a b               × x + w
Recall that the ceil function is used to ensure a non null integer length for cooling period, and that floor function is used ensure never exceeding T max after a heating period. Even though, these two functions contribute to increase the pessimism of U B x , removing them does not change the response time function monotonicity. Then, we can study the monotonicity of this new function that we call f (x) by computing its derivative function as follows:

f (x) = w × b × x ln b × T max × e -b×x
f (x) = b × ln b × T max × e -b×x -a b × T max -a + b 3 × T max × x × e -b×x b × T max × e -b×x -a ln b × T max × e -b×x -a b × T max -a 2
We do not show the whole study of f (x)'s sign, we do this only with deductions. We can see that the sign of f (x) depends only on the numerator part of the fraction, we denote this part g(x). Then, knowing that g(0) = ln(a/(a -bT max )) > 0, we can say that g(x) is positive in interval [1, +∞[ because of the following arguments. Firstly, the left part (i.e the logarithm part) is positively increasing because the combination of the logarithm and the reverse exponential functions leads to decrease the numerator part of the fraction which is inside the logarithm. Knowing that bT max -a is negative, then, bT max e -bx -a is negatively increasing which makes the sign of the fraction necessarily positive and increasing. Secondly, the right part is negative because b × T max < a. It is slightly decreasing from 0 for a while and then it increases asymptotically to 0 as shown in Figure 7.8. Therefore, the sum of these two parts leads g(x) to be positive because the left part dominates the right one as shown in Figure 7.8, and thereby it leads f (x) to be also positive which means that f (x) is increasing in interval [1, +∞[. Then tasks response time according to U B x increases when x is increasing. Therefore, we prove that U B x upper bounds the actual P F P ASAP worst-case response time. Knowing that the actual schedule respects the discrete time constraint, we can compute a lower bound of the actual tasks worst-case response time by violating this constraint, i.e. allowing non-discrete execution times (see 7.9). The following points summarize the behavior of LB x=1 :

• Cooling down the system for one time unit. This is sufficient because continous time allows executing less than one time unit.

• Then, executing jobs and heating up the system until T max is reached or there is no pending workload; the length of this period is not necessarily an integer.

• Repeat cooling-heating cycles until there is no pending workload.

The lower bound of task τ i of priority level-i that is requested simultaneously with higher priority tasks with T (0) = T max is given by Equation 7.24

w n+1 i = N (w n i ) + w R i = w n+1 i = w n i (7.24)
where :

• N (w) is the number of cooling periods needed to execute the workload w without exceeding T max :

N (w) = w ∆ LB x=1 h (7.25) • w is the workload of time interval [0, w n i [. • ∆ LB x=1 h
is the time to execute jobs and heat up the system from the temperature reached after one time unit of cooling to exactly T max : A lower bound on the worst-case response time for task τ i in the worst-case scenario described in Section 7.4.1 on page 179 can be obtained from a sequence of execution units of τ i and higher priority jobs and the necessary cooling time units where the cooling periods are of one time unit and the heating periods are continuous (not necessarily integers) and as long as needed to reach exactly T max after one time unit of cooling, as described by Formula 7.24 on the facing page.

∆ LB x=1 h = ln b × T max × e -b -a b × T max -a b ( 7
Proof. Let's denote ∆ H the longest execution period produced by the actual

P F P ASAP schedule. Knowing that ∆ LB2 h ≥ ∆ H because ∆ H is an integer and ∆ LB2 h is a real number, then: ∆ LB2 h ≥ ∆ H ⇒ w ∆ LB2 h ≤ w ∆ H ⇒ w ∆ LB2 h + w ≤ w ∆ H + w ⇒ R LB2 ≤ R H ≤ R
Therefore, we prove that LB2 lower bounds the actual worst-case response time according to P F P ASAP .

U B T min vs. U B x

The tightness of the upper bound U B x relative to U B T min depends on the parameter x. In fact, the greater x is, the more pessimistic U B x is because of the nature of the cooling function which is asymptotically decreasing to T A . Then, for small values of x, U B x is tighter and for great values U B T min is tighter. The experiments presented in Section 7.6 on page 197 demonstrates the differences in practice between U B x and U B T min in term of tightness and complexity.

Utilization bound

Under thermal constraints, cooling periods are needed to prevent the system exceeding T max . This means that for a certain processor utilization, more time is needed for cooling which means that the processor cannot be used at 100%. One can use this idea to propose a new maximum processor utilization that can respect the thermal constraints. In the following we discuss utilization bounds that consider cooling time.

Maximum utilization

Without considering thermal constraints, task sets cannot be feasible with a processor utilization greater than 100% for monoprocessor platforms. Furthermore, knowing that respecting the thermal constraints needs to add some cooling time, then, it is obvious that a task sets with a processor utilization of 100% cannot be feasible with P F P ASAP , especially when T max is limited. To compute the maximum supportable processor utilization that take into account cooling time, one can use the idea of overestimating response times, by overestimating the cooling time needed to execute the workload of one hyper-period. We can use for instance the idea of U B x to compute an upper bound for the maximum supportable processor utilization.

Lemma 7.3.

An upper bound of the processor utilization U = 1≤i≤n C i /T i for thermal-aware fixedpriority task sets can be obtained by Equation 7.27.

U ≤ ∆ U Bx h ∆ U Bx h + x (7.27)
where ∆ U Bx h is given by Equation 7.26 on page 194.

Proof. We first upper bound the workload of one hyper period with U B x then we compute the corresponding processor utilization, and finally we compute the maximum achievable utilization. The workload of a hyper-period HP can be obtained by multiplying HP by the processor utilization U . Then, we can replace w by U × HP in Equation 7.21 on page 189 to compute the time needed (cooling and workload) to satisfy the workload U × HP . Finally, we can compute the new utilization U * , that considers cooling time, by dividing the time demand (cooling and workload) by the available time HP , Equation 7.28 shows how to compute U * .

U * = U × HP ∆ U Bx h × x + U × HP HP (7.28)
For a task set to be feasible, the new utilization U * must be lesser than 1 because the available time must be greater or equal to the time demand. Then, An upper bound of the processor utilization U = 1≤i≤n C i /T i for thermal-aware fixedpriority task sets with implicit deadlines can be obtained by Equation 7.29.

U * ≤ 1 ⇒ U × HP ∆ U Bx h × x + U × HP HP ≤ 1 ⇒ U × HP × x ∆ U Bx h +U ×HP HP ≤ 1 ⇒ U × x ∆ U Bx h + 1 ≤ 1 ⇒ U ≤ ∆ U Bx h ∆ U Bx
U ≤ ∆ U Bx h × n( n √ 2 -1) ∆ U Bx h + x (7.29)
Proof. To prove this Lemma we just have to compare the over estimated utilization U * given by Equation 7.28 on the preceding page to Liu and Layland bound.

U * ≤ n(2 1/n -1) ⇒ U × HP ∆ U Bx h × x + U × HP HP ≤ n( n √ 2 -1) ⇒ U × HP × x ∆ U Bx h + U × HP HP ≤ n( n √ 2 -1) ⇒ U × x ∆ U Bx h + 1 ≤ n( n √ 2 -1) ⇒ U ≤ ∆ U Bx h × n( n √ 2 -1) ∆ U Bx h + x

Performance Evaluation

In this section, we present the results of an empirical investigation, examining the effectiveness of our sufficient schedulability tests.

Task set generation

To perform these experiments, we randomly generated 100000 task sets, varying the processor utilization. We varied U in the range [0.05, 1] in steps of 0.05. Hence we obtained 5000 distinct task sets for each U step. Each task set is composed of 10 tasks. The thermal parameters was set as, T max = 32 • C, b = 0.228, and a = β 0 × S 3 = 8. These parameters are the ones of the whole system (including an eventual cooling device) and correspond to a classical Intel Pentium processor parameters [START_REF] Pradeep | The Design and Analysis of Thermal-Resilient Hard-Real-Time Systems[END_REF]. The task parameters were randomly generated as follows: task processor utilization (U i = C i /T i ) using the U-Unifast Discard algorithm [START_REF] Bini | Measuring the Performance of Schedulability Tests[END_REF], and periods randomly generated between 2 and 25200 time units with a hyper-period limitation technique [START_REF] Macq | Limitation of the hyper-period in realtime periodic task set generation[END_REF]. Task deadlines were implicit.

We used YARTISS as a simulation environment (see Chapter 8) which respects the following hypotheses: discrete time (all scheduling operations are performed before or after one time unit), the heating behavior follows the Fourier's law (see Equation 7.6 on page 177) and temperature values are real numbers.

Schedulability tests investigated

We investigated the performance of the following schedulability tests.

• SIM : is an empirical necessary and sufficient test based on simulating the schedule of P F P ASAP over more than one hyper-period, starting with synchronous release and the maximum temperature level which corresponds to the worst-case scenario discussed in Section 7.4.1 on page 179.

• U B T min : the sufficient test presented in Section 7.5.2 on page 184, we consider that T min = 1 • C.

• U B x : the sufficient test presented in Section 7.5.2 on page 188, the parameter x is varied from 1 to 18.

• LB x=1 : the necessary test presented in Section 7.5.2 on page 194.

• CF P : the exact test for fixed-priority ignoring thermal and energy constraints. This was used to provide a schedulability bound, considering only processing time.

• U T Z: the necessary condition described in Section 7.5.2 on page 195.

• LnL: the sufficient condition described in Section 7.5.2 on the preceding page.

Experiments

Figure 7.10(a) on the next page shows how the percentage of task sets that are deemed schedulable by each of the tests varies with processor utilization. The CF P test has notionally the highest performance since it is widely optimistic and ignores thermal considerations. When temperature is considered, U T Z, LB x=1 provide necessary tests, upper bounding the number of task sets that are proved to be schedulable by the exact empirical test SIM . We observe that the results confirm that U B T min and U B x provide sufficient schedulability tests and that for x = 1, U B x is a tighter bound than U B T min with a larger improvement at higher utilization levels. Furthermore, this experiment confirms also the validity of the utilization bounds given in Section 7.5.2 on page 195. We can see that the maximum achievable utilization for 10 tasks is 80% for U T Z and the adapted Liu and Layland bound is 57%. We observe that U B x stays less pessimistic than U B T min for small values (1 ≤ x ≤ 14 in this experiment), however, it becomes more pessimistic starting from x = 14. This result is as expected because the longer cooling periods are, the slower the temperature decreases and the longer the response times are.

U B _ T m in U B _ x = 1 U B _ x = 2 U B _ x = 4 U B _ x = 6 U B _ x = 8 U B _ x = 1 0 U B _ x = 1 2 U B _ x = 1 4 U B _ x = 1 6 U B _ x = 1
Figure 7.10(c) on page 199 shows average deviation of bounds from the exact response time given by simulations over processor utilization. The upper bounds have positive values and lower bounds have negative values (the deviation of SIM is 0 because it gives the exact response time). We can see that deviation of U B x , LB x=1 and CF P are still stable over utilization variation in contrast of U B T min which behaves badly when utilization goes high. We notice also that when x = 1, U B x and LB x=1 are very close to the actual response time which makes them very interesting tools for approximate schedulability analysis. However, increasing x leads U B x to be less precise, when x > 14, U B x behaves as bad as U B T min or worse.

Weighted Schedulability As well as processor utilization, task set schedulability is dependent on a number of other key parameters, including: tasks deadlines model and the number of tasks. Evaluating all possible combinations of these parameters is not possible. Instead, the evaluation in this section varies one parameter at a time, with the results presented in terms of the weighted schedulability measure [START_REF] Bastoni | Cache-Related Preemption and Migration Delays: Empirical Approximation and Impact on Schedulability[END_REF].

The figures in this section show the weighted schedulability measure described in Section 5.4.2 on page 149. Here we vary the deadlines from heavily constrained where D i -C i is 10% of T i -C i to 100% of T i -C i (i.e. implicit deadlines). We observe that all of the schedulability tests are influenced by the tightness of deadlines to a similar degree, with heavily constrained deadlines having significant impact on schedulability in all cases. We observe that increasing parameter x decreases the percentage of schedulable task sets, however, it decreases the test complexity or overhead. We observe also that the loss of schedulablity is higher than the gain of overhead.

Conclusion

In this chapter, we addressed the problem of fixed-priority real-time scheduling for thermal-aware systems, where both time and thermal constraints have to be met. In a previous chapter, we showed that the scheduling policy P F P ASAP is optimal among all fixed-priority scheduling algorithms for energy-non-concrete energy-harvesting systems. The main contributions of this chapter are as follows. we adapted P F P ASAP algorithm to the thermal-aware model, we proved its optimality and we proposed two schedulability tests based on response-time upper bounds U B T min and U B x which is a parametric bound. Finally we performed simulations to validate the theoretical results. The scheduling problems of energy-harvesting and thermal-aware systems seem to be close to each other. This opens the door to use and adapt scheduling solutions from one side to an other. This work is a first step in this way. It is interesting to continue studying deeply the possible similarities between energy-harvesting model and the thermal-aware's one and to explore more adaptable and extensible results of each model.

Introduction

The real-time scheduling theory has been studied by many researchers since decades, and many solutions and approaches have been proposed in the past to optimize the scheduling of real-time tasks on single and multiple processor systems. In order to check if a task set respects its temporal constraints according to a specific scheduling policy or to evaluate the efficiency of a new approach against other algorithms, using simulation software is considered as a valid comparison technique and it is commonly used in the evaluation of real-time systems.

Unfortunately, there is no standard simulation tool approved by the real-time community and the existing tools are usually hard to be extended due to various reasons such as code complexity, software copyrights or poor documentation. As a result, most of the researchers tend to create their own simulation tools. This situation raises some concerns. On one hand, results are hard to be validated without careful examination of the used simulation tool. So these results might be biased toward the proposed approach either by adapting the generation of tasks or by biased implementation against the compared algorithms. On another hand, the use of out-of-date simulation tools or the lack of good documentation pushes researchers to not use the existing tools and to create their own ones, which leads to repetitive implementations especially the common ones e.g. Earliest Deadline First (EDF ), Rate Monotonic (RM ) and Deadline Monotonic (DM ).

Besides the time and the effort spent by researchers in developing new simulation tools, the process of implementing comparable algorithms can be sometimes complicated and time-consuming. If a standard simulation platform succeeds to emerge, one can re-use already-implemented policies from literature and compare them with new policies without the need to understand their specifications and particularities. Finally, the simulation protocols can be standardized, and easily describable by the use of such a reference tool.

In this chapter, we introduce Yet An Other Real-Time Systems Simulator (YARTISS), a new simulation tool for real-time multiprocessor systems, which provides various functions to simulate the scheduling process of real-time task sets and their temporal behavior.

The main particularity of YARTISS is its genericity, by which we aim to overcome the previously mentioned problems. Its architecture is designed in a way to allow new users to add their own policies and algorithms and extend the simulator easily with no need to modify the core of the simulator or even understand how it is built. YARTISS is an extension of previous simulator projects [Mas; Fau] designed earlier by our research team. We learned a lot from these attempts and we included this experience in the development of YARTISS.

YARTISS is written in Java programming language, which is a popular objectoriented language that offers valuable attributes regarding code portability. In order to ensure independence between the different features of the simulator and to control the development process, we used modern programming paradigms like module-oriented programming and agile programming methods. We tried to develop YARTISS keeping in mind that for a simulator in order to become a reference tool, it should have the following properties: 1) the software must be available under an open source license which gives any researcher the freedom to analyze, verify and modify its implementation without the permission of the copyright holder; 2) the Application Programming Interface (API) of the software must be well-documented and the developer who wants to add or modify a part should be able to do it easily with no need to read the entire source code in order to understand its behavior; 3) each part of the simulator must be 8.2. Related Works 205 independent from the other parts (or at least acyclic dependences must be guaranteed , and easily replaceable by an external module; and 4) the simulator has to be easy to use in a way that a non-developer researcher can be able to use it easily. Due to its genericity and modularity, we hope that YARTISS makes a valuable contribution to the long process of developing a standard simulation tool recognized by the real-time scheduling research community. YARTISS was developed in our Lab in collaboration with Manar Qamhieh and Frédéric Fauberteau. The work presented in this chapter is also available in [START_REF] Chandarli | YARTISS: A Tool to Visualize, Test, Compare and Evaluate Real-Time Scheduling Algorithms[END_REF].

The structure of this chapter is as follows. We review related works and examples of real-time simulators in Section 8.2. Section 8.3 on the following page contains our motivation and shows the history of YARTISS. Then, in Section 8.4 on page 207 we present the various features of our simulation tool. The architecture design of the simulator is described in Section 8.5 on page 213. We present a case study in Section 8.6 on page 221 in order to demonstrate the extensibility of the tool. Information about the available versions of YARTISS and its download and install instructions are provided in Section 8.7 on page 223. Finally, Section 8.8 on page 223 concludes this chapter.

Related Works

In this section we explore the existing works related to simulation tools and we identify their respective strengths and weaknesses. There exist many tools to test and visualize the execution of real-time systems. These tools are divided mainly into two categories: the execution analyzer frameworks and the simulation software. Regarding the execution analyzers, one can refer to RESCH [START_REF] Kato | A Loadable Real-Time Scheduler Suite for Multicore Platforms[END_REF] which is a loadable realtime scheduler framework for Linux. Also, Grasp [START_REF] Holenderski | Grasp: Tracing, visualizing and measuring the behavior of real-time systems[END_REF] which is a set of tools designed for tracing and measuring the scheduling of real-time tasks. Furthermore, LitmusRT [START_REF] Calandrino | LITMUS-RT: A Testbed for Empirically Comparing Real-Time Multiprocessor Schedulers[END_REF] is a real-time extension to Linux kernel for multiprocessor systems that monitors the scheduling behavior of a real task set on a real platform.

Among open-source simulation tools, we start by referring to MAST [GH+01] which is a modeling and analysis suite for real-time applications that was developed in 2000. MAST is an event-driven scheduling simulator that permits modeling distributed real-time systems and offers a set of tools to test their feasibility or to compute their sensitivity analysis. Another known simulator is Cheddar [Sin+09; Sin+04] which was developed in 2004, it handles the scheduling of real-time tasks on multiprocessor systems. It provides many implementations of basic scheduling, partitioning and analysis of algorithms. Unfortunately, no API documentation is available to help implementing new algorithms and to facilitate its extensibility. Moreover, Cheddar is written in Ada programming language [START_REF] Mccormick | Building Parallel, Embedded, and Real-Time Applications with Ada[END_REF] which is used mainly in embedded systems and has strong features such as modularity mechanisms and parallel processing. Ada is often the language of choice for large systems that require real-time processing, but in general, it is not a common language for desktop or web applications. We believe that the choice of Ada reduces the potential contributions to the software from average developers and researchers.

Finally, STORM [START_REF] Urunuela | STORM: a Simulation Tool for Real-time Multiprocessor Scheduling Evaluation[END_REF] and FORTAS [START_REF] Courbin | FORTAS: Framework fOr Real-Time Analysis and Simulation[END_REF] are simulation tools which, as YARTISS, are written in Java. The first one, STORM, was released in 2009 and was presented as a simulation tool for real-time multiprocessor scheduling. It has a modular architectures and can simulate the scheduling of task sets on multiprocessor systems according to several scheduling policies. The specifications of the simulation parameters and the scheduling policies are modifiable using an Extensible Markup Language (XML) file. However, the simulator tool lacks a detailed documentation and description of the available scheduling methods and the features of the software. The second one, FORTAS, is a real-time simulation and analysis framework which targets uniprocessor and multiprocessor systems. It was developed mainly to facilitate the comparison process between the different scheduling algorithms, and it includes features such as task generators and computation of results of each tested and compared scheduling algorithm. FORTAS represents a valuable contribution in the effort towards providing an open and modular tool. Unfortunately, it seems to suffer from the following issues: its development is not open to other developers up to now (we can only download .class files), no documentation is yet provided and no new version has been released to public since its presentation in [START_REF] Courbin | FORTAS: Framework fOr Real-Time Analysis and Simulation[END_REF].

During the development of YARTISS, we learned from those existing tools and we included some of their features in addition to others of our own. Our aim is to provide a simulation tool for multiprocessor systems that is easily extendable by fellow researchers and developers, and it can be used to compare, simulate and visualize the scheduling of real-time tasks on multiprocessor systems.

The History of YARTISS

YARTISS is the fourth simulation tool developed by our team during the last few years. In this section we present each one of these tools, their contributions, challenges and limitations. Each one of these tools was built for a specific purpose and consumed relatively a long period of time to be developed. We used the experience from the earlier simulators in the design of YARTISS. This is done by summing and optimizing their functionalities while avoiding their limitations.

Our first try in writing a real-time system simulator was called RTSS [Mas] and it was developed between 2005 and 2008. RTSS was initially developed to test some scheduling algorithms on uniprocessor systems in order to handle temporal fault tolerance, such as preemptive fixed priority, EDF and D OV ER algorithms [START_REF] Koren | D over : An Optimal On-Line Scheduling Algorithm for Overloaded Uniprocessor Real-Time Systems[END_REF]. Later, it was extended in order to test aperiodic tasks with task servers such as Polling and Deferrable Servers and their handling algorithms [START_REF] Masson | Userland Approximate Slack Stealer with Low Time Complexity[END_REF]. RTSS suffered from some problems. For example, many modifications have been made in a hurry with certain assumptions on the behavior of the existing code without a proper documentation. Also, RTSS

Functionalities

207

was not easily extendable, a single modification in one part of the code could cause non-understandable errors in another part of the software. Moreover, although the tool was initially written in Java, it began to rely more and more on bash scripts which are used mainly to launch the simulation processes and to transform outputs into human readable files.

Based on RTSS, a second simulation tool was developed between 2008 and 2011. It was called RTMSim [Fau] and it targeted the scheduling simulation of multiprocessor platforms [START_REF] Fauberteau | Laxity-Based Restricted-Migration Scheduling[END_REF]. In the meanwhile, RTSS had become such complicated and not maintainable that we had to start over rather than to extend its functionalities to multiprocessor systems. The general key ideas of RTSS were kept for RTMSim. Unfortunately, the validated parts of RTSS, which were of no interest at that time, were not re-implemented in RTMSim and thus they were lost.

A third try was made in early 2011. RTSS v2 [Mas] was developed as a rebuild of RTSS in the aim of including energy consuming tasks. Unfortunately, even if RTSS v2 is more usable today than the first version, it still suffers from the same problems of the original tool, namely the poor documentation and the lack of modularity. Moreover, it seemed difficult to extend it to simulate multiprocessor platforms.

So we came to the development of a new software: YARTISS. From the beginning, we aimed to produce a tool where the task models, the number of processors and scheduling behavior such as energy consumption models can be easily added and modified. Another important point is the usability of the user interface to produce human readable traces of the simulation process of scheduling algorithms. Our goal was to develop a tool that is able to perform evaluations as well as to debugging various algorithms including the energy-related algorithms. When we wanted to use YARTISS for another purpose, for example, the simulation of scheduling dependent real-time tasks of the acyclic graph model (see [START_REF] Qamhieh | Global EDF scheduling of directed acyclic graphs on multiprocessor systems[END_REF]), this was done without any problems which validated the extensibility of our simulator. This point is explained in more detail in Section 8.6 on page 221.

Functionalities

There are two main functionalities in our simulation tool, the first is the simulation of tasks execution and the temporal behavior of a task set according to a specific scheduling policy. The second functionality is the large-scale comparison of several scheduling policies in different scenarios. Both functionalities require a third feature which is the random task set generation.

In this section we explain all functionalities of YARTISS in details while showing their specifications and various characteristics regarding the scheduling problem of real-time systems.

Single Task Set Simulation

This feature deals with the simulation of the execution of a task set on mono/multiprocessor platform with a specific scheduling policy. The used task sets can be loaded into the simulator either through the graphic user interface by loading an input file or entering the parameters manually, or by using a task set generator. We can parameterize the desired simulation and run it easily. Furthermore, several views are proposed. The simulation parameters are the task set, the number of processors, the scheduling algorithm and the energy profile.

Task Models

YARTISS offers an open architecture that greatly facilitates the integration of different task models. The current version proposes two models, the first one is the Liu and Layland task model augmented with energy related parameters. All tasks are considered independent and each task τ i is characterized by its Worst Case Execution Time (WCET) C i , its worst case energy consumption E i , its period T i and its deadline D i . The second model is the Directed Acyclic Graph (DAG) task model which is a common real-time dependent task model for multiprocessor systems. It is used to implement systems consisting of number of subtasks with dependencies to control their execution flow. In this model, a graph task G i is a collection of real-time subtasks {τ i,1 , τ i,2 , ...τ i,q } that share the same deadline D i and period T i of the DAG, and they differ in their own WCET C i,j . The directed edges between the tasks of the graph determine their precedence constraints, and since each task in the graph might have more than one successor and predecessor, concurrent execution can be generated.

These two models are the common models of independent and dependent realtime tasks, and they can have different characteristics regarding deadlines (implicit, constrained), and regarding periods (periodic, sporadic). We show in Section 8.6 on page 221 a case study to demonstrate how to easily integrate new task models into YARTISS.

Mono / Multiprocessor

Our simulation tool supports multiprocessor scheduling. According to this, the number and the type of processors is passed as a parameter of the simulation. Initially we considered a single type of platforms which consists of identical monospeed processors. This model is extended in YARTISS to include heterogeneous systems in which the processors can have different characteristics.

By using the simulator, one can implement and test his own multiprocessor algorithms and partitioning policies. Also, we considered a global scheduling of task sets on multiprocessor systems. It is defined as the scheduling in which the execution of a job can be interrupted by higher priority jobs and the execution can be resumed on a different processor. By default, some multiprocessor scheduling algorithms were

Energy Profile

Unlike many other simulators, YARTISS permits us to simulate the production and the consumption of energy in real-time systems. It permits the user to model an energy-harvester and an energy storage unit such as a battery or a capacitor with a certain capacity. A renewable energy source can be modeled also using a charging function. It is possible as well for the user to implement and use customized energy profiles. Figure 8.2 on the facing page shows screen-shots of the user interface of YARTISS. We can see in Figure 8.1(a) on page 209 the time chart of the storage unit energy level where we can see the consumption during the scheduling process. The energy view, which is used to print the energy level chart is among many views provided by YARTISS to show other metrics.

Energy Source Model:

We have implemented an energy source profile that models a renewable energy source represented by an energy storage unit with limited capacity. Other models can be added by the user by implementing the profile interface and injecting it into the engine module of the simulator. This process is not complicated and it can be done without modifying the other modules of the simulator.

Consumption Model:

It is important to note that the energy consumption of a task must be modeled independently from its WCET as in the case of [START_REF] Jayaseelan | Estimating the Worst-Case Energy Consumption of Embedded Software[END_REF]. Therefore, our simulator provides the ability to define a consumption profile for each task of the system or to choose one global profile to apply to all tasks. A consumption model is represented by a function and must be able to provide the amount of energy consumed within a time interval during the tasks execution i.e. the integral of the consumption function. The implemented models so far are: Linear consumption (not realistic but permits to establish some interesting conclusions) and Early instantaneous consumption where all the energy cost of a task is consumed as soon as a task is scheduled. This latter model seems to be the worst-case scenario.

Scheduling Policy

The main purpose of the simulator is to test scheduling algorithms by comparing them to each other in order to measure their performances and efficiency. Much attention has been focused on the design of this part of YARTISS to make it as generic as possible so that users can add, override and inject their own scheduling policies easily. There are currently many algorithms implemented in YARTISS with different priority assignment policies such as fixed-job, fixed-task and dynamic priority. It includes also classical algorithms such as RM , DM , EDF , Least Laxity First (LLF ) for both mono and multiprocessor platforms. Users can add new scheduling policies easily, and Section 8.6 on page 221, we demonstrate in details how to integrate a new policy independently from the rest of the modules of the simulator.

Run Large Scale Simulations

One of the major features of YARTISS is the large scale comparison of several algorithms or scheduling policies. It is similar to the single task set simulation but it is performed on a large set of task sets in different configurations and scenarios. The comparison results are based on statistics such as the number of schedulability failures or deadline misses, the system's lifetime, the amount of time spent at maximum and minimum energy levels or the average duration of idle and busy periods. Multiple simulations can run simultaneously due to the use of the multi-threading concept supported by Java. As a result, the duration of simulations is greatly reduced through the parallelism of the used hardware.

Task Set Generation

Performing large scale simulations requires a large set of task sets. For the simulation results to be credible, the used task sets should be randomly generated and varied sufficiently. The simulator provides the ability to choose a generator according to the desired task models and algorithms. The current version includes by default a generator based on the UUniFast-Discard algorithm [START_REF] Bini | Measuring the Performance of Schedulability Tests[END_REF] coupled with a hyper-period limitation technique [START_REF] Macq | Limitation of the hyper-period in realtime periodic task set generation[END_REF] adapted to energy constraints. This algorithm generates task sets by distributing the processor utilization and the energy utilization on tasks randomly. Since the original version of the algorithm does not include energy, we had to adapt it to produce feasible systems regarding time and energy. The idea behind the algorithm is to distribute the system's utilization on the tasks of the system. When we consider tasks energy cost, we end up with two parameters to vary and two conditions to satisfy. The algorithm in its current version distributes U and U e uniformly on the tasks in such a way that when we generate n task sets, we get approximately the same number of task sets for each utilization value. Then, the algorithm finds the couples (C i , E i ) which satisfies all the conditions namely U i , U e and energy consumption constraints.

The operation is repeated several times until the desired couples satisfy the imposed conditions.

Graphical User Interface (GUI)

To facilitate the use of the simulator by a large number of users, we provide our tool with a Graphic User Interface (GUI) to support the above-mentioned features in an interactive and intuitive way. After the simulation of a specific system with a specific energy profile and a specific scheduling policy, the user can follow and analyze the scheduling process using three different views: a time chart (Gant chart), a processor view and the energy storage level chart which monitors the energy levels of the system. In order to run simulations and get the results of comparison of scheduling policies, the simulator offers a control panel that allows the user to select the scheduling policies, to choose the energy scenarios and to start the simulations. Thus, the user can see the simulation results as one graph per scenario or per comparison criterion or metric. Then, the simulator can obtain results on a large number of randomly generated task sets in order to evaluate the performance of the tested scheduling policies, and easily explore their properties. This view offers also a debugging window in which the user can analyze the results of comparison and can optionally display the time chart of a task set over each scheduling policy. This helps the user to analyze and debug scheduling policies. It can be also useful to find counter examples and to isolate degenerate cases. For example, in the case of energy-aware scheduling, no optimal algorithm exists yet. In order to test empirically whether a new algorithm is potentially optimal or not, a simple approach consists in simulating the scheduling of all possibilities of task sets and ask the simulator to filter cases where the new scheduling algorithm fails whereas other heuristics succeed.

Architecture

Usually, the common concern of real-time simulation tools is the possibility of using the simulator in different contexts. In many cases, extending a simulator to include customized modules needs a lot of modifications and refactoring of the code. Careless modifications can lead to incompatibility with the original modules of the tool, or worst, it may lead to a different or wrong simulation results. Furthermore, most of the time, researchers do not like to spend much time or effort to understand and preserve an existing tool, and finally, the tool becomes difficult to maintain. In our team, we experienced this issue previously, and we noticed the importance of design and software architecture. The more generic and flexible the software is, the less time and effort we spend to integrate new customized modules. For this reason and in order to meet the requirements mentioned in Section 8.3 on page 206, we decided to merge the old versions of our simulator and to provide a new tool with an enhanced architecture and As shown in Figure 8.3, the simulation tool is divided into four main modules each with a specific responsibility:

• the engine (core) module of the simulator which contains all the classes necessary to simulate the scheduling of real-time systems,

• the service module responsible of handling the transparent interactions between the engine and the presentation,

• the GUI module which contains the graphical components and classes,

• the framework module which contains useful tools and classes necessary for the application.

This module separation follows the classical Model-View-Controller (MVC) design pattern (see Figure 8.3) that allows a secure isolation of the business part of the application from its presentation, and thus, it allows the engine module to be more generic and easily usable by other applications as an API. Furthermore, splitting the code into several modules limits the communication between the different modules to specific classes or interfaces by respecting the Inversion of Control (IoC) design pattern. The main advantage of IoC is to prevent inter-dependency between modules and to facilitate their maintenance.

Engine Module

The aim of a real-time simulator is to imitate the execution behavior of systems while respecting the hypotheses. Real-time systems are usually composed of a platform (i.e. processors, memories and caches), an energy profile (i.e., supply, consumption, heating, etc), a real-time task set and a scheduling policy. Many types of these components are studied in research works and are simulated and compared. The architecture of the simulator must take into account the need to integrate new customized components, and then be used for the comparison process using the same simulator.

In YARTISS, the concept of each component is defined with a java interface that describes its responsibility, its input and its output as detailed in Figure 8 Task set: Firstly, a task is defined mainly by the interface ITask that describes, with getters and setters, the most common parameters of real-time tasks. A task is generally characterized by a deadline, a period, a WCET and energy consumption. Other parameters can be added based on the desired model by inheriting classes from the basic interface. As a result, several task models can be implemented from the same interface with different parameters, such as periodic and sporadic.

Secondly, a task set is defined in YARTISS as a collection of tasks sorted according to a static or dynamic priority assignment following the adopted model. This aims to provide a sorted subset of active tasks at any time to be used by scheduling policies. It can be seen as a container of tasks that manages the dependencies between the tasks (as Chapter 8. Simulation Tool: YARTISS in the case of DAG tasks) and provides a task ordering according to the specifications of the user (fixed job or task priority and dynamic priority). The combination of the inherited classes of tasks and task sets defines the task set model to be simulated. The user can implement a customized behavior of tasks and task sets by extending these interfaces and adding his own properties by using the generic available getters and setters.

The current release of YARTISS contains by default the following task set models: Liu and Layland model (i.e., periodic fixed-priority task sets), the dependent tasks of the DAG model and the energy-harvesting task model.

Scheduling policy:

The responsibility of a scheduling policy is to decide at any time t which task or job to execute on which processor. YARTISS defines this behavior with the interface ISchedulingPolicy. It has a main method called chooseNextTasks() that selects the highest priority tasks at time t, to execute on the processors of the system. This method receives the necessary components for simulation such as the state of the processors, the task set and the energy profile. The scheduling policy can use external and generic parameters to calibrate its behavior with the method setParameters(). A scheduling algorithm is usually adapted to a specific task set model. For this reason, we give to the scheduling policies the responsibility of creating new instances of the adapted type of task model with the method createTaskset(). By outsourcing the scheduling decisions from the core of the Simulation class, we are able to implement several scheduling algorithms for different task models, which simplifies the comparison process. We have already implemented many scheduling policies in YARTISS for different task models, including fixed-priority RM , DM , EDF , LLF , etc. Also, there are algorithms for energy-harvesting systems and DAG task model.

Energy profile:

The energy profile of a system includes the profiles of energy, production and consumption, and heating models. The interface IEnergyProfile describes how the system is supplied with energy and how it manages its consumption. It offers a set of methods that demonstrates the energy source (battery for instance), its limits and its energy levels within a time interval. The method howLongCanExecute() calculates the maximum time at which a task can execute w.r.t. the available energy and the used consumption profile. This can be used to simulate different energy sources, different rechargeable batteries with different environments and energy sources. The second part of the energy profile is the energy consumption model. YARTISS proposes two modes, the global mode in which all the tasks have the same energy consumption model, and the non-global mode which allows the tasks to consume energy based on their own consumption model. According to this, the simulator can be general and specific at the same time. The interface IEnergyConsumptionProfile describes how tasks consume energy with the method getConsumed(). This method gives the amount of energy to consume for a given execution time. The thermal behavior is also defined by this interface. It consists of providing the heating and the cooling functions that can be general or task or processor specific.

Execution platform: A system platform consists mainly of a number of processors on which the tasks execute their code. The interface IProcessor defines the common behavior of processors. A task is allocated to a processor within a time interval and the method execute() performs the execution of the tasks within this interval by updating the state of the tasks. The current release of YARTISS proposes only one default type of multiprocessor which is the homogeneous mono-speed processors. However, it is possible to add new types of processors with different speeds and, consequently, the method execute() has to be modified according to the new characteristics. An example of the different type of processors is the processors with Dynamic Voltage and Frequency Scaling (DVFS) capabilities.

The Simulation Process

The aim of this tool is to simulate the scheduling of a system according to the parameters and the assumptions set by the user, namely the task set, the platform, the energy profile and the scheduling policy. According to the scheduler, the scheduling decisions are taken based on specific events, such as activation and finish times of a job, its deadline and preemption events.

A scheduling decision consists of assigning priorities to the active jobs statically or dynamically according to the scheduling policy, and allocating them to processors by considering the state of the system (energy state for example). The simulator uses a basic set of events that guarantee a correct execution of the system such as job request events, finish executing events, deadline events, etc. These events are natively implemented in YARTISS. The simulation starts generating the events responsible of requesting the first job of each task. Then other events are generated dynamically during the simulation process. For example, when a job meets its deadline, the corresponding deadline event is generated in order to check if the job has met its deadline and to request an other event for the next job as well. The events are generated sorted according to their temporal order and priority ordering. For each event, the scheduling policy is called to select the highest priority jobs to execute on the available processors. Then, the selected jobs execute while respecting the type of processors and the energy profile. This mechanism is implemented in class Simulation.

The interface Event describes the role of an event. The current release of YARTISS provides the necessary events to schedule a real-time system. However, the user is allowed to add his own events by implementing their customized behavior. To do so, the user should extend the Event interface and register the new event with the method register() from class EventGenerator. Furthermore, to generate an event, the user should use the method generate() of class EventGenerator. Then the event will be processed with the desired behavior which is implemented by the user.

Metrics and Statistics:

The aim of a simulation is not restricted to checking the feasibility of a given system. It is important also to compute some metrics and statistics of the performed simulation in order to analyze the performance of the tested solution. We considered this functionality in YARTISS and we integrated a generic mechanism dedicated to compute statistics. It is possible to compute a metric at the beginning or the end of the simulation, or even during events processing. Moreover, it can be aggregated with other values when several simulations are performed. In the simulator, a metric is represented by the interface IStatisticCriterion which has a method for each possible calculation time (i.e., beginning, end, event processing). Several metrics are implemented natively and, as for the other parts, the user can add new customized metrics to the simulator by implementing the interface and injecting an instance of the new metric to the metrics manager class. At the beginning of each simulation, an instance of each active metric is created. Then, at each metric calculation time, the corresponding method of the metric is called. At the end of the simulation we can get the final value of each metric using the method getValue(). In the case of several simulations, we can also aggregate the values of the same metric on all of the simulations in order to compute the maximum/minimum values, the average value, etc. The aggregation function is implemented by the metric class and can provide several values: maximum, minimum, average values, percentage value, etc. By doing so, the simulation class computes several statistics independently from their implementation. Among the implemented metrics available in YARTISS, we can cite: deadline miss counter, average busy and idle periods, average overheads.

Inversion of Control and Dependency Injection

Based on the above described components, we notice that the simulator deals only with interfaces and never directly with implemented classes. This allows the simulator to be generic regarding the parts that can be replaced, such as the scheduling policy, the task set model, the platform, the energy profile and the statistics metrics. This implantation respects the IoC design pattern and the Dependency Injection that stipulates that the objects composing the application must be weakly coupled and dependencies should be linked only at run-time.

The IoC design pattern is a design pattern of software construction where reusable code controls the execution of problem-specific code. Its main advantage is that the reusable code is developed independently from the problem-specific code, which often results in a single integrated application. The IoC design guideline is useful for the following purposes:

• the execution of a certain task is independent from its implementation,

• every part of the system focuses on its design purpose,

• all parts have no assumptions about the constraints and the limitations of the other parts,

• replacing or modifying a part in the system does not affect the rest of the parts.

Sometimes, IoC is referred to as the Hollywood Principle: Don't call us, we'll call you, because program logic runs against abstractions such as callbacks.

In the case of YARTISS, the simulation code is a reusable part and the different implementations of scheduling policies, processors, task sets or metrics are done on specific parts that can be replaced and developed independently. This is what makes YARTISS a generic real-time simulator that can be used easily by other researchers.

Service Module

The engine module contains all the code necessary to build and run a simulation. Furthermore, it can be used alone or imported as an API to be integrated into another software. However, we were interested in providing a complete simulation tool and not only an API. So we implemented more classes which allow an intermediate user to build and run simulations easily. This is done using the Service module which contains the functionalities described above in Section 8.4 on page 207. From a design point of view, the service module represents the Controller and the Model parts of the famous MVC design pattern or the View-Model part of the Model View View-Model (MVVM) design pattern. It is a software brick of higher level that uses the engine module. The service module provides the classes that set the replaceable parts of a simulation (e.g. the scheduling policy, the task set, the platform, metrics, etc), run the simulation and save the results. It contains mainly three public classes, each represents a certain functionality:

• The TimeLineViewModel class provides the necessary parameters to simulate a task and allows the user to run the simulation and visualize the results.

• The BenchmarkViewModel class allows the user to set quickly the description of a large scale simulation where several scheduling policies are compared using the chosen statistic metrics in different scenarios of energy profiles. This class helps the user to build such a simulation without knowing the implementation of any parts. The description is passed using a String object and all created generic objects are done using the Dependency Injection paradigm. This class saves results which are readable by the chart plotter tool Gnuplot.

• The task GenViewModel class builds a custom task set generator in the same way.

These classes are packed in an independent module so as to be built easily using a higher level software layer with a friendly user interface (such as a web server or a graphical or textual interface).

Framework Module

This is a toolbox module that contains generic classes and functions that facilitate building simulations. It is completely independent from the other modules and can be reused by other projects easily. This module is considered as a small API that provides a simple and small abstraction of the Java concurrency API and some generic classes for the MVC design pattern :

Concurrency: This feature allows the user to run several Java Runnables objects simultaneously with the possibility of collecting results. It implements the producer/consumer design pattern to get the final results. It aims to accelerate simulations by leveraging the concurrency API of Java. Furthermore, running several computations in parallel can be done directly by using Java threads. However, getting and computing the final results of simulation is difficult due to threads concurrency. For this reason, we adopted the producer/consumer design pattern such that the threads perform the required computations and produce the results in parallel. On the other hand, a single consumer is allowed to collect and aggregate the results with a thread safe mode by using a blocking queue. The service module uses this functionality to run large scale simulations in parallel to collect aggregated results in order to present them through the user interface. It can also use the task set generator. Figure 8.5 illustrates the producer/consumer design pattern.

Model-View-Controller (MVC):

This part provides a simple framework for building MVC applications. It is not as sophisticated as commercial frameworks, but it is sufficient for the simulator needs. Mainly, it contains classes that use the Java reflection capabilities to handle getter and setter properties. This enhances the generic aspect of the architecture and keeps a weak coupling between objects and modules.

View-Module or GUI

This module is responsible of building and running a graphical user interface that facilitates the use of the different features and functionalities of the simulator that are described in section 8.4 on page 207. It represents the highest level of the application and it proposes some independent graphical components that can be used to build a customized graphical interface (components to visualize the time chart of a simulation, to visualize the energy or the battery evolution chart). The views provided by this module are linked to the other models and controllers of the service model only at run-time.

Case Study

As described above, the particularity of YARTISS is its genericity. This means that its parts can be extended easily by users. They can develop new customized parts and use them in the simulating tool without need to understand the implementation of simulator core.

In this section we demonstrate the generality of YARTISS by adding a new scheduling policy, The Preemptive Fixed-Task-Priority As Soon As Possible (P F P ASAP ) scheduling algorithm presented in Chapter 4 on page 109.

Adding a new Scheduling Policy

As mentioned in Section 8.5.1 on page 216, to add a new scheduling policy, the user have to import the modules of YARTISS and to implement the interface ISchedulingPolicy that defines the concept of a scheduling algorithm.

The implementation of the interface ISchedulingPolicy means the implementation of all methods. The most important method is chooseNextTasks( Platform platform, ITaskSet taskSet, IEnergyProfile energyProfile, long t, EventGenerator gen ) that assigns tasks to the available processors at any time t. The parameter platform represents the hardware part, i.e. processors and memories, etc. The parameter taskSet is the real-time task set to simulate, energyProfile is the energy profile chosen by the user and evGen is the event generator that can be used to generate additional events. We notice that except the task set, all of the parameters are typed with interfaces which means that the scheduling policy deals with generic parameters as illustrated by the UML diagram of Figure 8.6 on the previous page. The real types are instantiated at run-time following the configuration set by the user. For this reason the implementation of a new scheduling algorithm is easy and the new class contains only the code of the scheduling algorithm.

Therefore, knowing that P F P ASAP schedules tasks as soon as possible by consuming greedily the available energy, the method chooseNextTasks(...) can be implemented by writing in Java the following instructions:

1. check if there is at least one active task at time t, 2. get the task with the highest priority among the active tasks, 3. ask the energy profile how long this task can be executed continuously, 4. do not execute the task if the energy is not sufficient to execute by assigning null to the processor and generating a new event at time t + 1 to retry again, 5. execute the remaining time of the highest priority active task by assigning the task to the processor with platform.getProcessor().setNextTask(task), and generating an other event at the time when the energy become insufficient to execute all the remaining execution time of the active task.

The second important method is createTaskSet(). It creates an instance of the task set model that is compatible with the current policy. In the case of P F P ASAP , the suitable task set is the classical fixed-priority one, i.e. Liu and Layland model, where the tasks are sorted according to their static priorities. The task set models follows the same design pattern as scheduling policies but in this case we use an already existing model (with TaskSetFactory.getNewInstance( "priority")) instead of implementing a new one.

The third important method is newInstance() which is a factory method that creates new instances of the current scheduling policy, name P F P ASAP in this case. This method is used to create new objects of the scheduling policy class without requiring to do it manually with new constructors. This design patter allows us to centralize the creation of objects of classes that implement the same interface which allows a generic injection of new implementations, e.g. new scheduling algorithms in this case.

The remaining methods are used to identify the policy among others and to provide parameters if necessary (which is not the case of P F P ASAP ).

Then, the newly-created scheduling policy should be registered in the simulator by the use of the register() method from the SchedulingPolicyFactory class that centralize the creation of classes implementing ISchedulingPolicy interface. This method injects a sample object of the policy we want to register, then using the methods newInstance() and getPolicyName(), the new scheduling policy can appear in the list of the available scheduling policies and can be instantiated generically. The call of the method register() should be done in the customized main class created by the user or by using the GUI of YARTISS as shown in Listing 1 on page 251 in the Appendix.

The adopted design allows us to implement other scheduling policy easily, we did the same with all the policies discussed in this dissertation.

Adding an Energy Profile

The same methodology can be applied if we want to add a new energy consumption profile to YARTISS. Listing 2 on page 252 in the Appendix shows the Java code needed to use a logarithmic energy consumption profile as an external module.

Distribution

The project is available on the collaborative development platform hosted at https://svnigm.univ-mlv.fr/projects/YARTISS/. This environment provides a subversion repository allowing anonymous checkouts, documentation hosting, RSS feeds subscriptions, and public forums. A web page dedicated to YARTISS is also available at http://YARTISS.univ-mlv.fr. In addition to a general presentation of the tool, it proposes a demo applet version which allows interested readers to try YARTISS directly from their web browser and an application form to allow anybody to share external modules.

Conclusion

In this paper we presented YARTISS, a real-time multiprocessor scheduling simulator. A consequent effort has been made to make it as extensible as possible. To justify the need for an open and generic tool, we presented the history of YARTISS development. Then we briefly presented existing simulation tools. We have described the three main functionalities of YARTISS: 1) simulate a task set on one or several processors while monitoring the system energy consumption, 2) concurrently simulate a large number of task sets and present the results in a user friendly way that permits us to isolate interesting cases, and 3) randomly generate a large number of task sets. Then, in order to demonstrate the modularity and extensibility of our tool, we presented its architecture and a case study that shows how to add new parts, in most cases without having to open or modify the core modules. Finally, we gave the instructions to get and test YARTISS. We hope that this software can contribute to build a standard simulation tool that can be adopted through the real-time scheduling community.

General Conclusion Scope

In this thesis we addressed the real-time scheduling problem of fixed-priority energyharvesting systems. A real-time energy harvesting system must respect not only the deadlines of all tasks but also their energy constraints. This means that the energy cost of all jobs must be satisfied by the energy stored in the storage unit and the energy collected from the environment. To satisfy tasks energy cost, additional idle times may be necessary to collect the required energy. These necessary delays create a new scheduling problematic. Now, the challenge for a fixed-priority scheduling algorithm is to execute tasks according to their deadlines and to delay executions at the right moments and for the right durations in order to meet all deadlines and satisfy the energy demand.

The problems are: first to find an optimal scheduling for such a model; second to provide schedulability conditions that help designers to check if a given task set is schedulablable or not; third, to find the minimum battery capacity that ensure the feasibility of a given task set.

In this dissertation, we started by presenting the state of the art of this research area. We first reminded briefly the classical real-time scheduling theory including the different task models and the main scheduling algorithm families. Second, we explored the state of the art of energy-harvesting hardware, namely the different technologies of energy-harvesting and energy storage and the applications for which they are suitable. Third, we presented the main scheduling algorithms proposed in the literature and their properties. We showed also that the fixed-priority scheduling problematic for energy-harvesting systems is not very well studied by the community.

After that, we presented in detail the contributions of this thesis, summarized in the next section.

Main Results

The P F P ASAP Algorithm

The first result of this thesis is the P F P ASAP algorithm which is an adaptation of the classical FTP Algorithm. It schedules tasks as soon as possible by executing whenever the energy available in the storage unit is sufficient to execute at least one time unit, and by replenishing otherwise but only as long as needed to replenish the energy necessary to execute one time unit of the job with the highest priority. In other words, it is a fixed-priority energy-work-conserving algorithm. We proved that this algorithm is optimal for energy-non-concrete task sets where the initial battery capacity and task offsets are known only at run-time. This optimality relies first on the fact that all tasks consume more energy than what it is possible to replenish during their execution time, and second, on the fact that in this case the schedulability of the task set can be studied only for the first instance of each task in the worst-case scenario which is the simultaneous release of all the tasks with the minimum battery level. A necessary and sufficient schedulability test was also proposed for this family of task sets. Furthermore, we proposed a bound of the minimum battery capacity that preserves the schedulability of a task set with P F P ASAP algorithm. This capacity is equal to the maximum instantaneous energy consumption of task. Moreover, we compared P F P ASAP to the algorithms presented in the state of the art with simulations. These later confirmed the theoretical results and showed in one hand the advantages of P F P ASAP which are its optimility and its low overhead, and in an other hand its drawbacks which are mainly the high rate of preemptions and context switches.

Schedulability Analysis for P F P ASAP Algorithm

The second result is a schedulability analysis of P F P ASAP that removes some restrictive assumptions. As mentioned above, the optimality of P F P ASAP relies on the fact that the task sets are energy-non-concrete and that the consumption rate of all the tasks is greater than the replenishment rate. If we remove one of these assumptions, P F P ASAP is no longer optimal, the simultaneous request of all the tasks with the minimum battery level is no longer the worst-case scenario and the proposed schedulability test becomes only necessary.

To cope with this problem, we proposed a schedulability analysis using tasks worstcase response time upper bounds. For this analysis we relaxed the assumption of tasks consumption, offsets and initial battery level. Then, we can check with a sufficient test the schedulability of task sets that can include tasks with a consumption rate lesser than the replenishment, i.e. gainer tasks, for any scenario. The idea behind the first upper bound is to maximize the number of interferences and to assume that all consuming jobs are scheduled before gaining jobs, which maximizes the delays due to replenishments and the delays due to interferences. The second upper bound keeps the same idea but by respecting jobs request time and deadlines which tighten the upper bound. The schedulability test consists of computing an upper bound of the longest response time of each task and to compare it to its deadline. We proved also that the proposed schedulability tests are compatible with the optimal priority assignment algorithm of Audsley. We performed some simulations to evaluate the validity of the theoretical results and to measure the tightness of the upper bounds comparing to the empirical worst-case response time. The experiments showed that the second upper bound is tighter and that its deviation is reasonable.

Schedulability Analysis for Thermal-aware Systems

We showed in Chapter 6 the difficulty of finding an optimal scheduling algorithm and exact feasibility conditions for the general model of fixed-priority energy-harvesting systems. To cope with this problem, we decided to address the problem from an other point of view by studying other real-time scheduling problems that might present some similarities especially the ones where some delays are needed to produce a valid schedule. Then, we started studying the real-time scheduling for thermal-aware systems where the temperature of the system must be managed such that it never exceeds a certain maximum threshold. To respect this constraint, it may be necessary to delay executions in order to cool down the system reactively when reaching the maximum temperature or proactively before reaching it.

As a first step, we started by studying the behavior of the equivalent of P F P ASAP algorithm for thermal-aware systems. We proved that P F P ASAP is also optimal for thermal-non-concrete task sets where tasks offsets and the initial temperature are known only at run-time. In this model, P F P ASAP schedules jobs whenever the system is cold enough to execute at least one time unit, and otherwise, it delays executions in order to cool down enough to execute one time unit. In this model the worst-case scenario occurs for a task occurs when all the higher priority tasks are requested simultaneously while the temperature is at its maximum level. However, computing the exact response times is difficult to express with a formula or an algorithm. For this reason, we proposed two sufficient schedulability conditions that uses tasks worst-case response time approximation. The idea of the first bound is to maximize the cooling periods in the worst-case scenario by leveraging the fact that the cooling function is exponentially decreasing which leads to long cooling periods. The second bound is parametric, it considers that the cooling periods are of the same length x and the corresponding execution periods are integers (floor value). The performed simulations showed that the first upper bound is very pessimistic, however, the second one is very tight to the empirical worst-case response time when x = 1. This result is the first step of the exploration of similarities between energy-harvesting and thermal-aware systems. More work is planned to try to adapt some results from the thermal-aware side to the energy-harvesting one.

Simulation tool

The fourth main result of this thesis is the development of YARTISS the simulation tool used to perform all the experiments of this thesis and the ongoing work of our team. YARTISS is a modular and Java-based real-time simulator that provides a generic simulation framework and a friendly graphical user interface. This simulator was designed such that the major aspects of real-time scheduling can be substituted. The concept of each part, e.g. scheduling algorithm, task, task set, energy consumption, etc, is modeled by a java interface which facilitates the substitution of implementations. YARTISS provides also a graphic user interface that allows the visualization of the schedule of a given task set according to a given scheduling algorithm in a given environment of energy. Moreover, it can be also used to run large scale simulations which is very useful to evaluate and validate theoretical results.

Future Research

The work done along this thesis helped us to better understand the problematic of fixed-priority real-time scheduling for energy-harvesting systems. Moreover, the results of this thesis contribute to cover a part of the not yet studied research areas of this field.

As any research work, the achievement of a project is the starting point of an other one, and each answer arises more questions. In the case of this thesis, the following points and open questions deserve more investigations.

Optimal Algorithm

The main question that is still without answer is the existence of an optimal algorithm for the general model of energy-harvesting systems that includes all energy consumption types, i.e. gaining and consuming tasks, concrete task sets, i.e. without any assumption on tasks offsets and the initial battery level. We showed in Chapter 6 that many intuitive ideas do not work to build an optimal algorithm. The only idea that could lead to an optimal algorithm is to combine virtual deadlines with lookahead computation to compute the optimal delay at any moment. However, the complexity of this algorithm is exponential. The question now is: does an optimal algorithm for fixed-priority energy-harvesting systems exist ? or is the fixed-priority scheduling problem of energy-harvesting systems an NP-hard problem ?

We tried to answer both of these two questions but we was not able neither to find an optimal algorithm nor to prove the NP-hardness of the problem. Therefore, this is still an open question that deserves more interest and effort to answer.

Energy Assumptions

One of the interesting future axes is to study the problem in more realistic assumptions even with non optimal solutions. In fact, the results presented in this thesis assume that the replenishment and tasks consumption are constant functions. Even though there exist some applications where these assumptions are not far to be realistic, they are still marginal. For example, with energy sources like solar energy, the harvested energy varies over time which might make the proposed solutions very optimistic and not realistic. It might be useful to provide energy-source-specific scheduling algorithms and schedulability analysis in order to build real efficient applications. Moreover, the energy consumption of tasks may also vary over time due to the use of different circuitry or due to the thermal state of the system. This problem should be addressed by either taking into account the real consumption profile or to find the worst consumption profile of each task.

Similarities With Thermal-Aware Systems

This point is as important as the precedent ones because more work has been done for thermal-aware systems than energy-harvesting systems. Many ideas that have been proposed for the thermal model might be applicable for energy-harvesting systems especially for more realistic assumptions of energy replenishment and consumption. The results presented in Chapter 7 represent the first step in the exploration of such ideas.

Simulation Tool

YARTISS is still under development and requires more time and effort to improve its architecture and to add implementations of more algorithms task models, etc. The simulator is used by our team and few students around the world. We aim to form a dedicated development team that can maintain its code and do more communications about it in order to attract more interest and more contributions. Pendant les dernières décennies, l'utilisation des ordinateurs dans la vie moderne a fortement augmenté et a fait exploser la demande en termes de puissance de calcul et d'efficacité. Le progrès de la technologie a permis aux ordinateurs modernes d'être beaucoup plus petits et plus performant que les premières machines. Les ordinateur simples sont devenus tellement petits qu'il est aujourd'hui possible d'avoir des petits appareils mobiles qui peuvent fonctionner avec très peu d'énergie, ce qui a permis à de nouvelles applications d'émerger. De nos jours, les ordinateurs sont aussi utilisés pour contrôler des opérations critiques telles que les réactions nucléaires ou les commandes de vol d'un avion. Ce type d'ordinateurs est souvent utilisé dans les systèmes embarqués autonomes qui vont du simple lecteur MP3 aux très complexes navettes spatiales et des jouets d'enfants aux robots industriels.

Part III

Résumé en français

Dans ce genre d'applications, le temps que les tâches du système prennent pour délivrer les résultats est aussi important que leur exactitude. Les systèmes qui sont soumis à des contraintes temporelles sont les systèmes dits temps réel.

De plus, avec l'augmentation de la vitesse des processeurs et la miniaturisation des appareils électroniques, la gestion de l'énergie est devenue l'une de problématiques importantes à étudier. La mission des petits appareils est de fournir un service de manière autonome et cela pour une longue durée de vie comme par exemple dans les réseaux de capteurs ou les implants médicaux. Le défi ici est de pouvoir utiliser l'énergie ambiante pour permettre une longue durée de vie en éliminant les opérations de maintenance. Plusieurs sources d'énergie peuvent être exploitées en fonction des besoins de l'application, par exemple, les énergies solaires, vibratoires ou thermiques.

Dans cette thèse, nous nous intéressons à la problématique de l'ordonnancement temps réel de ce type de systèmes. renouvelable Durant la dernière décennie, le comportement temps réel de ce genre de systèmes a attiré plus d'attention. Le défi ici est de trouver le bon ordonnancement des tâches tout en respectant les contraintes énergétiques et temporelles. Quelques algorithmes d'ordonnancement ont été proposés dans la littérature mais la majorité des travaux sont concentrés sur l'ordonnancement à priorité dynamique du type EDF . L'ordonnancement à priorité fixe a quant à lui été très peu traité alors qu'il est largement utilisé en industrie. Cette thèse traite la problématique d'ordonnancement pour cette famille d'algorithmes.

Nous proposons d'abord une solution partielle qui consiste en un algorithme optimal pour une sous catégorie des systèmes étudiés, ainsi que l'analyse d'ordonnançabilité associée, puis nous expliquons la difficulté de la généralisation.

Le reste de ce résumé est organisé comme suit. Un bref aperçu de l'état de l'art de l'ordonnancement temps réel des systèmes collecteurs d'énergie est exposé dans les sections 9.2, 9.3, et 9.4. La section 9.5 introduit l'algorithme P F P ASAP qui est la première contribution de cette thèse. La section 9.6 présente une analyse approximative de temps réponse des tâches avec P F P ASAP en relâchant quelques hypothèses. La section 9.7 explique la difficulté de trouver un algorithme optimal pour notre modèle. Dans la section 9.8 nous discutons la similitude entre le modèle des systèmes collecteurs d'énergie et celui des systèmes contraints par la chaleur. La section 9.9 présente brièvement l'outil de simulation YARTISS développé pendant cette thèse. Pour terminer, la section 9.10 conclut ce résumé.

Ordonnancement temps réel

En informatique, un système est considéré comme étant temps réel si le respect de ses contraintes temporelles est aussi important que l'exactitude des résultats [START_REF] Buttazzo | Hard Real-Time Computing Systems[END_REF]. Le terme temps réel n'est pas forcément associé à la rapidité. L'objectif d'un système temps réel correct est de respecter perpétuellement les échéances individuelles des tâches dans le pire cas même si l'exécution est lente. Généralement, les systèmes temps réel sont classifiés en fonction de la gravité des conséquences des dépassements d'échéances. Nous distinguons alors deux familles : les systèmes temps réel durs et les systèmes réel souples. Dans la première famille, aucun dépassement n'est toléré car les dommages occasionnés sont catastrophiques, par exemple, la perte des commandes de vol d'un avion. Par contre, les dépassements d'échéances dans la deuxième famille ne font que dégrader la qualité du service, par exemple, la perte de quelques images lors du décodage d'un flux vidéo en direct.

Modèle de tâches

Un système temps réel est généralement composé d'un ensemble de tâches temps réel récurrentes noté Γ. Chaque tâche τ i est caractérisée par son pire temps de réponse C i , par son échéance temporelle relative D i , par sa période T i et sa première date d'activation O i . Chaque tâche se réactive au moins toutes les T i unités de temps pour exécuter ce que l'on appelle un travail ou un job. Un travail J i,j est caractérisé par sa date d'activation a i,j et son échéance absolue d i,j .

Ces paramètres peuvent êtres spécifiés avant le lancement du système ou uniquement au moment de l'exécution. De ce fait, nous distinguons deux familles de systèmes : les systèmes complètement spécifiés et les systèmes partiellement spécifiés. Dans la première catégorie, tous les paramètres sont connus à l'avance, ainsi le système est dit concret. Dans cette famille, nous trouvons les systèmes de tâches périodiques qui se réactivent à un intervalle régulier de temps. Dans la deuxième famille, au moins un paramètres n'est connu qu'au moment de l'exécution, par exemple les systèmes de tâches sporadiques où seul le temps minimal d'inter-arrivée est connue, ou encore les systèmes apériodiques où modèle de récurrence n'est pas connue du tout.

Algorithmes d'ordonnancement

Les tâches du système sont exécutées de manière concurrente sur le processeur. De ce fait, il est nécessaire de spécifier une politique pour choisir quelle tâche exécuter à tout moment. C'est le rôle de l'algorithme d'ordonnancement. Dans la théorie de l'ordonnancement temps réel, nous distinguons distingue trois familles d'algorithmes : les algorithmes à priorité de tâche fixe F T P , ceux à priorité de job fixe F JP et ceux à priorité dynamique DP . Dans la première famille, la tâche se voit attribuer une priorité fixe tout au long de son cycle de vie. Ainsi, l'algorithme exécute en premier la tâche active avec la priorité la plus élevée. Dans la deuxième famille, les priorités sont données aux jobs et non aux tâches, par exemple, l'ordonnancement EDF qui attribue les priorités aux jobs en fonction de leur échéance temporelle (le job avec l'échéance la plus proche est exécuté en premier). Dans la troisième famille, les priorités sont attribuées dynamiquement et peuvent changer d'un unité de temps à une autre, l'exemple typique de cette famille est l'algorithme LLF .

Analyses d'ordonnançabilité

Pour s'assurer qu'un système de tâches donné est faisable ou ordonnançable avec un algorithme spécifique, nous avons besoin d'outils d'analyse qui nous permettent de statuer sur le respect des échéances de toutes les tâches y compris dans le pire cas. Dans la théorie classique des systèmes temps réel, nous trouvons des conditions d'ordonnançabilité qui sont basées principalement sur la charge processeur du système (U = C i /T i ) ou sur une analyse du temps réponse des tâches dans le pire scénario. Pour la priorité de tâche fixe, la borne de Liu et Layland constitue une condition d'ordonnançabilité suffisante (U ≤ n(2 1/n -1)) dans le cas des échéances sur requête (∀ i T i = D i ) tandis que la condition de charge maximale (U ≤ 1) est une condition nécessaire. Pour EDF , la condition sur la charge maximale est nécessaire et suffisante dans le cas des échéances sur requête (∀ i T i = D i ). D'autre conditions et analyses sont détaillées dans le chapitre 1.

• Conversion piézoélectrique de l'énergie vibratoire : Cette méthode utilise un matériau piézoélectrique qui crée une différence potentiel lors des mouvements produits par les vibrations. Cette technique est très prometteuse et peut être facilement utilisée dans des applications de surveillance de machines industrielles où le taux de génération d'énergie s'approche du constant.

• Conversion de l'énergie thermoélectrique : Cette technique utilise le différentiel de température pour faire circuler les électrons et par conséquent un courant électrique. Cela peut être efficace uniquement dans le cas où la différence de température est assez élevée.

Cette liste de méthode de conversion n'est pas exhaustive, d'autres techniques moins connues existent dans la littérature.

Les technologies de stockage d'énergie

Le stockage d'énergie est le domaine qui a le moins évolué durant les dernières décennies par rapport aux autres technologies. Cela n'a pas empêché l'utilisation de supports de stockage rechargeables dans les petits systèmes embarqués.

Différentes technologies de stockage ont été explorées et commercialisées. Parmi ces dernières, nous distinguons deux familles : les batteries rechargeables et les supercondensateurs.

Les batteries chimiques sont les plus répandues dans le marché. Cela est dû non seulement aux facilités de fabrication mais aussi à leurs caractéristiques de durée de vie, de capacité, de courant et de taux d'auto-déchargement. Les batteries chimiques les plus utilisées de nos jours sur des petits appareils électroniques sont : les batterie Nickel Cadmium (NiCd), Nickel-Metal Hydrid (NiMH), et Lithium Ion (Li-ion).

Les inconvénients des batteries chimiques sont leur taille et leur perte de capacité (effet mémoire) au fils des cycles de charge et décharge.

Ces problèmes peuvent être résolus par l'usage des super-condensateurs qui sont capables de stocker une quantité d'énergie suffisante pour un petit appareil en offrant un taux de chargement et de déchargement quasiment constant avec un nombre de cycles de charge/décharge très important.

Dans cette thèse, nous supposons que le collecteur d'énergie recharge le réservoir avec un taux constant et que les tâches peuvent consommer l'énergie avec un taux constant également. Cela peut être réalisé avec un collecteur du type piézoélectrique et un super-condensateur pour des applications de surveillance des machines industrielles.

238

Chapter 9. Ordonnancement temps réel avec gestion de l'énergie renouvelable

L'ordonnancement temps réel dans les systèmes collecteurs d'Énergie

Dans cette section, nous nous concentrons sur la partie applicative en spécifiant le modèle général des systèmes temps réel collecteurs d'énergie visé par cette thèse. Nous présentons par la suite les différents algorithmes et approches d'ordonnancement proposés dans la littérature.

Modèle

Le modèle considéré ici est une extension du modèle de Liu et Layland décrit dans la section 9.2. L'extension consiste à intégrer les paramètres énergétiques au modèle, soit principalement la pire consommation d'énergie de la tâche notée E i .

Le rechargement : la quantité d'énergie qui arrive dans le réservoir est une fonction du temps notée P r (t). Dans un premier temps et afin de simplifier le modèle, nous considérons que cette fonction est constante. Ainsi, nous utiliserons par la suite P r à la place de P r (t) pour designer la fonction de rechargement constante.

Même si l'utilisation d'une fonction de rechargement constante parait irréaliste, il existe tout de même des sources d'énergie et des techniques d'extraction comme l'énergie vibratoire et la technique piézoélectrique qui permettent d'avoir un flux d'énergie proche du constant dans certaines applications industrielles (voir le chapitre 2).

Le stockage d'énergie : nous considérons un support de stockage idéal qui peut être chargé et déchargé avec des taux constants. Le niveau d'énergie dans le réservoir fluctue entre deux seuils, le niveau minimal E min qui assure la continuité de fonctionnement du système et le niveau maximal E max qui ne peut être dépassé. La capacité effective du réservoir pour notre système temps réel notée C est la différence entre E min et E min . Ces caractéristiques peuvent être satisfaites par les super-condensateurs qui permettent des taux de chargement et de déchargement constants et qui sont capables de supporter des cycles fréquents sans pour autant dégrader la capacité.

On utilisera par la suite le terme batterie pour désigner le réservoir d'énergie décrit dans cette section.

La consommation : pour ce travail nous considérons que les tâches consomment l'énergie de façon uniforme tout au long de leurs temps d'exécution. Nous considérons aussi que chaque tâche a son propre taux de consommation instantanée P c i = E i /C i qui diffère d'une tâche à une autre, c'est à dire qu'il est possible d'avoir deux tâches τ i et τ j avec C i < C j et E i > E j .

L'ordonnancement temps réel dans les systèmes collecteurs d'Énergie 239

Problématique

Rappelons que cette thèse se focalise sur l'ordonnancement monoprocesseur à priorité de tâche fixe des systèmes temps réel. Les problèmes soulevés par cette famille d'ordonnancement peuvent être résumés par les questions suivantes.

1. Les algorithmes : Comment peut-on ordonnancer un ensemble de tâches à priorité fixe sur un seul processeur de telle sorte que les échéances de toutes les tâches soient respectées et que leur demande d'énergie soit satisfaite tout en gardant le niveau du réservoir entre E min et E max ?

2. Les conditions d'ordonnançabilité : Existe-t-il une condition nécessaire et suffisante pour vérifier l'ordonnançabilité d'un système de tâches donné ?

3. La capacité minimale du réservoir : Quelle est la capacité minimale de la batterie qui préserve l'ordonnançabilité d'un système donné ?

Nous apportons quelques éléments de réponse à ces questions au travers de cette thèse.

Approches d'ordonnancement

Dans la littérature on identifie principalement deux approches pour répondre au besoin temps réel des systèmes collecteurs d'énergie. La première consiste à minimiser la consommation d'énergie en réduisant la fréquence et/ou la tension du processeur [START_REF] Pering | The Simulation and Evaluation of Dynamic Voltage Scaling Algorithms[END_REF][START_REF] Weiser | Scheduling for Reduced CPU Energy[END_REF]. La deuxième consiste à gérer l'énergie disponible sans avoir à baisser la consommation. Cela passe par une sélection judicieuse des moments d'exécution et ceux de rechargement ou des périodes d'activité et celles d'inactivité afin de ne jamais tomber à court d'énergie et faire au mieux pour respecter toutes les échéances. Dans la suite de ce manuscrit, nous nous intéresseront uniquement à la deuxième approche en explorant les différents algorithmes proposés dans la littérature pour cet effet.

Les algorithmes existants

Cette section présente brièvement les principaux algorithmes disponibles dans l'état de l'art des systèmes temps réel collecteurs d'énergie.

Frame-Based Algorithm (F BA) : Il s'agit du premier algorithme proposé pour les systèmes collecteurs d'énergie. Il est spécifique au modèle de tâches dit Frame-Based où toutes les tâches partagent la même période et la même échéance. L'idée de l'algorithme est de séparer les tâches en deux groupes : les tâches dites consommatrices qui ont un taux de consommation supérieur à celui du rechargement, et les tâches dites génératrices qui ont un taux de consommation inférieur ou égal. L'algorithme ordonnance alors en continue les tâches consommatrice pour vider la batterie puis les génératrices pour la recharger. Si l'énergie générée par les tâches génératrices n'est pas suffisante, une renouvelable période de rechargement suffisamment longue est ajoutée au début du cycle. La même séquence d'ordonnancement est répétée à chaque période.

EDF As Late As Possible (EDL) : Cet algorithme s'applique à notre modèle décrit plus haut. Il s'agit d'une adaptation de l'algorithme EDF qui exécute les tâches au plus tard tout en respectant les échéances temporelles des tâches [START_REF] Silly | The EDL Server for Scheduling Periodic and Soft AperiodicTasks with Resource Constraints[END_REF]. Quand une tâche est prête pour être exécutée selon les règles de EDF , EDL calcule d'abord le retardement maximal à appliquer, et si ce dernier n'est pas nul, alors la tâche est retardée jusqu'à la consommation de la totalité des temps creux disponibles.

Malheureusement EDL n'est pas optimal car même si les retardements servent à recharger un maximum d'énergie avant les exécutions, le calcul des retardements ne prend pas en compte les contraintes énergétiques, ce qui peut aboutir à les surestimer. Cet algorithme est optimal (voir [START_REF] Chetto | Optimal Scheduling for Real-Time Jobs in Energy Harvesting Computing Systems[END_REF]) mais seulement pour les systèmes de tâches périodiques et synchrones.

La condition de charge maximale de l'énergie (U e = n i=1 E i /T i × P r ≤ 1) représente d'après [START_REF] Chetto | Optimal Scheduling for Real-Time Jobs in Energy Harvesting Computing Systems[END_REF] un test d'ordonnançabilité nécessaire et suffisant dans le cas où ∀ i D i = T i .

Lazy Scheduling Algorithm (LSA) : Cet algorithme a été proposé par Moser et al dans [START_REF] Moser | Lazy Scheduling for Energy Harvesting Sensor Nodes[END_REF]. Il s'agit d'un algorithme basé sur EDF mais qui retarde les exécutions à une date à partir de laquelle la tâche en cours peut s'exécuter continuellement et finir avant son échéance et cela en prévoyant les éventuelles interférences et en évitant de perdre de l'énergie si E max est atteint.

Cet algorithme a été présenté comme étant optimal mais uniquement dans le cas où les tâches consomment l'énergie avec le même taux et que le temps d'exécution des tâches varie en fonction du taux de consommation appliqué.

Preemptive Fixed-Task-Priority As Late As Possible (P F P ALAP ) : Cet algorithme est l'équivalent de EDL pour la priorité fixe. Il retarde les exécutions au plus tard pour laisser le système recharger un maximum d'énergie. Malheureusement P F P ALAP n'est pas optimal non plus parce que l'algorithme utilisé pour calculer les temps creux ne prend pas en considération les contraintes d'énergie.

Preemptive Fixed-Task-Priority with Slack-Time (P F P ST ) : Cet algorithme exécute les tâches au plus tôt en respectant leurs priorités statiques quand l'énergie est suffisante et retarde au plus tard sinon. L'algorithme de calcul des retardements est le 9.5. L'algorithme P F P ASAP 241 même que celui de P F P ALAP . Cette approche améliore le taux d'ordonnançabilité par rapport à P F P ALAP mais n'est pas optimal car l'algorithme de retardement n'intègre pas les paramètres énergétiques du système.

L'algorithme P F P ASAP

La première contribution de cette thèse est l'étude de l'algorithme P F P ASAP . Il s'agit d'une adaptation de l'ordonnancement classique à priorité fixe au contexte des systèmes collecteurs d'énergie.

C'est un algorithme à priorité de tâche fixe qui exécute les tâches au plut tôt dès que l'énergie est suffisante pour exécuter au moins une unité de temps et qui laisse le réservoir d'énergie se recharger le cas échéant. Les périodes de rechargement sont aussi longues que nécessaire pour exécuter une seule unité de temps. P F P ASAP , malgré sa simplicité, présente des propriétés intéressantes telles qu'un pire scénario et une capacité minimale de batterie caractérisés et celle d'être un algorithme optimal dans sa classe.

Le pire scénario

La considération de la consommation d'énergie des tâches et les deux seuils du réservoir d'énergie impose des changements dans l'ordonnancement à priorité fixe et par conséquent la théorie classique d'analyse d'ordonnançabilité n'est plus applicable en l'état à commencer par la caractérisation du pire scénario.

Le pire scénario ou l'instant critique est la situation d'énergie et d'activation de tâches qui engendre les plus long temps de réponse des tâches. Cela se traduit par la maximisation des interférences de tâche plus prioritaires et la maximisation des temps de rechargement.

Dans le cas où toutes les tâches présentent un taux de consommation d'énergie plus élevé que le taux de rechargement, le pire scénario qu'un système peut subir avec un ordonnancement P F P ASAP est l'activation synchrone de toutes les tâches quand le niveau de la batterie est à son seuil minimal (voir le chapitre 4). Cela découle du fait que quand on a que des tâches consommatrices d'énergie, le système a un comportement très proche de l'ordonnancement classique.

L'optimalité

Dans le cas des systèmes temps réel non-concrets, c'est à dire les systèmes où les premières dates d'activation des tâches et le niveau initial d'énergie du réservoir ne sont connus qu'au moment de l'exécution, l'étude d'ordonnançabilité du système se fait dans le pire cas.

Sachant que ce scénario est connu pour l'algorithme P F P ASAP , si un système rate une échéance dans cette configuration, cela signifie que ce dernier n'est pas ordonnançable avec P F P ASAP . De plus, nous savons qu'une échéance ne peut être violée que dans renouvelable deux cas avec P F P ASAP . Le premier cas arrive quand la somme du temps d'exécution de la tâche et des interférences de tâches plus prioritaires est supérieure à l'échéance relative de la tâche. Dans ce cas le système n'est pas ordonanançable même sans les contraintes énergétiques. Le deuxième cas se produit quand la somme des interférences et des temps de rechargement dépassent l'échéance. Sachant que le système est composé uniquement de tâches qui nécessitent des rechargements, le système ne peut pas être ordonnnançable avec un autre algorithme à priorité fixe parce que les interférences ne peuvent pas être réduite et les temps de rechargement sont aussi court que possible. De ce fait, P F P ASAP est optimal pour les systèmes non-concrets composés uniquement de tâches consommatrices.

Condition d'ordonnançabilité

Connaissant un algorithme optimal et son pire scénario, il est possible de construire un test de faisabilité nécessaire et suffisant en vérifiant que le temps réponse de chaque tâche dans le pire scénario ne dépasse pas son échéance. C'est ce que nous avons fait en proposant la formule 4.13 on page 120 pour calculer le pire temps réponse des tâches en adoptant l'algorithme itératif classique.

La capacité minimale de la batterie

La capacité minimale de la batterie recherchée ici est la plus petite capacité qui permet à un système de tâches ordonnançable avec P F P ASAP et une capacité non bornée de le rester. Sachant que P F P ASAP introduit des périodes de rechargement aussi courtes que possible pour exécuter une seule unité de temps, la capacité nécessaire pour stocker cette quantité d'énergie doit être supérieure ou égale au plus grand taux de consommation des tâches.

Avantages et inconvénients

Le principal inconvénient de P F P ASAP est son taux très élevé de préemptions qui peut être bloquant en pratique car le coût des transitions entre les modes actif/inactif n'est pas négligeable dans certains cas. Par contre, P F P ASAP peut être considéré comme un algorithme de référence dans l'ordonnancement à priorité fixe des systèmes collecteurs d'énergie de par sa simplicité et son optimalité pour les systèmes non-concrets.

Analyse de temps de réponse avec approximation

Malheureusement, quand on relâche les hypothèse sur la consommation des tâches, c'est à dire lorsque l'on considère également les tâches qui ont un taux de consommation inférieur au taux de rechargement (tâches génératrices d'énergie), le pire scénario de P F P ASAP n'est plus l'activation synchrone de toutes les tâches, et il n'existe à ce jour aucune caractérisation de ce pire scénario. Sans ce scénario, le calcul du pire temps de réponse des tâches n'est plus possible et par conséquent le test d'ordonnançabilité précédemment mentionné non plus.

Pour répondre à cette limitation, nous proposons de borner le pire temps réponse des tâches afin de construire des conditions d'ordonnançabilité suffisantes.

Pour ce faire, nous avons besoin d'une fonction qui borne par le haut le temps de réponse d'une tâche dans un intervalle de temps fini. Cela passe par une borne des interférences et des temps de rechargement.

Pour cela, nous construisons un scénario virtuel où nous maximisons indépendamment le nombre de tâches qui interfèrent avec la tâche dont nous bornons le pire temps de réponse, et le nombre d'unités de temps de rechargement nécessaires pour satisfaire la demande d'énergie de la tâche et les interférences.

Pour maximiser le nombre de jobs activés dans un intervalle donné, le seul moyen est d'activer le premier job immédiatement au début de l'intervalle ce qui anticipe l'activation des jobs suivants de la même tâche et permet d'avoir le plus d'activation possible. En faisant cela pour toutes les tâches, le scénario qui maximise les interférences est l'activation synchrone de toutes les tâches.

Une fois le nombre d'interférence maximisé, nous construisons nos scénarios virtuels qui maximisent le temps de rechargement.

La première borne supérieure U B1

Pour la première borne supérieure notée U B1, nous construisons une séquence d'exécution virtuelle qui suppose que tous les jobs consommateurs sont exécutés avant les jobs générateurs. Cela force le système à rajouter des unités de temps de rechargement à tous les jobs consommateurs et les prive de l'énergie générée par tâches génératrices. Ce scénario ne peut pas se produire dans l'ordonnancement réel mais peut être utilisé pour borner le pire temps réponse des tâches. Ainsi, la fonction de calcul de pire temps de réponse est construite. Cette fonction est ensuite utilisée dans l'algorithme itératif classique pour calculer les temps de réponse en priorité fixe.

Il est aussi possible de construire un scénario symétrique pour calculer une borne inférieure du pire temps de réponse afin de construire un test de faisabilité suffisant.

La deuxième borne supérieure U B2

Le borne U B1 est très pessimiste car elle considère un scénario irréaliste. Pour réduire ce pessimisme, nous proposons une deuxième borne notée U B2 qui reprend le même principe que U B1 mais en respectant cette fois les dates d'activation des jobs et leurs échéances. Nous construisons un scénario virtuel où les jobs consommateurs sont exécutés au plut tôt immédiatement après leurs activations et les jobs générateurs sont renouvelable exécutés au plus tard juste avant leurs échéances. De plus, les activations des tâches génératrices sont décalées de telle sorte que le dernier job soit exécuté immédiatement après son activation et juste avant la fin de l'intervalle. Un fois le scénario construit, toutes les unités de temps de l'intervalle sont parcourues pour calculer le temps réponse dans ce scénario. Quand une unité d'un job consommateur est rencontrée, cette dernière est ajoutée au temps réponse avec les unités de rechargement nécessaires, et quand une unité d'un job générateur est rencontrée, celle-ci est ajoutée au temps réponse à son tour. En cas de chevauchement entre consommateurs et générateurs, les générateurs sont plus prioritaires car ils sont contraints par leurs échéances et cela permet de réduire le pessimisme. Ainsi, la fonction de bornage du pire temps de réponse est construite et peut être utilisée itérativement pour un test de faisabilité.

Les simulations montrent qu'effectivement U B2 est moins pessimiste que U B1 en particulier quand l'utilisation du système U est très élevée. Nous constatons aussi que les conditions d'ordonnançabilité basées sur ces bornes deviennent des tests exacts quand le système est composé uniquement de tâches consommatrices ou uniquement de tâches génératrices.

La capacité minimale de la batterie

Pour que ces bornes soient valides, la capacité de la batterie doit être suffisamment grande pour stocker l'énergie collectée pendant les périodes de rechargement et pendant l'exécution des tâches génératrices. Pour U B1 la batterie doit pouvoir stocker au moins l'énergie nécessaire pour satisfaire le plus grand taux de consommation d'énergie des tâches. Cela découle des exécutions gloutonnes produites par P F P ASAP .

Pour U B2, on borne la capacité minimale par la plus grande demande d'énergie de la plus longue période d'exécution.

Recherche d'algorithme optimal

Nous avons vu dans les sections précédentes que ni l'ordonnancement au plut tôt avec P F P ASAP , ni l'ordonnancement au plus tard avec P F P ALAP , ni le mixte des deux avec P F P ST ne sont optimaux. Pour P F P ASAP , cela est dû au fait que l'ordonnancement au plus tôt peut mener à la situation où une tâche moins prioritaire qui s'exécute au plus tôt peut consommer l'énergie nécessaire pour une autre tâche plus prioritaire qui s'active juste après alors que la tâche la moins prioritaire peut être retardée pour permettre la tâche la plus prioritaire d'utiliser l'énergie rechargée pendant le retardement. Pour P F P ASAP et P F P ST , le problème vient du fait que les retardements sont calculés sans prendre en compte les contraintes énergétiques.

L'algorithme optimal doit alors calculer les retardements exacts qui prennent en compte la demande d'énergie des tâches et l'énergie disponible. Cela veut dire que cet algorithme ne peut être non-oisif énergiquement (comme P F P ASAP ) et doit être clairvoyant pour éviter les futurs dépassements d'échéances.

Pour aller dans ce sens, nous avons exploré les idées intuitives suivantes :

• Fixed-Task-Priority Clairvoyant as soon as possible (F P Casap) : Cet algorithme utilise une fonction de clairvoyance pour prédire de futurs dépassements d'échéances avant l'autorisation de l'exécution du plus prioritaires des jobs actifs. Cette fonction consiste à simuler l'ordonnancement du système selon P F P ASAP dans l'intervalle de temps qui va de l'instant courant jusqu'à l'échéance du job en cours. Ainsi, si un dépassement d'échéance est détecté, l'exécution est retardée jusqu'à ce que toutes les échéances de l'intervalle soient respectées.

Malheureusement, même si F P Casap est clairvoyant et oisif, il n'est pas optimal car il retarde toutes les tâches dans l'ordre chronologique de leur activations. La figure 6.7 on page 163 montre un contre-exemple où l'ordonnancement optimal ne respecte pas cet ordre.

• Fixed-Task-Priority Lazy Scheduling Algorithm (F P LSA) : Cet algorithme est l'équivalent "priorité de tâche fixe" de LSA qui est basé sur EDF (voir section 9.4). Il n'est pas optimal non plus pour la priorité fixe même en supposant un taux de consommation d'énergie unique pour toutes les tâches car le même problème de retardement persiste.

• Fixed-Task-Priority As Late As Possible with energy guaranty (F P Leg) : Cet algorithme reprend l'ordonnancement produit par P F P ALAP mais cette fois en prenant en compte les contraintes énergétiques. Cela passe par l'utilisation des échéances virtuelles à la place des vraies pour calculer les retardements. Ici, une échéance virtuelle est une date chronologiquement inférieure à l'échéance réelle mais qui garantit un bilan d'énergie positif de l'intervalle de temps qui va de l'instant courant à cette échéance virtuelle. Cela suppose que si un ordonnancement faisable existe, le bilan énergétique à la fin de chaque job doit être positif.

Cette idée est une piste très intéressante mais n'est pas suffisante car si un job moins prioritaire trouve une telle échéance, cela force toutes les interférences plus prioritaires à s'exécuter plus tôt que nécessaire ce qui les expose au même problème que celui de P F P ASAP . La figure 6.9 on page 166 illustre une telle situation.

• Fixed-Task-Priority lookahead (F P lh) : L'idée de cet algorithme est d'utiliser des échéances virtuelles exactes qui garantissent non seulement un bilan positif mais aussi une vérification des bilans énergétiques des jobs activés dans une fenêtre de clairvoyance. Cela est supposé calculer le retardement optimal pour chaque job. Malheureusement, la complexité de cet algorithme est exponentielle du fait que le calcul des échéances virtuelles est interdépendant entre les jobs plus prioritaires 246 Chapter 9. Ordonnancement temps réel avec gestion de l'énergie renouvelable et les moins prioritaires et que la taille de la fenêtre de clairvoyance est très importante dans le pire cas.

Cela montre la difficulté de trouver un algorithme optimal pour la priorité fixe et mène à la conclusion suivante :

• Si le calcul des échéances virtuelles est nécessaire pour un algorithme optimal, alors, il aura une complexité pseudo-polynomiale multipliée par la complexité de l'algorithme de calcul de ces échéances virtuelles.

• Dans ce cas, si la complexité de calcul des échéances virtuelles est NP-difficile alors la problématique d'ordonnancement à priorité de tâche fixe des systèmes collecteurs d'énergie l'est également.

• Sinon, le problème reste ouvert.

Analyse de temps de réponse des systèmes à contraintes thermiques

Dans le but de mieux comprendre la problématique d'ordonnancement à priorité fixe des systèmes collecteurs d'énergie, nous proposons d'explorer les solutions proposées pour des problématiques d'ordonnancement similaires, en particulier celles où le retardement des exécutions est parfois nécessaire pour respecter certaines contraintes.

L'ordonnancement avec contraintes thermiques est l'une de ces problématiques. Cette dernière consiste à exécuter les tâches de telle sorte qu'une certaine température maximale n'est jamais atteinte ou dépassée. Cette contrainte pousse le système à suspendre les exécutions de temps en temps pour insérer des temps de refroidissement afin d'éviter que la température maximale ne soit atteinte.

Dans ce domaine, il existe deux approches. La première dite réactive consiste à suspendre l'exécution en réaction à l'atteinte de la température maximale. La seconde dite proactive consiste à suspendre l'exécution ou à réduire la vitesse du processeur avant d'atteindre la température maximale. Différents travaux ont été menés sur ce sujet mais la majorité des résultats sont basés sur la technique de réduction de la fréquence et/ou de la tension du processeur ou sur l'ordonnancement EDF.

Comme première étape de ce travail, nous proposons dans cette thèse d'adapter les solutions proposées pour les systèmes à énergie renouvelable aux systèmes à contraintes thermiques pour l'ordonnancement à priorité fixe. Ainsi, nous adaptons l'algorithme P F P ASAP pour que la contrainte thermique soit respectée ce qui constitue une solution réactive. Nous proposons également une analyse d'ordonnançabilité basée sur des bornes du pire temps de réponse des tâches.

Analyse de temps de réponse des systèmes à contraintes thermiques 247

Modèle

Nous considérons un système temps réel non-concret composé d'un ensemble de tâches sporadiques et indépendantes avec des échancres contraintes (∀ i D i ≤ T i ).

Le modèle Thermique : nous considérons que la température du système fluctue en fonction de la dissipation de chaleur générée par l'exécution des tâches sur le processeur.

La température à l'instant t notée T (t) est toujours supérieure ou égale à la température ambiante T A et ne doit jamais dépasser la température maximale T max . Le seul moyen pour refroidir le système est de suspendre temporairement l'exécution des tâches et de mettre le processeur en mode inactif.

Le comportement thermique du processeur peut être modélisé par un filtre Résistance Capacitance (RC) [START_REF] Toriyama | Thermoelectric Micro Power Generator Utilizing Self-standing Polysilicon-metal Thermopile[END_REF] illustré par la Figure 7.1 on page 176. Nous utilisons alors l'équation différentielle de Fourrier pour modéliser le comportement thermique de notre système (voir l'équation 7.1 on page 176). La solution à cette equation donne la fonction qui exprime la température en fonction du temps et des paramètres du processeur (voir l'équation 7.6 on page 177). Quand le processeur est inactif, sa vitesse devient nulle, et par conséquent la dissipation de chaleur est nulle, le système commence alors à se refroidir jusqu'à atteindre la température ambiante (voir l'équation 7.7 on page 177).

L'adaptation de l'algorithme P F P ASAP

L'équivalent de l'algorithme P F P ASAP pour le modèle avec contraintes thermiques est l'ordonnancement au plus tôt qui choisit la plus prioritaire des tâches actives à tout instant dès que le système est suffisamment froid pour pouvoir exécuter au moins une unité de temps, et qui laisse seulement refroidir dans le cas échéant. Les périodes de refroidissement sont aussi longues que nécessaire pour pouvoir exécuter une seule unité de temps. Il s'agit de l'ordonnancement thermiquement non-oisif, c'est à dire que des périodes de refroidissement ne sont ajoutées que lorsque c'est nécessaire.

Pour le modèle considéré, nous prouvons que le pire scénario de P F P ASAP est l'activation synchrone de toutes les tâches quand la température est à son niveau maximal. Cela découle du fait que toutes les tâches chauffent le système de la même façon ce qui est très proche du cas des systèmes collecteurs d'énergie composés uniquement de tâches consommatrices d'énergie.

Nous prouvons également que P F P ASAP est optimal pour les systèmes non-concrets dont la température initiale et la date de la première activation des tâches ne sont connus qu'au moment de l'exécution. L'idée de la preuve consiste à analyser tous les cas où P F P ASAP rate une échéance dans le pire cas et voir s'il est possible de l'éviter.

Analyse de temps de réponse

Notre objectif maintenant est de construire des conditions d'ordonnançabilité de P F P ASAP pour le modèle considéré. Le temps de réponse d'une tâche étant difficile à renouvelable écrire sous forme d'une formule générique à cause du temps discret, nous proposons une analyse de temps de réponse basée sur des bornes du pire temps de réponse des tâches. Pour cela, nous proposons deux bornes supérieures qui maximisent le temps de refroidissent nécessaire pour l'exécution selon P F P ASAP .

La première borne U B T min : Cette borne consiste à supposer que toutes les périodes de refroidissement sont les plus longues possible, c'est à dire le temps nécessaire pour faire baisser la température de T max à la température ambiante. L'approximation vient du fait de la nature exponentielle inversée de la fonction de refroidissement, c'est à dire que plus le refroidissent est long plus il est lent. On utilisera T min à la place de T A car quand le processeur est éteint, la température baisse asymptotiquement à T A ce qui peut rendre la borne très pessimiste.

La borne paramétrée U B

x : L'idée de cette borne est de reproduire l'ordonnancement de P F P ASAP en considérant que toutes les périodes de refroidissent ont la même longueur et que cette dernière est toujours plus longue que celle de l'ordonnancement réel. En variant celle-ci, nous augmentons le pessimisme de la borne mais nous baissons sa complexité en moyenne.

Ces bornes sont utilisées dans l'algorithme itératif classique pour calculer le pire temps réponse final des tâches. Ainsi, nous obtenons deux tests d'ordonnançabilité suffisants.

Les simulations montrent que U B x domine de loin U B T min et est très proche du pire temps de réponse empirique pour des petites valeurs du paramètre x mais devient très pessimiste quand x devient très grand. Nous observons aussi qu'en variant x, le gain en complexité est plus faible que la perte au niveau de l'ordonnançabilité.

L'outil de simulation YARTISS

Pour terminer, nous présentons brièvement YARTISS : l'outil de simulation développé pendant cette thèse pour en évaluer les résultats théoriques.

YARTISS est un logiciel qui permet de simuler l'ordonnancement des systèmes de tâches temps réel. Il permet de tester et comparer différents algorithmes et politiques d'ordonnancement dans différents environnements, par exemple, multi/monoprocesseur, contraintes d'énergie, etc.

Un effort conséquent a été fait pour rendre son architecture la plus générique et extensible possible afin de pouvoir y intégrer et tester différents modèles de tâches, d'algorithmes d'ordonnancement, de plateformes, etc.

YARTISS offre deux fonctionnalités principales : la première est la visualisation de l'ordonnancement temps réel d'un système donné selon un algorithme donné et dans un environnement donné. La deuxième est la simulation à grande échelle d'un ensemble de systèmes de tâches afin de comparer les performances d'algorithmes d'ordonnancement ou de tests de faisabilité/ordonnançabilité donnés.

Nous espérons que cet apport pourra contribuer au développement d'un outil de simulation qui pourra être adopté par une grande partie de la communauté de l'ordonnancement temps réel.

Conclusion

Dans cette thèse nous avons traité le problème de l'ordonnancement temps réel à priorité fixe des systèmes collecteurs d'énergie. Un tel système doit respecter non seulement les échéances des tâches mais aussi leurs contraintes énergétiques. Cela veut dire que le coût énergétique des tâches doit être satisfait par l'énergie stockée dans la batterie ainsi que par l'énergie collectée depuis l'environnement. Pour satisfaire la demande énergétique des tâches, des périodes d'inactivité du processeur additionnelles peuvent être nécessaires pour collecter l'énergie demandée. Le défi pour un algorithme d'ordonnancement à priorité fixe est alors d'exécuter les tâches en respectant leurs échéances et de retarder les exécutions au bon moment et pendant la bonne durée pour satisfaire au mieux les contraintes énergétiques et les échéances.

La problématique ici est de premièrement trouver un algorithme optimal pour le modèle considéré ; deuxièmement, de fournir des outils d'analyse d'ordonnançabilité ; troisièmement, de trouver la capacité minimale de la batterie qui préserve l'ordonnançabilité d'un système donné.

Dans ce résumé, nous avons commencé par un bref état de l'art de ce domaine de recherche incluant un aperçu de la théorie classique de l'ordonnancement temps réel, les différentes technologies de stockage et d'extraction de l'énergie environnementale et les principaux algorithmes d'ordonnancement proposés dans la littérature pour les systèmes collecteurs d'énergie.

Nous avons présenté ensuite les résultats de cette thèse. Le premier résultat est l'étude de l'algorithme P F P ASAP qui est optimal pour les systèmes non-concrets composés uniquement de tâches qui consomment plus d'énergie que le rechargement. Ce travail a été effectué en collaboration avec Dr. Y. Abdeddaïm et a été publié dans les actes de la conférence ECRTS 2013 [START_REF] Abdeddaïm | The Optimality of P F P ASAP Algorithm for Fixed-Priority Energy-Harvesting Real-Time Systems[END_REF]. Le deuxième résultat est une analyse d'ordonnançabilité basée sur des bornes du pire temps de réponse des tâches qui prend en compte tous les types de taux de consommation des tâches. Ce travail est le fruit d'une collaboration avec Prof. R. Davis et a été publié dans les actes de la conférence RTNS 2014 [START_REF] Abdeddaïm | Schedulability Analysis for Fixed Priority Real-Time Systems with Energy-Harvesting[END_REF]. Ce papier a obtenu le prix du meilleur article de cette conférence. Le troisième résultat est une exploration des différentes idées intuitives pour construire un algorithme optimal où nous avons soulevé la difficulté de trouver un tel algorithme. Ce travail est publié dans un rapport de recherche [START_REF] Abdeddaïm | Optimal Real-Time Scheduling Algorithm for Fixed-Priority Energy-Harvesting Systems[END_REF]. Le quatrième résultat est la transposition des résultats obtenus pour les systèmes collecteurs sur les systèmes contraints par la température qui présentent des similitudes au niveau de la problé-

Glossaries Symbols

Ba i (t)

The energy balance of a job J i,j at time t. 155

Bu(t 1 , t 2 )
The energy budget of time interval [t 1 , t 2 ]. 155

C i
The worst case execution time of task τ i . 31 Constant A constant. 99, 100, 102-104

DBF i (t)
The demand bound function of task τ i in time interval [0, t]. 42

D i
The relative deadline of task τ i . 31

E(t)

The level of the energy storage unit at time t. 68

E * X [m]
The total energy required by execution units from the start of the sequence up to and including execution unit X [m]. 134

E X [m]
The amount of energy required by the execution unit X[m] of sequence X. 134

E i
The worst case energy consumption of task τ i . 67

E max
The highest reachable level of the energy storage unit. 68, 238

E min

The lowest authorized level of the energy storage unit. The subset of Γ that contains consuming tasks. 132

Γ g
The subset of Γ that contains gaining tasks. 132

Λ

The density of the system. 41

Λ i
The density of task τ i . 41

Figure 1 . 1 :

 11 Figure 1.1: Task and job parameters

Figure 1 . 2 :

 12 Figure 1.2: Task life cycle

Figure 2 . 1 :

 21 Figure 2.1: Energy-harvesting system components

Figure 2 . 2 :Figure 2 . 3 :

 2223 Figure 2.2: Operating principle of a photovoltaic cell

Figure 2 . 4 :

 24 Figure 2.4: Electromagnetic vibration energy-harvesting method

Figure 2 . 5 :

 25 Figure 2.5: Electrostatic energy-harvesting method

Figure 2 .

 2 8 on the following page illustrates the progress of technology in different Information and Communication Technologies (ICT) comparing to energy storage during the last twenty years. Research

Figure 2 . 8 :

 28 Figure 2.8: Improvement of the battery energy density compared to other significant figures in the ICT panorama in the last twenty years [PS05]

Figure 2 . 9 :

 29 Figure 2.9: Example of Panasonic NiCd batteries

Figure 2 .

 2 [START_REF] Example | [END_REF] shows an example of commercial NiCd batteries.

Figure 2 . 10 :

 210 Figure 2.10: Example of Panasonic NiMH batteries

Figure 2 .

 2 Figure 2.11: Example of Lead Acid batteries

Figure 2 .

 2 10 shows an example of commercial NiMH batteries.

Figure 2 .

 2 11 shows an example of car Lead Acid batteries.

Figure 2 .

 2 Figure 2.12: Example of Panasonic Li-ion batteries

Figure 2 .

 2 13 shows an example of commercial Li-polymer batteries.

Figure 2 .

 2 Figure 2.14: Example of Maxwell ultracapacitors

Figure 3 . 4 :

 34 Figure 3.4: EDL scheduling examples

3 :do 4 :

 34 while E(t) > E min and SE(t) > 0 execute jobs according to EDF rules

Figure 3 . 5 :

 35 Figure 3.5: The EDeg schedule of Γ with E max = 250

Figure 3 . 6 :

 36 Figure 3.6: LSA optimality counter example

Figure 3 . 7 :

 37 Figure 3.7: P F P ALAP optimality counter example

Figure 3 . 8 :

 38 Figure 3.8: P F P ST optimality counter example

Chapter 3 .

 3 Real-time Scheduling for Energy-Harvesting SystemsBased E i /C i = Cst not optimal optimal optimal

Figure 3 . 9 :

 39 Figure 3.9: Frame-base task model

Figure 3 . 10 :

 310 Figure 3.10: Periodic task model with implicit deadlines

Figure 3 .

 3 Figure 3.11: Periodic task model with constrained deadlines

4. 3 .Figure 4 . 1 :

 341 Figure 4.1: The effect of the parameter x on schedulability

Figure 4 . 2 :

 42 Figure 4.2: P F P ASAP schedule

Figure 4 .

 4 2(b) illustrates an example of P F P ASAP schedule of the task set described in Table

2 (

 2 d) E(0) > E min

Figure 4 . 3 :

 43 Figure 4.3: P F P ASAP worst-case scenario

Figure 4 . 4 :

 44 Figure 4.4: P F P ASAP worst-case scenario counter example with gaining tasks

122 Chapter 4 .

 4 The P F P ASAP Algorithm Algorithm 4.2 Feasibility Test 1: for i = 1 → n do

  Figure 3.7 on page 94 illustrates this phenomenon.

Figure 4 . 5 :

 45 Figure 4.5: Comparison between P F P ALAP , P F P ST and P F P ASAP

Figure 5 . 1 :Definition 5 . 1 (

 5151 Figure 5.1: Worst-case scenario counter example

  X[m] by E X [m]. Further we use E * X [m] to denote the total energy required by execution units from the start of the 5.3. Schedulability Analysis 135 sequence up to and including execution unit X[m]. Thus:

Figure 5 . 2 :

 52 Figure 5.2: Dummy schedule used in the construction of U B2

  is a monotonically non-decreasing function of w.

Finally, in order

  to use the workload function W LB1 i (w) in a fixed point iteration to determine the lower bound R LB1 i on the worst-case response time of task τ i , we must show that W LB1 i (w) is a monotonically non-decreasing function of w. is a monotonically non-decreasing function of w.

Figure 5 . 3 :

 53 Figure 5.3: Percentage of task sets schedulable

Figure 5 . 4 :Figure 5 . 5 :

 5455 Figure 5.4: Varying the energy utilization

Figure 5 . 6 :Figure 5 . 6

 5656 Figure 5.6: Varying relative deadlines in [C i , T i ]

Contents 6 . 1 6 . 2

 6162 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 Definitions and Notations . . . . . . . . . . . . . . . . . . . . . 154 6.2.1 Model and Notations . . . . . . . . . . . . . . . . . . . . . . . . . 154 6.2.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 6.2.3 Energy-Work-Conserving . . . . . . . . . . . . . . . . . . . . . . 155 6.2.4 Energy-Lookahead Scheduling . . . . . . . . . . . . . . . . . . . . 158 6.3 Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 6.4 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

Figure 6 . 1 :

 61 Figure 6.1: Energy balance of J 2,1 at time t=8

Figure 6 . 2 :

 62 Figure 6.2: P F P ASAP is not optimal

Contents 7 . 1

 71 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 7.2 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 7.3 Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 7.3.1 Task Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 7.3.2 Thermal Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 7.4 The P F P ASAP algorithm . . . . . . . . . . . . . . . . . . . . . . 178 7.4.1 Worst-case scenario . . . . . . . . . . . . . . . . . . . . . . . . . 179 7.4.2 The optimality of P F P ASAP . . . . . . . . . . . . . . . . . . . . 181 7.5 Response-Time Analysis . . . . . . . . . . . . . . . . . . . . . . 183 7.5.1 Exact Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 7.5.2 Approximate Analysis . . . . . . . . . . . . . . . . . . . . . . . . 183 7.6 Performance Evaluation . . . . . . . . . . . . . . . . . . . . . . 197 7.6.1 Task set generation . . . . . . . . . . . . . . . . . . . . . . . . . . 197 7.6.2 Schedulability tests investigated . . . . . . . . . . . . . . . . . . 198 7.6.3 Experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 7.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202

  Figure 7.1: Thermal model

Figure 7 . 2 :

 72 Figure 7.2: Cooling and heating functions

Figure 7 . 3 :

 73 Figure 7.3: Worst-case scenario

Figure 7 . 4 :

 74 Figure 7.4: First upper bound (U B T min )

1 Figure 7 . 6 :

 176 Figure 7.6: Parametric upper bound U B x

Figure 7 . 8 :

 78 Figure 7.8: f (x) sign

Figure 7 . 9 :

 79 Figure 7.9: Lower bound (LB x=1 )

  bound We can use the same reasoning as the above utilization upper bound to propose a sufficient and pessimistic feasibility test based on Liu and Layland bound. In fact, we can compare the total time utilization (processor and cooling) to Liu and Layland bound. Lemma 7.4.

Figure 7

 7 Figure 7.10: Simulations results

8 deviation

 8 Trade-off of schedulability and overhead between U B x and U B Tmin

Figure 7 Figure 7 .

 77 Figure 7.11: Simulations results

Figure 7 .

 7 Figure 7.11(a) on the facing page shows the impact of constrained deadlines on performance. Here we vary the deadlines from heavily constrained whereD i -C i is 10% of T i -C i to 100% of T i -C i (i.e. implicit deadlines). We observe that all of the schedulability tests are influenced by the tightness of deadlines to a similar degree, with heavily constrained deadlines having significant impact on schedulability in all cases.

Figure 7 .

 7 Figure 7.11(b) on the preceding page shows the impact of the number of tasks on the effectiveness of the feasibility tests. We can see that the number of tasks does not alter the feasibility rate of all the bounds.

Figure 7 .

 7 Figure 7.11(c) on the facing page shows the trade-off of schedulability and overhead between U B x and U B T min over parameter x variation. The shown percentages represent the gain or the loss of schedulability and overhead comparing to U B T min . For example, for x = 1, The schedulability test based on U B x=1 has more than 100% of schedulability than U B T min and almost 40% more overhead than U B T min . Positive values mean better performances than U B T min and negative value mean worse performances.We observe that increasing parameter x decreases the percentage of schedulable task

  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 8.2 Related Works . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 8.3 The History of YARTISS . . . . . . . . . . . . . . . . . . . . . 206 8.4 Functionalities . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 8.4.1 Single Task Set Simulation . . . . . . . . . . . . . . . . . . . . . 208 8.4.2 Run Large Scale Simulations . . . . . . . . . . . . . . . . . . . . 212 8.4.3 Task Set Generation . . . . . . . . . . . . . . . . . . . . . . . . . 212 8.4.4 Graphical User Interface (GUI) . . . . . . . . . . . . . . . . . . . 213 8.5 Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 8.5.1 Engine Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 8.5.2 Service Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 8.5.3 Framework Module . . . . . . . . . . . . . . . . . . . . . . . . . . 220 8.5.4 View-Module or GUI . . . . . . . . . . . . . . . . . . . . . . . . . 220 8.6 Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 8.6.1 Adding a new Scheduling Policy . . . . . . . . . . . . . . . . . . 221 8.6.2 Adding an Energy Profile . . . . . . . . . . . . . . . . . . . . . . 223 8.7 Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 8.8 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

Figure 8 . 1 :

 81 Figure 8.1: Energy and multiprocessor views

Figure 8 . 2 :

 82 Figure 8.2: Large scale simulation view

Figure 8 . 3 :

 83 Figure 8.3: Modules UML diagram

Figure 8 . 4 :

 84 Figure 8.4: The engine module UML diagram

  .

  4.

Chapter 8 .Figure 8 . 5 :

 885 Figure 8.5: Producer/Consumer design pattern

Figure 8 . 6 :

 86 Figure 8.6: UML diagram describing the addition of a new scheduling policy

  est l'une des sciences qui ont révolutionné le monde durant le dernier siècle. L'homme a inventé les ordinateurs électroniques durant la deuxième guerre mondiale. Ces derniers étaient capables d'effectuer des opérations de cryptographie en utilisant le modèle de la Machine de Turing. Depuis, ces ordinateurs n'ont cessé d'évoluer.

EDF

  with energy guaranty (EDeg) : L'intuition derrière cet algorithme est d'ordonnancer les tâches selon EDF , mais avant d'autoriser un job à s'exécuter, EDeg utilise la notion du surplus d'énergie [Che14; EGCC11] pour prédire d'éventuels futurs dépassements d'échéances dûs à une insuffisance d'énergie. Cette notion est l'équivalent "énergie" de celle du temps creux utilisée par EDL.

1.4. Scheduling Algorithms 39 Algorithm 1.1

  Optimal Priority Assignment 1: for all priority level k, lowest first do

	2:	for all unschedulable task τ i do
	3:	if τ i is schedulable at priority k with all other unassigned tasks assumed to
		higher priorities then
	4:	assign τ i to priority k
	5:	break (continue outer loop)
	6:	end if
	7:	end for
	8:

  Definition 1.8 (Task Workload Function). The workload of task τ i within time interval [t 1 , t 2 ] denoted W i (t 1 , t 2 ) is the amount of processor time needed to execute the jobs of τ i that are requested within time interval [t 1 , t 2 ] or are pending at time t 1 . The workload of a set of tasks Γ within time interval [t 1 , t 2 ] denoted W (t 1 , t 2 ) is the sum of workload of all tasks composing Γ within [t 1 , t 2 ].

	Definition 1.9 (System Workload Function).

  Definition 1.10 (Request Bound Function (RBF)). The request bound function of recurrent task τ i denoted RBF i (t) computes the worst cumulative workload generated by τ i 's jobs that are requested during time interval [0, t[. Lehoczky et al. [JLY89] proposed Equation 1.6 to compute RBF i (t).

	RBF i (t) = max	t -O i T i	, 0 × C

i (1.6) Definition 1.11 (Demand Bound Function (DBF)).

The demand bound function of recurrent task τ i denoted DBF i (t) is the worst cumulative workload generated by τ i 's jobs that are requested and finished during time interval [0, t].

Baruah et al. [BHR90a]

proposed Equation 1.7 to compute DBF i (t).

Table 2 .

 2

1: Power density comparison of energy-harvesting methods

[START_REF] Yildiz | Potential Ambient Energy-Harvesting Sources and Techniques[END_REF]

2.5. Energy-Harvesting Applications 61 NiCd NiMH Lead Acid Li-ion Li-ion polymer Reusable Alkaline Super capacitors Energy Density

		45-80	60-120	30-50	110-160	100-130	80	1-10
	Gravimetric (Wh/kg)
	Internal Resistance	100-200	200-300	<100	150-250	200-300	200-2000	1 -30
	(mW) (includes peripheral cir-
	cuits)
	Cycle Life	1500	300-500	200-300	500-	300-500	50 (to 50%) 10 6
	to 80% of initial capacity				1000
	Fast Charge Time	1h	2-4h	8-16h	2-4h	2-4h	2-3h	1-10s
	Self-discharge /Month 20%	30%	5%	10%5	10%	0.3%	40%
	Nominal Voltage (V) 1.25V	1.25V	2V	3.6V	3.6V	1.5V	1-3V
	Charge rate (C)	20-1	5-0.5	5-0.2	2-1	2-1	0.5-0.2
	peak to best
	Operating	-40-60	-20-60	-20-60	-20-60	0-60	0-65	-40-85
	Temperature ( • C)
	Table 2.2: Energy storage technologies comparison [Buc11]

Chapter 3 Real-time Scheduling for Energy-Harvesting Systems Contents 3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 3

  .1.1 Task Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

66 3.2 General Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 3

  .2.1 Energy Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 3.2.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

70 3.3 Scheduling Problematic . . . . . . . . . . . . . . . . . . . . . . . 71 3.4 Scheduling Approaches . . . . . . . . . . . . . . . . . . . . . . . 73

	3.4.1 Dynamic Voltage and Frequency Scaling . . . . . . . . . . . . . . 73
	3.4.2 Energy-Aware Scheduling . . . . . . . . . . . . . . . . . . . . . . 74
	3.4.3 Other Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . 75
	3

.5 Scheduling for Frame-Based Systems . . . . . . . . . . . . . . 75 3.6 EDF-based Scheduling Algorithms . . . . . . . . . . . . . . . . 79

	3.6.1 EDF As Late As Possible Scheduling (EDL) . . . . . . . . . . . 80
	3.6.2 EDF with Energy Guarantee Scheduling (EDeg) . . . . . . . . 83
	3.6.3 Lazy Scheduling Algorithm (LSA) . . . . . . . . . . . . . . . . . 86
	3

.7 Fixed-Priority Scheduling . . . . . . . . . . . . . . . . . . . . . 92

	3.7.1 The P F P ALAP Scheduling Algorithm . . . . . . . . . . . . . . . 92
	3.7.2 Preemptive Fixed-Priority with Slack-Time Algorithm . . . . . . 95
	3.7.3 Other Scheduling Heuristics . . . . . . . . . . . . . . . . . . . . . 97
	3

.8 Performance Evaluation and Comparison . . . . . . . . . . . . 99

	3.8.1 Simulation configuration . . . . . . . . . . . . . . . . . . . . . . . 99
	3.8.2 Results analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
	3.8.3 Comparison summary . . . . . . . . . . . . . . . . . . . . . . . . 103
	3

.9 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

3.2. General Model 69 E max Energy source Battery Pr < C Real-time task set Processor Sensor ... Harvester } E min E(t) C ... τ 1 (C 1 , T 1 ,D 1 , E 1 , P 1 ) τ n (C n , T n ,D n , E n , P n )

	Figure 3.1: Energy-harvesting system model
	that the energy consumption function is different from task to task but linear, which
	means that each task has its own constant instantaneous consumption E i /C i .
	Figure 3.1 recapitulates these descriptions.
	Addressing the limitations of the model
	This model seems to be too theoretical and not realistic, especially for energy assump-
	tions, i.e. the replenishment function and the energy consumption profiles. In fact,
	although we have considered a constant replenishment function, most Lithium batteries
	have nearly a constant recharging rate in the middle part (0 to 80%), then this rate
	decreases asymptotically to 0 when the battery is fully charged [Tos01]. Moreover, as
	shown in Section 2.4.2 on page 60, new generation of supercapacitors are capable of
	delivering a constant rate of energy all the time. Moreover, there exist some energy
	extraction technologies that can now provide a nearly constant energy output from
	specific energy sources, e.g. vibrations and piezoelectric techniques (see Section 2.3.2
	on page 52). Note that this may not be possible for other renewable energy sources and
	harvesting methods.

0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 10 12 14 16 18 20 E max E min

													1
								τ 2 3	9 10 9	2
								τ 3 4 16 18 17 3
									(a) Task set Γ with P r = 3
	E max	16 20 18								inactivity period
		14
		12
		10
	E min	0	2	4	6	8		10	12	14	16	18	20	22	24
	τ 1	0	2	4	6	8		10	12	14	16	18	20	22	24
															energy_failure
	τ 2	0	2	4	6	8		10	12	14	16	18	20	22	24
	τ 3	0	2	4	6	8		10	12	14	16	18	20	22	24			30
								(b) Classical FTP algorithm
										inactivity period				replenishment periods
	τ 1	0	2	4	6	8	10	12	14	16	18	20	22	24	26	28	30
	τ 2	0	2	4	6	8	10	12	14	16	18	20	22	24	26	28	30
	τ 3	0	2	4	6	8	10	12	14	16	18	20	22	24	26	28	30
									(c) Ideling algorithm
			Figure 3.2: Classical FTP scheduling algorithms are not suitable

end loop Chapter 3. Real-time Scheduling for Energy-Harvesting Systems

	Algorithm 3.1 Scheduling decision of F BA Algorithm at time t 1: t ← 0 2: execΓ c = true 3: execΓ g = f alse 4: loop 5: Γ g ← subset of Γ g of active tasks at time t 6: Γ c ← subset of Γ c of active tasks at time t 7: if Γ g = ∅ And execΓ g = true then 8: τ k ← the first task of Γ g 9: execute τ k 10: if E(t) + P r > E max or Γ g = ∅ then 11: execΓ g = f alse 12: execΓ c = true 13: end if 14: else if C = ∅ And execC = true then 15: τ k ← the first task of C 16: if E(t) + P r >= E k /C k then 17: execute τ k 18: else if Γ g = ∅ then 19: idle |Γ c | -|Γ g | P r time units 20: end if 21: if E(t) + P r -E k /C k <= 0 or Γ g = ∅ then 22: execΓ c = f alse 23: execΓ g = true 24: end if 25: else 26: idle for one time unit 27: end if 28: t ← t + 1 τ 1 4 20 18 18 τ 2 2 16 18 18 τ 3 2 16 18 18 τ 4 3 3 18 18 τ 5 3 3 18 18 (a) Task set Γ with P r = 3 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 0 5 10 15 20 E max E min 2,1 2,2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 τ 2 1,1 1,1 1,2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 τ 1 3,1 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 τ 3 4,1 4,2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 τ 4 5,1 5,1 5,2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 τ 5 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 0 5 10 15 20 E max E min 2,1 2,2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 τ 2 1,1 1,2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 τ 1 3,1 3,1 3,2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 τ 3 4,1 4,2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 τ 4 29: -C i E i T i D i 5,1 5,2 τ 5	34 34 34 3,2 34 34 34 34 34 34 3,2 34 34	36 36 36 36 36 36 36 36 36 36 36	38 38 38 38 38 38 38 38 38 38 38
	0	2	4	6	8	10	12	14	16	18	20	22	24	26	28	30	32	34	36	38

(b) E max = 20 and E(0) = E max (c) E max = 20 and E(0) = E min Figure 3.3: Example of F BA scheduling algorithm 3.6. EDF-

based Scheduling Algorithms 79

min s 1,1 a 1,1 s' 2,2 f 1,1 s* 2,2

											)
						τ 1 2	8	9	3	4
						τ 2 3 12 13 9	4
						τ 3 4 20 24 23	5
							(a) Task set Γ with P r = 3
	E max	12 15
	0 E deadline_missed 2 4 6	8	10	12	14	16	18	20	22	24	26
	τ 1		1,1				1,2				1,3
		0	2	4	6	8	10	12	14	16	18	20	22	24	26
	τ 2			2,1						2,2
		0	2	4	6	8	10	12	14	16	18	20	22	24 deadline_missed 26
	τ 3												3,1
		0	2	4	6	8	10	12	14	16	18	20	22	24	26
	E max	12 15
	E min
		0	2	4	6	8	10	12	14	16	18	20	22	24	26
	τ 1		1,1				1,2				1,3
		0	2	4	6	8	10	12	14	16	18	20	22	24	26
	τ 2		2,1	2,1				2,2	2,2
		0	2	4	6	8	10	12	14	16	18	20	22	24	26
	τ 3							3,1				3,1	3,1
		0	2	4	6	8	10	12	14	16	18	20	22	24	26
							(c) Feasible schedule

(b) LSA schedule with P max = max(P i (t))

Scheduling 93 Algorithm 3.4

  Slack-time of priority level-i at time t 1: ST i (t) ← 0

	2: W m+1 i	(t) ← 0
	3: repeat
	4:

96 Chapter 3. Real-time Scheduling for Energy-Harvesting Systems Algorithm 3.6

  3.6 on the next page summarizes the scheduling schemes of P F P ALAP .

P F P ST Algorithm 1: while true do 2: while there is ready jobs do 3: while E(t) > E min do 4:

3.8. Performance Evaluation and Comparison 103

		Failure rate	100				Failure rate
		Average energy level					Average energy level
		Preemptions rate	80				Preemptions rate
			60
	%	%
			40
			20
	%	EDL (a) E 0 EDeg LSA FBA PFP_ALAP PFP_ST Algorithms EDeg LSA FBA PFP_ALAP PFP_ST Failure rate Average energy level 0 20 40 60 100 % (b) E EDL EDL EDL Preemptions rate 80	EDeg EDeg	LSA Algorithms LSA	FBA FBA	PFP_ALAP PFP_ALAP Average energy level PFP_ST PFP_ST Failure rate Preemptions rate
		Algorithms			Algorithms

i /C i =Constant with E max = ∞ i /C i = f (τ i ) with E max = ∞ (c) E i /C i =Constant with E max = 200

Table 3 .

 3 1 on page 98 summarizes the properties of the discussed algorithms.

	100						Failure rate				Scenario :600000_15
	80					Average energy level Preemptions rate	100 80					Failures Average energy level Preemptions
	60							60
	%						%
	40							40
								20
	20
	0	EDL (a) E 0 EDeg LSA FBA PFP_ALAP PFP_ST Algorithms	EDL	EDeg	LSA Algorithms	FBA	PFP_ALAP	PFP_ST
	100						Failure rate				Scenario :600000_15
	80					Average energy level Preemptions rate	100						Failures
								80					Average energy level Preemptions
	60
	%							60
	40						%	40
	20							20
	0	EDL	EDeg	LSA	FBA	PFP_ALAP	PFP_ST	0	EDL	EDeg	LSA	FBA	PFP_ALAP	PFP_ST
				Algorithms							Algorithms

i /C i =Constant with E max = ∞ (b) E i /C i = f (τ i ) with E max = ∞ (c) E i /C i =Constant with E max = 200

  It schedules jobs as soon as possible when there is enough energy to execute at least one time unit, otherwise, it delays jobs executions by adding idle periods in order to

	112									Chapter 4. The P F P ASAP Algorithm
	Algorithm 4.1 P F P ASAP Algorithm
	1: t ← 0
	2: loop
	3:	A ← set of active tasks at time t
	4:	if A = ∅ then
	5:	τ k ← the highest priority task of A
	7:		execute τ k for one time unit
	8:	end if
	9:	end if
	10:	t ← t + 1
	11: end loop
								-C i E i T i D i P i
								τ 1 2 14 10 5	1
								τ 2 3 12 18 13 2
									(a) task set Γ with P r = 3
		E max	10
			8
			6
			4
		E min	0 2	0	2	4	6	8	10	12	14	16	18	20	22	24	26
		τ 1			1,1	1,1			1,2	1,2			1,3
				0	2	4	6	8	10	12	14	16	18	20	22	24	26
		τ 2				2,1		2,1					2,2			2,2
				0	2	4	6	8	10	12	14	16	18	20	22	24	26

P F P ASAP ).

Algorithm 4

.1 on the following page shows how P F P ASAP takes decisions at time t. 6: if E(t) + P r -E min ≥ E k /C k then (b) P F P ASAP time chart for task set Γ with E max = 10

Table 4 .

 4 .6 on the next page and confirm our previous observations. Both of P F P ALAP and P F P ST have a very large overhead

	128

1: P F P ALAP vs P F P ST vs P F P ASAP

  The intuition behind Equation6.1 on the facing page is derived from the notion of processor demand. It represents the sum of the cost of energy of all the jobs of priority equal or higher than i that are requested during the time interval [t 1 , t 2 [. The energy demand of time interval [0, t[ is just noted W e i (t) and can be obtained by Equation 6.2. The energy budget of the system during time interval [t 1 , t 2 ] denoted Bu(t 1 , t 2 ) is the amount of energy available until time t 2 , i.e. the battery level at time t 1 plus the energy replenished during time interval [t 1 , t 2 ]. It can be computed by Equation 6.3.

	W e i (t) = W e i (0, t) =	j≤i	t -O j T j	× E j	(6.2)
	Definition 6.2 (Energy Budget).
		t 2
		t 1	P r (t) dt	(6.3)
	Definition 6.1 (Energy Demand).
	The energy demand of priority level-i of time interval [t 1 , t 2 [ denoted W e i (t 1 , t 2 ) is
	the amount of energy to be consumed by the execution of the jobs of priority levels
	1, . . . , i -1, i that are requested within interval [t 1 , t 2 [ or are pending at time t 1 . It can
	be obtained by Equation 6.1.

W e i (t 1 , t 2 ) = j≤i e j (t 1 ) + t 2 -a j (t 1 ) T j × E j (6.1) Bu(t 1 , t 2 ) = E(t 1 ) + Definition 6.3 (Energy Balance).

Table 6 .

 6 1: Task set Γ with P r = 3, E max = 100, E min = 0 and E 0 = 6

		2 38 80 40 1
	τ 2 7	2 32 16 8	2
	τ 3 3	2 14 80 70 3
	τ 3 0	1 12 68 44 4

4 Figure 6.3: A feasible schedule of task set Γ

  4.1 on page 112).

																Chapter 6. Optimal Algorithm Investigation
	E max
	E min	0
			2	4	6	8	10	12	14	16	18	20	22	24	26	28	30	32	34	36	38	40	42	44	46	48	50	52	54	56	58	60	62	64	66	68	70
	τ 1 τ 2 τ 3 E max E min τ 1 τ 2 τ 3 τ 4 τ	0 0 0 0	2 2 2 2 2 2 2 2 2	4 4 4 4 4 4 4 4 4	6 6 6 6 6 6 6 6 6	8 8 8 8 8 8 8 8 8	10 10 10 10 10 10 10 10 10	12 12 12 12 12 12 12 12 12	14 14 14 14 14 14 14 14 14	16 deadline_missed 18 16 18 16 18 16 18 16 18 16 18 16 18 16 18 16 18	20 20 20 20 Figure 6.4: P F P ASAP counter example 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 deadline_missed 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 deadline_missed 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 deadline_missed 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50	52 52 52 52 52 52 52 52 52	54 54 54 54 54 54 54 54 54	56 56 56 56 56 56 56 56 56	58 58 58 58 58 58 58 58 58	60 60 60 60 60 60 60 60 60	62 62 62 62 62 62 62 62 62	64 64 64 64 64 64 64 64 64	66 66 66 66 66 66 66 66 66	68 68 68 68 68 68 68 68 68	70 70 70 70 70 70 70 70 70	72 72 72 72 72

4 Figure 6.5: P F P ALAP counter example

164 Chapter 6. Optimal Algorithm Investigation

	Algorithm 6.2 F P LSA Algorithm
	1: t ← 0
	2: while true do
	3:	J i,j the ready job with the higher priority at time t
	4:	calculate s i,j
	5:	if t ≥ s i,j or E(t) + P r > E max then
	6:	execute job J i,j
	7:	else
	8:	idle the system
	9:	end if
	10:

166 Chapter 6. Optimal Algorithm Investigation

		Algorithm 6.3 F P Leg Algorithm
		1: t ← 0
		2: loop
		3:		A ← set of active tasks at time t
		4:		if A = ∅ then
		5:			τ k ← the highest priority task of A
		6:			if E(t) ≥ E k /C k and Slack.T ime(t) ≤ 0 then
		7:				execute τ k for one time unit
		8:			else
		9:				replenish until time t + max(1, Slack.T ime.with.virtual.deadlines(t))
		10:			end if
		11:		end if
		12:		t ← t + 1
		13: end loop
	E max
	E min	0
		2	4	6	8	10	12	14	16	18	20	22	24	26	28	30	32	34	36	38	40	42	44	46	48	50	52	54	56	58	60	62	64	66	68	70
	τ
	1
		2	4	6	8	10	12	14	16	18	20	22	24	26	28	30	32	34	36	38	40	42	44	46	48	50	52	54	56	58	60	62	64	66	68	70
																									deadline_missed
	τ
	2
		2	4	6	8	10	12	14	16	18	20	22	24	26	28	30	32	34	36	38	40	42	44	46	48	50	52	54	56	58	60	62	64	66	68	70
	τ
	3
		2	4	6	8	10	12	14	16	18	20	22	24	26	28	30	32	34	36	38	40	42	44	46	48	50	52	54	56	58	60	62	64	66	68	70
	τ
		2	4	6	8	10	12	14	16	18	20	22	24	26	28	30	32	34	36	38	40	42	44	46	48	50	52	54	56	58	60	62	64	66	68	70

4

Figure 6.9: F P Leg counter example one of the higher priority jobs described above. It must satisfy the following conditions:

  68, 238The workload of the system in time interval [t 1 , t 2 ]. 42W/cm 2Watt per square centimeter. 50W i (t 1 , t 2 )The workload of task τ i in time interval [t 1 , t 2 ]. 42

		Symbols	Symbols 259
	V	Γ
		Volt. 54 A task set. 38, 132, 259
	W	Γ c
		Watt. 50
	W (t 1 , t 2 )
	W m i (t)
		The recurrent workload function. 92
	W U B1
	W h/kg
		Watt-hour per kilogram. 56
	W h/m 3
		Watt-hour per cubic centimeter. 56
	W p i (t)
		The processor workload or demand of priority level-i in time interval [0, t]. 113
	X
		A vector of execution units from 1 to L X . 134, 255, 256
	X[m]
		The m-th element of sequence X. 134, 255, 256
	∆
		A certain interval of time. 87

i (w)

The workload function of priority level-i according to upper bound U B1. 139

W e i (t)

The energy workload or demand of priority level-i in time interval [0, t]. 113

  Milliwatt per cubic centimeter. 53

	C U Bi min
	The minimum energy storage unit capacity needed for response time upper bound
	U Bi. 143
	C min
	The minimum capacity of the energy storage unit that keeps a task set schedulable.
	91
	µA
	Microampere. 54
	µF
	Microfarad. 60
	µW
	Microwatt. 54
	µW/cm 2
	Milliwatt per square meter. 51
	µW/cm 3

• C Celsius degree. 54

C

The capacity of the energy storage unit. 68, 176

Information and Communication Technologies

Observe that a low T min value may result in an extremely pessimistic upper bound due to the nature of the cooling function; It decreases asymptotically to T A , so waiting until T min is too pessimistic because of the nature of the cooling function.

Symbols

The the minimum number of replenishment units required to execute all of the subsequence X [1] to X[m] in order. 135

The minimum number of replenishment units required to provide sufficient energy to execute X[m] at the end of the subsequence X [1] to

The number of execution units in sequence X. 134

The number of jobs in sequence X. 141

Offset or first release time of task τ i . 30

The global power consumption function of the system. 176

The dynamic power consumption function of the system. 176

The power leakage or the static power consumption function of the system. 177

The priority of task τ i . 38

Constant replenishment function. 68

The power rate or the replenishment function. 67, 238

The priority of job J i,j . 38

c i The worst-case power consumption of task τ i during one time unit. 132 R The electrical resistance. 176 Symbols 257 RBF i (t) The request bound function of task τ i in time interval [0, t]. 42 R i

The Worst Case Response Time (WCRT) of task τ i . 32

The WCRT of task τ i according to response time upper bound U Bx. 137

The response time of job J i,j . 32

SE(t)

The available slack-energy of the system at time t. 84

The available slack-time of the system at time t. 84

The available slack-time of priority level-i at time t. 92

The temperature of the system at time t. 176, 247

The period or the inter-arrival time of task τ i . 31

The ambient temperature. 176

T max

The the maximum tolerated temperature. 176, 247

U

The processor utilization of the system. 41

The processor utilization of task τ i . 41

U e

The energy utilization of the system. 70

Part II Contributions

The P F P ASAP Algorithm Contents lower bounds of tasks worst-case response time. Section 7.6 shows some simulation results to evaluate the effectiveness of the proposed schedulability analysis. Finally, Section 7.7 concludes this chapter.

Related Work

In this section we give a brief overview of prior research related to thermal-aware real-time scheduling. As for the energy-aware real-time systems, most works addressing this problem consider Dynamic Voltage and Frequency Scaling (DVFS) strategies. DVFS consists of scaling down the DVFS speed, and thereby lengthening task execution times as described in Section 3.4 on page 73, to reduce energy consumption and reduce the peak temperature [CWT09; WAB10; WB06; WB08].

Among existing works, the proposed techniques can be divided into reactive and proactive approaches. The difference between these two approaches is that reactive schemes adapt to the temperature of the system when it reaches the maximum temperature or a specific trigger by switching the Central Processing Unit (CPU) speed or by changing scheduling decisions. In this scope, Wang et al. proposed a schedulability analysis for speed scaling scheme for frame-based task model in [START_REF] Wang | Reactive Speed Control in Temperature-constrained Real-time Systems[END_REF], and they completed this with a worst-case response time analysis for First In First Out (FIFO) and fixed-priority scheduling in [START_REF] Wang | Delay Analysis in Temperature-Constrained Hard Real-Time Systems with General Task Arrivals[END_REF][START_REF] Wang | Reactive Speed Control in Temperature-constrained Real-time Systems[END_REF]. In contrast, proactive approaches set the configuration of the system judiciously beforehand (CPU speed and scheduling decisions) so that the maximum temperature is never reached [CWT09; QZ09; Qua+08]. In this scope, Chen et al. proposed in [CHK07; CWT09] a proactive EDF-based scheduling approach that changes the processor speed proactively by requests issued by the scheduler.

There exists also some works that address this scheduling problem without DVFS schemes by considering processors with only one frequency. In this scope, Ahmed et al. proposed in [START_REF] Ahmed | Minimizing Peak Temperature in Embedded Real-Time Systems Via Thermal-aware Periodic Resources[END_REF] a technique that computes proactively the length of execution and cooling intervals so that a certain temperature is never reached. This idea was extended in [START_REF] Pradeep | The Design and Analysis of Thermal-Resilient Hard-Real-Time Systems[END_REF] to support unpredictable ambient temperature fluctuations. Rehan et al. proposed in [RPK13; RPK14] a kind of thermal utilization of the system (using a fluid schedule) and leveraged it to obtain a necessary and sufficient conditions for systems thermal feasibility.

All the mentioned work have the following limitations: 1) Except for works cited in the previous paragraph [Ahm+11; RPK13; RPK14; Het+12], all the proposed solutions rely on speed scaling to manage energy and temperature. These approaches cannot be applied to systems without DVFS capabilities.

2) Most of the scheduling solutions proposed in the literature are EDF-based. Knowing that static fixed-priority scheduling is highly used in industry, it deserves more attention and effort.

Chapter 9. Ordonnancement temps réel avec gestion de l'énergie renouvelable

Dans cette thèse, nous nous focalisons sur l'ordonnancement à priorité de tâche fixe sur des plateformes monoprocesseur.

Les systèmes collecteurs d'énergie

Un système collecteur d'énergie est un système qui récupère l'énergie ambiante et la stocke dans un réservoir d'énergie afin d'alimenter un appareil électronique.

Généralement, ce genre de système est composé de trois composants principaux : un collecteur d'énergie, un réservoir d'énergie et une unité de calcul.

Le collecteur d'énergie est responsable de la transformation de l'énergie ambiante en courant électrique.

Le réservoir d'énergie stocke temporairement l'énergie collectée par le collecteur. Généralement, les batteries rechargeables ou les super-condensateurs sont utilisés pour cet effet en fonction des besoins de l'application.

L'unité de calcul est généralement composée de capteurs de données, de processeurs et de composants de transmission. C'est ce composant héberge le système temps réel que nous étudions dans cette thèse.

Les technologies d'extraction de l'énergie ambiante

Plusieurs sources d'énergie peuvent être exploitées. Toutes les sources ne sont pas adaptées à toutes les applications. La source d'énergie et la méthode d'extraction doivent être soigneusement choisies pour répondre aux besoins de l'application.

Parmi les méthodes de conversion on trouve les suivantes :

• Conversion de l'énergie solaire : Cela passe par l'utilisation de cellules photovoltaïques. Cette technique présente un rendement assez faible (de l'ordre de 13%) et la quantité d'énergie produite est très fluctuante dans la journée et dans l'année.

• Conversion de l'énergie des ondes radio : Cette méthode présente un rendement faible mais très utile pour un usage ponctuel, par exemple, les puces Radio Frequency Identification (RFID).

• Conversion électromagnétique de l'énergie vibratoire : Cette technique utilise le champ magnétique pour transformer l'énergie mécanique des vibrations en courant électrique. Cette technique présente un rendement faible par rapport aux précédentes.

• Conversion électrostatique de l'énergie vibratoire : Cette technique utilise cette fois le champ électrostatique pour transformer l'énergie mécanique des vibrations. Le rendement de cette dernière est meilleur et peut être intéressant pour les applications qui subissent une fréquence de vibration importante.

Les systèmes collecteurs d'énergie

Chapter 9. Ordonnancement temps réel avec gestion de l'énergie renouvelable matique de l'ordonnancement à priorité fixe. Cette idée a été étudiée dans le cadre d'une collaboration avec Prof. N. Fisher et est en cours de soumission. Finalement, le cinquième résultat est le développement d'un outil de simulation de l'ordonnancement des systèmes temps réels. YARTISS a fait l'objet d'une publication dans le workshop WATERS 2012 [START_REF] Chandarli | YARTISS: A Tool to Visualize, Test, Compare and Evaluate Real-Time Scheduling Algorithms[END_REF]. Task number i or of priority level i. 30

Appendix YARTISS Case Study

The next job request time of priority level-i. 92, 154

The arrival time of job J i,j . 32

The remaining execution time at time t of the current job of task τ i . 92, 154

Square centimeter. 50

Cubic centimeter. 53

The next absolute deadline of priority level-i after time t. 92, 154

The absolute deadline of job J i,j . 32

The remaining energy cost of the current job of task τ i at time t. 154

The termination time of job J i,j . 32

The energy replenished during time interval [t

Glossary

Glossary

DM

The priority assignment policy that grants the highest priority to the task with the smallest deadline. 262

EDF

The scheduling policy that executes first the jobs with the nearest deadlines. 262

EDL

The scheduling algorithm that schedules jobs as late as possible according to EDF rules. 262

EDeg

The scheduling algorithm that checks if the execution of the current job does not lead to future deadline miss before authorizing it to execute according to EDF rules. 262

The scheduling algorithm that schedules continuously the group of gaining tasks when the minimum battery level is reached and executes the group of consuming tasks when the maximum battery level is reached. 262

F P Casap

The FTP algorithm that uses lookahead computations to detect future deadline misses in order to adapt the scheduling decisions. 262

F P LSA

The FTP counter-part of Lazy Scheduling Algorithm. 262

F P Leg

The FTP algorithm that uses only virtual deadlines to compute the maximum delay to apply for each job. 262

F P lh

The FTP algorithm that uses virtual deadlines and lookahead verifications to compute the maximum delay to apply for each job. 262

LLF

The scheduling policy that executes first the jobs with the smallest laxity. 262

Glossary

269

LSA

The Lazy Scheduling Algorithm is an EDF-based algorithm that delays execution such that the current job and the eventual higher priority jobs can be executed continuously without running out of energy and without exceeding the maximum capacity of the battery. 263

P F P ALAP

The scheduling algorithm that schedules jobs as late as possible according to FTP rules. 263

P F P ASAP

An energy-work-conserving FTP scheduling policy. 263

P F P ST

The scheduling algorithm that executes jobs according to FTP rules when some energy is available and replenishes as long as possible otherwise. 263

RM

The priority assignment policy that grants the highest priority to the task with the smallest period. 263

CPU

The processor. 263

DAG

The task model that considers dependencies between the jobs of the same task. 263

DBF

OPA

The algorithm of Audsley that calculate a valid tasks priority assignment whenever there exists one. 266

OPA-compatible

A schedulability test is compatible with the OPA algorithm if the priority ordering of higher and lower priority tasks does not alter the schedulability of the current level. 265

RBF

The request bound function computes the worst cumulative workload generated by jobs that are requested during time interval [0, t[. 266

Glossary

271

RC

The Resistance Capacitance circuit (RC) circuit is used to model the thermal behavior of the system. 266

TA

Thermal-Aware systems adapt the performances in order to keep the temperature of the system below a maximum threshold. 266

WCRT

The WCRT of a task is the maximum duration between the activation of the task and the moment it finishes its execution. 266

List of Figures

List of Algorithms