Ordonnancement de tâches Temps-réel avec suspension Vendredi 28 janvier 2005 http://www.lisi.ensma.fr/tempsreel/ Good morning. I’m a PHD student and I work in the Laboratory Of Applied Computer Science at Poitiers in France. I’m going to present our work on scheduling independent hard real-time tasks with self-suspensions. Laboratoire d’Informatique Scientifique et Industrielle Frédéric RIDOUARD, frederic.ridouard@ensma.fr
Plan : Introduction Complexité du problème d’ordonnancement Exemple Système de tâches Complexité du problème d’ordonnancement Calcul de complexité Anomalies d’ordonnancement Algorithmes d’ordonnancement Analyse de compétitivité Respect des échéances Résultats connus L’algorithme SRPTF et le système de tâches MAD EDF, RM & DM LLF Technique d’augmentation de ressources Temps de réponse maximum Conclusion First, I’ll state the context with an example and I’ll define the task system. Then we first determine the complexity of the feasibility problem. We also present scheduling anomalies occurring while scheduling tasks with self-suspension under EDF. Then, with competitive analysis, we prove that classical scheduling algorithms fail to schedule task systems having arbitrary small utilization factors whereas there exist trivial off-line feasible schedules. Lastly, we show that increasing the processor speed does not improve the performance of EDF. To finish this presentation, the conclusion. F. Ridouard
Plan : Introduction Complexité du problème d’ordonnancement Exemple Système de tâches Complexité du problème d’ordonnancement Calcul de complexité Anomalies d’ordonnancement Algorithmes d’ordonnancement Analyse de compétitivité Respect des échéances Résultats connus L’algorithme SRPTF et le système de tâches MAD EDF, RM & DM LLF Technique d’augmentation de ressources Temps de réponse maximum Conclusion First, I’ll state the context with an example and I’ll define the task system. Then we first determine the complexity of the feasibility problem. We also present scheduling anomalies occurring while scheduling tasks with self-suspension under EDF. Then, with competitive analysis, we prove that classical scheduling algorithms fail to schedule task systems having arbitrary small utilization factors whereas there exist trivial off-line feasible schedules. Lastly, we show that increasing the processor speed does not improve the performance of EDF. To finish this presentation, the conclusion. F. Ridouard
Exemple Entrée/Sortie Noyau temps-réel Operation externe Opération finie During its execution, a task can invoke an external operation for example, a video acquisition. The real-time kernel suspends the task and chooses the next task ready to run according to an on-line scheduling policy. The task waits until the completion of the external operation. The execution requirement of the external operation is usually modelled by directly execution requirement of the task. But if self-suspension delays are large, then they must be considered in the task model. They cannot be added in the worst-case execution times of tasks. Noyau temps-réel F. Ridouard
Système de tâches Périodique stricte Di Ti Échéance sur requête Xi ri Ci1 Ci2 di Périodique stricte Di Ti Task system are based on a collection of periodic tasks. Every task i arrives in the system at time ri. its deadline is denoted di, its relative deadline to its release date Di and its period Ti. If the relative deadline is equals to the period then the task has a constrained deadline else an implicit deadline. To simplify our results we consider that every task is allowed to self-suspend only once. Ci1 and Ci2 denote the execution requirements of the two subtasks of tau i. The upper limit to its execution requirement is noted Ci. Xi is the worst-case suspension delay. Such delays change from one execution to another since they model execution requirements of external operations. Échéance sur requête Di = Ti Ci = Ci1+ Ci2 Xi est la pire durée de suspension F. Ridouard
Tests de faisabilité : Plusieurs tests de faisabilité sont connus pour l’ordonnancement de tâches à suspension : Un test basé sur le facteur d’utilisation du processeur. Des tests basés sur le calcul du pire temps de réponse des tâches. Mais notre but est de déterminer l’efficacité de quelques algorithmes classiques en ordonnançant des tâches à suspension. F. Ridouard
Plan : Introduction Complexité du problème d’ordonnancement Exemple Système de tâches Complexité du problème d’ordonnancement Calcul de complexité Anomalies d’ordonnancement Algorithmes d’ordonnancement Analyse de compétitivité Respect des échéances Résultats connus L’algorithme SRPTF et le système de tâches MAD EDF, RM & DM LLF Technique d’augmentation de ressources Temps de réponse maximum Conclusion First, I’ll state the context with an example and I’ll define the task system. Then we first determine the complexity of the feasibility problem. We also present scheduling anomalies occurring while scheduling tasks with self-suspension under EDF. Then, with competitive analysis, we prove that classical scheduling algorithms fail to schedule task systems having arbitrary small utilization factors whereas there exist trivial off-line feasible schedules. Lastly, we show that increasing the processor speed does not improve the performance of EDF. To finish this presentation, the conclusion. F. Ridouard
Calcul de complexité Résultats connus : L’ordonnancement de tâches périodiques strictes et à départ simultané est un problème NP -difficile au sens fort. (P. Richard, ECRTS’03) Le problème d’ordonnancement de tâches périodiques à échéance sur requête et départ simultané est un problème NP -difficile au sens fort. We have already proved that the feasibility problem of scheduling synchronous periodic task systems is NP-hard in the strong sense when tasks are allowed to self-suspend and have constrained deadlines. In this previous paper, we left open the case of tasks having implicit-deadlines. We establish that the feasibility problem of scheduling tasks with self-suspensions is NP-hard in the strong sense, even in this restrictive case. (F. Ridouard et al. RTSS’04) F. Ridouard
Calcul de complexité Définition : Un algorithme d’ordonnancement est dit « universel » si cet algorithme effectue le choix de la prochaine tâche à ordonnancer en temps polynomial. Un tel algorithme ne peut pas exister pour l’ordonnancement de tâches à suspension (sauf si P = NP). F. Ridouard
Anomalies d’ordonnancement sous EDF Définition : Réduire la durée d’exécution ou de suspension d’une des tâches rend l’instance non ordonnançable. Résultats connus : EDF est robuste pour l’ordonnancement de tâches indépendantes sans suspension. An anomalous behaviour occurs when reducing the execution requirement of a task can lead to miss a deadline whereas the same task system is feasible if all jobs are run with their worst-case execution and suspension delays requirements. A known result is that EDF has not scheduling anomalies for scheduling independent tasks upon an uni-processor system. This result does not hold when tasks are allowed to self-suspend. F. Ridouard
Anomalies d’ordonnancement sous EDF Système de tâches I : 1 6 2 5 9 3 7 10 Ordonnancement de I par EDF : To prove this theorem, we define an instance of tasks I and we show that the scheduling of I by EDF is feasible. But if the execution requirement of a task or a suspension delay are decreased, then a deadline will be missed. The instance I contains three tasks with the following characteristics. When all tasks use their worst-case execution requirements and worst-case suspension delays, EDF defines the following schedule: at time 0, 1 is scheduled and completed at time 6. Then, at this instant, 2 is released, scheduled and self-suspended at time 7. 3 is released at time 7 and immediately scheduled. At time 8, 3 self-suspends and 2 is resumed after its self-suspension and completed by time 9. Lastly, 3 is resumed and completed by time 10. 5 10 F. Ridouard
Anomalies d’ordonnancement sous EDF Système de tâches I : 1 6 2 3 5 9 7 10 Ordonnancement de I par EDF : Now, we show that C1,1 is decreased of one unit of time, C1,1 = 1 , and all other job requirements are still unchanged. Then 1 is completed by time 5. Then, 2 is released and immediately run. At time 7, 2 is resumed from its self-suspension and 3 is delayed since it has a larger deadline than 2. 3 starts its execution at time 8 and is completed by time 11, thus one unit of time after its deadline. then 3 is not completed by its deadline. We can easily show that the same anomaly occurs if X1 or C1,2 are decreased of one unit of time. The previous result can be easily extended to fixed-priority task systems. 5 10 F. Ridouard
Anomalies d’ordonnancement sous EDF Système de tâches I : 1 6 2 5 9 3 7 10 Ordonnancement de I par EDF : 5 10 F. Ridouard
Anomalies d’ordonnancement sous EDF Système de tâches I : 1 6 2 5 9 3 7 10 Ordonnancement de I par EDF : 5 10 F. Ridouard
Plan : Introduction Complexité du problème d’ordonnancement Exemple Système de tâches Complexité du problème d’ordonnancement Calcul de complexité Anomalies d’ordonnancement Algorithmes d’ordonnancement Analyse de compétitivité Respect des échéances Résultats connus L’algorithme SRPTF et le système de tâches MAD EDF, RM & DM LLF Technique d’augmentation de ressources Temps de réponse maximum Conclusion First, I’ll state the context with an example and I’ll define the task system. Then we first determine the complexity of the feasibility problem. We also present scheduling anomalies occurring while scheduling tasks with self-suspension under EDF. Then, with competitive analysis, we prove that classical scheduling algorithms fail to schedule task systems having arbitrary small utilization factors whereas there exist trivial off-line feasible schedules. Lastly, we show that increasing the processor speed does not improve the performance of EDF. To finish this presentation, the conclusion. F. Ridouard
Analyse de compétitivé Comparaison : Algorithme en-ligne (non clairvoyant) Algorithme hors-ligne (optimal, clairvoyant) : l’adversaire Principe : Un bon adversaire définit les instances de problème pour que l’algorithme en-ligne atteigne sa pire performance. The competitive analysis allows for a performance criteria to determine the performance guarantee of an on-line algorithm. This approach compares an on-line algorithm to an optimal clairvoyant algorithm: the adversary. A good adversary defines instances of problems so that the on-line algorithm achieves its worst-case performance. F. Ridouard
Analyse de compétitivité Ratio de compétitivité (Maximisation) cA : A: performance atteinte par l’algorithme en-ligne A. *: performance atteinte par l’adversaire cA 0 cA 1. More formally, given a performance criteria cigma and an on-line algorithm A, then, A is the value obtained by A and * is the value obtained by the optimal clairvoyant algorithm. The competitive ratio cA of the algorithm A is the worst-case ratio while considering any instance I. CA is less than or equal to 1. cA=1, alors A est un algorithme optimal F. Ridouard
Résultats connus (Respect des échéances) : Aucun algorithme d’ordonnancement en-ligne n’est compétitif Mais des résultats positifs sont connus dans différents cas particuliers : Monotonic Absolute Deadline (MAD) : Si ri rj alors di dj Shortest Remaining Processing Time First (SRPTF): SRPTF est un algorithme d’ordonnancement en-ligne qui alloue le processeur à chaque instant à la tâche ayant le plus petit temps processeur restant. Pour les systèmes MAD, SRPTF est compétitif. There is no competitive algorithms for general preemptive task systems, but competitive algorithms are known for special cases. We present one of these special cases. A task system is said to be MAD if the following is respected. SRPTF is an on-line scheduling algorithm that allocates the processor at any time to the task having the shortest remaining processing time. If the task system has the MAD property, then the on-line scheduling algorithm SRPTF is 2-competitive to minimize the number of tardy tasks. F. Ridouard
SRPTF et le système MAD Pour les systèmes de tâches à suspension MAD même avec un faible facteur d’utilisation, l’algorithme en-ligne SRPTF n’est pas compétitif pour maximiser le nombre de tâches respectant leurs échéances. Une tâche sans suspension. N tâches avec: Faibles et égales durées d’exécution Longues périodes de suspension F. Ridouard
SRPTF et le système MAD 0 1 2 n 0 1 2 … 1 2 , EDF, DM, et RM SRPTF n K 0 … 1 2 At time 0, 0 and 1 are available, SRPTF schedules 0 because 0 has the shortest remaining processing time. After, the first subtask of task I is scheduled at time i (1 = i = n) and the second at time K + (i - 1). All deadlines expect one are missed. The clairvoyant algorithm schedules 1 at time 0 and it schedules every task i (i . {2, . . . , n}) at time i - 1. To finish, the clairvoyant algorithm schedules 0. We can set the utilization factor as small as possible in increasing the suspension delays of tasks with self-suspension. If we use the same instance I, EDF, DM and RM assign priorities to the tasks exactly as SRPTF do. Consequently, we obtain the same conclusions for all these scheduling algorithms. Algorithme Optimal EDF, DM et RM assignent les priorités aux tâches exactement comme SRPTF le fait. n K F. Ridouard
Non compétitivité de LLF LLF n’est pas compétitif pour maximiser le nombre de tâches à suspension respectant leurs échéances. N tâches avec : Temps processeur de chaque sous-tâche égal à trois. Longues périodes de suspension We study an instance I with n identical tasks. F. Ridouard
Non compétitivité de LLF 1 … 2 LLF n K 1 … 2 LLF : At time 0, the first subtask of 1 is scheduled by LLF. But at time 1, the priorities of the tasks i (2 = i = n) are greater than the priority of 1. Consequently, the task 2 is scheduled. But at time 2, the others tasks have a priority greater than the priority of 2. Therefore, every task i with 1 = i = n always have the same laxity leading LLF to preempt the active job after one unit of its execution. all deadlines are missed. The clairvoyant algorithm schedules in the order, the first subtask of 1, 2, . . . , n and in the same order the second subtask of these tasks. We can still set the utilization factor as small as possible in increasing the suspension delays. Algorithme Optimal n K F. Ridouard
Augmentation de ressources Comparaison : Algorithme hors-ligne sur un processeur Algorithme en-ligne sur une machine s fois plus rapide Résultats connus : S’il existe un ordonnancement possible, alors EDF définira un ordonnancement possible sur une machine deux fois (s=2) plus rapide. In the competitive analysis, the on-line algorithm and the optimal one use the same processor having a unit speed. A simple way to improve the competitive ratio is to give a faster processor to the on-line algorithm whereas the off-line algorithm is still running on a unit speed processor. This technique is called resource augmentation. EDF is competitive under overloaded conditions if it is run under a two-speed processor Thus, if a feasible schedule is determined by a clairvoyant algorithm with a 1-speed processor, then EDF will define a feasible schedule under a 2-speed processor. F. Ridouard
Augmentation de ressources Allouer plus de ressources à EDF n’améliore pas ses performances quand les tâches peuvent se suspendre au plus une fois. Preuve par l’absurde : Soit s, un entier tel que s>1. 1 : 2 : 4s 3s 2s s 1 We show that when tasks are allowed to self-suspend, then EDF cannot always define a feasible schedule under a k-speed processor while there exists an off-line feasible schedule under a 1-speed processor. Let s be an integer such that s > 1 and such that if there exists a feasible schedule under a 1-speed processor then there exists a feasible EDF schedule under s-speed processor. Let I be an instance with two tasks. These two tasks of I arrive in the system at time 0 with the following characteristics. 4s 3s 2s s 2 F. Ridouard
Augmentation de ressources 1 2 2 EDF s 2s 3s 4s Algorithme optimal 2 1 2 At time 0, 1 is scheduled by EDF on a s-speed machine since its absolute deadline is before the deadline of 2. Then, at time 2, 1 is completed and 2 is scheduled and is completed after its deadline At time 0, 2 is scheduled by the optimal algorithm and self-suspended at time 1. Then 1 is immediately scheduled and completed. Consequently, EDF cannot schedule I under a s-speed system. s 2s 3s 4s F. Ridouard
Plan : Introduction Complexité du problème d’ordonnancement Exemple Système de tâches Complexité du problème d’ordonnancement Calcul de complexité Anomalies d’ordonnancement Algorithmes d’ordonnancement Analyse de compétitivité Respect des échéances Résultats connus L’algorithme SRPTF et le système de tâches MAD EDF, RM & DM LLF Technique d’augmentation de ressources Temps de réponse maximum Conclusion First, I’ll state the context with an example and I’ll define the task system. Then we first determine the complexity of the feasibility problem. We also present scheduling anomalies occurring while scheduling tasks with self-suspension under EDF. Then, with competitive analysis, we prove that classical scheduling algorithms fail to schedule task systems having arbitrary small utilization factors whereas there exist trivial off-line feasible schedules. Lastly, we show that increasing the processor speed does not improve the performance of EDF. To finish this presentation, the conclusion. F. Ridouard
Analyse de compétitivité (bis) Ratio de compétitivité (Minimisation) cA : A: performance atteinte par l’algorithme en-ligne A. *: performance atteinte par l’adversaire cA cA 1 More formally, given a performance criteria cigma and an on-line algorithm A, then, A is the value obtained by A and * is the value obtained by the optimal clairvoyant algorithm. The competitive ratio cA of the algorithm A is the worst-case ratio while considering any instance I. CA is less than or equal to 1. cA=1, alors A est un algorithme optimal F. Ridouard
Temps de réponse maximum EDF est au mieux 2-compétitif pour minimiser le temps de réponse maximum. 1 : 2 : K 4K 4K-1 F. Ridouard
Temps de réponse maximum 2 EDF, DM, et RM 4K At time 0, 0 and 1 are available, SRPTF schedules 0 because 0 has the shortest remaining processing time. After, the first subtask of task I is scheduled at time i (1 = i = n) and the second at time K + (i - 1). All deadlines expect one are missed. The clairvoyant algorithm schedules 1 at time 0 and it schedules every task i (i . {2, . . . , n}) at time i - 1. To finish, the clairvoyant algorithm schedules 0. We can set the utilization factor as small as possible in increasing the suspension delays of tasks with self-suspension. If we use the same instance I, EDF, DM and RM assign priorities to the tasks exactly as SRPTF do. Consequently, we obtain the same conclusions for all these scheduling algorithms. 2 Algorithme Optimal 4K F. Ridouard
Temps de réponse maximum LLF est au mieux 2-compétitive pour minimiser le temps de réponse maximum. 1 : 2 : K 4K 2K+2 F. Ridouard
Temps de réponse maximum 2 LLF 4K At time 0, 0 and 1 are available, SRPTF schedules 0 because 0 has the shortest remaining processing time. After, the first subtask of task I is scheduled at time i (1 = i = n) and the second at time K + (i - 1). All deadlines expect one are missed. The clairvoyant algorithm schedules 1 at time 0 and it schedules every task i (i . {2, . . . , n}) at time i - 1. To finish, the clairvoyant algorithm schedules 0. We can set the utilization factor as small as possible in increasing the suspension delays of tasks with self-suspension. If we use the same instance I, EDF, DM and RM assign priorities to the tasks exactly as SRPTF do. Consequently, we obtain the same conclusions for all these scheduling algorithms. 2 Algorithme Optimal 4K F. Ridouard
Plan : Introduction Complexité du problème d’ordonnancement Exemple Système de tâches Complexité du problème d’ordonnancement Calcul de complexité Anomalies d’ordonnancement Algorithmes d’ordonnancement Analyse de compétitivité Résultats connus L’algorithme SRPTF et le système de tâches MAD EDF, RM & DM LLF Technique d’augmentation de ressources Conclusion First, I’ll state the context with an example and I’ll define the task system. Then we first determine the complexity of the feasibility problem. We also present scheduling anomalies occurring while scheduling tasks with self-suspension under EDF. Then, with competitive analysis, we prove that classical scheduling algorithms fail to schedule task systems having arbitrary small utilization factors whereas there exist trivial off-line feasible schedules. Lastly, we show that increasing the processor speed does not improve the performance of EDF. To finish this presentation, the conclusion. F. Ridouard
Conclusion Résultats négatifs pour l’ordonnancement de tâche à suspension : Ordonnancer des tâches à suspension, à départ simultané et à échéance sur requête est un problème NP-difficile au sens fort. Présence sous EDF d’anomalies d’ordonnancement. Les algorithmes classiques d’ordonnancement ne peuvent pas ordonnancer certaines instances même avec un facteur d’utilisation du processeur arbitrairement faible alors qu’il existe un ordonnancement hors-ligne trivial faisable. L’allocation d’un processeur plus rapide n’améliore pas les performances d’EDF pour ordonnancer des tâches à suspension. Les algorithmes classiques d’ordonnancement que sont EDF, RM, DM et LLF sont au mieux 2-compétitif pour minimiser le temps de reponse maximum. We have presented some negative results to schedule tasks with self-suspension. We have proved that scheduling synchronous tasks having at most one self-suspension and implicit deadlines is NP-hard problem in the strong sense and there is no universal scheduling algorithm, unless P = NP. We have shown that under the EDF scheduling policy, scheduling anomalies can occur at runtime. We have shown that classical scheduling rules can miss deadlines, even if the utilization factor of the processor is arbitrary small, whereas an off-line feasible schedule can be easily defined. Lastly, we also have proved that faster processor does not help to schedule tasks with self-suspensions under EDF. F. Ridouard
Conclusion Futurs travaux : Essayer de définir des solutions pratiques pour l’ordonnancement de système de tâches avec suspensions. Considérer des tâches dépendantes Ressources partagées Contraintes de précédence In further works, we will try to define practical solutions for scheduling such task systems. An other interesting issue will be to consider dependent tasks. Tasks with shared resources Or tasks with precedence constraints F. Ridouard