Section: New Results
Scheduling and Optimization
Participants : Liliana Cucu, Omar Kermia, Patrick Meumeu, Alix Munier, Nicolas Pernet, Yves Sorel.
Preemtive offline scheduling in the monoprocessor case
The two last years we had preliminary results about the introduction of the preemption into the scheduling problem of realtime system with precedence and strict periodicity constraints in the monoprocessor case. Classical offline approaches based on preemption, such as RM (Rate Monotonic), DM (Deadline Monotonic), EDF (Earliest Deadline First), LLF (Least Laxity First), etc, give schedulability conditions but assuming the cost of the preemption is negligible compared to the duration of the operations. Clearly this is difficult to calculate accurately because, if the cost of one preemption is easy to determine, it is not the same for the number of preemptions. Thus, the main drawback of these approaches is that the designer must take as many margins as there are operations in the system to guarantee that the realtime behavior will conform to the schedulability condition.
We adopted a constructive approach in order to find a schedulability condition which counts the exact number of preemptions to take into account accurately the cost of the preemption. To the best of our knowledge there is only few results about this problem. Constructive means we construct all the possible preemptive schedules relatively to the strict periodicity of the operations and the possible durations taken by each operation, assuming the duration of an operation cannot be greater than its period. That was done after determining the cases where the operations are not schedulable because of their periods, the preemption beeing allowed or not. We proved the two following impossibilities. Firstly, we proved it is not possible to find a schedule as soon as two operations have coprime periods. Secondly, we proved it is not possible to find a schedule as soon as the time elapsed between the first start times of two operations is a multiple of the greatest common divisor of their periods. Then, we called the set of operations potentially schedulable. We used the scheduling policy which schedules operations according to the increasing order of their periods thanks to the result given in [20] taking into account the precedence constraints. We defined a partition of into the three following subsets. We called V_{c} the subset of operations such that the start time of a repetition of an operation occurs while the processor is executing another repetition of an already scheduled operation. Such operations cannot be scheduled because the precedences impose that an operation may be preempted, only by another one already scheduled. Again this is due to the result previously cited. We called V_{d} the subset of operations such that their periods grow harmonically, i.e. the period of any operation is a multiple of the period of the previous one. We called V_{i} the subset of operations such that it exists, at least, two operations whose periods are not multiple. For V_{d} we proposed a scheduling algorithm which constructs, as previously discribed, all the schedules, and in addition gives the number of preemptions. That corresponds to a schedulability analysis taking into account accurately the cost of the preemption when the cost of one preemption is known for each operation.
Nonpreemtive offline scheduling in the multiprocessor case
We studied the distribution and scheduling problem for system with precedence and strict periodicity constraints. The latter constraint means each operation of the graph is labeled by its period beside its duration. First, each operation is repeated within the LCM (Least Common Multiple) of all periods of operations (hyperperiod), allowing to unroll the graph over the hyperperiod. We propose an algorithm adding the missing edges. We repeat each operation ntimes, nis equal to n= ( P/ T) where the period of this operation is Tand Pis the value of the hyperperiod. In order to maintain the data transfers between operations during the unrolling we must add new edges between the repetitions of the same operations, and between the repetitions of different operations. The operations are classified (clustered) by their periods in such way that each class corresponds to each different period. The resulting class are assigned to the processors as following: if the number of processors is greater than the number of classes we must create as many classes as there are of processors for which no class was assigned. We propose a loadbalancing algorithm such that the number of class is equal to the number of processors. Otherwise if the number of class is lower or equal to the number of class we assign the resulting class to the processors (by ascendant period order), and some class may not be assigned.
We proposed an extension of our distribution and scheduling greedy heuristic in the case of precedence, and one latency constraint equal to a unique periodicity constraint. We apply this extended heuristic on the unrolled and assigned graph in order to distribute and schedule the periodic operations onto the multiprocessor. We compute the complexity of the proposed heuristic, and perform a performance comparison which shows its effectiveness.
Mixing offline and online scheduling for aperiodic operations
The AAA methodology deals with distributed hard realtime systems. Thus it is presently based on offline heuristics to find a schedule satisfying in addition to precedence and periodicities, complex realtime constraints as latency constraints introduced in [19] . A latency constraint concerns a couple of operations and defines the maximum amount of time which can separate the beginning of the first operation and the end the second one. Offline scheduling reduces execution overhead because it does not require a scheduler as online scheduling do. The drawback of these approaches is that there are not suited for aperiodic operations, that is to say operations whose occurrence time is unknown contrary to periodic operations. Nevertheless, we aim at handling online aperiodic operations while satisfying all the realtime constraints of the periodic operations scheduled offline.
Previous works on aperiodic operations rely on specific scheduling algorithms for periodic operations (Rate Monotonic, Earliest Deadline First) and a simplified model (periods equal to deadlines, no latency constraints, no precedence). Consequently, they are unusable for solving our problem. The only method which does not impose such restrictions is the Slot Shifting [65] . It consists in splitting the scheduling in execution intervals. These intervals are delimited by the deadlines of each operation, and by interprocessor communication operations. Then, the spare capacity of each interval, that is to say the amount of time which is available in this interval to execute aperiodic operations, is computed. This approach is independent on the scheduling algorithm or heuristic employed to perform the offline scheduling, and takes into account communications costs.
We extended the Slot Shifting algorithm to deal with several latency constraints. First, assuming that we have an offline schedule of the periodic operations which satisfy their constraints (deadlines and latencies), we have to handle, online, aperiodic operations still satisfying the previous constraints. We construct a subset of these constraints such as satisfying them implies to satisfy the whole set of constraints. Second, we give a method to use slot shifting with several latency constraints, and we show that latency constraints offer more inline spare capacity than deadlines do. This method consists in transforming each latency constraint in a deadline for the second operation of the couple of operations concerned by a latency constraint. Nevertheless, this transformation only takes place online when the first operation of the couple of operations begins its execution. Indeed, before this is known it is not possible to translate the latency constraint in a deadline. Our method dealing with dealdine and latency constraints constraints for distributed systems, and is totally independent of the heuristic (because distributed implies NPhard problem) used to perform the offline scheduling.
For softreal time applications we continued to investigate the adaptive scheduling technique. We proposed a new heuristics based on the one used in the case of precedence, and one latency constraint equal to a unique periodicity constrain, extended by a PID controller which manages aperiodic operations [53] .
Cyclic scheduling problem with latencies
The execution of a realtime application may be considered as a cyclic scheduling problem for which a set of generic tasks constrained by precedence and resource relations are executed a large number of time. The model AAA [20] also considered non classical constraints between the generic tasks (called latency constraints) to model additional temporal relations between their executions. We proved that this new class of constraints may be modelled using an extension of the basic cyclic scheduling problem [17] , [18] .
Firstly, we studied the problem without resource constraint. We expressed an original necessary and sufficient condition for the existence of a schedule. Since there is no resource constraint, the earliest schedule has a maximal throughput : we characterized the structure of this schedule, and we showed that it is always possible to build a periodic schedule (for which the schedule of one iteration is repeated) with the same throughput. We also developed a polynomial time algorithm to compute the necessary and sufficient condition of schedulabilty, the maximal throughput and a periodic schedule [48] . The conclusions for the AAA model are double :

