T HESIS FOR THE DEGREE OF D OCTOR OF P HILOSOPHY
Staticpriority scheduling on multiprocessors ¨ BJORN ANDERSSON
Department of Computer Engineering CHALMERS UNIVERSITY OF TECHNOLOGY G¨oteborg, Sweden 2003
Staticpriority scheduling on multiprocessors ¨ BJORN ANDERSSON ISBN 9172913223 ¨
c BJORN ANDERSSON, 2003. Doktorsavhandlingar vid Chalmers tekniska h¨ogskola Ny serie Nr 2004 ISSN 0346718X School of Computer Science and Engineering Chalmers University of Technology Technical report 17D
Department of Computer Engineering Chalmers University of Technology SE–412 96 G¨oteborg Sweden Telephone: + 46 (0)31–772 1000 www.ce.chalmers.se Author email address:
[email protected]
Printed by Chalmers Reproservice G¨oteborg, Sweden 2003
i
Staticpriority scheduling on multiprocessors ¨ BJORN ANDERSSON Department of Computer Engineering Chalmers University of Technology
Abstract This thesis deals with the problem of scheduling a set of tasks to meet deadlines on a computer with multiple processors. Staticpriority scheduling is considered, that is, a task is assigned a priority number that never changes and at every moment the highestpriority tasks that request to be executed are selected for execution. The performance metric used is the capacity that tasks can request without missing a deadline. It is shown that every staticpriority algorithm can miss deadlines although close to 50% of the capacity is requested. The new algorithms in this thesis have the following performance. In periodic scheduling, the capacity that can be requested without missing a deadline is: 33% for migrative scheduling and 50% for nonmigrative scheduling. In aperiodic scheduling, many performance metrics have been used in previous research. With the aperiodic model used in this thesis, the new algorithms in this thesis have the following performance. The capacity that can be requested without missing a deadline is: 50% for migrative scheduling and 31% for nonmigrative scheduling. Keywords: realtime systems, realtime scheduling, multiprocessors, multiprocessor scheduling, staticpriority scheduling, global scheduling, partitioned scheduling, periodic, aperiodic, online scheduling.
ii
List of papers List of Papers This thesis is based on and extends the work and results presented in the following papers and publications: I. Bj¨orn Andersson and Jan Jonsson, “FixedPriority Preemptive Multiprocessor Scheduling: To Partition or Not to Partition,” In Proc. of the International Conference on RealTime Computing Systems and Applications, pages 337–346, Cheju Island, Korea, December 12–14, 2000. II. Bj¨orn Andersson and Jan Jonsson, “Some Insights on FixedPriority Preemptive NonPartitioned Multiprocessor Scheduling,” Technical Report no. 01–2, Department of Computer Engineering, Chalmers University of Technology, Sweden, 2001. III. Bj¨orn Andersson, Sanjoy Baruah and Jan Jonsson, “StaticPriority Scheduling on Multiprocessors,” In Proc. of the IEEE RealTime Systems Symposium, pages 193202, London, UK, December 3–6, 2001. IV. Bj¨orn Andersson and Jan Jonsson, “Preemptive Multiprocessor Scheduling Anomalies,” In Proc. of the International Parallel and Distributed Processing Symposium, pages 12–19, Fort Lauderdale, Florida, April 15–19, 2002. V. Bj¨orn Andersson, Tarek Abdelzaher and Jan Jonsson, “Global PriorityDriven Aperiodic Scheduling on Multiprocessors,” In Proc. of the International Parallel and Distributed Processing Symposium, Nice, France, April 22–26, 2003. VI. Bj¨orn Andersson, Tarek Abdelzaher and Jan Jonsson, “Partitioned Aperiodic Scheduling on Multiprocessors,” In Proc. of the International Parallel and Distributed Processing Symposium, Nice, France, April 22–26, 2003. VII. Bj¨orn Andersson and Jan Jonsson, “The utilization bounds of partitioned and pfair staticpriority scheduling on multiprocessors are 50%,” In Proc. of the Euromicro Conference on RealTime Systems, pages 33–40, Porto, Portugal, July 2–4, 2003.
iii
iv
LIST OF PAPERS The following papers and publications are related but not covered in this thesis: I. Tarek Abdelzaher, Bj¨orn Andersson, Jan Jonsson, Vivek Sharma and Minh Nguyen, “The Aperiodic Multiprocessor Utilization Bound for Liquid Tasks,” In RealTime Technology and Applications Symposium, pages 173–185, San Jos´e, California, September 24–27, 2002. II. Vivek Sharma, Tarek Abdelzaher, Bj¨orn Andersson, Shiva Prasad, Qiuhua Cao, “Generalized UtilizationBased Aperiodic Schedulability Analysis for Liquid Tasks,” Technical Report at Department of Computer Science, University of Virginia, 2002.
Contents 1 Introduction 1.1 Realtime systems . . . . . . . . . . . . . 1.1.1 Realtime requirements . . . . . . 1.1.2 Satisfying realtime requirements 1.1.3 Verifying realtime requirements . 1.2 Design space of scheduling algorithms . . 1.3 Problems, assumptions and related work . 1.3.1 Problem statement . . . . . . . . 1.3.2 Assumptions . . . . . . . . . . . 1.3.3 Related work . . . . . . . . . . . 1.4 Thesis contributions . . . . . . . . . . . . 1.5 Thesis outline . . . . . . . . . . . . . . .
I
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
Periodic scheduling
15
2 Introduction to periodic scheduling 2.1 Motivation . . . . . . . . . . . . . . 2.2 System model . . . . . . . . . . . . 2.3 Design issues in periodic scheduling 2.3.1 Uniprocessor scheduling . . 2.3.2 Partitioned scheduling . . . 2.3.3 Global scheduling . . . . . 2.4 Detailed contributions . . . . . . . . 3 Global scheduling 3.1 Introduction . . . . . . . . . . 3.2 Results we will use . . . . . . 3.3 Algorithm RMUS(m/(3m2)) 3.3.1 “Light” systems . . . . 3.3.2 Arbitrary systems . . .
1 3 3 4 6 7 9 9 10 11 13 14
. . . . .
. . . . .
v
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
. . . . .
. . . . . . .
17 17 17 19 19 22 23 25
. . . . .
29 29 30 32 32 37
CONTENTS
vi 3.4
Bound on utilization bounds . . . . . . . . . . . . . . . . . . . . . . . 39
4 Partitioned scheduling 4.1 Introduction . . . . . . . . . . . . . . 4.2 Background on partitioned scheduling 4.3 Restricted periods . . . . . . . . . . . 4.4 Not restricted periods . . . . . . . . . 5 Anomalies 5.1 Introduction . . . . . . . . . . 5.2 What is a scheduling anomaly? 5.3 Examples of anomalies . . . . 5.4 Solutions . . . . . . . . . . . 5.5 Anomalyfree partitioning . . 5.6 Generalization . . . . . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
. . . . . .
. . . .
41 41 41 43 49
. . . . . .
51 51 52 52 58 61 66
II Aperiodic scheduling
67
6 Introduction to aperiodic scheduling 6.1 Motivation . . . . . . . . . . . . . . . 6.2 Different system models . . . . . . . 6.3 System model . . . . . . . . . . . . . 6.4 Design issues in aperiodic scheduling 6.5 Detailed contributions . . . . . . . . .
. . . . .
71 71 72 76 77 77
. . . . . .
79 79 79 80 88 88 89
. . . . .
. . . . .
7 Global scheduling 7.1 Introduction . . . . . . . . . . . . . . . . 7.2 Design of EDFUS(m/(2m1)) . . . . . . 7.3 Utilization bound of EDFUS(m/(2m1)) 7.4 Design of a better admission controller . . 7.4.1 Experimental setup . . . . . . . . 7.4.2 Experimental results . . . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
. . . . .
. . . . . .
8 Partitioned scheduling 91 8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 8.2 Partitioned scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . 91 8.3 EDFFF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 9 Conclusions
101
A Impossibility of periodic execution
113
B Admission controllers that can reject admitted tasks
115
CONTENTS
vii
C Defining utilization of aperiodic tasks
117
D A drawback of my definition of utilization in aperiodic scheduling
119
E Utilization and the capacity that is busy in aperiodic scheduling
121
F Utilization and the capacity that is busy in periodic scheduling
125
G Algebraic rewriting used in partitioned aperiodic scheduling
127
viii
CONTENTS
Acknowledgements I’ve had the opportunity to work with many bright, fun or in other ways outstanding people. Dr. Jan Jonsson, my supervisor, didn’t really supervise me, but he had the confidence in me to let me do what I wanted, gave me advise ondemand and tried to figure out what I had in mind so I could write it down more clearly. Of course, I learned the tacit knowledge of research from him but I also learned many non researchrelated things. Professor Per Stenstr¨om gave me a head start in my Ph.D. studies with teaching me research methodology. Dr. Tarek Abdelzaher was my supervisor when I was a visiting scholar at the University of Virginia. He is living proof that there exist people on a tenuretrack position who are pleasant and generous with ideas. I have absorbed some of his visions and some work attitudes. Dr. Sanjoy Baruah helped me to improve the performance of one of the algorithms presented in this thesis, but perhaps more important is his role as a “cheerleader” for multiprocessor scheduling researchers, including myself. I learned that proof is better than prose (and I saw that a clean office promotes productive research!). Magnus Barse has earned his M.Sc. degree from Chalmers, and I acted as his cosupervisor. None of his work is included in this thesis but it helped me to confirm my guesses about cachememory behavior in multiprocessors when a task can migrate between processors. Some people in the scientific community anonymously reviewed and refereed my results before publication. I appreciate their having taken valuable time to read my manuscripts. The undergraduate students that I have taught in realtime computing classes offered creative solutions when they handed in their exams and a healthy perspective – scheduling is not the only problem in realtime systems. Other people that I have interacted with have offered interesting discussions about research and nonresearch issues, scrutinized my proofs, proofread manuscripts before submission, listened to dry runs on conference presentations, spent time being in my Ph.D. student evaluation group, helped me with mathematical issues, helped me with LATEX issues, helped me to move to/from an apartment, given water to the flowers in my
ix
x
ACKNOWLEDGEMENTS
office, postponed the upgrading of the file server simply to let my simulation finish first, collected all those pages of my Ph.D. thesis that were blown away by the wind, cooked me dinner, paid for dinner, paid taxi drivers, negotiated with taxi drivers, and finally — made life more pleasant. I remember you. This work was funded by PAMP, a cluster within the national Swedish RealTime Systems research initiative ARTES (www.artes.uu.se), supported by the Swedish Foundation for Strategic Research.
Chapter 1
Introduction Human beings face hurdles and annoyances in their everyday life. For example: they need to transport themselves from point A to point B (sometimes jeopardizing their life in traffic!), they need to clean their homes, take the garbage out and watch out so that the delicious apple pie in the oven does not get burned. Why is it that no one has designed machines that take care of this for us? Is it because appropriate motors or sensors are not available? Or because energy is too expensive or batteries are too bulky? Or because strong enough materials are not yet available? Very often, the answer is: no one can program a computer to do it. Writing computer programs requires domain knowledge of the problem to be solved. For example, a computer which cleans my home needs to distinguish between my items (which should not be thrown away) and dirt (which should be thrown away). This is a big problem; it is such a big problem that it is not addressed in this thesis. However, some general principles exist which can be used in all these applications. One of them, the use of time in computers, is addressed in this thesis. These kinds of computers do not live a life of their own, or solely think about their inner operations, meaning of life or computing with 5 1011 decimals; they interact with the physical world, by sensing and acting on it, in realtime. And the dynamics of the environment progresses regardless of whether the computer is on, off, or makes progress, so if the computer’s view of the world is not updated quickly enough, by taking sensor readings, then the computer may act on the basis of old sensor readings and hence take undesirable actions (see Example 1). Example 1 Consider a hypothetical car where a computer in the car is given a street address and the computer automatically drives to that address with no human intervention (research prototypes that can do things similar to this exist [JPKA95] but are not commercially available). Think about yourself as being the computer in the car. You are driving your car and approach a crossing. You see that there is no pedestrian there (a sensor reading) so you close your eyes for a few seconds and listen to
1
CHAPTER 1. INTRODUCTION
2
the radio while your car approaches the intersection, and after those seconds you conclude that you can drive straight ahead without any need to slow down (an action). If, during those seconds, a pedestrian starts to walk at the crossing, an accident may occur, neither because your sensor reading was incorrect nor because you inferred an incorrect action based on your sensor reading, but because your action was based on a sensor reading that was too old. If you had monitored your environment with periodic sampling of a high enough rate, an accident would not have occurred. Let us assume that you woke up in time to see the pedestrian (a sensor reading) so you conclude that you should break or steer away (an action). Although you computed the right answer (that is, made the right decision) this is not sufficient for successful driving; you need to apply a break force quickly enough, that is, before a deadline. This deadline depends on states in the environment, for example, the speed of your car and the distance from your car to the pedestrian. As seen in Example 1, it is necessary to meet timing requirements, for example completing the execution of a task before a deadline. These kinds of computers, called realtime systems, are challenging to design mainly for two reasons: First, the view that computer programmers have of the computer is based on the idea that a processor executes instructions sequentially [Neu62] and there is often an idea that a sequence of instruction has a beginning and an end [Neu62, page 41]1 . This view is inappropriate for realtime systems because here the computer may need to monitor and control many different physical processes that run in parallel and they have no beginning or end. The computer processes a stream of data, or events, rather than one single, large job. Second, the design of software in non realtime systems can benefit greatly from ideas like decomposition and informationhiding [Par72] to create building blocks (for example, processes, subroutines or objects) that compute the right result regardless of the existence of other building blocks. However, in realtime systems, each building block may execute (if it is a task) or cause blocking (if it is a shared data object) and hence affects the timing of other building blocks, causing many (potentially subtle) dependencies, which complicate the design. Hence, it should come as no surprise that it requires more effort to design a realtime system than the corresponding nonrealtime system. Since many physical processes run in parallel and a computer can execute only one instruction at a time, it is necessary to schedule the processor to run some instructions to service one physical process and then some other instructions to service another physical process in such a way that the computer can keep pace with all the physical processes in its environment. This can be translated into the problem of scheduling a set of tasks, each consisting of a sequence of instructions, so that the timing requirements of the tasks hold. This thesis deals with the problem of scheduling, but first let us take a broader look at realtime systems. 1
It was suggested that a bell should ring when the task had finished.
1.1. REALTIME SYSTEMS
3
1.1 Realtime systems 1.1.1 Realtime requirements What is a realtime requirement? In my view, a realtime requirement is a requirement which includes the time instant of one or many events. With this definition, the following is a realtime requirement: a task needs to finish its execution (an event) no later than 10 ms from when its execution was requested (an event). Some requirements do not express anything related to time — for example: the system must tolerate two faults — so they are clearly not realtime requirements. Other requirements express a quantity which includes time, for example throughput (number of jobs completed per time unit) or power dissipation (energy “destroyed” per time unit), but do not say anything about events, so neither are they realtime requirements.
Why do realtime requirements exist? Typically, timing requirements come from the following design process. First, a designer specifies how the environment and the computer system in general should behave. For example, (i) a human user who presses a button should perceive that the computer responds instantaneously, (ii) an aircraft should be at approximately the altitude that the pilot wants it to be, (iii) a computer should count the number of products that have passed a conveyor belt. Then the designer derives timing requirements such that, if these timing requirements are satisfied, then the behavior is as desired. The derived timing requirements tend to be a function of the state of the environment, for example (i) whether the user perceives the response to be instantaneous depends on the attentiveness of the human being, and it varies between individuals (because their blood sugar level and how many hours they have slept the night before are different), (ii) the time delay that can be tolerated between sensing and acting in order to keep an aircraft at the desired altitude depends on how large an error one can tolerate, the dynamics of the aircraft and the weather situation, and (iii) the time delay from when a product on a conveyor belt causes an interrupt until the computer processes this interrupt, perhaps incrementing a counter, depends on the speed of the conveyor belt and whether a sensor board can buffer events. Since the timing requirements are a function of the state of the environment, and the state of the environment is not known at design time, one typically selects pessimistic timing requirements such that if these pessimistic timing requirements are satisfied then the timing requirements that depend on the state of the environment are satisfied as well.
What happens if realtime requirements are violated? The consequence of not satisfying timing requirements depends on the environment. It may lead to a disaster (like failing miserably to control an aircraft so it crashes). But often it does not do too much harm. For example, if the environment is in a state that is not too vulnerable (for example, on this day, the speed of the conveyor belt was a little bit slower or at this moment two consecutive products just happened to be separated more than other products), then failing to satisfy the timing requirement that the designer had chosen by just
4
CHAPTER 1. INTRODUCTION
a little may be tolerable without violating the desired behavior of the environment (for example, the counter that keeps track of the number of products produced is correct). Furthermore, even if timing requirements were violated and even if the environment did not behave as desired, it may be just annoying (the passenger felt that the aircraft did not fly smoothly) but no disaster happened (the aircraft did not crash). It is common in the research literature to distinguish between hard/soft/firm deadlines/realtime computing. However, my opinion is that this separation is not fruitful for two reasons. First, these concepts are too vague: do they describe the consequence of missing a deadline or how abruptly the value of the results depends on timeliness? And do they describe the deadline imposed by the environment or the deadline chosen by the designer? Second, the hard/firm/soft concepts tend to have different interpretations among different researchers. For this reason, this thesis attempts to avoid these words. In the remainder of this thesis, we will ignore the origin of timing requirements (see for example [Cer03], [Liu00, Chapter 1], [Ram96] and [EJ99] for discussions on the origins of timing requirements) and, when we speak of timing requirements, we mean those timing requirements that are chosen by the designer.
1.1.2 Satisfying realtime requirements Most realtime requirements can be reformulated into a task with an arrival time, a deadline and an execution time. Hence, to satisfy timing requirements, we need to ascertain that: (i) a task does not start to execute too early and (ii) a task does not finish its execution too late. The first problem can be taken care of by making the task runnable at the arrival time or later, and this usually simply involves using timers with good enough accuracy. The second problem is harder; it involves keeping the delay from arrival until the task finishes its execution short enough. Two terms constitute the delay: the time that the task executes and the time waiting for resources needed for execution. The first term can be reduced by making computers and programs faster; the latter can be controlled by scheduling.
Are fast computers sufficient to meet deadlines? It is desirable for all computers and programs, realtime or nonrealtime, to execute quickly, so this is not characteristic for only realtime systems: it is a problem of general interest in computing which has received great attention. Moore’s law [Moo65, page 3] states that the number of transistors per area unit doubles every 18 months and the speed of processors tends to increase exponentially (though at a slightly slower rate) [HP96][page 7]. Does this mean that when computers become fast enough, realtime scheduling is unnecessary? It depends. If a computer becomes k times faster then the execution time of a task becomes 1=k . If the scheduling algorithm applied does not make use of the execution time in its scheduling decisions and if no other resources are used, then it is possible to scale the
1.1. REALTIME SYSTEMS
5
processor speed k , so that when it gets fast enough, all deadlines are met, causing any scheduling algorithms to meet deadlines. For that case, the work in this thesis is not needed. However, as processors become faster, designers use the increased capacity to deliver better service, hence making the scheduling problem still demanding. In addition, even if one can satisfy realtime requirements with fast computers and ignore realtime scheduling techniques, it is often advantageous to use realtime scheduling because doing so makes it possible to meet deadlines with slower processors. Slower processors can be translated to: lower power consumption, lower component costs and greater reliability (because the processor design is older and hence more mature).
Scheduling Scheduling refers to the act of assigning resources to tasks (or assigning tasks to resources; these two viewpoints are equivalent). One way to do this is to generate a timetable with explicit start times for each task in such a way that only one task at a time requests the resource. This is often called static scheduling [XP90, Xu93, Foh94] or timetable scheduling2 . Another solution for scheduling is to assign numbers, called priorities, to tasks and choose for execution the task with the highest priority. Scheduling decisions occur whenever there are more outstanding requests than the number of available resources. The exact priority assigned is unimportant; only the relative priority order is, because it determines which tasks are the highest priority ones. With scheduling based on priorities instead of a timetable, we do not lose any generality because, if we can change priorities at any time and also have the option of introducing idle tasks, then we can emulate every timetable. In addition, scheduling based on priorities can meet deadlines in cases where timetables cannot. This happens when the exact time when a task requests to execute is not known at design time; a task requests to execute when an event occurs — not just because a clock has reached a certain time. The way priorities are assigned to tasks is important because it affects whether deadlines are going to be met. One way to use priorities is to assign the highest priority to the task that is most important, in the sense that if the task misses a deadline then the consequences are the most disastrous. This may seem natural but it has the disadvantage that it may lead to missed deadlines although another assignment of priorities could have lead to that all tasks met their deadlines. But in order to know whether tasks meet their deadlines, we need schedulability analysis.
2
This is the way airliners schedule their flights.
CHAPTER 1. INTRODUCTION
6
1.1.3 Verifying realtime requirements Schedulability analysis Schedulability analysis3 refers to the act of giving a yes/no answer to the question: will a given workload meet all its deadlines when scheduled by a given scheduling algorithm? Schedulability analysis in timetable scheduling is trivial — it is only a matter of reading the timetable checking that all timing requirements hold It is much more complicated for prioritybased scheduling. Schedulability analysis is used in many different ways. It can be used at design time to make sure that a product will function correctly. If the schedulability analysis cannot guarantee that all deadlines will be met, then one may want to stop the shipping of a product because it may be better to ship no product at all than to ship a faulty product. In addition, schedulability analysis often gives a hint about why a deadline was missed, which can be helpful in a redesign of a faulty system. Schedulability analysis can be used to guide design decisions, for example in choosing the smallest sampling period that can be used while meeting all deadlines. Finally, some schedulability analysis techniques can be expressed as a closedform expression such as: if (a simple expression is true) then all deadlines are met. If this expression is simple enough then it can be used to determine how slow a processor one can use and yet meet deadlines. Schedulability analysis can also be used at runtime to determine whether a task should be admitted to the system. If a task is not admitted (that is, rejected) then it will not consume any resources. The reason why admission control is useful is that, if it were not used, then it could happen, in overloaded cases, that all tasks execute a little but not enough to complete execution before its deadline. Then almost all deadlines are missed, although capacity was available for a subset of the tasks to complete before their deadlines (see the example in [SSRB98, Chapter 5]). This reasoning is based on the assumption that missing a deadline is as bad as not running the task at all. Another benefit of admission control is that all admitted tasks meet their deadlines. This can be important in applications where missing a deadline has severe consequences but not running the task at all is not that severe (see Example 1).
Robustness With a robust scheduling algorithm, every workload that satisfied all timing requirements can be modified in such a way that, if one task is changed to reduce the amount of capacity requested, then all tasks continue to meet deadlines. Such a situation can happen in for example processor upgrades (because the execution time of a task decreases) or when a sensor is replaced by a new one with a lower frequency of samples (and hence a longer period). In addition, programs often execute for a shorter time than their maximum execution time because input data tend to cause programs to execute different paths and access memory locations differently. Hence, if the schedul3
A related concept is feasibility analysis. Feasibility analysis refers to the question: is there any scheduling algorithm which will cause all timing requirements of this workload to be satisfied? Feasibility analysis can be used in a company before it promises to design a product for a customer.
1.2. DESIGN SPACE OF SCHEDULING ALGORITHMS
7
priority restrictions taskstatic jobstatic dynamic restrictions priority priority priority nonpreemptive partitioned [GL89] [JSM91] global scheduling [Gra69] preemptive partitioned [LMM98b] [LGDG00] [LGDG00] global scheduling [Liu69] [Liu69] [AS00]
Table 1.1: The design space of multiprocessor scheduling algorithms. References show examples of previous work. Areas studied in this thesis are shaded. ing algorithm is not robust, then it is not obvious that timing requirements are satisfied, although they were satisfied when the program executed with its maximum execution time. Clearly, a robust scheduling algorithm simplifies verification.
1.2 Design space of scheduling algorithms This thesis deals with realtime scheduling on a computer with many processors (called a multiprocessor). We assume that each processor has the same capability and the same speed and that a task is not preassigned to a specific processor. The design space of realtime scheduling algorithms on multiprocessors is diverse (see [CK88]). This is mainly because algorithms solve different problems, that is, they solve problems with a wide range of different realtime requirements, sometimes with a deterministic and sometimes with a probabilistic way of describing the problem. Different requirements on the task behavior further increase the number of scheduling problems; for example, when a task arrives and then executes until completion, does it vanish or does it arrive again? Other requirements are not realtime requirements and are not a part of the workload, but they are constraints on the scheduling algorithm. For example, realtime scheduling of frames in communication networks has to be done in a nonpreemptive manner; this is not a realtime requirement but it is a requirement on scheduling due to the nature of packetized datacommunication. Because of this diversity, we will not cover the whole design space.
Overview of the design space Table 1.1 illustrates my view of the design space of scheduling algorithms on multiprocessors and gives examples of results for each option in the design space. I choose to organize the design space according to the restrictions that the scheduling algorithm must obey4 . A related taxonomy is given in [CFH+ 03]. My taxonomy differs from that one in that I (i) include the preemptive vs. nonpreemptive restriction and (ii) do not include restricted migra4
8
CHAPTER 1. INTRODUCTION
A scheduling algorithm is preemptive if the execution of a task can be interrupted and a new task is selected for execution. The task that is interrupted is resumed later at the same location in the program as where the task was preempted. Both nonpreemptive and preemptive scheduling are worth studying: a preemptive scheduling algorithm can succeed in meeting deadlines where a nonpreemptive scheduling algorithm fails but a nonpreemptive scheduling algorithm has naturally the advantage of not having any runtime overhead caused by preemptions. A multiprocessor scheduling algorithm uses the partitioned method if a task is assigned to a processor and the task is allowed to be executed only on that processor. A scheduling algorithm uses global scheduling if a task is allowed to be executed on any processor even when it is resumed after having been preempted. Both partitioned and global scheduling are interesting to study since: a global scheduling algorithm can succeed in meeting deadlines where a partitioned scheduling algorithm fails but a partitioned scheduling algorithm has naturally the advantage of not having any runtime overhead caused by task migrations. A scheduling algorithm selects the task having the highest priority. Recall that a task that has higher priority is not necessarily more important than a task with lower priority; the priorities are only used to generate a schedule that meets deadlines. Different tasks are allowed to have different priorities but, depending on whether the priority of a task can change, we can distinguish between two cases: where the priority of a task remains fixed during the whole operation of the system, static priority, and where the priority is allowed to change at any time, dynamic priority. Both static and dynamic priority scheduling are interesting: a dynamicpriority scheduling algorithm can succeed in meeting deadlines where a staticpriority scheduling algorithm fails, but a staticpriority scheduling algorithm is often implemented in currently available operating systems and in scheduling of interrupt handlers. The reason why staticpriority scheduling has been so popular is probably because it distinguishes between mechanism and policy: an operating system can export an interface to assign a static priority to a task without any knowledge of deadlines, how deadlines are assigned or which task is most important. Because a task may arrive periodically, we need to distinguish between two types of staticpriority scheduling: taskstatic priority and jobstatic priority. If a task can arrive multiple times, then a taskstatic priority algorithm needs to keep the same priority every time a task arrives, but a jobstatic priority only needs to keep the priority static for one task arrival. When a task arrives again, it may be given another priority. If a task arrives only once (we call this an aperiodic task) then taskstatic priority and jobtion. The reason for not including restricted migration is that there are two (perhaps even more) ways to schedule tasks with restricted migration based on how one answers the question: when is a task assigned to a processor? When it arrives, or when it starts to execute? The taxonomy in [CFH+ 03] appears (based on [BC03]) to assume that a task is assigned when it arrives, but others [HL94] assume that a task is assigned when it starts to execute. I think that it is not clear which interpretation of restricted migration is most interesting.
1.3. PROBLEMS, ASSUMPTIONS AND RELATED WORK
9
static priority are synonymous. When we speak of staticpriority scheduling, we mean taskstatic priority scheduling. This thesis addresses staticpriority preemptive scheduling with partitioned and global scheduling. This is indicated by the shaded areas in Table 1.1.
1.3 Problems, assumptions and related work 1.3.1 Problem statement The problem addressed in this thesis is: How much of the capacity of a multiprocessor system can be requested without missing a deadline when staticpriority preemptive scheduling is used? Of course, the answer to this question depends on the scheduling algorithms used. With a poor scheduling algorithm, it can happen that close to 0% of the capacity is requested and a deadline is still missed. For this reason, this thesis aims to design scheduling algorithms that maximize the capacity that can be used without missing a deadline. We will discuss three aspects related to the capacity of staticpriority scheduling on multiprocessors: scheduling algorithms, schedulability analysis and robustness.
Scheduling algorithms In global staticpriority scheduling, the way an algorithm can affect when a task is executed is to assign priorities. Hence, an important research question is to assign priorities so that all tasks meet their deadlines. And, if a task misses a deadline with this priority assignment, we want this to happen only because the capacity that was requested was large. In partitioned staticpriority scheduling, two algorithms are needed in order to schedule tasks: (i) a tasktoprocessor assignment algorithm and (ii) an algorithm to assign priorities to a task and these priorities are only used locally on each processor. As we will see (in Part I), assigning priorities to tasks running on a uniprocessor is straightforward. The main challenge in partitioned scheduling is thus to assign tasks to processors.
Schedulability analysis Whether tasks meet their deadlines or not, depends not only on how much capacity is requested; two different workloads may request the same capacity, but the arrival times of tasks are different and the individual execution times of tasks are different so that one workload meets all deadlines whereas the other workload does not. Schedulability analysis techniques that incorporate knowledge of arrival times and execution times can often be used to guarantee that deadlines are met even if the capacity that is requested is high. In addition, such a schedulability analysis is often helpful when proving that a scheduling algorithm meets all deadlines if less than a certain capacity is requested, regardless of task arrival times.
10
CHAPTER 1. INTRODUCTION
In staticpriority scheduling, the scheduling of a task is unaffected by its lower priority tasks. Hence, the problem in schedulability analysis is to compute how much a task can be delayed by higher priority tasks. Typically, we attempt to find not exactly how much a task is delayed by the execution of higher priority tasks but rather an upper bound on that delay. We do so because (i) if a task arrives at multiples times, for example periodically, then it may be delayed by different amounts at different times or (ii) the execution times are not known exactly but there is a known upper bound on them. The approach to schedulability analysis taken in this thesis is based on computing the capacity that is requested and compare it to the minimum capacity that can be requested without missing a deadline. This kind of schedulability analysis has the drawback of being very pessimistic, in the sense that many workloads could actually meet their deadlines but our schedulability test cannot guarantee that at design time. However, our schedulability test offers the following advantages: (i) execution times do not necessarily have to be known, it may be possible to measure the capacity that is requested, and (ii) it is computationally efficient in that the number of steps required to give a yes/no answer is proportional to the number of tasks, even when a task arrives periodically.
Robustness Finding the greatest capacity that can be requested without missing a deadline is one mean to achieve robustness in that if less of the capacity is requested then deadlines are met and if execution times decrease or arrival periods increase then deadlines are still met. But there are scheduling algorithms such that if they are applied to some workloads then deadlines are met but changing the workload in an intuitively positive way leads to a missed deadline. These workloads are called anomalies and naturally finding the existence of anomalies in a scheduling algorithm is interesting because they show that the scheduling algorithm is not robust.
1.3.2 Assumptions Every scientific study is based on a model and that model has its own assumptions. There is often a tradeoff between choosing a model which is on the one hand (i) expressive (to allow many applications to be used) and realistic (to describe something which is close to problems that designers in the industry face) and on the other hand a model which is (ii) simple enough to allow reasoning. I believe that a simple model, where one understands what is actually happening, can, without too much difficulty, be extended to become more realistic, while the opposite — trying to understand something from a complex (though realistic) model — is in general much harder. In this thesis, I will make the following assumptions: A1. The deadlines are given as requirements to the scheduling algorithm, that is, the scheduling algorithm is not permitted to change the deadlines.
1.3. PROBLEMS, ASSUMPTIONS AND RELATED WORK
11
A2. The characteristics of the workload (arrival times, periods and execution times) are given as requirements to the scheduling algorithm, that is, the scheduling algorithm is not permitted to change that. A3. If all tasks meet their deadlines then the scheduling algorithm has succeeded; if a task misses a deadline, even if it finishes just a little later than the deadline, then the scheduling algorithm has failed. A4. Tasks do not request any other resources than a processor. A5. The arrival times of tasks are independent, that is, the execution of one task does not affect the arrival of another task. A6. The execution time of a task is not a variable with an upper and lower bound. It is a constant, but different tasks may have different execution times. The execution or absence of execution of a task may of course affect the finishing time of other tasks, but it does not affect the execution time of other tasks. A7. Preemption is permitted at any time and has no associated overhead. When we speak of preemption, we mean that the execution of a task is suspended and its state is saved in such a way that the task can resume its execution in the same location in the program. For scheduling algorithms that allow task migration (that is, global scheduling), no overhead is associated with migration, even if a task resumes on another processor than the one on which it was preempted. A8. There are no faults in hardware or software. A9. The speed of a processor does not change and cannot be changed. A10. A task cannot execute on two or more processors simultaneously, and a processor cannot execute two or more tasks simultaneously.
1.3.3 Related work The problem of finding how much of the capacity that tasks can request without missing a deadline is well studied. In dynamic priority scheduling on uni and multiprocessors, there are algorithms that can meet deadlines as long as less than 100% of the capacity is requested. In uniprocessor scheduling, an algorithm called EarliestDeadlineFirst (EDF) [LL73] can do this. In multiprocessor scheduling, a family of algorithms called dynamicpriority pfair scheduling [BCPV96] can do this too. We will ignore these algorithms because they are not staticpriority scheduling algorithms and hence not in the scope of this thesis. Some work in pfair scheduling uses static priorities [Bar95, RM00, Ram02, AJ03] but this thesis ignores them as well because (i) periods and execution times must be a multiple of a time quantum, and this time quantum cannot be arbitrarily small in practice, and (ii) it is not obvious among researchers whether they should be counted as staticpriority scheduling algorithms.
CHAPTER 1. INTRODUCTION
12
restrictions preemptive partitioned global scheduling
arrival pattern periodic aperiodic scheduling scheduling
: ! 0:50 0:00 ! 0:33
0 41
: ! 0:31 0:00 ! 0:50
0 00
Table 1.2: The contributions of this thesis. The figures show, for stateoftheart algorithms, the capacity that can be requested without missing a deadline. The figure to the left of the arrow is the capacity prior to the work in this thesis, whereas the figure to the right of the arrow is the capacity resulting from the work in this thesis.
In uniprocessor staticpriority scheduling, it is known that if less than 69% of the capacity is requested then there is a priorityassignment scheme, called ratemonotonic, that schedules tasks to meet all deadlines [Ser72, LL73]. Unfortunately, applying this priority assignment scheme in global scheduling can lead to deadline misses even with workloads that request close to 0% of the capacity [Dha77, DL78]. This is called Dhall’s effect. An alternative approach without migration, called the partitioned approach, was suggested. Here, the set of tasks is partitioned, and each partition has a processor; a task is assigned to the processor of its partition. Hence, the multiprocessor scheduling problem is transformed into many uniprocessor scheduling problems [Dha77, DL78] for which the ratemonotonic priorityassignment scheme can be applied. This avoids the problem of Dhall’s effect, and several algorithms for partitioning tasks have been proposed [Dha77, DL78, DD85, DD86, BLOS95, OS95a, OS95b, LMM98b, SVC98, LW82, OB98, LDG01]. However, it was not until 1998 that one of these algorithms was analyzed in terms in how much of the capacity can be requested without missing a deadline. It was found that one algorithm, RMFFS, meets all deadlines if less than 41% of the capacity is requested [OB98]. During my work on this thesis, staticpriority scheduling on multiprocessors has received increasing attention. It is known that, in global scheduling, an algorithm called RMUS(0.37) can meet all deadlines as long as 37% of the capacity is requested [Lun02]. A model of how to describe the capacity requested by aperiodic tasks was developed [AL01] and applied in various scheduling problems [AL01, AAJ+ 02, LL03, AS03]. Most notable is the DMUS(0.35) algorithm [LL03], which meets all deadlines as long as 35% of the capacity is requested. Further discussions concerning related work are given in Part I and Part II of this thesis where the system models used are thoroughly defined.
1.4. THESIS CONTRIBUTIONS
13
1.4 Thesis contributions The main contribution of this thesis to the state of the art in staticpriority preemptive multiprocessor scheduling is that I have found how much of the capacity that tasks can request without missing a deadline. The contributions are illustrated in Table 1.2. C1. I have shown that regardless of whether partitioned scheduling or global scheduling is used, and regardless of whether tasks arrive periodically or aperiodically, there are workloads that request just a little over 50% of the capacity and yet it is impossible to design a staticpriority scheduling algorithm to meet all deadlines. C2. For global periodic scheduling, I have designed an algorithm that meets all deadlines if 33% or less of the capacity is requested. This result is significant because before I started my research, the best algorithm in global staticpriority scheduling could miss deadlines even when the fraction of the capacity that the workload requested approached 0% [DL78]. C3. For partitioned periodic scheduling, I have designed an algorithm that meets all deadlines if 50% or less of the capacity is requested. This result is significant because, as stated above, no staticpriority scheduling algorithm can guarantee that a fraction of the capacity greater than 50% can be used without missing a deadline. The best partitioned staticpriority scheduling algorithm could only guarantee that 41% could be requested without missing a deadline [OB98, LDG01]. C4. For global aperiodic scheduling, I have designed an algorithm that meets all deadlines if 50% or less of the capacity is requested. This result is significant because, as stated above, no staticpriority scheduling algorithm can guarantee that a fraction of the capacity greater than 50% can be used without missing a deadline. Other work that uses our definition of capacity has focused on a more restricted type of priorityassignment schemes and they can guarantee that all deadlines are met if 35% of the capacity is requested [LL03]. C5. For partitioned aperiodic scheduling, I have designed an algorithm that meets all deadlines if 31% or less of the capacity is requested. There is no previous work that uses our definition of capacity. C6. I have shown that scheduling anomalies can happen in several previously known preemptive multiprocessor scheduling algorithms for global and partitioned scheduling. I have also designed a partitioned scheduling algorithm that is free from anomalies. Previously, anomalies were only known in nonpreemptive scheduling [Gra69] and scheduling with preemption but restricted migration [HL94]. The concept of “capacity” is intentionally left undefined because a clear definition depends on the system model used — the system model is different in periodic and aperiodic scheduling. System models and a more precise list of contributions will therefore be given given in the introductions to Part I and Part II.
14
CHAPTER 1. INTRODUCTION
1.5 Thesis outline The remainder of this thesis is structured as follows. Part I presents results in periodic scheduling and Part II results in aperiodic scheduling. The reason for using this structure is that the concepts and system models are different in periodic and aperiodic scheduling. Both global and partitioned scheduling are studied. After Part II follows a chapter, Conclusions, that gives the implications of the results in this thesis. Finally, reasoning that would interrupt the main thread of the thesis is given in a number of appendices.
Part I
Periodic scheduling
15
Chapter 2
Introduction to periodic scheduling 2.1 Motivation Many applications in feedbackcontrol theory, signal processing and data acquisition require equidistant sampling, making the scheduling of periodic tasks especially interesting. Other applications, such as interactive computer graphics and tracking, do not necessarily require periodicity but do require that tasks execute “over and over again”; periodic scheduling is one way to achieve this as well. It would be desirable that a task could be scheduled so that it executed periodically. Some algorithms, for example pinwheel scheduling [BL98], can do this for restricted task sets, but unfortunately this problem is in general impossible to solve (see Appendix A). For this reason we will focus on periodically arriving tasks. In such a system a task arrives (requests to execute), periodically, but its execution is only approximately periodic. The remainder of this chapter is organized as follows. Section 2.2 states the system model that we will use. Issues in the design of uni and multiprocessor scheduling algorithms are discussed in Section 2.3. My contributions are listed in Section 2.4. After this chapter follows the Chapters 3–5 which present my main results: the design of scheduling algorithms, their capacities, and their robustness.
2.2 System model The system model of the periodic scheduling problem that we study is well established in previous research. It is as follows: We consider the problem of scheduling a task set = f1 ; 2 ; : : : ; n g of n inde
17
CHAPTER 2. INTRODUCTION TO PERIODIC SCHEDULING
18
pendent1 , periodicallyarriving realtime tasks on m identical processors. A task arrives periodically with a period of Ti . Each time a task arrives, a new instance2 of the task is created. We denote the k th instance of the task by i;k , where k 2 Z+ . A task is runnable at time t if an instance of i has arrived but this instance has not yet been completed. Each instance has a constant execution time of Ci . Each task instance has a prescribed deadline, Di time units after its arrival. If Di is not written out, then it is assumed that Di = Ti , that is the deadline is equal to the time of the next arrival of the task. The response time of an instance of a task i is the time from its arrival to the time when it has completed Ci units of execution. The response time, Ri , of a task i is the maximum response time of all instances of that task. The interference of an instance of a task i is its response time minus its execution time. The interference, Ii , of a task i is the maximum interference of all instances of that task. The utilization, ui , of a task i is ui = Ci =Ti , that is, the ratio of the task’s execution time to its period. The utilization, U , of a taskP set is the sum of the utilizations of the tasks belonging to that task set, that is, U = ni=1 Ci =Ti . Since we consider scheduling on a multiprocessor system, the utilization is not always indicative of the load of the system. This is because the original definition of utilization is a property of the task set only and does not consider the number of processors. To also reflect the amount of processing capability available, we use the concept of system utilization, Us , for a task set on m processors, which is the average utilization of each processor, that is, Us = U=m. Note that utilization and system utilization describe how much the task set stresses the computer system without referring to any particular time or time interval. It can happen that the system utilization of a task set is less than 100% but there are still time intervals during which all processors are busy. A task is schedulable with respect to an algorithm if all its instances complete no later than their deadlines when scheduled by that algorithm. A task set is schedulable if all its tasks are schedulable. The utilization bound of a scheduling algorithm is a figure such that if the system utilization is less than or equal to the utilization bound then all deadlines are met. With this definition, every scheduling algorithm has the utilization bound of 0%, so when we speak of the utilization bound of an algorithm we usually mean the greatest utilization bound that we are able to prove for an algorithm or the greatest utilization bound that is possible. A task set is feasible with respect to a class of algorithms if there is any algorithm in the class that can schedule the task set to meet all deadlines. When we say feasible without mentioning which class we mean, then it is understood that the class is: all scheduling algorithms that could possible exist that satisfy the two very reasonable constraints that: (i) a task cannot execute on two or more processors simultaneously and (ii) a processor cannot execute on two or more tasks simultaneously. A schedulability test is a condition which tells whether a task set meets its dead1
That is, the execution of one task does not affect the arrival of another task. In Part I, about periodic scheduling, we use the concepts: job, instance and task instance synonymously. 2
2.3. DESIGN ISSUES IN PERIODIC SCHEDULING
19
lines. A schedulability test with a condition such that if it is true then it implies that all deadlines are met is called a sufficient schedulability test. A schedulability test with a condition such that if all deadlines are met then the condition is true is called a necessary schedulability test. A schedulability test that is both sufficient and necessary is called exact. In partitioned scheduling, the system behaves as follows. Each task is assigned to a processor and then assigned a local (for the processor) and static priority. With no loss of generality, we assume that the tasks on each processor are numbered in the order of decreasing priority, that is, 1 has the highest priority. On each processor, the task with the highest priority of those tasks that have arrived but not completed is executed, using preemption if necessary. In global scheduling, the system behaves as follows. Each task is assigned a global, unique and static priority. With no loss of generality, we assume that the tasks in are numbered in the order of decreasing priority, that is, 1 has the highest priority. Of all tasks that have arrived but not completed, the m highestpriority tasks are executed, using preemption and migration if necessary3 in parallel on the m processors. We assume that Ci and Ti are real numbers such that 0 < Ci Ti . Let Si denote the time when i arrives for the first time. We assume that Si is part of the description of the scheduling problem — Si cannot be chosen by the scheduling algorithm and Si cannot be chosen by the designer. When Si cannot be chosen by a designer there are two models, the synchronous model, where 8i : Si = 0 and the asynchronous model, where Si is arbitrary. Unless otherwise stated, we use the most general model, the asynchronous task model. In the asynchronous model, the scheduling algorithm only uses Ti and Ci in its decisions on how to assign priorities — Si are not used, and a task set is deemed schedulable only if it meets all deadlines for every choice of Si .
2.3 Design issues in periodic scheduling 2.3.1 Uniprocessor scheduling It is desirable that a scheduling algorithm causes deadline misses only when it is impossible to meet deadlines. Such an algorithm is said to be optimal4 . EarliestDeadlineFirst (EDF) [LL73] is one of these optimal scheduling algorithms for uniprocessor preemptive scheduling of periodic tasks5 . EDF assigns priorities in the following way. At time t, let di denote the time of the deadline (in our model, the time of the next arrival) of task i . The priority of task i is computed as: prio(i ) = 1=di . (Tasks with a high prio(i ) are chosen over those with a low prio(i ).) EDF will not be discussed further in the context of periodic scheduling because EDF is not a staticpriority scheduling 3
At each instant, the processor chosen for each of the m tasks is arbitrary. If less than m tasks should be executed simultaneously, some processors will be idle. 4 Some authors call it universal. 5 It is optimal for many other models too.
20
CHAPTER 2. INTRODUCTION TO PERIODIC SCHEDULING
algorithm when it is used in periodic scheduling (the priority of different instances of the same task may be different). Unfortunately, no staticpriority scheduling algorithm is optimal (see Example 2). Example 2 Consider two tasks to be scheduled on one processor. The tasks have the following characteristics: T1 = 5; C1 = 2 and T2 = 7; C2 = 3 + . It is assumed that 0 < 2m
Ui
m 2m
1.
Since Ui
(3.2)
1
m2 (Property P2 above) and (k) Similarly from U ( ) 3m 2 X
i 2
(k)
Ui
3mm 2 for each task i
, it can be derived that
m2 : 2m 1
(3.3)
As a consequence of Inequalities 3.2 and 3.3 we may conclude that (k) can be scheduled to meet all deadlines on m processors each of computing capacity ( 2mm 1 ): the processorsharing schedule (which we will henceforth denote OPT), which assigns a fraction Ui of a processor to i at each timeinstant bears witness to the feasibility of (k) . End proof (of Lemma 3.1) 1 Since 2mm 1 (2 m ) = 1, it follows from Theorem 1, the existence of the schedule OPT described in the proof of Lemma 3.1, and the fact that Algorithm RM is workconserving, that
W (RM; m; 1; (k); t) W (OPT; m;
m ; (k); t) 2m 1
(3.4)
for all t 0; i.e., at any timeinstant t, the amount of work done on (k) by Algorithm RM executing on m unitspeed processors is at least as much as the amount of work done on (k) by OPT on m 2mm 1 speed processors. Lemma 3.2 All jobs of k meet their deadlines when rithm RM.
(k)
is scheduled using Algo
CHAPTER 3. GLOBAL SCHEDULING
34
Proof: Let us assume that the first (` 1) jobs of k have met their deadlines under Algorithm RM; we will prove below that the `’th job of k also meets its deadline. The correctness of Lemma 3.2 will then follow by induction on `, starting with ` = 1. The `’th job of k arrives at timeinstant Sk + (` 1)Tk , has a deadline at timeinstant Sk + `Tk , and needs Ck units of execution. From Inequality 3.4 and the fact that the processorsharing schedule OPT schedules each task j for Uj max(0; Sk + (` 1)Tk Sj ) units over the interval [0; Sk + (` 1)Tk ), we have
W (RM; m; 1; (k); Sk + (`
k X j =1
Uj max(0; Sk + (`
(
Tk )
1)
Tk
Sj ))
1)
(3.5)
P Also, at least kj =11 (Uj max(0; Sk + (` 1)Tk Sj )) units of this execution by Algorithm RM was of tasks 1 ; 2 ; : : : ; k 1 — this follows from the fact that exactly (` 1)Tk Uk units of k ’s work has been generated prior to instant Sk + (` 1)Tk ; the remainder of the work executed by Algorithm RM must therefore be generated by 1 ; 2 ; : : : ; k 1 . The cumulative execution requirement of all the jobs generated by the tasks 1 ; 2 ; : : : ; k 1 that arrive prior to the deadline of k ’s `’th job is bounded from above by
kX1l
max(0
j =1
kX1
0.
Using the inequalities of this case yields:
; Sk + `Tk Sj ) max(0; Sk + (` 1)Tk Sj ) = (Sk + `Tk Sj ) (Sk + (` 1)Tk Sj ) = Tk max(0
Applying max(0; Sk + `Tk yields that at most
Sj )
; Sk + (`
max(0
0 @Tk
kX1 j =1
Uj +
kX1 j =1
1)
Tk Sj ) Tk on Inequality 3.7
1
Cj A
(3.8)
remains to be executed after timeinstant Sk + (` 1)Tk . The amount of processor capacity left unused by 1 ; : : : [Sk + (` 1)Tk ; Sk + `Tk ) is therefore no smaller than 0
m Tk
@Tk
kX1 j =1
Uj +
kX1 j =1
; k 1 during the interval
1
Cj A
(3.9)
Since there are m processors available, the cumulative length of the intervals over [Sk + (` 1)Tk ; Sk + `Tk ) during which 1 ; : : : ; k 1 leave at least one processor idle is
CHAPTER 3. GLOBAL SCHEDULING
36
minimized if the different processors tend to idle simultaneously (in parallel); hence, a lower bound on this cumulative length of the intervals over [Sk + (` 1)Tk ; Sk + `Tk ) during which 1 ; : : : ; k 1 leave at least one processor idle is given by (m Tk P P Tk kj =11 Uj + kj =11 Cj )=m, which equals 0
1
Tk
m
@Tk
kX1 j =1
Uj +
kX1 j =1
1
Cj A
(3.10)
For the `’th job of k to meet its deadline, it suffices that this cumulative interval length be at least as large at k ’s execution requirement; i.e.,
kX1
Tk
(
kX1
(T U + C ) Ck m k j =1 j j =1 j kX1 Ck 1 kX1 Cj + ( Uj + )1 Tk m j =1 T k j =1 (Since Tk Tj for j < k ) kX1 1 Uk + (2 Uj ) 1 m j =1 1
(3.11)
Let us now simplify the lhs of Inequality 3.11 above:
Uk +
1
kX1
(2 U) m j =1 j
Uk + m (2 1
=
k X
Uj
Uk )
2
j =1 (By Property P2 of task system ) 2
Uk (1
m
)+
m 3m 2 2
(By Property P1 of task system )
m 3m
1
2
(1
2
m
)+
m 3m 2 2
(3.12) (3.13)
From Inequalities 3.11 and 3.13, we may conclude that the `’th job of k does meet its deadline. End proof (of Lemma 3.2) The correctness of Theorem 3 follows from Lemma 3.2 by induction on k , with k = m being the base case (that 1 ; 2 ; : : : m meet all their deadlines directly follows from the fact that there are m processors available in the system).
3.3. ALGORITHM RMUS(M/(3M2))
37
End proof (of Theorem 3)
3.3.2 Arbitrary systems In Section 3.3.1, we saw that Algorithm RM successfully schedules any periodic task system with utilization U ( ) m2 =(3m 1) on m identical processors, provided each i 2 has a utilization Ui m=(3m 2). We now relax the restriction on the utilization of each individual task; rather, we permit any Ui 1 for each i 2 . That is, we will consider in this section the staticpriority global scheduling of any task system satisfying the condition
U ( )
m2 3m
2
:
For such task systems, we define the static priorityassignment scheme Algorithm RMUS(m/(3m2)) as follows.
Algorithm RMUS(m/(3m2)) assigns (static) priorities to tasks in according to the following rule: if Ui > 3mm 2 then i has the highest priority (ties broken arbitrarily) if Ui 3mm 2 then i has ratemonotonic priority. Example 1 As an example of the priorities assigned by Algorithm RMUS(m/(3m2)), consider a task system
def =
f1 = (T1 = 7; C1 = 1); 2 = (T2 = 10; C2 = 2); 3 = (T3 = 20; C3 = 9); 4 = (T4 = 22; C4 = 11); 5 = (T5 = 25; C5 = 2)g
to be scheduled on a platform of 3 identical unitspeed processors. The utilizations of these five tasks are 0:143, 0:2, 0:45, 0:5, and 0:08 respectively. For m = 3, m=(3m 2) equals 3=7 0:4286; hence, tasks 3 and 4 will be assigned highest priorities, and the remaining three tasks will be assigned ratemonotonic priorities. The possible priority assignments are therefore as follows (highestpriority task listed first):
3 ; 4 ; 1 ; 2 ; 5 or
4 ; 3 ; 1 ; 2 ; 5
CHAPTER 3. GLOBAL SCHEDULING
38
Theorem 4 Any periodic task system with utilization U ( ) m2 =(3m 2) will be scheduled to meet all deadlines on m unitspeed processors by Algorithm RMUS(m/(3m2)). Proof: Assume that the tasks in are indexed according to the priorities assigned to them by Algorithm RMUS(m/(3m2)). First, observe that since U ( ) m2 =(3m 2), while each task i that is assigned highest priority has Ui strictly greater than m=(3m 2), there can be at most (m 1) such tasks that are assigned highest priority. Let ko denote the number of tasks that are assigned the highest priority; i.e., 1 ; 2 ; : : : ; ko each have utilization greater than m=(3m 2), and ko +1 ; : : : n are assigned priorities
def
ratemonotonically. Let mo = m ko . Let us first analyze the task system ^, consisting of the tasks in utilization m=(3m 2):
each having
(k ) ^ def = n o : The utilization of ^ can be bounded from above as follows:
U (^ )
Furthermore, for each i
U ( ) U ( (ko ) ) m m2 ko < 3m 2 3m m(m ko ) = 3m 2 (m3(mko ) k(m) 2ko ) o 2 mo = 3mo 2 =
2
(3.14)
2 ^, we have mo m : Ui 3m 2 3 mo 2
(3.15)
From Inequalities 3.14 and 3.15, we conclude that ^ is a periodic task system that is light on mo processors. Hence by Theorem 3, ^ can be scheduled by Algorithm RM to meet all deadlines on mo processors. Now, consider the task system ~ obtained from by replacing each task i 2 that has a utilization Ui greater than m=(3m 2) by a task with the same period, but with utilization equal to one:
~ def = ^
[
[(Ci ;Ti ;Si )2 ko f(Ti ; Ti ; Si )g : (
)
Notice that Algorithm RMUS(m/(3m2)) will assign identical priorities to corresponding tasks in and ^ (where the notion of “corresponding” is defined in the obvious
3.4. BOUND ON UTILIZATION BOUNDS
39
manner). Also notice that when scheduling ~, Algorithm RMUS(m/(3m2)) will devote ko processors exclusively to the ko tasks in (ko ) (these are the highestpriority tasks, and each have a utilization equal to unity) and will be executing Algorithm RM on the remaining tasks (the tasks in ^) upon the remaining mo = (m ko ) processors. As we have seen above, Algorithm RM schedules the tasks in ^ to meet all deadlines; hence, Algorithm RMUS(m/(3m2)) schedules ~ to meet all deadlines of all jobs. Finally, notice that an execution of Algorithm RMUS(m/(3m2)) on task system can be considered to be an instantiation of a run of Algorithm RMUS(m/(3m2)) on task system ~, in which some jobs — the ones generated by tasks in (ko ) — do not execute to their full execution requirement. By the result of Ha and Liu (Theorem 2), it follows that Algorithm RMUS(m/(3m2)) is a predictable scheduling algorithm, and hence each job of each task during the execution of Algorithm RMUS(m/(3m2)) on task system completes no later than the corresponding job during the execution of Algorithm RMUS(m/(3m2)) on task system ~. And, we have already seen above that no deadlines are missed during the execution of Algorithm RMUS(m/(3m2)) on task system ~. End proof (of Theorem 4)
3.4 Bound on utilization bounds We can show an upper bound on the best possible system utilization bound for any staticpriority multiprocessor scheduling algorithm. Consider the task set
def =
f1 = (L; 2L
; 2 = (L; 2L 1); : : : ; m = (L; 2L 1); m+1 = (L; 2L 1)g 1)
to be scheduled on m processors (L is a positive integer) when all tasks arrive at time 0. For this task set, the system utilization is L=(2L 1) + (L=(2L 1))=m. For global staticpriority scheduling, deadlines will be missed for this task set because all m highest priority tasks will execute at the same time and occupy L time units during [0,2L 1). There will be L 1 time units available for a lower priority tasks, but the lowest priority task needs L time units and thus misses its deadline. By letting L ! 1 and m ! 1, the task set is unschedulable at a system utilization of 1=2. Consequently, the utilization guarantee bound for any global staticpriority multiprocessor scheduling algorithm cannot be higher than 1/2 of the capacity of the multiprocessor platform. This bound of 0:5 applies to all global staticpriority algorithms; it applies even to very complex algorithms such as algorithms that enumerate all possible orders of priorities of tasks. However, if we consider simpler algorithms, algorithms (such as RMUS(m/(3m2))) that assign a priority to a task based on only information of that task — not other tasks, then the utilization bound that we can achieve is even lower. This is illustrated by Theorem 3.1.
CHAPTER 3. GLOBAL SCHEDULING
40
Theorem 3.1 If the priorities of global traditional staticpriority scheduling are assigned according to the function prio(i ) = f (Ti ; Ci ) and if the function f (Ti ; Ci ) is scale invariant, that is f (Ti ; Ci ) < f (Tj ; Cj ) , f (A pTi ; A Ci ) < f (A Tj ; A Cj ) 8A > 0, then the utilization bound is no greater than 2 1. Proof The proof is based on contradiction. Let us assume p that there was one function f (Ti ; Ci ) which had a utilization bound greater than 2 1. For the case of m ! 1, it is necessary that:
f (T
;C =
=1
p
2
< f (T
1+ )
=
p
p
;C = 2
2
2)
p
(3.16)
otherwise, p a task set withpm tasks of Ti = 1,Ci = 2 1 + and one task with Tm+1 = 2, Cm+1 = 2 2 with all tasks arriving at the same time would miss a deadline because the m tasks would p receive the highest priority and hence this would contradict the utilization bound of 2 1. p f (Ti ; Ci ) is scale invariant. We can divide each task parameter by 2. Hence we have:
f (T
=
p1 ; C = 1 p1 2
2
+
p ) < f (T = 1; C = 2
p
2
1)
(3.17)
Consider m +p1 tasks to be scheduled on m processors. p The tasks are characterized p p as: (Ti = 1,Ci = 2 1) for i=1..m and (Tm+1 = 1= 2,Cm+1 = 1 1= 2 + = 2). All tasks arrive at time 0. Because of Equation 3.17,p we have that 1 ; p 2 ; :::m receive p the highest priority pand hence they execute during [0, 2 1). During [ 2 1,1= 2), there are 1 (1= 2) time units available for the lower priority p p task m+1 to execute. During another time interval [0,1= 2), there are still 1 (1= 2) time units available p pfor the lower priority task m+1 to execute. But p m+1 needs to execute 1 1= 2 + = 2 time units and hence it needs to execute p = 2 time units more. Hence it misses its deadline. The system utilization is 2 1 when m ! 1. That is a contradiction. We can conclude that although our algorithm RMUS(m/(3m2)) only achieved a utilization bound of 0:33, it is not too far from what can be achieved given that it only takes a limited amount of information into account in its decisions.
Chapter 4
Partitioned scheduling 4.1 Introduction Before I started my research, the partitioned method was well explored [Dha77, DL78, DD85, DD86, BLOS95, OS95a, OS95b, LMM98b, SVC98, LW82, OB98] and it was known that no partitioned scheduling algorithm can have a utilization bound greater than 0.50 but the best utilization bound known so far was 41% [OB98, LDG01], leaving room for improvements. In this chapter, we show that an algorithm, called RBOUNDMPNFR, has a utilization bound of 50%. We hence close the problem. The remainder of this chapter is organized as follows. Section 4.2 gives a background on partitioned scheduling. We propose an algorithm and prove its utilization bound, first in Section 4.3 where the periods of tasks are restricted and later in Section 4.4 where the periods of tasks are not restricted.
4.2 Background on partitioned scheduling Recall that the partitioned method divides tasks into partitions, each having its own dedicated processor. Unfortunately, the problem of deciding whether a schedulable partition exists is NPcomplete [LW82]. Therefore many heuristics for partitioning have been proposed, a majority of which are versions of the binpacking algorithm1 . These binpacking algorithms rely on a schedulability test in order to know whether a task can be assigned to a processor or not. This reduces our problem from partitioning 1
The binpacking algorithm works as follows: (1) sort the tasks according to some criterion; (2) select the first task and an arbitrary processor; (3) attempt to assign the selected task to the selected processor by applying a schedulability test for the processor; (4) if the schedulability test fails, select the next available processor; if it succeeds, select the next task; (5) goto step 3.
41
CHAPTER 4. PARTITIONED SCHEDULING
42
a set of tasks to meet deadlines into the problem of partitioning a set of tasks such that, on every processor, the schedulability test can guarantee that all tasks on that processor meet their As a schedulability test, a natural choice is to use the knowledge Pndeadlines. p that: if i=1 Ci =Ti np (21=np 1) and ratemonotonic is used to schedule tasks on processor p then all deadlines are met. (We let np denote the number of tasks assigned to processor p.) This schedulability test is often used, but as shown in Example 7 below, this bound is not tight enough to allow us to design a multiprocessor scheduling algorithm with a utilization bound of 50%.
p
Example 7 Consider m + 1 tasks with Ti = 1 and Ci = 2 1 + to be scheduled on m processors. For this system, there must a processor p p which is assigned two Pnbe p tasks. On that processor the utilization is i=1 Ci =Ti = 2 ( 2 1 + ) which is p greater than 2 ( 2 1). Hence, there is no way to partition tasks so that all tasks can be guaranteed by this schedulability test to meet deadlines. We can do this reasoning for every m and every . By letting ! 0 and m ! 1 we can see that the utilization bound for algorithms that are based on this schedulability test cannot be greater than p 2 1, which is approximately 41%. Note that the task set in Example 7 could actually be guaranteed by a necessary and sufficient schedulability test to meet deadlines (provided that is not too large). It is known that if all tasks are harmonic2 then the uniprocessor utilization bound is 100%3 , and then the task set in Example 7 could be assigned with two tasks on one processor. A uniprocessor schedulability test that could exploit this information could allow a multiprocessor scheduling algorithm to achieve a utilization bound of 50%. This is what we will do in the following. RBOUND [LMM98b] is a uniprocessor schedulability test which exploits harmonicity. Let rp denote the fraction between the maximum and the minimum period among the tasks assigned to processor p. If we restrict our attention to the case in which 8p : 1 rp < 2 (we will relax this restriction later), we have the following theorem. Theorem 4.1 (Lauzac, Melhem and Moss´e[LMM98b]) Let B (rp ; np ) = Pnp 1 =np np (rp 1) + 2=rp 1. If i=1 Ci =Ti B (rp ; np ) and ratemonotonic is used to schedule tasks on processor p then all deadlines are met. RBOUNDMP is a previously known multiprocessor scheduling algorithm that exploits RBOUND [LMM98b]. RBOUNDMP combined RBOUND with a firstfit binpacking algorithm. To show which utilization bound a partitioned scheduling algorithm can achieve, we will design two derivatives of RBOUNDMP. First, we will consider an algorithm RBOUNDMPNFRNS (RBOUNDMP with nextfitring noscal2
In a harmonic task set, the periods Ti and Tj of any two tasks i and j are related as follows: either Ti is an integer multiple of Tj , or Tj is an integer multiple of Ti . 3 This is easy to see by dropping the ceiling in the equations/inequalities in exact schedulability tests [JP86, LSD89].
4.3. RESTRICTED PERIODS
43
max T ing) and prove its utilization bound when 1 mini22 Tii < 2. ( denotes the set of all i n tasks.) Then we will consider the algorithm RBOUNDMPNFR (RBOUNDMP with nextfitring) and prove its utilization bound when periods are not restricted.
4.3 Restricted periods max T In this section, we assume that 1 mini22 Tii < 2 holds. Clearly it means that i no matter how we assign tasks to processors, it holds that 8p : 1 rp < 2 and hence Theorem 4.1 can be used. We will use the algorithm RBOUNDMPNFRNS. It works as follows: (i) sort tasks in ascending order of periods, that is, the task with the shortest period is considered first, (ii) use Theorem 4.1 as a schedulability test on each uniprocessor, (iii) assign tasks with the nextfit binpacking algorithm and (iv) when a task cannot be assigned to processor m, try to assign it to processor 1, if this does not work then declare FAILURE. If the algorithm terminates and has partitioned the whole task set then the algorithm declares SUCCESS. Example 8 illustrates the workings of our algorithm RBOUNDMPNFRNS. Example 8 Consider
:
; T3
0 26) (
: ; C3
= 12
4
tasks with
:
; T4
= 0 084) (
f(T1
: ; C1 = 0:935); (T2 = 1:3; C2 = : g to be scheduled on 2 processors
= 11
; C4
= 1
= 0 1)
using RBOUNDMPNFRNS. The algorithm sorts the tasks in ascending order of periods. Reordering the tasks yields: f(T4 = 1; C4 = 0:1); (T1 = 1:1; C1 = 0:935); (T3 = 1:2; C3 = 0:084); (T2 = 1:3; C2 = 0:26)g. We can compute the utilizations of tasks: u4 = 0:1,u1 = 0:85,u3 = 0:07 and u2 = 0:2. The current processor is processor 1. Tasks are now assigned in order. 4 is assigned to processor 1. Then an attempt is made to assign 1 to processor 1, but it fails because the T1 =T4 = 1:1, and n1 = 2 gives a utilization bound of 0:915 for these two tasks, and the sum of utilization of these two tasks is 0.95. Hence 1 is assigned to processor 2. Now, processor 2 is the current processor. An attempt is made to assign 3 processor 2, and it succeeds because T3 =T1 = 1:2=1:1 = 1:09, and n2 = 2 gives a utilization bound of 0:922 for these two tasks, and the sum of utilization of these two tasks is 0:92. Processor 2 is still the current processor. An attempt is made to assign 2 to processor 2, but it fails because max(T1 ; T3 ; T2 )= min(T1 ; T3 ; T2 ) = 1:3=1:1 = 1:18 and n2 = 3 gives a utilization bound of 0:86 for these three tasks, and the sum of utilization of these three tasks is 1:12. Since processor 2 is the last processor and 2 failed, we make an attempt to assign 2 to the first processor, that is, processor 1. This succeeds because T2 =T4 = 1:3=1 = 1:3 and n1 = 2 gives a utilization bound of 0:818 for these two tasks, and the sum of utilization of these two tasks is 0:3. Hence 2 is assigned to processor 1.
CHAPTER 4. PARTITIONED SCHEDULING
44
Theorem 4.2 (Utilization bound of RBOUNDMPNFRNS) IfP RBOUNDMP1 n ui 1=2, then NFRNS is used and T1 T2 : : : Tn and Tn =T1 < 2 and m i=1 RBOUNDMPNFRNS will find a partitioning (declare SUCCESS). Proof Let us assume that the theorem was wrong. Then there must exist a task set that caused RBOUNDMPNFRS to declare failure. If it was not the last task (the one with the longest period) that failed, then we can always remove the task that had a higher index than the failed task, and then the utilization would be lower. Hence, we can assume that it was the task with the greatest index that failed. Let failed denote that task. We will now consider the situation when RBOUNDMPNFRS failed and use the following notation. Let pjk be the task that is the k th task assigned to processor j . Let 1 denote Tp21 =Tp11 . Let 2 denote Tp31 =Tp21 . : : : Let m denote Tfailed =Tpm1 . Let nj denote the number of tasks that are assigned to processor j . n1 requires further explanation because we assign tasks to processor 1 in two states: first when no processor has been assigned a task, and later when all processors have been assigned a task. We let n1 0 denote the number of tasks assigned to processor 1 when RBOUNDMPNFRS declared failure. n1 denotes the number of tasks assigned to processor 1 when p21 was assigned to processor 2. Task p21 could not be assigned to processor 1 because the schedulability test in Theorem 4.1 failed. Hence, on processor 1 it holds that:
up11 + (
n1 X k=2
1
up1k ) + up21 > (n1 + 1)(1n1 +1
1) +
2
1
1
(4.1)
1
(4.2)
In the same way, on processor 2, it holds that:
up21 + (
n2 X k=2
1
up2k ) + up31 > (n2 + 1)(2n2 +1
1) +
2
2
And so on, until processor m, where it holds that:
upm1 + (
nm X k=2
upmk ) + ufailed > 1
nm + 1)(mnm +1
(
1) +
2
m
1
(4.3)
Our algorithm RBOUNDMPNFRS attempts to assign failed to processor 1. It fails so the schedulability test must have failed. Here we do not know anything about T the relationships between the periods (other than 1 failed Ti < 2). Hence we have
up11 + (
n1 X
k=2
up1k ) + ufailed > (n1 0 + 1) (2 n1 0+1 1
1)
(4.4)
4.3. RESTRICTED PERIODS
45
Note that when RBOUNDMPNFRNS declares failure, the utilization of all tasks at processor 1 is greater or the same as the utilization of all tasks at processor 1 when p21 is assigned to processor 2. Our proof hinges on this fact. Since we want to derive a utilization bound we have the following problem:
minimize Us =
1
m
(up11 + (
n1 X k=2 n2 X
up21 + (
k=2
upm1 + (
nm X k=2
up1k ) + up2k ) + ::: +
upmk ) + ufailed )
subject to Inequalities 4.1–4.4 and subject to 0
< upij 1; 8i; j
(4.5)
1 2 : : : m = Tfailed =Tp11 < 2 1
i ; 8i
(4.6)
(4.7)
Note that the constraints Inequality 4.6 and Inequality 4.7 follow immediately from T1 T2 : : : Tn and Tn =T1 < 2, which we assumed in the theorem. We make a relaxation on Inequalities 4.1–4.4 by replacing > by , relax Inequality 4.5 to 0 upij and relax Inequality 4.6 by replacing < by . 1=(n +1) 1) monotonically decreases with increasing One can see that (ni + 1)(i i ni . We can compute limni !1 (ni + 1)(i1=(ni +1) 1) = ln i . Hence we have:
ni + 1)(i1=(ni +1)
(
1)
ln i
(4.8)
ln 2
(4.9)
In the same way, we have:
ni 0 + 1)(21=(ni 0+1)
(
1)
Using Inequality 4.8 and Inequality 4.9, we can relax Inequalities 4.1–4.4. All these relaxations change the constraints such that a point which satisfied all constraints will also satisfy the new constraints. We now have the problem:
CHAPTER 4. PARTITIONED SCHEDULING
46
minimize Us =
1
m
(up11 + (
n1 X k=2 n2 X
up21 + (
k=2
upm1 + (
nm X k=2
up1k ) + up2k ) + ::: +
upmk ) + ufailed )
subject to:
up11 + (
n1 X k=2
up21 + (
n2 X k=2
upm1 + (
nm X k=2
up1k ) + up21 ln 1 + 2=1
1
(4.10)
up2k ) + up31 ln 2 + 2=2
1
(4.11)
:::
upmk ) + ufailed ln m + 2=m
up11 + (
n1 X k=2 0
1
(4.12)
up1k ) + ufailed ln 2
(4.13)
upij ; 8i; j
(4.14)
1 2 : : : m 2 1
i ; 8 i
(4.15) (4.16)
Note that we are not interested in finding every global minimizer. We simply want to find a global minimizer. Hence, at a minimizer, we could always move to a new
4.3. RESTRICTED PERIODS
47
point (with primed variables) which satisfies all constraints and does not increase the objective function in the following way:
upi1 0 = upi1 +
ni X k=2
upik
(4.17)
upik 0 = 0; 8k 2
(4.18)
Note that upij is permitted to be greater than 1. If 1 2 : : : m < 2 then we can increase any i so that 1 2 : : : m = 2. This clearly does not affect the objective function. Neither does it violate any constraints +2=i 1) can be computed to 12 (i 2) and this is nonpositive because @ (ln i@ i i because i 2. i 2 follows from 1 2 : : : m = 2 and 1 i . Hence we have the problem:
minimize Us =
1
m
(up11 + up21 + : : : + upm1 + ufailed )
subject to:
up11 + up21 ln 1 + 2=1
1
(4.19)
up21 + up31 ln 2 + 2=2
1
(4.20)
::: upm1 + ufailed ln m + 2=m up11 + ufailed > ln 2 0
upij ; 8i; j
1 2 : : : m = 2 1
i ; 8i
1
(4.21) (4.22) (4.23) (4.24) (4.25)
Note that in Inequalities 4.19–4.22, each variable upik and ufailed show up in exactly two constraints. Summing the lefthand side of Inequalities 4.19–4.22 and dividing by two gives us a lower bound on the objective function. We can also relax the problem by dropping Equation 4.23 and Equation 4.25. Hence we have the problem:
CHAPTER 4. PARTITIONED SCHEDULING
48
minimize Us = + ln
2 + 2=2
1
m
2
1+
(ln 2 + ln 1 + 2=1
1
: : : + ln m + 2=m
1)
subject to:
1 2 : : : m = 2
(4.26)
A necessary condition for a local minimizer is that the gradient of the Lagrangian function is zero (see for example Theorem 14.1 in [NS96]). Let denote the Lagrange multiplier for 1 2 : : : m = 2. Using this gives us that a necessary condition for a local minimizer is: 1 ( (1=1 m 2
2
=12 )) 2 3 4 : : : m = 0
1 ( (1=2 m 2
2
=22 )) 1 3 4 : : : m = 0
1 ( (1=3 m 2
2
=32 )) 1 2 4 : : : m = 0
1
1
1
::: 1 ( (1=m m 2 1
2 )) 1 2 3 4 : : : = 0 =m
2
Since a global minimizer is a local minimizer, the conditions are also necessary for a global minimizer. Rewriting each of them and using 1 2 : : : m = 2 yields: 1
(1
2
1
(1
2
m m
=1 ) = 4 =2 ) = 4
:::
4.4. NOT RESTRICTED PERIODS
49
Algorithm 1 Scale Task Set.
Input: A task set . Output: Another task set 0. 1: q = T1
2: 3: 4: 5: 6: 7: 8: 9: 10:
i2 q = max(q; Ti )
for each end for
i2 Ti 0 = Ti 2log2 (q=Ti ) Ci 0 = Ci 2log2 (q=Ti )
for each
end for
sort tasks in 0 in increasing period return 0 1
m
(1
=m ) = 4
2
This implies that:
1 = 2 = : : : = m We now have the following problem:
minimize Us =
1 2
m
(ln 2 + m (ln 1 + 2=1
1))
subject to 1m = 2. Rewriting yields:
minimize Us =
1=m ) + 2 (ln (2 2m 2 21=m
ln 2
+
1
s We compute @U @m < 0 and limm!1 Us This states the theorem.
=
= 1 2.
1)
Hence we have that Us
1=2.
4.4 Not restricted periods In this section, we will see that if task periods are not restricted as they were in the previous section, Section 4.3, then it is possible to scale the periods and execution times of all tasks such that the restriction holds. This is meaningful because we will use a theorem which claims that, if the scaled task set meets all deadlines, then the task set which is not scaled also meets its deadlines.
CHAPTER 4. PARTITIONED SCHEDULING
50
Consider two task sets, and 0. is not restricted. 0 is computed from according to Algorithm 1. Note that Algorithm 1 does not change the utilization of tasks. In addition we know that: Theorem 4.3 (Lauzac, Melhem and Moss´e[LMM98b]) Given a task set , let 0 be the task set resulting from the application of the algorithm Scale Task Set to . If 0 is schedulable on one processor using ratemonotonic scheduling, then is schedulable on one processor with ratemonotonic scheduling. Now let RBOUNDMPNFR (RBOUNDMP with nextfitring) be an algorithm which works as follows. First, each task in is transformed according to Algorithm 1 into 0 and the tasks in 0 are then assigned according to RBOUNDMPNFRNS. We can see that every task in has a corresponding task in 0, so i is assigned to the processor where i 0 is. We are now ready to state our utilization bound of RBOUNDMPNFR when tasks are not restricted. Theorem P 4.4 (Utilization bound of RBOUNDMPNFR) If RBOUNDMPNFR is used and ni=1 ui m=2, then RBOUNDMPNFR will find a partitioning (declare SUCCESS). Proof The proof is by contradiction. Suppose that the theorem was false. Then there P would exist a task set with ni=1 ui m=2 which failed. The first thing that RBOUNDMPNFR does is to scale4 the task set, so a scaled task set 0 will also declare failure when scheduled by RBOUNDMPNFRNS. Since Pnui of a task does not change when it is scaled, we have that 0 (which failed) has i=1 ui m=2. But this is impossible according to Theorem 4.2.
4
This does not change ui .
Chapter 5
Anomalies 5.1 Introduction Analysis techniques for realtime systems often require exact knowledge of task characteristics, but this is usually not available, for example: the execution time of a task depends on input data (which is unknown) or the arrival time of a task depends on when an external event occurs (which is unknown). Fortunately, upper and lower bounds are often known, so in order to give guarantees that deadlines are met, an oftenused approach is to make assumptions. For example: (i) assume that a task meets its deadline if it did so when all tasks executed at their maximum execution time or (ii) assume that a task meets its deadline if it did so when all tasks arrived at their maximum arrival frequency. Situations where these assumptions do not hold are referred to as scheduling anomalies, and their existence jeopardizes timeliness or complicates the design process. Anomalies neither occur in popular preemptive uniprocessor scheduling algorithms, such as ratemonotonic (RM) and earliestdeadlinefirst (EDF) [LL73, Mok00], nor in multiprocessor systems with the partitioned scheduling and each processor using an anomalyfree uniprocessor scheduling algorithm. Anomalies can occur in both uniprocessor and multiprocessor systems [GL89, Mok00, SRS95, LS99, Gra69, HL94] due to nonpreemptive scheduling or due to restricted task migration because decreasing the execution time of a task changes the schedule and that can constrain future scheduling choices. However, in preemptive global scheduling and in partitioned scheduling where tasks are repartitioned when the task set changes, it is not known whether scheduling anomalies exist. In this chapter, we study executiontime and period anomalies in preemptive multiprocessor scheduling algorithms. Our objective is to find anomalies and avoid them without introducing too much additional pessimism in the analysis. The remainder of this chapter is organized as follows. Section 5.2 discusses what a scheduling anomaly is. Section 5.3 shows examples of anomalies in preemptive mul
51
52
CHAPTER 5. ANOMALIES
tiprocessor scheduling. Section 5.4 discusses strategies for avoiding anomalies. Section 5.5 describes a new algorithm that does not suffer from anomalies and Section 5.6 generalizes this algorithm.
5.2 What is a scheduling anomaly? In theory of science, an anomaly is an event that contradicts a theory, hence putting the prevailing paradigm up for a test [Kuh62]. In this thesis, and in particular in this chapter, we will use the word “anomaly” in another way. We say that a scheduling algorithm suffers from an anomaly if an intuitively positive change in the task set causes a task to miss a deadline when it met its deadline before the change occurred.
What is a change? Since the task set is only described by Ti , Ci , and Si , we mean that one or many tasks changed their Ti , Ci , or Si .
What is an intuitively positive change? An intuitively positive change is a change that decreases the utilization of one or many tasks in the task set. That is,
Ti increases, or Ci decreases. If Si changes then it is not an intuitively positive change.
What does the scheduling algorithm do when the intuitively positive change happens? I conceive of two ways. One way is that the priority assignment and task assignments remain the same. Another way is that, when the task set changes, the algorithm that assigns priorities and/or assign tasks to processors is run again, hence causing possibly new scheduling decisions. If the period is changed then both ways are reasonable; a change in period may be a consequence of inaccuracies in the clock (first way) or of an algorithm choosing another sampling frequency (second way). If the execution time is changed then the first way is most likely; an execution time was smaller than the maximum execution time because the program executed another path. However, the second way is possible as well, because some programs can give different QualityofService by changing their execution time and then the modification of the execution could be known to the scheduling algorithm. In this chapter, if any of these two ways leads to a deadline miss, then we will say that the scheduling algorithm suffers from anomalies.
5.3 Examples of anomalies This section shows that anomalies can occur in many existing preemptive multiprocessor scheduling algorithms. For different scheduling algorithms there are different reasons why anomalies occur. However, if many scheduling algorithms are similar, and the cause of their anomalies is the same, we present only one example.
5.3. EXAMPLES OF ANOMALIES
1 " 2 " 3 "
"
P1
1;1
P2
2;1
53
"
"
"
"
" " "
1;2 3;1 1;3 3;1 1;4 3;1
0
2;2
3;1
"
1;5
2;3 3;1 8
4
"

2;4

12
16
" " "
" "
(a) Task set schedulable
1 " 2 " 3 "
" "
P1
1;1
P2
2;1 0
" "
1;2 3;1
2;2 4
1;3 3;1
2;3
1;4 3;1
8

2;4 3;1 12

16
(b) Task set unschedulable
Figure 5.1: When 1 increases its period from 3 to 4, the first instance of 3 becomes unschedulable (misses its deadline by four time units). This is because 3 already barely meets its deadline and the delay from higher priority tasks during the first task period increases by 2 (from 4 to 6).
Period anomalies in global scheduling One reason why anomalies can occur in global scheduling is that an increase in period causes tasks to arrive at different times. These different times do not affect schedulability directly, and the schedule generated when the period increases, performs less work on the processors. However, the execution can be distributed differently. This change in distribution of execution causes more instants when all processors are busy, and this delays a lower priority task even more. This can happen in global staticpriority scheduling (see Observation 3). Observation 3 For staticpriority preemptive global multiprocessor scheduling, there exist task sets that meet all deadlines with one priority assignment but if the period of a task increases and priorities remain the same then a task misses its deadline.
54
CHAPTER 5. ANOMALIES
Example 9 Consider the following three periodic tasks: (T1 = 3; C1 = 2); (T2 = 4; C2 = 2); (T3 = 12; C3 = 7). These tasks can be scheduled on two processors (see Figure 5.1(a)). Here S1 = S2 = S3 but even if Si is arbitrary then the task set is still schedulable. However, if we increase the period of 1 from 3 to 4 (but not change the relative priority order), the resulting task set misses a deadline (see Figure 5.1(b)). A similar but different reason for why period anomalies can occur in global scheduling is that an increase in period causes tasks to arrive at different times. These different times make tasks perform less work on the processors, and the execution is not distributed so that all processors are busy at the same time more frequently. However, just the fact that the arrival times are different causes a task to miss its deadline. This can happen in global staticpriority scheduling, but we will not discuss that here. Instead, we will look at a more interesting case, to show that these anomalies are not specific to staticpriority scheduling. We will look at the case in which there are no restrictions on the scheduling algorithm: preemption at any time, migration at any time and priorities can vary at any time. Priorities vary as a function of time in such a way that a deadline is only missed if it is impossible to vary the priorities to meet deadlines; this is called optimal scheduling. Observation 4 illustrates this. Observation 4 In global optimal scheduling, where the deadline Di < Ti , there exist schedulable synchronous task sets (that is S1 = S2 = : : : = Sn ) such that, if the period of a task increases, a task misses a deadline.
Example 10 Consider the following three periodic tasks:
T1
(
; D1
= 4
; C1
= 2
=
; T2 = 5; D2 = 3; C2 = 3); (T3 = 10; D3 = 8; C3 = 7) to be scheduled using global optimal scheduling on two processors. The tasks are schedulable if s1 = s2 = s3 (Figure 5.2(a)). However, if T1 is increased to 5, the resulting task set is no longer schedulable because it is not possible to construct any schedule that makes the tasks meet their deadlines. The reason is that 2 must execute immediately when it arrives, because 2 would otherwise miss a deadline. 1 must execute 1 time unit within [0; 2) and 1 time unit within [5; 7). Figure 5.2(b) illustrates the situation in which 3 starts to execute at time 0 and at time 5. Regardless of when 1 executes within these intervals, the two first instances of 1 will execute at the same time as 2 executes. That is, within the interval [0; 8) there are at least 2 time units when both 1 and 2 execute. That is, during [0; 8) there are 6 time units or less available for 3 to execute. But 3 needs to execute 7 time units in the interval [0; 8). Hence 3 misses its deadline. 1) (
Note that, although an unschedulable synchronous task set is also an unschedulable asynchronous task set, the fact that a scheduling algorithm suffers from anomalies of a synchronous task set does not necessarily imply that there exist asynchronous task sets that suffer from anomalies.
5.3. EXAMPLES OF ANOMALIES
1 " 2 " 3 "
"
P1 1;1 P2
3;1 2;1
0
55
"
"
1;2
3;1
3;1
2;2
" "
1;3
"
3;2 2;3
5
10
"
1;4
"
" " "
3;2 1;5
3;2

2;4

15
20
" "
" " "
(a) Task set schedulable
1 " 2 " 3 "
" "
P1 1;1 P2
3;1
1;2 3;1
2;1 0
" " "

2;2 5

10
15
20
(b) Task set unschedulable
Figure 5.2: Period anomaly in global optimal scheduling. Increasing the period of 1 from 4 to 5 causes the second instance of 1 to miss its deadline.
Periodbased anomalies in binpacking schemes Recall that, with the partition method, binpacking is a common technique for assigning tasks to processors (see for example [DL78, OB98, LDG01]). All partitioning schemes that we will discuss use binpacking. Binpacking algorithms work as follows: (1) sort the tasks according to some criterion; (2) select the first task and an arbitrary processor; (3) attempt to assign the selected task to the selected processor by applying a schedulability test for the processor; (4) if the schedulability test fails, select the next available processor; if it succeeds, select the next task; (5) go to step 3. Step 1, sorting, can be performed by sorting tasks (i) in ascending order of periods, (ii) by decreasing utilization or (iii) to make the period of a task harmonic to the period of its subsequence task. Step 3 can be performed by attempting to assign a task to the processor that the previous task was assigned on (nextfit) or make attempts on all processors that have at least one task assigned to them but make the attempts in order of processor index (firstfit), or make attempts on all processors that have at least one task assigned but select the processor that is heavily loaded but that still can host the task that is to be assigned (bestfit).
56
CHAPTER 5. ANOMALIES
Nextfit and decreasing utilization will be discussed in more detail in Section 5.5. Partitioning schemes based on binpacking never miss deadlines, but they declare failure because a schedulability test in the scheduling algorithm cannot guarantee the task to meet deadlines. For that reason, we will say that the scheduling algorithm suffers from an anomaly iff there is a task set for which the algorithm declares success, but there is at least one task such that, if its utilization is decreased, then the algorithm declares failure. The original binpacking problem did not address processors and tasks, but rather putting items in bins, where items correspond to tasks and bins correspond to processors. For systems, in which bin sizes do not depend on the item sizes, the existence of bin packing anomalies has been shown for firstfit and firstfit decreasing [Gra72]. Since EDF scheduling on a uniprocessor has a utilization bound of 1, which does not depend on the task sets, there clearly exist anomalies for partitioned EDF. In the remainder of this section, we will discuss staticpriority scheduling using partitioning. One reason for the anomaly in binpacking is that, if the period increases, the schedulability test used becomes more pessimistic. That cannot happen if the schedulability test is a utilizationbased test, where the utilization bound does depends on the number of processors (and hence does not depend on execution times or periods). However, one way of improving the schedulability of partitioning schemes is to make the utilization bound dependent on the periods of the tasks. RBOUNDMP [LMM98b] is one such binpackingbased partitioning scheme. Then anomalies can occur. Observation 5 For the partitioning scheme, RBOUNDMP [LMM98b], there exist task sets that can be guaranteed to meet their deadlines, but if the period of a task increases, a task is not guaranteed to meet its deadline. Example 11 Consider the following three periodic tasks: (T1 = 1; C1 = 1); (T2 = 2; C2 = 1); (T3 = 4; C3 = 2) to be scheduled using RBOUNDMP on two processors. During task set transformation in RBOUNDMP, the task set will be changed to (T1 0 = 4; C1 0 = 4); (T2 0 = 4; C2 0 = 2); (T3 0 = 4; C3 0 = 2). The task set transformation is done such that if 0 is schedulable, then is schedulable. Then continue to run the algorithm. 1 0 will be assigned to processor P1 . 2 0 will be attempted to be assigned to processor P1 , but the schedulability test fails because processor P1 is utilized to 100%. 2 0 is then tested to be assigned to processor P2 , and that succeeds because no other tasks are yet assigned to processor P2 . Then 3 0 is tested to be assigned to processor P1 , but the schedulability test fails, so 3 0 is tested to be assigned to processor P2 . The schedulability test, RBOUND, succeeds because the ratio between maximum and minimum period of the task set assigned to P2 is 1, and then the utilization bound according to RBOUND is 100% on that processor. 3 0 is assigned to P2 , and hence the task set is guaranteed to be schedulable according to RBOUNDMP. However, if we increase the period of 1 from 4 to 5, the resulting task set is no longer guaranteed by RBOUNDMP to be schedulable. To see this, we can run the
5.3. EXAMPLES OF ANOMALIES
57
algorithm RBOUNDMP. The task set is transformed to (T1 0 = 4; C1 0 = 4); (T2 0 = 4; C2 0 = 2); (T3 0 = 5; C3 0 = 2). When assigning 1 0 and 2 0, the algorithm RBOUNDMP behaves as previously, that is 1 0 is assigned to processor P1 and 2 0 is assigned to processor P2 . Then 3 0 is attempted to be assigned to processor P1 and that attempt fails, so 3 0 is attempted to be assigned to processor P2 . Now RBOUNDMP behaves differently. The schedulability test fails because the ratio between periods is 5=4 = 1:25, and thereby RBOUND can only guarantee a task set that has a utilization that is no greater than 85%. The utilization of 2 0 and 3 0 is 90%. Hence RBOUNDMP cannot guarantee the task set to be schedulable. It would be tempting to think that if a necessary and sufficient schedulability test is used then these anomalies cannot occur. However, anomalies can still occur for partitioning schemes that sort tasks according to periods, because when periods are changed, the order of how tasks are assigned to processors also changes. One such technique is RMFFS improved by using a necessary and sufficient schedulability test. RMFFS [DL78] is a firstfit binpacking algorithm that originally used a schedulability test that was similar to a utilization based test. Since we use a necessary and sufficient schedulability test, we can be sure that, if the partitioning scheme fails, then a task will actually miss a deadline. Observation 6 For the partitioning scheme, RMFFS improved by using a necessary and sufficient schedulability test, there exist task sets that can be guaranteed to meet their deadlines, but if the period of a task increases, a task misses its deadline. Example 12 Consider the following four periodic tasks: (T1 = 2; C1 = 1); (T2 = 3; C2 = 2); (T3 = 6; C3 = 3); (T4 = 7; C4 = 1) to be scheduled on two processors using RMFFS improved by using a necessary and sufficient schedulability test. RMFFS will first sort the task set according to its periods. That does not change the task set. 1 will be assigned to processor P1 and 2 will be assigned to processor P2 . 3 is tested to be assigned to processor P1 and it succeeds. 4 is tested to be assigned to processor P2 and it succeeds. Hence the task set can be guaranteed. If the period of 3 is increase by 2, we obtain the task set: (T1 = 2; C1 = 1); (T2 = 3; C2 = 2); (T3 = 8; C3 = 3); (T4 = 7; C4 = 1). RMFFS will first sort the task set according to its periods. That yields the task set: (T1 = 2; C1 = 1); (T2 = 3; C2 = 2); (T4 = 7; C4 = 1); (T3 = 8; C3 = 3). 1 will be assigned to processor P1 and 2 will be assigned to processor P2 . 4 is assigned to processor P1 , but 3 cannot be assigned to processor P1 (because then the utilization would be 1:017, and 3 cannot be assigned to processor P2 . It turns out that all previously published partitioning schemes for static priority preemptive scheduling, suffer from period anomalies as long as repartitioning is done when the task set changes. The reasons for the anomalies are the two reasons given so far, or a similar reason as for the executiontime anomaly in the next paragraph.
CHAPTER 5. ANOMALIES
58
Executiontime anomalies in binpacking Because a decrease in execution time of a task can make the schedulability test succeed when it would otherwise fail, the partitioning can become different when subsequent tasks are assigned to processors, making the task set miss deadlines. Observation 7 For the partitioning scheme, RMFFS improved by using a necessary and sufficient schedulability test, there exist task sets that can be guaranteed to meet their deadlines, but if the execution time of a task decreases, a task misses its deadline. Example 13 Consider the following four periodic tasks: (T1 = 5; C1 = 3); (T2 = ; C2 = 4); (T3 = 8; C3 = 3); (T4 = 10; C4 = 4) to be scheduled on two processors using RMFFS improved by using a necessary and sufficient schedulability test. Tasks are sorted according to their periods. That does not change the task set. 1 will be assigned to processor P1 and 2 will be assigned to processor P2 . 3 is tested to be assigned to processor P1 , but fails. 3 is then tested to be assigned to processor P2 , and succeeds. 4 is tested to be assigned to processor P1 , and succeeds. If the execution time of 1 is decreased by 1, we obtain the task set: (T1 = 5; C1 = 2); (T2 = 7; C2 = 4); (T3 = 8; C3 = 3); (T4 = 10; C4 = 4). Tasks are sorted according to their periods. That does not change the task set. 1 will be assigned to processor P1 and 2 will be assigned to processor P2 . 3 is tested to be assigned to processor P1 , and succeeds. 4 is tested to be assigned to processor P1 , but fails. Then 4 is tested to be assigned to processor P2 , but fails again. 7
Similar executiontime anomalies can occur for many other partitioning schemes such as RBOUNDMP, RBOUNDMPrespan, RMFFDU and RMFFDUrespan. RBOUNDMPrespan differs from RBOUNDMP only in that RBOUNDMPrespan uses a necessary and sufficient schedulability test. RMFFDUrespan is defined analogously.
5.4 Solutions Having observed that anomalies can occur for preemptive multiprocessor scheduling, the question arises of how to deal with them. We conceive the following approaches:
Perform system adjustments such that anomalies cannot occur. For example, if the system suffers from period anomalies, but it does not suffer from executiontime anomalies, then we can perform system adjustments on execution times. Use a scheduling algorithm that is designed to dynamically detect anomalies and avoid them. Accept only such task sets that cannot suffer from anomalies. Use a scheduling algorithm that is designed so that anomalies cannot occur.
5.4. SOLUTIONS
59
Since the first approach transfers the problem of anomalies to another parameter, we only discuss the last three approaches below.
Designed to detect anomalies When designing algorithms to determine whether a certain property holds (e.g. whether there exists an offset assignment [Goo03] or whether there exists a schedule [BCPV96] that causes a given task set to meet deadlines), it is often the case that only solutions that are of the same granularity (a multiple of the greatest common divisor) as parameters describing the problem instance need to be explored. If that assumption holds, and if the parameters describing the problem instance are bounded, then the number of computational steps (computational complexity) of an algorithm is bounded by simply enumerating all combinations (which are bounded). Unfortunately, such an approach is not always possible in anomaly detection (Example 14). Example 14 For global staticpriority preemptive scheduling, the following asynchronous task set is schedulable (T1 = 8; C1 = 4); (T2 = 20; C2 = 12); (T3 = 32; C3 = 20) on two processors, assuming global RM. Any combination of increases in period or decreases in execution times that are multiples of 4 causes the task set to be schedulable. However, increasing T1 by a value less than the granularity (for example, 1) makes the task set unschedulable. This example is also applicable to optimal priority assignment. As the example shows, it seems difficult to design a necessary and sufficient condition to determine whether a task set suffers from scheduling anomalies. However, as will be described below, sufficient conditions for anomalyfree task sets are easier to design.
Accept tasks If a scheduling algorithm has a utilization bound, then task sets with a utilization lower than or equal to the utilization bound can neither suffer from executiontime anomalies nor period anomalies. Consequently, in order to avoid anomalies, accept only task sets that have a utilization lower than or equal to this bound. Unfortunately, such an approach introduces additional pessimism, since there are anomalyfree task sets with a utilization that is higher than the bound. We can also use a schedulability test such that if the task set can be guaranteed to meet deadlines according to this schedulability test then the task set is also anomalyfree, assuming that the priority order does not change. Theorem 5.1 does this. Theorem 5.1 (Circumventing anomalies) Consider global staticpriority scheduling of periodic tasks. If, for each task i in a task set, there exists a Riub Ti such that:
Ci +
1
X j Rub k
m j 2hp (i)
i Tj
Cj + 2Cj Riub
(5.1)
CHAPTER 5. ANOMALIES
60
then the task set meets all deadlines. In addition, if all tasks met their deadlines and tasks increase their period and the relative priority order does not change, then all deadlines will continue to hold. Proof For this lemma, we need to show that two conditions are satisfied: I. The task set meets its deadlines. This property has been proven by [LMM98a]. II. Increasing periods does not jeopardize schedulability. j ub k R It is clear that the expression Tij Cj + 2Cj is nonincreasing as Tj increases. Hence, if Equation 5.1 holds and Tj increases, then Equation 5.1 still holds. This implies that the task set remains schedulable even when Tj increases. If Ti increases, neither the lefthand side nor the righthand side (Riub ) of Equation 5.1 will change. Thus, the task set remains schedulable when Ti increases.
Designed to avoid anomalies We conceive three ways of designing scheduling algorithms to avoid anomalies: optimal scheduling, no repartitioning and anomalyfree repartitioning. algorithms that are optimal for Di = Ti must1 have the property that Pn Scheduling Ci i=1 Ti m ) schedulable. Obviously, such algorithms do not suffer from anomalies. However, as we saw in Observation 4, scheduling algorithms that are optimal for Di 6= Ti can still suffer from anomalies. Scheduling algorithms, that partition a task set and apply an anomalyfree uniprocessor scheduling algorithm on each processor and do not repartition the task set when the task set changes do not suffer from anomalies. Unfortunately such an approach can cause deadlines to be missed at a system utilization of zero (Example 15). Example 15 Consider a task set of m + 1 tasks where (Ti = 1; Ci = 0:5 + ) for i = 1::m 1 and (Ti = 1; Ci = 0:5 =2) for i = m and i = m + 1 to be scheduled on m processors. No matter how partitioning and scheduling is done (assuming that we use the partitioned method), the only way that this task set can be made to meet its deadlines is to partition m and m+1 to the same processor, let us say processor Pm . Now, assume that the execution times of tasks changes so that (Ti = 1; Ci = ) for i = 1::m 1 and (Ti = 1; Ci = 0:5 + ) for i = m and i = m + 1. Assuming that m ! 1 and ! 0 and that repartitioning is not allowed, then the task set is unschedulable with a system utilization of zero. 1
In the synchronous case, when task characteristics are integers, PF [BCPV96] is optimal. In the asynchronous case, when characteristics are real numbers, a simple polynomial time algorithm can be designed by using Theorem 1 in [Hor74]. These two algorithms can schedule all task sets with a utilization m.
5.5. ANOMALYFREE PARTITIONING
61
Anomalyfree binpacking can be achieved using a nextfit policy [Mur88]. It is easy to see that such a policy can also be used in realtime scheduling for partitioning of tasks that are scheduled by EDF on each uniprocessors because in EDF each processor has a utilization bound of 1 and hence can be thought of as a bin with a size that does not depend on the size of the elements. However, from the perspective of realtime staticpriority scheduling that result is not fully satisfactory because (i) the algorithm in [Mur88] does not have a system utilization bound, and (ii) a straightforward extension to static priority scheduling does not perform well. The nextfit scheduling algorithm by Dhall [DL78] can be shown to suffer from period anomalies because tasks are sorted according to periods before assignment. Consider, for example, (T1 = 2; C1 = 1); (T2 = 4; C2 = 1); (T3 = 5; C3 = 4) to be scheduled on 2 processors, and then increase T2 by 2 time units. One straightforward extension from binpacking to partitioned multiprocessor scheduling is as follows. Apply the nextfit by [Mur88] (that is, no sorting) but allow a task to be assigned to a processor if the utilization of the tasks that are assigned to the processor and the task that is added is no greater than the Liu and Layland utilization bound [LL73]. Otherwise, assign the task to the next empty processor. However, such an approach can fail with a system utilization of (1=2) ln 2 0:35 (Example 16). Example 16 Consider (M +1)m +1 tasks to be scheduled on m processors using nextfit with initial sorting and Liu and Layland’s utilization bound as the schedulability test. The tasks are given as follows
i = (Ti = 1; Ci = M2+1 (21=(M 1) i = (Ti = 1; Ci = 12 )
if i
6= ((M + 1 )m + 1 ) V
M
if i
6= ((M + 1 )m + 1 ) V
i = (Ti = 1; Ci = 1)
if i
1))
The task set misses a deadline and as we let utilization is (1=2) ln 2 0:35.
m
i
1) mod (
i
1) mod (
( (
M + 1) = 0 M + 1) 6= 0
= ((M + 1 )m + 1 )
! 1 and M ! 1, the system
Hence there is a need for a staticpriority partitioning scheme that: (i) does not suffer from anomalies and (ii) has a utilization bound that is no lower than the best partitioning schemes. The second item means that we should strive for a utilization bound of 0:5 because this is what we achieved in chapter Chapter 4. However, this turns out to be difficult, and when I started my research, the best utilization bound was 0:41, so achieving 0:41 is sufficient to meet our goal.
5.5 Anomalyfree partitioning In this section, we will propose a partitioning scheme RMDUNFS that avoids both period and executiontime anomalies, while still providing a system utilization bound
62
CHAPTER 5. ANOMALIES
Algorithm 2 Anomalyfree partitioning: RMDUNFS. Input: and m Output: assigned processor(i ) 1: Sort tasks (rearrange indices) such that u1 u2 u3 : : : un 2: i := 1 j := 1 3: for each p 2 [1::m] np := 0 4: for each p 2 [1::m] util on processorp := 0 5: while i n loop 6: util bound := (nj + 1) (21=(nj +1) 1) 7: if util on processorj + ui util bound 8: assigned processor(i ) = j nj := nj + 1 9: util on processorj := util on processorj + ui 10: 11: else 12: if j=m then 13: declare failure 14: else 15: j := j + 1 16: assigned processor(i ) = j nj := nj + 1 17: util on processorj := util on processorj + ui 18: 19: endif 20: i := i + 1 21: end while 22: declare success
that is no lower than what the best published partitioning schemes could achieve before I started my research. RMDUNFS is described in Algorithm 2. In the remainder of this section, we will define a certain property SD that is used in a set of lemmas. These lemmas are used to prove that RMDUNFS suffers neither from period anomalies nor executiontime anomalies. Finally, we prove the system utilization bound of RMDUNFS. Definition 5.1 An assignment of the task set to processors is SD (schedulable with decreasing utilization on each processor) if and only P if: 8p 2 [1::m 1]: minj 2 p Cj =Tj maxj 2 p+1 Cj =Tj and 8p 2 [1::m]: j 2 p Cj =Tj np (21=np 1).
Lemma 1 RMDUNFS declares success for a given of that is SD. Follows directly from the algorithm.
, there exists an assignment
5.5. ANOMALYFREE PARTITIONING
63
Lemma 2 Consider two task sets before and after , where after differs from before only in that there is a task iafter such that uafter ubefore . If there exists an assignment i i before after of that is SD then there exists an assignment of that is SD.
8p 2 [1::m]: However, with such an assignment of after ,
Proof If tasks in after have the same assignment as tasks in before , then P 1=n
j 2 after;p Cj =Tj
np (2
p
1).
is not necessarily SD, because it could be that iafter has a lower utilization than tasks assigned a processor with higher index. We will now show that by swapping the assignment of tasks, it is possible to achieve an assignment of after that is SD. Consider those tasks j 2 before that satisfy ubefore uj uafter i i . Those tasks are assigned to the processors Pk ; : : : ; Pl . For each of the processors Pg 2 fPk+1 ; : : : ; Pl g, move the task with the highest utilization from processor Pg to Pg 1 . Also move task ibefore from Pk to processor Pl . The number of tasks on each processor is unaffected, so the utilization bounds of each processor are unaffected. The utilization of tasks on each of the processors Pg 2 fPk ; : : : ; Pl g does not increase, and for the other processors the utilization does not change. This new assignment of after also satisfies minj 2 p Cj =Tj maxj 2 p+1 Cj =Tj . Hence the new assignment of after is SD.
after
Lemma 3 Consider two task sets before and after , where after differs from before only in that there is a task iafter such that uafter ubefore . If RMDUNFS declares i i before success for , then RMDUNFS declares success for after . Proof: By applying Lemma 1 and Lemma 2, we can reason as follows:
RMDUNFS declares success for before . There exists an assignment of before that is SD. There exists an assignment of after that is SD. RMDUNFS declares success for after .
) ) )
Lemma 4 Consider a task set such that RMDUNFS has declared success when is applied. If ui is decreased for any subset of , then RMDUNFS will declare success. Proof Apply Lemma 3 repeatedly for each task that decreased its utilization.
Theorem 5.2 Consider a task set such that RMDUNFS has declared success when is applied. If Ti is increased or Ci is decreased for any subset of , then RMDUNFS will declare success. Proof Apply Lemma 4.
CHAPTER 5. ANOMALIES
64
In the remainder of this section, we will prove the utilization bound of RMDUNFS. First, a lemma proves the utilization bound assuming that the tasks are sorted, then a theorem states the same utilization bound holds even if tasks were not sorted.
p P i ( 2 Lemma 5 If ni=1 C 1) m and u1 u2 u3 : : : un then executing Ti lines 225 in Algorithm 2 (RMDUNFS) will declare success. Proof P We can provepthis by contradiction. Suppose that there was a task set such that n i it had i=1 C Ti ( 2 1) m and the algorithm declared failure. Let added be the task that was added when RMDUNFS declared failure. Since every task have a utilization > 0 (because in our system model, Ci > 0 and added > 0. Ti > 0), added satisfies CTadded We can now reason as follows:
n X
Ci i=1 Ti X X Ci Cadded + Tadded p=1::m i 2 p Ti
p
(
p
(
2
1)
m)
2
1)
m)
Ci p a
(a) There is no k such that changek Then let b = t0 .
> a and changek t0
(b) There is no k such that changek > a and changek Then let b = min(changek : changek > a).
t0
We will now study the time interval [a,b), and let us summarize its properties:
a (2
(
mUB
)
y
The amount of work done by A over [a,b) is at least: (2
1
mUB
)
s (m(a) x + y):
while the amount of work done by A0 over this interval is at most
m(a) s (x + y)
therefor it must be the case that
m(a) (x + y) > (2 By adding m(a)
1
m(a)
m(a)
1) (2
(2m(a)
mUB
m(a) x + y):
) (
times Inequality 7.3 to Inequality 7.3, we get (
(
1
1
mUB
x + y) + m(a) (x + y) > 1 ) y + (2 ) (m(a) x + y ) m 1) (
x + y) > (2
1) (
UB 1
mUB
)
m(a) (x + y)
x + y) > (2 m1(a) ) m(a) (x + y) (2m(a) 1) (x + y) > (2m(a) 1) (x + y)
) (2m(a) which is a contradiction.
1) (
CHAPTER 7. GLOBAL SCHEDULING
84
We can now present a lemma that can be used to indirectly determine whether EDF meets deadlines.
Lemma 8 Let A0 denote an arbitrary scheduling algorithm. Let 0 denote a computer platform of m(t) processors and let denote a computer platform that has, at every time, the same number of processors as 0, but the processors of have speed 2 m1UB . If A0 meets all deadlines of on 0, then EDF meets deadlines of on .
Proof Since EDF is a workconserving scheduling algorithm we obtain from Lemma 7 that for every t:
W (EDF; m(t); (2
1
mUB
)
s; ; t) W (A0 ; m(t); s; ; t)
Let di = Ai + Di and let k = f1 ; 2 ; : : : ; k g, where tasks are ordered in EDF priority, that is, d1 d2 : : : dk . We will prove the lemma using induction on k .
Base case If k m, this implies that a task is not delayed by another task and hence all deadlines hold.
Induction step We make two remarks. First, the scheduling of tasks 1 ; : : : ; k
k+1 is the same as the scheduling of tasks 1 ; : : :
2
; k 2 k , so we need to prove only that k+1 meets its deadline. Second, since k+1 has the lowest priority according to EDF and there is no task with lower priority, k+1 , will do all work that the higher priority tasks do not do. From the lemma we know that:
all tasks in k+1 meet their deadlines when scheduled by A0 on 0
7.3. UTILIZATION BOUND OF EDFUS(M/(2M1))
85
We can now reason as follows:
all tasks in k+1 meet their deadlines when scheduled by A0 on 0 )
kX +1 ) 7 W (A0 ; m(t); 1; k+1; dk+1 ) = Cj use Lemma j =1 kX +1 1 k +1 W (EDF; m(t); 2 ; ; dk+1 ) Cj ) mUB j =1 k+1 executes at least Ck+1 time units before dk+1 when scheduled by EDF on ) k+1 meets its deadline when scheduled by EDF on ) all tasks in k+1 meet their deadlines when scheduled by EDF on
The following lemma is a schedulability condition for EDF on a variable number of processors. UB Lemma 9 Consider EDF scheduling on m(t) processors. If 8t: U (t) m(t) 2mmUB UB then all tasks meet their deadlines. and Ci =Di 2mmUB 1
1
Proof From the properties of OPT we know that: If a task set is such that meets all deadlines.
8t: U (t) m(t) and Ci =Di 1, then OPT
Applying Lemma 8 yields: If a task set is such that 8t: U (t) m(t) and Ci =Di 1 and processors have the speed of 2 m1UB , then EDF meets all deadlines. Scaling the speed of processors yields: If a task set is such that 8t: U (t) m(t)mUB =(2mUB 1) and Ci =Di mUB =(2mUB 1) and processors have the speed of 1, then EDF meets all deadlines.
To be able to prove utilization bounds of task sets that have not only light tasks but also heavy tasks, we introduce two new terms and present a lemma from previous
CHAPTER 7. GLOBAL SCHEDULING
86
research. Let heavy (t) denote the number of current tasks at time t that have Ci =Di > m (t) denote the sum of utilization of all current tasks at time t that 2m 1 and let Ulight m have Ci =Di 2m 1 . We will make use of a result by Ha and Liu [HL94], that states how the finishing time of a task is affected by the variability of execution times of tasks in global jobstatic priority scheduling. Let fi denote the finishing time of task i , fi+ denote the finishing time of task i when all tasks execute at their maximum execution time and fi denote the finishing time of task i when all tasks execute at their minimum execution time. Lemma 10 presents the result that we will use. Lemma 10 For global scheduling where the priority orders of tasks does not change when the execution times change, it holds that:
fi
fi fi+
Proof See Corollary 3.1 in [HL94]. We can now design a schedulability condition for EDFUS(m/2m1)).
Lemma 11 Consider EDFUS(m/(2m1)) scheduling on m processors. If 8t: (m heavy(t)) m=(2m 1) and 8t: heavy(t) m 1, then all tasks meet their deadlines.
Ulight (t)
Proof The tasks with Ci =Di > 2mm 1 meet their deadlines because they receive the highest priority and there are at most m 1 of them. It remains to be proven that tasks with Ci =Di 2mm 1 meet their deadlines. Consider two cases. All tasks with Ci =Di > 2mm 1 have Ci = Di , The tasks with Ci =Di 2mm 1 experience it as if there were m heavy (t) processors available for them to execute on, and according to Lemma 9 the tasks meet their deadlines. Of the tasks with Ci =Di > 2mm 1 , there is a subset of tasks that have Ci < Di . If this subset of tasks had Ci = Di , then according to the first case, all deadlines would hold. Reducing Ci of tasks with Ci =Di > 2mm 1 does not affect priority order so according to Lemma 10 all deadlines continue to hold.
Now we have all the lemmas at our disposal for stating our final theorem. Theorem 7.1 Consider EDFUS(m/(2m1)) scheduling on U (t) m m=(2m 1) then all tasks meet their deadlines.
m
processors.
If
8t:
7.3. UTILIZATION BOUND OF EDFUS(M/(2M1))
87
Capacity bounds
Capacity bound
1 EDFUS(m/(2m1)) Upper bound
0.8 0.6 0.4 0.2 0 2
4
8
16 32 #processors
64
128
Figure 7.1: Utilization bounds for EDFUS(m/(2m1)) and an upper bound on the utilization bound of all jobstatic priority scheduling algorithms.
Proof It follows from
heavy(t)) m=(2m theorem.
8t: U (t) m m=(2m and 8t: heavy (t) m
1)
1) 1.
that: 8t: Ulight (t) (m Applying Lemma 11 gives the
Theorem 7.1 states that EDFUS(m/(2m1)) has a utilization bound of m=(2m 1). For a large number of processors this bound approaches 1=2. In Example 18 we show that an upper bound on the utilization bound of every jobstatic priority scheduling algorithm is 0:5 + 0:5=m, which demonstrates that EDFUS(m/(2m1)) is close to the best possible performance and with an infinite number of processors, no jobstatic priority scheduling algorithm can perform better than EDFUS(m/(2m1)). Example 18 Consider m +1 aperiodic tasks that should be scheduled on m processors using jobstatic priority global scheduling. All tasks have Ai = 0; Di = 1; Ci = 0:5+, 5+ . Because of so at every instant during [0; 1), the system utilization is 0:5 + + 0:m jobstatic priority scheduling, there must be a task with lowest priority, and that priority order is not permitted to change. That task executes when its higher priority tasks do not execute. Hence the lowest priority task executes 0:5 time units during [0; 1), but it needs to execute 0:5 + time units, so it misses its deadline. We can do this reasoning for every > 0 and for every m, so letting ! 0 and m ! 1 gives us that: There are task sets that always have a system utilization arbitrarily close to 1/2+1/(2m), but no jobstatic priority scheduling algorithm can meet all its deadlines.
CHAPTER 7. GLOBAL SCHEDULING
88
7.4 Design of a better admission controller In aperiodic online scheduling, we have no knowledge of future arrivals, which means that any sets of tasks could arrive. Some of those task sets could cause the system to become overloaded and in the worst case make all tasks miss their deadlines. Hence, it is necessary to use an admission controller that can avoid such situations. A straightforward admission controller would be to only admit tasks that cause the resulting task set to satisfy the schedulability condition in Theorem 7.1. Unfortunately, such an approach has the following serious drawback. Assume that m tasks arrive and, when they finish, all processors become idle. With our admission controller used so far, the utilization of these tasks must still be considered because their deadlines have not yet expired, which may lead to no new tasks being admitted. This is clearly an undesirable situation. However, we can design a better admission controller based on the following observation. Observation 8 For EDFUS(m/(2m1)) the following holds: If all processors are idle at time t, then the schedule of tasks after time t does not depend on the schedule before time t. We can now design an improved admission controller, Resetallidle, which works as follows. A variable called admission counter is initialized to zero when the system starts. When a task i arrives, if ui =m plus admission counter is no greater than the utilization bound, then task i is admitted; otherwise, it is rejected. If i is admitted, then the admission counter is increased by ui =m. If all processors are idle then admission counter is reset to zero. When the deadline of a task expires, the admission counter is decreased by ui =m if the task arrived after or at the time of the last reset2 . The goal of the new admission controller is to keep processors busy as much as possible while meeting the deadlines of admitted tasks. We will now evaluate the performance of this admission controller. To measure its performance, we define the real system utilization in the time interval [t1 ,t2 ) as R t2 the number of busy processors at time t dt. We expect that Resetallidle will keep m t1 the real system utilization higher than the utilization bound.
7.4.1 Experimental setup Tasks are randomly generated with interarrival times between two subsequent tasks as exponentially distributed. Execution times and deadlines are generated from uniform distributions with the minimum value of 1. If the execution time of a task is greater than its deadline, then the execution time and the deadline is generated again3 . In all experiments, we choose the expected value of the deadline E [D ] as 10000, whereas different 2
We consider the initialization as a reset, so there is always a time of the last reset. This distorts the distributions somewhat, but the means of the samples of Di and Ci do not deviate more than 20% from the means that we want. 3
7.4. DESIGN OF A BETTER ADMISSION CONTROLLER E[C]/E[D] 3 0.005 0.95
6 0.94
9 0.91
number of processors 12 15 18 21 0.87 0.77 0.60 0.53
24 0.51
27 0.51
0.010
0.93
0.90
0.86
0.79
0.64
0.55
0.52
0.51
0.51
0.020
0.90
0.86
0.79
0.68
0.57
0.52
0.51
0.51
0.51
0.050
0.82
0.76
0.67
0.57
0.52
0.51
0.51
0.51
0.50
0.100
0.74
0.68
0.59
0.53
0.51
0.50
0.50
0.50
0.50
0.200
0.65
0.58
0.52
0.50
0.50
0.49
0.49
0.50
0.50
0.500
0.52
0.48
0.47
0.47
0.48
0.48
0.48
0.48
0.49
89
Figure 7.2: Real system utilization as a function of the number of processors and expected value of the utilization of tasks. The light shaded regions indicate where the real system utilization is greater than the utilization bound of the scheduling algorithm while the dark shaded regions indicate where the real system utilization is 50% greater than the utilization bound. experiments use different expected values of the execution time E [C ] and number of processors. We generate tasks so that the first task arrives at time 0 and we generate new tasks until Ai + Di > 10000000, after which no more tasks were generated. When a task arrives, resetallidle decides whether it should be admitted and we schedule the admitted tasks during the time interval [0; 10000000). Hence, when we stopped the simulation, there were no tasks with remaining execution. We choose the expected 1 all generated tasks C , is value of the interarrival times so that the load, defined as: m 10000000 one. When we say real system utilization, we mean the real system utilization during [0; 10000000).
P
7.4.2 Experimental results Figure 7.4.2 shows real system utilization as a function of the number of processors and E[C]/E[D]. It can be seen for EDFUS(m/(2m1)) that the fewer processors there are and the shorter the execution times of tasks are, the more the real system utilization exceeds the utilization bound. For example, for E [C ]=E [D ] = 0:02 and m = 3, the real utilization is 90%. In contrast, the utilization bound is 60%. The reason is that, for these workloads, there are many instants when the admission counter can be reset. This happens when the execution times of tasks are small, because then the processors are more evenly utilized, and hence if one processor is idle, then it is more likely that all processors are idle. When there are few processors, the same explanation holds: if one processor is idle, then there is greater likelihood that all processors are idle.
90
CHAPTER 7. GLOBAL SCHEDULING
Chapter 8
Partitioned scheduling 8.1 Introduction In this chapter, we study multiprocessor scheduling algorithms and their utilization bounds for aperiodic tasks where future arrivals are unknown. We propose a jobstatic1 priority algorithm for tasks without migration capabilities and prove that it has a utilization bound of 0:31. No algorithm for tasks without migration capabilities can have a utilization bound greater than 0:50. Section 8.2 discusses aperiodic partitioned scheduling and Section 8.3 presents our new results: an algorithm to assign a task to a processor and the proof of its utilization bound.
8.2 Partitioned scheduling In partitioned scheduling, a task is immediately assigned to a processor when the task arrives, and the task does not migrate, effectively making a multiprocessor behave as a set of uniprocessors. Algorithms that assign a task to a processor require knowledge of whether a task can be assigned to a processor and meet its deadline. We will make use of the following result2 : Theorem 8.1 Consider EDF scheduling on a uniprocessor. If tasks meet their deadlines.
8t: U (t) 1, then all
Proof Before proving this theorem, we will establish two claims: 1 2
Recall that jobstatic and taskstatic are synonymous in aperiodic scheduling. A more general theorem is available in [DL97].
91
92
CHAPTER 8. PARTITIONED SCHEDULING I. If 8t: U (t) 1, then a uniprocessor sharing algorithm (called OPT) meets all deadlines. This follows from the observation that a processor sharing algorithm attempts to execute an arbitrary active task i for ui time units during every time interval of length within [Ai ,Ai + Di ). Since 8t: U (t) 1, OPT succeeds in executing an arbitrary task i for ui time units during every time interval of length within [Ai ,Ai + Di ). One such interval is [Ai ,Ai + Di ) and it has a length of Di . In this interval, an arbitrary task i is executed for ui = ui Di = Ci time units. Hence OPT meets all deadlines. II. If any scheduling algorithm meets all deadlines then EDF will also do so. This follows from the optimality of EDF on a uniprocessor [Der74]. We can now reason as follows:
8t : U (t) 1 use claim ) 1 use claim 2 OPT meets all deadlines )
EDF meets all deadlines
Intuitively, Theorem 8.1 reduces the partitioned multiprocessor scheduling problem to the design of an algorithm that assigns tasks to processors in order to keep the utilization on each processor at every moment to be no greater than 1. When assigning tasks to processors, it is tempting to choose load balancing, but one can see that it can perform poorly in that it can miss deadlines even when only a small fraction of the capacity is requested. Example 19 illustrates that the utilization bound for load balancing is zero. Example 19 Consider m + 1 aperiodic tasks that should be scheduled on m processors using load balancing. We define load balancing as: assign an arriving task to a processor such that, after the task has been assigned to a processor, the utilization of the processor that has the maximum processor utilization is minimized. Let the tasks i (where 1 i m) have Di = 1,Ci = 2 and Ai = i 2 , and let the task m+1 have Dm+1 = 1 + ,Cm+1 = 1 and Am+1 = (m + 1) 2 . The tasks i (where 1 i m) will be assigned one processor each due to load balancing. When m+1 arrives, it cannot be assigned to any processor to meet its deadline. By letting m ! 1 and ! 0, we have a task set that requests an arbitrarily small fraction of the capacity but still a deadline is missed. In periodic scheduling, a common solution is to use binpacking algorithms [DL78]. Here, a task is first tentatively assigned to the processor with the lowest index, but if a schedulability test cannot guarantee that the task can be assigned there, then the task is tentatively assigned to the next processor with a higher index and so on. This avoids the poor performance of load balancing [OB98, LGDG00].
8.3. EDFFF
93
8.3 EDFFF We will now apply these ideas in aperiodic scheduling by proposing a new algorithm EDFFF and analyzing its performance. Although the work by [OB98, LGDG00] proved a utilization bound for the periodic case, their proof is not easily generalized because, in our problem with aperiodic tasks, a task “disappears” when its deadline expires. When discussing EDFFF we P need to define the following concepts. The utilization of processor p at time t is i 2Vp Ci =Di , where Vp = fk : (Ak t < Ak + Dk ) ^ (k is assigned to processor p)g. A processor p is called occupied at time t if there is at least one task that is both current at time t and that is assigned to processor p. A processor that is not occupied is called empty. Let transition p (t) be the latest time t such that processor p makes a transition from being empty to being occupied at time transitionp (t). If processor p has never been occupied, then transitionp (t) is 1. EDFFF means schedule tasks according to EarliestDeadlineFirst on each uniprocessor and assign tasks using FirstFit. EDFFF works as follows. When a task i arrives it is assigned to the occupied processor with the lowest transitionp (Ai ) that passes the schedulability condition of Theorem 8.1. Otherwise the task is assigned to an arbitrary empty processor (if no empty processor exists then EDFFF declares failure). Because of Theorem 8.1, we know that if EDFFF does not declare failure, then all deadlines are met. If two or more tasks arrive at the same time, there is a tie in which task should be assigned first, and there could also be a tie in finding which processor is the one with the least transition. However, if there are tasks that arrive at the same time, then we can assign an order to them such that, for every pair of these tasks, we can say that one task i arrives earlier than another j . One such order could be to use the index of tasks. To illustrate this, consider two tasks, 1 and 2 , with A1 = 0 and A2 = 0. The tasks have (C1 = 0:6,D1 = 1) and (C1 = 0:7,D2 = 1). It is clear that EDFFF will not assign 1 and 2 to the same processor, but if we did not have a tie breaking scheme we would not know whether EDFFF would produce the assignment 1 to processor 1 (and consequently 2 to processor 2) or 2 to processor 2 (and consequently 1 to processor 1). Moreover, it would not be clear whether transition1 (t) < transition2 (t), for 0 < t < 0:6. To resolve this, we can choose an order such that A1 is earlier than A2 . This order implies that 1 is assigned to processor 1 and 2 is assigned to processor 2 and transition1 (t) < transition2 (t) for 0 < t < 0:6. In the remainder of this section, if Ai = Aj , but it has been chosen that i arrives before j , then we will write Ai < Aj . The reason why this works is that the algorithm EDFFF and its analysis does not depend on the absolute value of the arrival times; only the order is important. Theorem 8.2 analyzes the performance of EDFFF by computing its utilization bound B . We will see that B 0:31 and hence EDFFF performs significantly better than load balancing. Theorem 8.2 Consider scheduling on
m
3 processors using EDFFF. Let B be a
CHAPTER 8. PARTITIONED SCHEDULING
94
real number which is a solution to the equation
m B = m (1 B B ln
m Bm
1 1
) + ln
m Bm
1 1
(8.1)
Then we know that: I. There is exactly one solution B, and it is in the interval (1/m,1]. II. If 8t:
U (t) m B then EDFFF does not declare failure.
Proof The theorem has two claims, so we first prove claim 1 and then prove claim 2. I. There is exactly one solution B, and it is in the interval (1/m,1]. If B < 1=m, then the righthand side of Equation 8.1 has an imaginary part and then the lefthand side of Equation 8.1 also has an imaginary part, so B must have an imaginary part. But from the theorem we have that B is a real number, so this is not possible. Hence we have proven that B 1=m. If B ! 1=m, then the lefthand side is 1, and the righthand side is m 1, so this cannot be a solution. Hence we have proven that B > 1=m. Let us introduce the function f (which is simply a manipulation of Equation 8.1):
m Bm
m 1 1 Bm 1 We only need to prove that there is exactly one solution B to f (B ) = 0. Noting f (B ) = m (1
2
B B ln
1
) + ln
that:
@f @B
=
(1 + ln
lim
B !1=m lim
B !1
m Bm
f (B ) = m
1 1
)
2
m0
f (B ) = m < 0
makes it possible to draw the conclusion that there is exactly one solution, and it is in the interval (1/m,1]. II. If 8t: U (t) m B then EDFFF does not declare failure. We will first derive a lower bound of the utilization of a task that was not assigned to one of the l occupied processors with the least transitionp . Then we will assume that claim 2 in Theorem 8.2 was wrong, i.e. that there exists a task set with 8t: U (t) m B for which EDFFF declares failure. We will use the result of the lower bound of the utilization of a task to prove a lower bound on the utilization at the time when EDFFF declared failure. This is finally used to derive a contradiction, which proves the correctness of claim 2 in Theorem 8.2.
8.3. EDFFF
95
A lower bound of the utilization of a task Consider a task i with utilization ui that arrives but is not assigned to the l occupied processors with the least transitionp (Ai ). If one of the l occupied processors had a utilization that was 1 ui or less, then i would have been assigned to it, but that did not happen. Consequently, each of the l occupied processors with the least transitionp (Ai ) has a utilization greater than 1 ui . Hence we have:
U (t = Ai ) > l (1 ui ) + ui
(8.2)
From the theorem we obtain:
U (t = Ai ) B m
(8.3)
Combining Inequality 8.2 and Inequality 8.3 yields:
l (1 ui ) + ui < B m Rearranging:
l l ui + ui < B m Rearranging again (for l 2).
l B m < (l
1)
ui
Rearranging again (for l 2).
l Bm < ui l 1 We also know that ui > 0. Hence we have (for l 2): l Bm max(0; ) < ui l 1
(8.4)
A lower bound of the utilization at failure Suppose that claim 2 in The
orem 8.2 was wrong. Then there must exist a task set with 8t: U (t) m B for which EDFFF declares failure. Let failed denote the task that arrived and caused the failure. If there was one processor that was empty at time Afailure , then failed could have been assigned there and EDFFF would not have declared failure. For this reason, we know that all processors must have been occupied at time Afailure . Let us choose the indices of processors so that transition1 (Afailed ) < transition2 (Afailed ) < : : : < transitionm (Afailed ). Every task that was current at time Afailed and that was assigned processor j must have arrived during [transitionj (Afailed ),Afailed ], because processor j was empty just before
CHAPTER 8. PARTITIONED SCHEDULING
96
transitionj (Afailed ), so any task that was current before transitionj (Afailed ) and that was assigned to processor j must have had its absolute deadline earlier than transitionj (Afailed ). When a task arrived arrived during [transitionj (Afailed ),Afailed ] and was assigned to processor j , there were at least j 1 occupied processors (processor1 ,: : : ,processorj 1 ) with a lower transitionp (Aarrived), so applying Inequality 8.4 (with l = j 1) gives (for j 3): j 1 Bm ) < uarrived max(0; (8.5) j 2 Since all processors are occupied at time Afailure , for every processor j 2 [1::m], there is at least one current task assigned to processor j that satisfies Inequality 8.5. For this reason (for j 3) the utilization of processor j at time Afailed must satisfy: j 1 Bm Uj (t = Afailed ) > max(0; ) (8.6) j 2 where Uj (t = Afailed ) denotes the utilization of processor j at time Afailed . We also know that the task failed was not assigned to the m occupied processors with the least transitionp (Afailed ), so applying Inequality 8.4 with l = m gives:
ufailed (t = Afailed ) > max(0;
m Bm ) m 1
(8.7)
When EDFFF failed, the utilization of all current tasks is the same as the utilization of all current tasks that have been assigned processors plus the utilization of the task that just arrived. Hence: m X U (t = Afailed ) = ( Uj (t = Afailed )) + ufailed j =1 Pm Applying Inequality 8.6 and Inequality 8.7 and using j =1 Uj (t = Afailed ) > Pm j =3 Uj (t = Afailed ) yields: m X (j 1) Bm U (t = Afailed ) > ( max(0; )) (j 2) j =3 + max(0
;
m Bm ) m 1
(8.8)
Rewriting (see Algebraic manipulation 1 in Appendix G for details) gives us: m X1 Bm 1 ) U (t = Afailed ) > m 1 min(1; (8.9) k k=1
8.3. EDFFF
97
It is worth to noting that every term in the sum of Inequality 8.9 is nonnegative because, from the first claim in the theorem, we have B > 1=m, which can be rewritten as B m 1 > 0. We will now compute an upper bound on P m 1 min(1; B m 1 ). Clearly we have: k=1 k
m X1
Bm min(1; k k=1
1
)
=
1 X
Bm k
;
min(1
k=1 m X1 k=2
;
min(1
1
Bm k
)+
1
)
Observing that the series: min(1; B mk 1 ) is nonincreasing with respect to P 1 B m 1 and that 1k=1 min(1; B m k ) = min(1; 1 ) 1 yields:
m X1
Bm min(1; k k=1
1
)
1+
1
Z m
k=1
;
min(1
Bm k
1
k
)
Rewriting (see Algebraic manipulation 2 in Appendix G for details) gives us:
m X1 k=1
min(1
;
Bm k
1
)
1+
Bm
1
1+
Bm m 1 1
Bm
(
1) ln
Using Inequality 8.10 in Inequality 8.9 yields:
U (t = Afailed ) > m
1
(1 +
Bm
(
Bm
1
1+
Bm m 1 1 )
1) ln
Simplifying yields:
U (t = Afailed ) > m B m
m B m ln Bm m 1 ln Bm 1
1 1
+
(8.10)
CHAPTER 8. PARTITIONED SCHEDULING
98
m B
:
3
0 41
:
4
0 38
:
5
0 36
:
10
100
1000
1
0 34
0 32
0.31
0.31...
6
0 35
:
:
Table 8.1: B for different number of processors. Simplifying again:
m U (t = Afailed ) > m (1 B B ln Bm m 1 ln Bm 1
1 1
)+
Since U (t = Afailed ) m B it must have been that
m B > m (1 B B ln
m Bm
1 1
) + ln
m Bm
1
But this is impossible, because we have chosen B such that m B B B ln Bmm 11 ) + ln Bmm 1 1 .
1 =
m (1
Different values of B are shown in Table 8.1. When m approaches infinity, then B is the solution to 1 2B + B ln B = 0. This is where our utilization bound of 0:31 came from. Our analysis of utilization bounds of EDFFF is not necessarily tight but one can see that no analysis of utilization bounds of EDFFF can, in general, obtain a utilization bound that is greater than 0:42. This is illustrated in Example 20. Example 20 (Adapted from [CGJ83]) Let m = 7k=3, where k is divisible by 6. First k tasks with ui = 2=3 arrive, followed by k tasks with ui = 1=3 and then k tasks with ui = 2. Figure 8.1(a) illustrates the packing of current tasks. The deadline of tasks with ui = 1=3 expires, so we remove them. k=2 tasks with ui = 1=3 and k=2 tasks with ui = 1=3 + arrive in the sequence 1=3; 1=3 + ; 1=3; 1=3 + ; : : : ; 1=3; 1=3 + . Figure 8.1(b) illustrates the packing of current tasks. The deadline of tasks with ui = 2=3 expires, so we remove them. The deadline of tasks with ui = 1=3 + expires, so we remove them too. 5k=6 tasks with ui = 1 arrive. Now, at least one task is assigned to every processor. Figure 8.1(c) illustrates the packing of current tasks. Finally, a task with ui = 1 arrives, but it cannot be assigned to any processor, so EDFFF fails. If we let ! 0 and k ! 1 (and consequently m ! 1), then we have that 8t : Us (t) 3=7, but EDFFF still fails.
8.3. EDFFF
99
Although one could design other partitioning schemes, those are unlikely to offer any significant performance improvements. This is because in dynamic binpacking (where items arrive and depart), it is known that firstfit offers performance (in terms of competitive ratio) not too far from the best that one could hope for [CGJ83, page 230]. Nevertheless, it is known [LGDG00] that no partitioned multiprocessor scheduling algorithm can achieve a utilization bound greater than 0:5. For computer platforms where task migration is prohibitively expensive, one could conceive of other approaches than partitioning. For example, one could conceive of scheduling algorithms where an arriving task is assigned to a global runnable queue, and when it has started to execute, it is assigned to that processor and does not migrate. However, such approaches suffer from scheduling anomalies [HL94] and they still cannot achieve a utilization bound greater than 0.50 (to see this, consider the same example as given in [LGDG00]). We conclude that, although it may be possible to design and analyze scheduling algorithms that do not migrate tasks and make these algorithms achieve greater utilization bounds, these algorithms will not improve the performance as much as the EDFFF did (from 0 to 0.31).
CHAPTER 8. PARTITIONED SCHEDULING
100
2
=
1 3
2
1 3
=
=
q q q
=
2 3
2 3
P1
Pk
(a) Tasks arrive and are assigned to processors P1 ; : : : ; Pk , but the deadlines of tasks have not yet expired.
2
=
2 3
2 q q q
=
2 3
P1
Pk
=
1 3+
= Pk+1
q q q
P1 2
= P3k=2 1 3
(b) The deadlines of tasks with utilization 1=3 assigned to processors Pk+1 ; : : : ; P3k=2 .
q q q
=
1 3+
1 3
expire and new tasks arrive and are
1
q q q
Pk 2
= Pk+1 1 3
= P3k=2
q q q
1
1 3
P3k=2+1
P7k=3
(c) The deadlines of tasks expire and tasks with utilization one arrive and are assigned to processors P3k=2+1 ; : : : ; P7k=3 .
Figure 8.1: No analysis of EDFFF can give a utilization bound greater than 0.42.
Chapter 9
Conclusions This thesis addressed the problem: How much of the capacity of a multiprocessor system can be requested without missing a deadline when staticpriority preemptive scheduling is used? To this end, I designed scheduling algorithms and proved their performance. The results imply the following: I1. Global staticpriority scheduling on multiprocessors is worth considering in multiprocessorbased realtime systems. Before I started my research, it was believed [Dha77, DL78] that global staticpriority scheduling was unfit because global staticpriority scheduling with the ratemonotonic priority assignment has a utilization bound of zero. With a new priority assignment scheme, we have seen that a greater utilization bound of 1=3 can be achieved. The new priorityassignment scheme was based on the RMUS approach. After that, the RMUS approach has been used [Lun02] to design a better priority assignment scheme for periodic scheduling with a utilization bound of 0.37, that is, the greatest utilization bound that a global staticpriority scheduling algorithm can have that is based on the RMUS approach. Of course, other priority assignment schemes are conceivable, but we saw that a class of algorithms, which seem to cover all possible simple ones, have a utilization bound of 0.41 or lower. This implies two interesting topics for future research: design a simple algorithm that achieves a utilization bound of 0.41; design a nonsimple algorithm that achieves the utilization bound of 0.50. I2. In partitioned scheduling, dynamic priorities in uniprocessor scheduling do not offer any increase in utilization bounds as compared to static priorities. I presented a staticpriority partitioned scheduling algorithm that could achieve
101
102
CHAPTER 9. CONCLUSIONS a utilization bound of 0:50, and since every partitioned scheduling algorithm has a utilization bound of 0:50 or less, we can conclude that dynamic priorities do not offer any increase in utilization bounds as compared to static priorities.
I3. Anomalies exist in many preemptive multiprocessor scheduling algorithms. Using several examples, I showed that anomalies exist in many preemptive multiprocessor scheduling algorithms. However, it is possible to design an anomalyfree partitioned scheduling algorithm with a utilization bound of 0:41. This clearly implies that if the utilization is low enough and this algorithm is used then anomalies can be avoided. I left open the question of whether it is possible to design an anomalyfree partitioned scheduling algorithm with a utilization bound of 0.50. If the answer is yes, then it shows that, for a scheduling algorithm, the requirement of having a high utilization bound does not conflict with the requirement of being anomalyfree. So far, this thesis has attempted to present results that are not too controversial in nature. However, there are many issues related to the presented results that are a matter of opinion, belief, hope, industrial trends, hype, scientific paradigms or simulation setups. Here are some of these issues: I1. Many computer systems with many processors are distributed (like cars) where tasks migration is too expensive. So why is global scheduling interesting in practice? I2. Other computer systems are implemented as systemonachip which means that processors are not identical. So why is scheduling on multiprocessors with identical processors interesting in practice? I3. Is task migration expensive in a sharedmemory multiprocessor? I4. Is it interesting to study utilization bounds? These bounds are sometimes rather low so how useful are they in practice? Wouldn’t it be better to make an exact characterization? I5. It is so hard to find an upper bound on the execution time of a program, so why design scheduling algorithms that depend on this? I6. Are there really tasks that will cause a catastrophe if they finish just a nanosecond too late? I7. What are the advantages of the aperiodic task model used in this thesis? I will only discuss the last one: what are the advantages of the aperiodic task model used in this thesis? I mentioned that a straightforward solution for an exact schedulability test of EDF scheduling on a uniprocessor has a timecomplexity of O (n2 ) (where n is the number of concurrent aperiodic tasks). I suggested that it may be too costly. This is the case for highperformance servers [AAJ+ 02] where tens of thousands of tasks arrive per second.
103 I also suggested that schedulability tests that can be expressed as closedform expressions are desirable. The reason is as follows. Often when designing computer systems, there are other objectives than meeting deadlines, and there tend to be quite a lot of flexibility in task parameters and the computer system. For example, one may want to maximize the utility that tasks give, subject to the constraint that all aperiodic tasks meet their deadlines. There is flexibility in that a task can give different QualityofService [AAS97] by varying its execution time (for example, a web server that renders raytraced 3D images, can render a picture with a lower resolution which leads to a lower execution time). A short execution time naturally consumes less resources and makes the scheduling problem easier but it gives a lower utility of the system. A naive approach is to enumerate all combinations of all QualityofServicelevels that tasks can have, and choose the ones that gives the greatest utility of the ones that meet all deadlines. Of course, one may reduce the complexity in many ways, for example by cutting branches in the search tree early and attempt to choose paths that looks promising early. But, if conditions, for example the number of tasks, change quickly, perhaps several times per second, then it may be better to produce a nonoptimal solution quickly than not adapting at all to the new condition. One can resort to solutions that are not necessarily optimal but produce solutions quickly. One way to solve this problem is to state the constraint that all tasks must meet their deadlines as a closedform expression and then apply standard techniques from mathematical optimization [NS96]. This is a reason why expressing whether tasks meet all deadlines as a closedform expression may be useful. Another reason why expressing whether tasks meet their deadlines using my definition of utilization is that utilization can be measured and hence controlled using feedbackcontrol theory. Recently, this has been done in aperiodic scheduling with the goal to minimize energy subject to the constraint that all deadlines should be met [STAS03]. I mentioned that it may be acceptable to reject an incoming task but that rejecting a task that has already been admitted may not be acceptable. This may be the case, even when the new task has a higher value than the old task. Consider an aperiodic task that outputs a sequence of control signals to its physical environment but executing only the first control signals in the sequence causes a disaster. For example, an applepiebaking machine may put the apple pie in the oven, turn the heater on, wait 30 minutes, and take the apple pie out of the oven. Assume that a task has started to execute a little (put the apple pie in the oven and turn the heater on) but then the task got rejected. This causes the apple pie to get burned. This is not a big problem because we could have rejected the task in the first place and then we would not have any apple pie at all either. However, the fact that we have partially executed a task, gives negative effects like: an unpleasant smell in your home, bad relationships to your neighbors, an unpleasant screaming sound from the fire detector and, in the worst case, a visit from the fire brigade with a corresponding invoice. Clearly, it is better to not execute a task at all, then to execute a task partially.
104
CHAPTER 9. CONCLUSIONS
Bibliography [AAJ+ 02]
T. Abdelzaher, B. Andersson, J. Jonsson, V. Sharma, and M. Nguyen. The aperiodic multiprocessor utilization bound for liquid tasks. In Proc. of the IEEE RealTime and Embedded Technology and Applications Symposium, San Jos´e, California, September 24–27 2002. 12, 78, 102
[AAS97]
T. F. Abdelzaher, E. M. Atkins, and K. G. Shin. QoS negotiation in realtime systems and its application to automated flight control. In Proc. of the IEEE RealTime Technology and Applications Symposium, pages 228–238, Montreal, Canada, June 9–11, 1997. 103
[AB98]
L. Abeni and G. Buttazzo. Integrating multimedia applications in hard realtime systems. In Proc. of the IEEE RealTime Systems Symposium, Madrid, Spain, December 2–4, 1998. 72
[AJ03]
B. Andersson and J. Jonsson. The utilization bounds of partitioned and pfair staticpriority scheduling on multiprocessors are 50%. In Proc. of the EuroMicro Conference on RealTime Systems, pages 33–40, Porto, Portugal, July 2–4, 2003. 11
[AL01]
T. Abdelzaher and C. Lu. Schedulability analysis and utilization bounds for highly scalable realtime services. In Proc. of the IEEE RealTime Technology and Applications Symposium, pages 15–25, Taipei, Taiwan, May 30–1, 2001. 12, 12, 78, 78
[AS00]
J. Anderson and A. Srinivasan. Earlyrelease fair scheduling. In Proc. of the 12th EuroMicro Conference on RealTime Systems, pages 35–43, Stockholm, Sweden, June 19–21 2000. 7
[AS03]
T. Abdelzaher and V. Sharma. A synthetic utilization bound for aperiodic tasks with resource requirements. In Proc. of the 15th EuroMicro Conference on RealTime Systems, pages 141–150, Porto, Portugal, July 2–4 2003. 12
[ATB93]
N. Audsley, K. Tindell, and A. Burns. The end of the line for static cyclic scheduling? In Proc. of the EuroMicro Workshop on RealTime Systems, pages 36–41, Oulu, Finland, June 22–24, 1993. 22
105
106
BIBLIOGRAPHY
[Aud91]
N. C. Audsley. Optimal priority assignment and feasibility of static priority tasks with arbitrary start times. Technical Report YCS 164, Dept. of Computer Science, University of York, York, England Y01 5DD, December 1991. 22
[Bar95]
S. K. Baruah. Fairness in periodic realtime scheduling. In Proc. of the IEEE RealTime Systems Symposium, pages 200–209, Pisa, Italy, December 5–7, 1995. 11
[BC03]
S. Baruah and J. Carpenter. Multiprocessor fixedpriority scheduling with restricted interprocessor migrations. In Proc. of the EuroMicro Conference on RealTime Systems, pages 195–202, Porto, Portugal, July 2–4, 2003. 8
[BCPV96]
S. Baruah, N. Cohen, G. Plaxton, and D. Varvel. Proportionate progress: A notion of fairness in resource allocation. Algorithmica, 15(6):600–625, June 1996. 11, 59, 60, 77
[BHS94]
S. Baruah, J. Haritsa, and N. Sharma. Online scheduling to maximize task completions. In Proc. of the IEEE RealTime Systems Symposium, pages 228–237, San Juan, Puerto Rico, 1994. 30, 30
[BKM+ 91a] S. Baruah, G. Koren, D. Mao, B. Mishra, A. Raghunathan, L. Rosier, D. Shasha, and F. Wang. On the competitiveness of online realtime task scheduling. In Proc. of the IEEE RealTime Systems Symposium, pages 106–115, San Antonio, Texas, December 4–6, 1991. 73, 74, 74, 74 [BKM+ 91b] S. Baruah, G. Koren, B. Mishra, A. Raghunathan, L. Rosier, and D. Shasha. Online scheduling in the presence of overload. In Proc. of the 32nd Annual IEEE Symposium on Foundations of Computer Science, pages 100–110, San Juan, Puerto Rico, October 1991. 30, 30 [BKM+ 92]
S. Baruah, G. Koren, D. Mao, B. Mishra, A. Raghunathan, L. Rosier, D. Shasha, and F. Wang. On the competitiveness of online realtime task scheduling. RealTime Systems, 4(2):125–144, June 1992. 30, 30
[BL98]
S. Baruah and S.S. Lin. Pfair scheduling of generalized pinwheel task systems. IEEE Transactions on Computers, 47(7):812–816, July 1998. 17
[BLOS95]
A. Burchard, J. Liebeherr, Y. Oh, and S.H. Son. New strategies for assigning realtime tasks to multiprocessor systems. IEEE Transactions on Computers, 44(12):1429–1442, December 1995. 12, 26, 41
[BTW95]
A. Burns, K. Tindell, and A. Wellings. Effective analysis for engineering realtime fixed priority schedulers. IEEE Trans. on Software Engineering, 21(5):475–480, May 1995. 22
BIBLIOGRAPHY [Cer03]
[CFH+ 03]
107
A. Cervin. Integrated Control and RealTime Scheduling. PhD thesis, Department of Automatic Control, Lund Institute of Technology, Sweden, April 2003. 4 J. Carpenter, S. Funk, P. Holman, A. Srinivasan, J. Anderson, and S. Baruah. Handbook on Scheduling Algorithms, Methods, and Models, chapter A Categorization of Realtime Multiprocessor Scheduling Problems and Algorithms. Chapman Hall/CRC, 2003. 7, 8
[CGJ83]
E. G. Coffman, M. R. Garey, and D. S. Johnson. Dynamic bin packing. SIAM Journal of Applied Mathematics, 12(2):227–258, May 1983. 98, 99
[CK88]
T. L. Casavant and J. G. Kuhl. A taxonomy of scheduling in generalpurpose distributed computing systems. IEEE Trans. on Software Engineering, 14(2):141–154, February 1988. 7
[DD85]
S. Davari and S.K. Dhall. On a realtime task allocation problem. In 19th Annual Hawaii International Conference on System Sciences, pages 8–10, Honolulu, Hawaii, 1985. 12, 41
[DD86]
S. Davari and S.K. Dhall. An online algorithm for realtime task allocation. In Proc. of the IEEE RealTime Systems Symposium, volume 7, pages 194–200, New Orleans, LA, December 1986. 12, 41
[Der74]
M. L. Dertouzos. Control robotics: The procedural control of physical processes. In IFIP Congress, pages 807–813, 1974. 92
[Dha77]
S. Dhall. Scheduling PeriodicTimeCritical Jobs on Single Processor and Multiprocessor Computing Systems. Ph.D. thesis, Department of Computer Science, University of Illinois at UrbanaChampain, 1977. 12, 12, 12, 25, 29, 41, 101
[DL78]
S. K. Dhall and C. L. Liu. On a realtime scheduling problem. Operations Research, 26(1):127–140, January/February 1978. 12, 12, 12, 13, 23, 25, 26, 29, 41, 55, 57, 61, 92, 101
[DL97]
Z. Deng and J. W.S. Liu. Scheduling realtime applications in an open environment. In Proc. of the IEEE RealTime Systems Symposium, volume 18, pages 308–319, San Francisco, California, December 3–5, 1997. 91
[DLS97]
Z. Deng, J.W.S Liu, and J. Sun. A scheme for scheduling hard realtime applications in open system environment. In Proc. of the EuroMicro Workshop on RealTime Systems, pages 191–199, Toledo, Spain, June 11–13, 1997. 72
108
BIBLIOGRAPHY
[DM89]
M. L. Dertouzos and A. K. Mok. Multiprocessor online scheduling of hardrealtime tasks. IEEE Trans. on Software Engineering, 15(12):1497–1506, December 1989. 77, 77
[EJ99]
C. Ekelin and J. Jonsson. Realtime system constraints: Where do they come from and where do they go? In Proc. of the International Workshop on RealTime Constraints, pages 53–57, Alexandria, Virginia, USA, October 1999. 4
[FGB01]
S. Funk, J. Goossens, and S. Baruah. Online scheduling on uniform multiprocessors. In Proc. of the IEEE RealTime Systems Symposium, pages 183–192, London, UK, December 5–7, 2001. 78
[Fid98]
C. J. Fidge. Realtime schedulability tests for preemptive multitasking. RealTime Systems, 14(1):61–93, January 1998. 20
[Foh94]
G. Fohler. Flexibility in Statically Scheduled Hard RealTime Systems. PhD thesis, Technische Universit¨at Wien, Institut f¨ur Technische Informatik, Treitlstr. 3/3/1821, 1040 Vienna, Austria, 1994. 5
[GL89]
D. W. Gillies and J. W.S. Liu. Greed in resource scheduling. In Proc. of the IEEE RealTime Systems Symposium, pages 285–294, Santa Monica, California, December 5–7, 1989. 7, 51
[Goo03]
J. Goossens. Scheduling of offset free systems. RealTime Systems, 24(2):239–258, March 2003. 22, 59
[Gra69]
R. L. Graham. Bounds on multiprocessing timing anomalies. SIAM Journal of Applied Mathematics, 17(2):416–429, March 1969. 7, 13, 27, 51
[Gra72]
R. L. Graham. Bounds on multiprocessor scheduling anomalies and related packing problem. In Proceedings AFIPS Spring Joint Computer Conference, pages 205–217, 1972. 56
[HL94]
R. Ha and J. W.S. Liu. Validating timing constraints in multiprocessor and distributed realtime systems. In Proc. of the IEEE Int’l Conf. on Distributed Computing Systems, pages 162–171, Poznan, Poland, June 21– 24, 1994. 8, 13, 27, 31, 32, 51, 86, 86, 99
[Hor74]
W. A. Horn. Some simple scheduling algorithms. Naval Research Logistics Quarterly, 21(1):177–185, March 1974. 60, 77, 81, 81
[HP96]
J. L. Hennessy and D. A. Patterson. Computer Architecture: A Quantitive Approach. Morgan Kaufmann, London, second edition, 1996. 4
[JP86]
M. Joseph and P. Pandya. Finding response times in a realtime system. Computer Journal, 29(5):390–395, October 1986. 20, 42
BIBLIOGRAPHY
109
[JPKA95]
T. Jochem, D. Pomerleau, B. Kumar, and J. Armstrong. PANS: A portable navigation platform. In 1995 IEEE Symposium on Intelligent vehicle, Detroit, Michigan, USA, September 25–26, 1995. 1
[JSM91]
K. Jeffay, D. F. Stanat, and C. U. Martel. On nonpreemptive scheduling of periodic and sporadic tasks. In Proc. of the IEEE RealTime Systems Symposium, pages 129–139, San Antonio, Texas, December 4–6, 1991. 7
[KAS93]
D. I. Katcher, H. Arakawa, and J. K. Strosnider. Engineering and analysis of fixed priority schedulers. IEEE Trans. on Software Engineering, 19(9):920–934, September 1993. 22
[KP95]
B. Kalyanasundaram and K. Pruhs. Speed is as powerful as clairvoyance. In 36th Annual Symposium on Foundations of Computer Science, pages 214–223, Milwaukee, Wisconsin, 1995. 30
[KSH93]
G. Koren, D. Shasha, and S.C. Huang. MOCA: A multiprocessor online competitive algorithm for realtime system scheduling. In Proc. of the IEEE RealTime Systems Symposium, pages 172–181, RaleighDurham, North Carolina, December 1–3, 1993. 74, 74, 78
[Kuh62]
T. S. Kuhn. The structure of scientific revolutions. 1962. 52
[LDG01]
J. M. L´opez, J. L. D´ıaz, and D. F. Garc´ıa. Minimum and maximum utilization bounds for multiprocessor RM scheduling. In Proc. of the EuroMicro Conference on RealTime Systems, pages 67–75, Delft, The Netherlands, June 13–15 2001. 12, 13, 27, 41, 55
[LGDG00]
J.M. L´opez, M. Garc´ıa, J.L. D´ıaz, and D.F. Garc´ıa. Worstcase utilization bound for EDF scheduling on realtime multiprocessor systems. In Proc. of the 12th EuroMicro Conference on RealTime Systems, pages 25–33, Stockholm, Sweden, June 19–21, 2000. 7, 7, 23, 92, 93, 99, 99
[Liu69]
C. L. Liu. Scheduling algorithms for multiprocessors in a hard realtime environment. In JPL Space Programs Summary 37–60, volume II, pages 28–31. 1969. 7, 7
[Liu00]
J. W. S. Liu. RealTime Systems, chapter 1. Prentice Hall, 2000. ISBN 0130996513. 4
[LL73]
C. L. Liu and J. W. Layland. Scheduling algorithms for multiprogramming in a hardrealtime environment. Journal of the Association for Computing Machinery, 20(1):46–61, January 1973. 11, 12, 19, 20, 20, 20, 22, 51, 61, 73
[LL03]
L. Lundberg and H. Lennerstad. Global multiprocessor scheduling of tasks using timeindependent priorities. In Proc. of the IEEE Real Time Technology and Applications Symposium, volume 9, Washington, DC, May 27–30, 2003. 12, 12, 13, 78, 78, 78
110
BIBLIOGRAPHY
[LM81]
E. L. Lawler and C. U. Martel. Scheduling periodically occurring tasks on multiple processors. Information Processing Letters, 12(1):9–12, February 1981. 77
[LMM98a]
S. Lauzac, R. Melhem, and D. Moss´e. Comparison of global and partitioning schemes for scheduling rate monotonic tasks on a multiprocessor. In Proc. of the EuroMicro Workshop on RealTime Systems, pages 188– 195, Berlin, Germany, June 17–19, 1998. 24, 60
[LMM98b]
S. Lauzac, R. Melhem, and D. Moss´e. An efficient RMS admission control and its application to multiprocessor scheduling. In Proc. of the IEEE Int’l Parallel Processing Symposium, pages 511–518, Orlando, Florida, March 1998. 7, 12, 41, 42, 42, 42, 50, 56, 56
[LS99]
T. Lundqvist and P. Stenstr¨om. Timing anomalies in dynamically scheduled microprocessors. In Proc. of the IEEE RealTime Systems Symposium, pages 12–21, Scottsdale, Arizona, December 1–3, 1999. 51
[LSD89]
J. Lehoczky, L. Sha, and Y. Ding. The rate monotonic scheduling algorithm: Exact characterization and average behavior. In Proc. of the IEEE RealTime Systems Symposium, pages 166–171, Santa Monica, California, December 5–7, 1989. 42
[Lun98]
L. Lundberg. Multiprocessor scheduling of age constraint processes. In Proc. of the International Conference on RealTime Computing Systems and Applications, pages 42–47, Hiroshima, Japan, October 27–29, 1998. 24
[Lun02]
L. Lundberg. Analyzing fixedpriority global multiprocessor scheduling. In Proc. of the IEEE Real Time Technology and Applications Symposium, volume 8, pages 145–153, San Jos´e, California, September 24–27, 2002. 12, 101
[LW82]
J. Y.T. Leung and J. Whitehead. On the complexity of fixedpriority scheduling of periodic, realtime tasks. Performance Evaluation, 2(4):237–250, December 1982. 12, 41, 41, 73, 78
[MFFR02]
P. Marti, J. M. Fuertes, G. Fohler, and K. Ramamritham. Improving qualityofcontrol using flexible timing controls: Metric and scheduling issues. In Proc. of the IEEE RealTime Systems Symposium, Austin, Texas, December 3–5, 2002. 71
[Mok83]
A. K. Mok. Fundamental Design Problems of Distributed Systems for the HardRealTime Environment. Ph.D. thesis, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, Cambridge, Massachusetts, May 1983. 77
BIBLIOGRAPHY
111
[Mok00]
A. K. Mok. Tracking realtime systems requirements, December 12–14, 2000. Invited talk at the International Conference on RealTime Computing Systems and Applications. 51, 51
[Moo65]
G. E. Moore. Cramming more components onto integrated circuits. Electronics, 38(8), April19 1965. Available at ftp://download.intel.com/research/silicon/moorespaper.pdf. 4
[Mur88]
F. D. Murgolo. Anomalous behavior in bin packing algorithms. Discrete Applied Mathematics, 21(3):229–243, October 1988. North Holland. 61, 61, 61
[Neu62]
J. Neumann. A preliminary discussion of the logical design of an electronic computing instrument. Datamation, 1962. 2, 2
[NS96]
S. G. Nash and A. Sofer. Linear and Nonlinear optimization. McGrawHill, 1996. ISBN 0070460655. 48, 103
[OB98]
D. Oh and T. P. Baker. Utilization bounds for nprocessor rate monotone scheduling with static processor assignment. RealTime Systems, 15(2):183–192, September 1998. 12, 12, 13, 23, 27, 41, 41, 55, 92, 93
[OS95a]
Y. Oh and S. H. Son. Allocating fixedpriority periodic tasks on multiprocessor systems. RealTime Systems, 9(3):207–239, November 1995. 12, 41
[OS95b]
Y. Oh and S. H. Son. Fixedpriority scheduling of periodic tasks on multiprocessor systems. Technical Report 9516, Department of Computer Science, University of Virginia, March 1995. 12, 41
[Par72]
D. L. Parnas. On the criteria to be used in decomposing systems into modules. Communications of the ACM, 15(12):1053—1058, dec 1972. 2
[PSTW97]
C. A. Phillips, C. Stein, E. Torng, and J. Wein. Optimal timecritical scheduling via resource augmentation. In Proc. of the TwentyNinth Annual ACM Symposium on Theory of Computing, pages 140–149, El Paso, Texas, May 4–6 1997. 30, 30, 30, 78, 81
[Ram96]
K. Ramamritham. Where do time constraints come from and where do they go? Journal of Database Management, 7(2):4–10, 1996. Invited paper. 4
[Ram02]
S. Ramamurthy. Scheduling periodic hard realtime with arbitrary deadlines tasks on multiprocessors. In Proc. of the IEEE RealTime Systems Symposium, pages 59–68, Austin, Texas, December 3–5, 2002. 11
[RM00]
S. Ramamurthy and M. Moir. Staticpriority periodic scheduling on multiprocessors. In Proc. of the IEEE RealTime Systems Symposium, pages 69–78, Orlando, Florida, November 27–30, 2000. 11
112
BIBLIOGRAPHY
[SB94]
M. Spuri and G.C. Buttazzo. Efficient aperiodic service under earliest deadline scheduling. In Proc. of the IEEE RealTime Systems Symposium, pages 2–11, San Juan, Puerto Rico, December 7–9, 1994. 72
[SB02]
A. Srinivasan and S. Baruah. Deadlinebased scheduling of periodic task systems on multiprocessors. Information Processing Letters, 84(2):93– 98, October 2002. 27, 80
[Ser72]
O. Serlin. Scheduling of time critical processes. In Proceedings of the Spring Joint Computer Conference, pages 925–932, Atlantic City, NJ, May 1972. 12
[SRS95]
C. Shen, K. Ramamritham, and J. A. Stankovic. Resource reclaiming in multiprocessor realtime systems. IEEE Trans. on Parallel and Distributed Systems, 4(4):382–397, April 1995. 51
[SSRB98]
J. A. Stankovic, M. Spuri, K. Ramamritham, and G. C. Buttazzo. Deadline scheduling for realtime systems. Kluwer Acamdeic Publishers, 1998. ISBN 0792382692. 6, 73, 74
[STAS03]
V. Sharma, A. Thomas, T. Abdelzaher, and K. Skadron. Poweraware QoS management in web servers. In Proc. of the IEEE RealTime Systems Symposium, Cancun, Mexico, December 3–5, 2003. 103
[SVC98]
S. S´aez, J. Vila, and A. Crespo. Using exact feasibility tests for allocating realtime tasks in multiprocessor systems. In 10th Euromicro Workshop on Real Time Systems, pages 53–60, Berlin, Germany, June 17–19, 1998. 12, 41
[XP90]
J. Xu and D. L. Parnas. Scheduling processes with release times, deadlines, precedence, and exclusion relations. IEEE Trans. on Software Engineering, 16(3):360–369, March 1990. 5
[Xu93]
J. Xu. Multiprocessor scheduling of processes with release times, deadlines, precedence, and exclusion relations. IEEE Trans. on Software Engineering, 19(2):139–154, February 1993. 5
The numbers after an entry list the pages that have a reference to that entry.
Appendix A
Impossibility of periodic execution Here we show that it is in general impossible to schedule tasks to execute periodically. Example 21 Consider two tasks, 1 and 2 , to be scheduled on one processor. 1 executes for the first time at time t1 and, since it is periodic, it should also execute at every time t1 + k1 T1 , where k1 is a nonnegative integer, and T1 is the period of 1 . Analogously, 2 executes for the first time at time t2 and should execute at every time t2 + k2 T2 . To illustrate the point with this example, we assume that t1 and t2 are integers. Now, let T1 = L and T2 = L + 1. In this example, we do not need to know the execution times of tasks and we do not need to know which scheduling algorithm is used. We will now consider two cases: I.
t1 t2 .
Let us look at the instances when k1 = k2 = t1 t2 . Since 1 executed at time t1 it must also execute at time t1 + k1 T1 = t1 + (t1 t2 ) L. Analogously, since 2 executed at time t2 it must also execute at time t2 + k2 T2 = t2 + (t1 t2 ) (L + 1) = t2 + (t1 t2 ) L + (t1 t2 ) = t1 + (t1 t2 ) L. Hence, both 1 and 2 should execute at time t1 + (t1 t2 ) L. II.
t1 < t2 . Let us look at the instances when:
t t k1 = k2 + d 2 1 e L 113
114
APPENDIX A. IMPOSSIBILITY OF PERIODIC EXECUTION
t t k2 = d 2 1 e L + t1 L
t2
It can readily be seen that k1 0 and k2 0. This makes sense. Since 1 executed at time t1 it must also execute at time t1 + k1 yields:
t1 + k1 T1 = = =
use Equation A.1 =
= =
(A.1)
T1 .
Algebra
t1 + k1 L t t t1 + (k2 + d 2 1 e) L L t2 t1 t1 + k2 L + d eL L t1 + k2 L + k2 (t1 t2 ) t2 + k2 L + k2 t2 + k2 (L + 1)
Analogously, since 2 executed at time t2 it must also execute at time:
t2 + k2 T2 = t2 + k2 (L + 1) Hence, both 1 and 2 should execute at time t2 + k2 (L + 1).
In both cases, there is an instant when both 1 and 2 should execute. This is impossible because there is only one processor, and a processor cannot execute two or more tasks simultaneously. Hence, we can conclude that it is in general impossible to schedule tasks periodically.
Appendix B
Admission controllers that can reject admitted tasks Here we discuss admission controllers that can reject admitted tasks. Example 22 Consider online scheduling of aperiodic tasks on one processor using EDF and use an admission controller that must not reject a task that has already been admitted. A task 1 arrives at time t = 0 and requests to execute 1 time unit during [0,1). The admission controller can admit it or reject it: I.
II.
1 is rejected.
No more tasks arrive, and the admission controller has kept the processor busy for zero time units but it could have kept the processor busy for 1 time unit if the admission controller knew all task arrivals initially.
1
is admitted. A task 2 arrives at time t = A2 = 1 1=L and requests to execute L time units during [1 1=L,1 1=L + L). (We assume that 0 < L < 1.) Since we use an admission controller that must not reject the admitted task, 1 , we must reject 2 . The admission controller has kept the processor busy for 1 time unit but it could have kept the processor busy for L time units if it knew all task arrivals initially.
Regardless of our choice of L, we do can this reasoning for every algorithm that must not reject a task that is already admitted. Hence we can choose L ! 1 and this gives us a competitive factor of zero.
115
116
APPENDIX B. CAN REJECT ADMITTED TASKS
Appendix C
Defining utilization of aperiodic tasks Here we discuss choices in how to define utilization in aperiodic scheduling. Let Ai denote the arrival time of an aperiodic task, Ci its execution time and Di its deadline, that is, the task i must execute Ci time units within [Ai ,Ai + Di ). Let fi denote the finishing time of task i . Let Ci;remain (t) denote the remaining execution time of task i at time t. Let Di;remain (t) denote the remaining deadline of task i , that is, Di;remain (t) = Ai + Di t. I conceive of four possible definitions of utilization as shown below. I.
U (t) =
P
IV.
U (t) =
P
Ci i 2fk :Ak t
m X1 k=1
;
max(0 1 +
127
1
Bm ) k
)
))
APPENDIX G. SOME ALGEBRAIC REWRITING
128 Rearranging:
m X1
U (t = Afailed ) >
k=1
Bm k
;
max(0 1
1
)
Rearranging:
m X1
U (t = Afailed ) >
k=1
;
(1
min(1
Bm k
1
))
Rearranging:
U (t = Afailed ) > m
m X1
1
k=1
;
min(1
Bm k
1
)
Algebraic manipulation 2 Consider:
m X1
Bm min(1; k k=1
1
)
1+
1
Z m
k=1
Bm k
;
min(1
1
)
(G.1)
We can rewrite the integral to: Z m
1
Bm min(1; k k=1
1
)
Z B m
1
Bm k k=1 Z m 1 Bm min(1; k k=B m 1
=
;
min(1
1
)+ 1
)
Rewriting again: Z m
1
Bm min(1; k k=1
1
)
=
1
Z B m
k=1 Z m
1+
1
Bm k k=B m 1
1
Rewriting again: Z m
k=1
1
min(1
;
Bm k
1
)
=
Bm Bm
(
1
1+
Bm m 1 1
1) ln
(G.2)
129 Substituting Equation G.2 in Inequality G.1 yields:
m X1 k=1
min(1
;
Bm k
1
)
1+
Bm
Bm
+(
1
1
Bm m 1 1
1) ln