If the latencies are fixed, a periodic schedule with a minimum latency may be polynomially computed.

If the throughput is fixed, we can polynomially compute a periodic schedule which optimizes linear functions of the latencies using linear programming.
In both cases, the periodic schedule obtained is optimal (since it has the same characteristic as the earliest schedule).
Then we considered the corresponding sequencing problem with some restrictions on the structure of the latencies corresponding to the practical problem. The existence of a feasible schedule is an NPcomplete problem. We proved that, if a periodic schedule exists, it is always possible to increase its throughput such that no idle slots remains on the processor in the steady state. This property allows us to develop an original branch and bound method to solve the problem of the existence of a schedule. For each node, several original necessary conditions allows us to reduce significantly the number of children.
We noticed than, in more than 95 percent of randomly generated case, the non existence of a schedule is checked using the necessary and sufficient condition obtained for the problem without resource constraints. Moreover, up to 50 tasks, 99 percent of randomly generated instances are solved with less than 10.000 nodes. The perspectives of this work are the development of efficient algorithms to solve quickly the problem of the existence of a periodic schedule for one or a fixed number of processors for the AAA model.
Memory optimization
Because the amount of memory is usually limited in embedded processors we aim at minimizing memory utilization. Presently, due to the dataflow model, the RAMs necessary for storing local data memory (inside the processor) and for storing data to transfer (between processors) are specified in the implementation model by as many alloc vertices as there are of data dependences. A buffer is associated to each alloc vertex during the code generation. Obviously, this method consumes too much memory while some buffers should be reused when there are not used latter on. We proposed several heuristics based on coloured graph technics in order to minimize the number of buffers. This problem is particularly complex when conditionings are considered.