• No results found

Scheduling Algorithms for Real-Time Systems

N/A
N/A
Protected

Academic year: 2021

Share "Scheduling Algorithms for Real-Time Systems"

Copied!
143
0
0

Loading.... (view fulltext now)

Full text

(1)

Scheduling Algorithms for Real-Time Systems

by

Arezou Mohammadi

A thesis submitted to the School of Computing in conformity with the requirements for the degree of

Doctor of Philosophy

Queen’s University Kingston, Ontario, Canada

April 2009

(2)

Abstract

Real-time systems are those whose correctness depends not only on logical results of computations, but also on the time at which the results are produced. This thesis provides a formal definition for real-time systems and includes the following original contributions on real-time scheduling algorithms.

The first topic studied in the thesis is minimizing the total penalty to be paid in scheduling a set of soft real-time tasks. The problem is NP-hard. We prove the properties of any optimal scheduling algorithm. We also derive a number of heuristic algorithms which satisfy the properties obtained. Moreover, we obtain a tight upper bound for the optimal solution to the problem. Numerical results that compare the upper bound with the optimal solution and the heuristic algorithms are provided.

In the second part of this thesis, we study the problem of minimizing the number of processors required for scheduling a set of periodic preemptive independent hard real-time tasks. We use a partitioning strategy with an EDF scheduling algorithm on each processor. The problem is NP-hard. We derive lower and upper bounds for the number of processors required to satisfy the constraints of the problem. We also compare a number of heuristic algorithms with each other and with the bounds derived in this research. Numerical results demonstrate that our lower bound is very tight.

In the third part of the thesis, we study the problem of uplink scheduling in telecommunication systems with two dimensional resources. Our goal is to maximize the total value of the packets sent in uplink subframe such that system constraints and requirements are satisfied. The packets have various QoS requirements and have either soft or hard deadlines. We take two approaches, namely 0-1 and fractional approaches, to model the problem. Considering the properties of the application, we derive globally optimal solutions in polynomial time for the models. We also present a method to fine-tune the models. Numerical results are provided to compare the performance of the various optimal algorithms each corresponding to a model.

(3)

Acknowledgements

I would like to extend my sincere thanks to my supervisor, Professor Selim Akl, for his support, encouragement and understanding. He is a generous source of knowl-edge. I am thankful to him for giving me the freedom to find my path in research while helping me to stay in the right path.

I am grateful to my supervisory committee, Professor Selim Akl, Professor Hos-sam Hassanein and Professor Kai Salomaa for their dedication and guidance through-out my PhD program.

My thesis examining committee members (in alphabetical order), Professor Dorothea Blostein, Professor Parvin Mousavi, Professor John Oommen, and Professor Ying Zou, deserve special thanks for spending their valuable time to review my thesis and for providing constructive comments. I am also thankful to Professor Andrew Lewis for chairing my defense committee.

I wish to thank Debby Robertson, the Graduate Secretary of Queen’s School of Computing, for making my academic life easier at Queen’s.

My deepest gratitude goes to my dear parents for their support, encouragement, and unconditional love. They have made my life beautiful. I am thankful to them for their trust and encouragement to be the best I can be.

I am indebted to my husband Firouz Behnamfar for his kindness, encouragement and endless support, love, and care. I would not have been able to complete this thesis without my warm life with him. I always benefited from his brightness and patience in my discussions about my ideas and thoughts with him.

I would also like to gratefully acknowledge the financial support received from the Natural Sciences and Engineering Research Council (NSERC), School of Computing, and School of Graduate Studies.

(4)

Contents

Abstract i Acknowledgements ii List of Figures vi Acronyms ix Chapter 1 Introduction 1 1.1 Introduction . . . 1 1.2 Real-Time Systems . . . 4

1.3 Problems that seem real-time but are not . . . 5

1.4 Real-Time Scheduling . . . 6

1.5 Thesis Contributions . . . 13

1.6 Thesis Organization . . . 14

Chapter 2 Penalty Minimization for Soft Real-Time Tasks 16 2.1 Introduction . . . 16

2.2 Problem definition . . . 20

2.3 Optimal scheduling algorithm properties . . . 22

2.4 Heuristic algorithms . . . 25

2.4.1 Algorithms Description . . . 25

(5)

2.5 Upper bound . . . 31

2.5.1 Deriving an Upper Bound . . . 31

2.5.2 Simulation Results: The Upper Bound . . . 34

2.6 Conclusions . . . 35

Chapter 3 Minimizing the Number of Processors for Scheduling Hard Real-Time Tasks 39 3.1 Introduction . . . 39

3.2 EDF scheduling . . . 42

3.3 Problem definition . . . 44

3.4 Heuristic Algorithms . . . 45

3.4.1 The BF-based Algorithms . . . 48

3.4.2 The FF-based Algorithms . . . 49

3.5 Lower and Upper Bounds . . . 51

3.5.1 A Lower Bound . . . 53

3.5.2 An Upper Bound . . . 54

3.6 Simulation Results . . . 56

3.7 Conclusions . . . 59

Chapter 4 Uplink Scheduling Algorithms for WiMAX Systems 61 4.1 Introduction . . . 61

4.2 Problem Definition . . . 68

4.3 Heuristic Algorithms . . . 73

4.4 Model-Based Optimal Algorithms: First Method . . . 74

4.4.1 First Model . . . 74

4.4.2 Second Model: Considering the Number of Packets in Each QoS class . . . 81

(6)

4.4.4 Fourth Model: Considering the Spectral Efficiency of Packets 84 4.4.5 General Model: Maximizing the Value Based on Deadline,

Spectral Efficiency, Customer Needs, and QoS Classes . . . . 86

4.4.6 Fine Tuning the Model . . . 87

4.4.7 Simulation Results for Packets with Hard Deadlines . . . 88

4.5 A Model for Packets with Soft and Hard Deadlines . . . 93

4.5.1 Model and Optimal Algorithm . . . 93

4.5.2 Simulation Results for Packets with Soft and Hard Deadlines . 95 4.6 Model-Based Optimal Algorithms: Second Method . . . 96

4.6.1 Model and Optimal Algorithm . . . 96

4.6.2 Simulation Results for the Second Method . . . 101

4.7 Conclusions . . . 102

Chapter 5 Conclusions and Open Problems 109 5.1 Conclusions . . . 109

5.2 Open Problems . . . 116

(7)

List of Figures

2.1 Status of processor in the proof of Lemma 1. . . 22 2.2 Status of processor for an optimal schedule in the proof of Lemma 1. . 23 2.3 Status of processor in the proof of Theorem 2.3.2. . . 24 2.4 Status of processor for a more efficient schedule in the proof of

The-orem 2.3.2. . . 24 2.5 Task preemption in the proof of Lemma 2.3.3. . . 25 2.6 Example of a more efficient schedule for the proof of Lemma 2.3.3. . 25 2.7 Comparing different priority functions. . . 30 2.8 ComparingS8 andS15. . . 31

2.9 The total penalty of the optimal solution and the upper bound in (2.6). 35 2.10 The upper bound of the total penalty for a large number of tasks. . . . 36 2.11 Comparing the upper bound of the total penalty andS8. . . 36

3.1 Number of processors required for scheduling n real-time tasks by various EDF-based partitioning algorithms. . . 58 3.2 Enlarged version of a portion of Figure 3.1. . . 59 4.1 WiMAX frame structure, sub-channel, symbol, and a typical UL slot. . 71 4.2 Comparison between the number of UGS packets which are selected by the

algorithms to be sent. . . 89 4.3 Comparison between the number of rtps packets which are selected by the

(8)

4.4 Comparison between the number of nrtps packets which are selected by the algorithms to be sent. . . 91 4.5 Comparison between the number of BE packets which are selected by the

algorithms to be sent. . . 92 4.6 Throughput achieved by the EvalHQF algorithm when the spectral efficiency

of the packets is either considered or not considered in the objective. . . 93 4.7 Comparison between the number of BE packets sent when BE and nrtps

packets have hard or soft deadlines. The percentage of the arrived packets are 15, 10, 5, and 70 for UGS, rtps, nrtps, and BE classes, respectively. Spectral efficiencies of the packets are the same. . . 96 4.8 Comparison between the number of UGS packets sent when BE and nrtps

packets have hard or soft deadlines. The percentage of the arrived packets are 15, 10, 5, and 70 for UGS, rtps, nrtps, and BE classes, respectively. Spectral efficiencies of the packets are the same. . . 97 4.9 Comparison between the number of BE packets sent when BE and nrtps

packets have hard or soft deadlines. The percentage of the arrived packets are 55, 15, 5, and 25 for UGS, rtps, nrtps, and BE classes, respectively. Spectral efficiencies of the packets are the same. . . 98 4.10 Comparison between the number of UGS packets sent when BE and nrtps

packets have hard or soft deadlines. The percentage of the arrived packets are 55, 15, 5, and 25 for UGS, rtps, nrtps, and BE classes, respectively. Spectral efficiencies of the packets are the same. . . 99 4.11 Comparison between the number of BE packets sent when BE and nrtps

packets have hard or soft deadlines, using the fractional algorithms of Eval-HQF and EvalEval-HQF-SH. The percentage of the arrived packets are 55, 15, 5, and 25 for UGS, rtps, nrtps, and BE classes, respectively. . . 102

(9)

4.12 Comparison between the number of UGS packets sent when BE and nrtps packets have hard or soft deadlines, using the fractional algorithms of Eval-HQF and EvalEval-HQF-SH. The percentage of the arrived packets are 55, 15, 5, and 25 for UGS, rtps, nrtps, and BE classes, respectively. . . 103 4.13 Comparison between the number of BE packets sent when BE and nrtps

packets have hard or soft deadlines, using the fractional algorithms of Eval-HQF and EvalEval-HQF-SH. The percentage of the arrived packets are 55, 15, 5, and 25 for UGS, rtps, nrtps, and BE classes, respectively. Spectral efficien-cies of the packets are the same. . . 104 4.14 Comparison between the number of UGS packets sent when BE and nrtps

packets have hard or soft deadlines, using the fractional algorithms of Eval-HQF and EvalEval-HQF-SH. The percentage of the arrived packets are 55, 15, 5, and 25 for UGS, rtps, nrtps, and BE classes, respectively. Spectral efficien-cies of the packets are the same. . . 105

(10)

Acronyms AG Annealing Genetic

BE Best Effort BF Best-Fit

BFD Best Fit Decreasing

BFDE Best Fit Decreasing in Execution BFDP Best Fit Decreasing in Period BFDU Best Fit Decreasing in Utilization BFIE Best Fit Increasing in Execution BFIP Best Fit Increasing in Period BFIU Best Fit Increasing in Utilization BPP Bin Packing problem BS Base Station BWA Broadband Wireless Access

DASA Dependent Activity Scheduling Algorithm DS Deferred Server

DSP Digital Signal Processing EDF Earliest Deadline First FF First-Fit

FFD First Fit Decreasing

FFDE First Fit Decreasing in Execution FFDP First Fit Decreasing in Period FFDU First Fit Decreasing in Utilization FFIE First Fit Increasing in Execution FFIP First Fit Increasing in Period FFIU First Fit Increasing in Utilization FTP File Transfer Protocol

(11)

GPC Grant Per Connection GPSS Grant Per Subscriber Station

LBESA Lockes Best Effort Scheduling Algorithm LLF Least Laxity First

LP Linear Programming LTE Long Term Evolution MAC Medium Access Control MAN Metropolitan Area Network MFFD Modified First-Fit Decreasing

NF Next-Fit

nrtPS Non-real-time Polling Service

OFDMA Orthogonal Frequency Division Multiple Access PMP Point-to-Multipoint

QoS Quality of Service

RM Rate Monotonic

rtPS Real-time Polling Service SS Subscriber Station

TDD Time Division Duplex UGS Unsolicited Grant Service VoIP Voice over Internet Protocol

(12)

Chapter 1

Introduction

1.1

Introduction

In the physical world, the purpose of a real-time system is to have a physical effect within a chosen time-frame. Typically, a real-time system consists of a controlling system (computer) and a controlled system (environment). The controlling system interacts with its environment based on information available about the environment. On a real-time computer, which controls a device or process, sensors will provide readings at periodic intervals and the computer must respond by sending signals to actuators. It is imperative that the state of the environment, as received by the con-trolling system, be consistent with the actual state of the environment. Otherwise, the effects of the controlling systems’ activities may be disastrous. Therefore, periodic monitoring of the environment as well as timely processing of the sensed information is necessary [40, 66].

In a real-time system, there may be unexpected or irregular events and these must also receive a response. In all cases, there will be a time bound within which the response should be delivered. The ability of the computer to meet these demands depends on its capacity to perform the necessary computations in the given time. If a

(13)

number of events occur close together, the computer will need to schedule the com-putations so that each response is provided within the required time bounds. It may be that, even so, the system is unable to meet all the possible unexpected demands. In this case we say that the system lacks sufficient resources; a system with unlimited resources and capable of processing at infinite speed could satisfy any such timing constraint. Failure to meet the timing constraint for a response can have different con-sequences; there may be no effect at all, or the effects may be minor or correctable, or the results may be catastrophic. On the other hand, having a sufficient number of processors, one is able to schedule the tasks without missing any deadlines.

Each task occurring in a real-time system has some timing properties. These timing properties should be considered when scheduling tasks on a real-time system. The timing properties of a given task refer to the following items [24, 40, 46, 66]:

Release time (or ready time (rj)): Time at which the task is ready for processing.

Deadline (dj): Time by which execution of the task should be completed.

Execution time (ej): Time taken without interruption to complete the task, after

the task is started.

Completion time (Cj): Maximum time taken to complete the task, after the task

is started. This factor depends on the schedule.

Makespan factor (ξj): Ratio ofCj toej, i.e., ξj = Cj/ej. This factor depends

on the schedule.

Finishing time (Fj): Time at which the task is finished: Fj = Cj +rj. This

factor depends on the schedule.

Penalty factor (Gj): Penalty that should be paid per time unit after the deadline

(14)

Priority (ζj): Relative urgency of the task.

Period (Pj): A periodic taskτj is a task recurring at intervals of time. Period

Pj is the time interval between any two consecutive occurrences of taskτj.

Utilization factor (uj): The utilization factor of a periodic task τj is defined

by ej/Pj. The utilization factor of a set ofn periodic tasks τ1, τ2, τ3, ..., τn is

defined byPni=1ei/Pi.

Real-time systems span a broad spectrum of complexity from very simple micro-controllers to highly sophisticated, complex and distributed systems. Some examples of real-time systems include process control systems, flight control systems, flexible manufacturing applications, robotics, intelligent highway systems, and high speed and multimedia communication systems [7, 13, 24, 31, 40, 46, 61, 66]. For instance, the objective of a computer controller might be to command the robots to move parts from machines to conveyors in some required fashion without colliding with other objects. If the computer controlling a robot does not command it to stop or turn in time, the robot might collide with another object on the factory floor.

A real-time system will usually have to meet many demands within a limited time. The importance of the demands may vary with their nature (e.g. a safety-related demand may be more important than a simple data-logging demand) or with the time available for a response. Thus, the allocation of the system resources needs to be planned so that all demands are met by the time of their respective deadlines. This is usually done using a scheduler which implements a scheduling policy that determines how the resources of the system are allocated to the demands. Scheduling policies can be analyzed mathematically so the precision of the formal specification and program development stages can be complemented by a mathematical timing analysis of the program properties [13, 40, 66].

(15)

1.2

Real-Time Systems

In this section we present a formal definition of real-time systems. As we mentioned in Section 1.1, real-time systems are defined as those systems in which the correctness of the system depends not only on the logical result of computation, but also on the time at which the results are produced. If the timing constraints of the system are violated, system failure occurs or a punishment is incurred for the violation. Hence, it is essential that the timing constraints of the system are guaranteed to be met. It is also desirable that the system attain a high degree of utilization while satisfying the timing constraints of the system [7, 13, 40, 46, 66].

A real-time application is normally composed of multiple tasks with different lev-els of criticality. Although missing deadlines is not desirable in a real-time system,

soft real-time tasks could miss some deadlines and the system could still work

cor-rectly. However, missing some deadlines for soft real-time tasks will lead to paying penalties. On the other hand, hard real-time tasks cannot miss any deadline, other-wise, undesirable or fatal results will be produced in the system [40, 46, 66].

We can formally define a real-time system as follows.

Consider a system consisting of a set of tasks, T = {τ1, τ2, ..., τn}, where the

finishing time of each task τi ∈ T is Fi. The system is said to be real-time if there

exists at least one taskτi ∈T, which falls into one of the following categories:

(1) Taskτiis a hard real-time task. That is, the execution of the taskτi should be

completed by a given deadlinedi; i.e.,Fi ≤di.

(2) Taskτi is a soft real-time task. That is, the later the task τi finishes its

com-putation after a given deadlinedi, the more penalty it pays. A penalty function

G(τi)is defined for the task. If Fi ≤ di, the penalty function G(τi) is zero.

OtherwiseG(τi)>0. The value ofG(τi)is an increasing function ofFi−di.

(16)

tasks.

LetTSbe the set of all soft real-time tasks inT; i.e.,TS ={τS,1, τS,2, ..., τS,l}with

τS,i∈T. The penalty function of the system is denoted byG(T), where

G(T) =

l

X

i=1

G(τS,i)

1.3

Problems that seem real-time but are not

Sometimes the concept of real-time is misunderstood. The following cases are given to clarify this [72, 73].

• One will occasionally see references to “real-time” systems when what is meant is “on-line”, or “an interactive system with better response time than what we used to have”. This is not correct. For instance, a system interacting with a human and waiting for a person’s response is not real-time. This is because the system is interacting with a human who can tolerate hundreds of milliseconds of delays without a problem. In other words, since no deadline is given for any task, it is not a real-time system.

A real-life example is standing in a line waiting for the checkout in a grocery store. If the line can grow longer and longer without bound, the checkout pro-cess is not real-time. But, if the length of the line is bounded, customers should be served and output as rapidly, on average, as they arrive into the line. The grocer must lose business or pay a penalty if the line grows longer than the determined bound. In this case the system is real-time. The deadline of the checkout process depends on the maximum length given for the line and the average serving time for each costumer.

• One will also see references to real-time systems when what is meant is just “fast”. It might be worth pointing out that “real-time” is not necessarily

(17)

syn-onymous with “fast”. For example consider a robot that has to pick up some-thing from a conveyor belt. The object is moving, and the robot has a small time interval to pick it up. If the robot is late, the object won’t be there anymore, and thus the job will have been done incorrectly, even though the robot went to the right place. If the robot is too early there, the object won’t be there yet, and the robot may block it.

1.4

Real-Time Scheduling

For a given set of tasks the general scheduling problem asks for an order accord-ing to which the tasks are to be executed such that various constraints are satisfied. The scheduling problems considered in this thesis are characterized by a set of tasks T ={τ1, τ2, ..., τn}and a set of processors (machines)π={π1, π2, ..., πm}on which

the tasks are to be processed. Scheduling, generally speaking, means the assignment of processors from π to tasks from T in order to complete all tasks under certain imposed constraints. In classical scheduling theory it is also assumed that each task is to be processed by at most one processor at a time and each processor is capa-ble of processing at most one task at a time [32]. For a given set of real-time tasks, we aim to devise a feasible allocation/schedule to satisfy timing constraints. Let an

implementation consists of a hardware platform and the scheduler under which the

program is executed. An implementation is called feasible if every execution of the program meets all its deadlines. The release time, the deadline and the execution time of the tasks are some of the parameters that should be considered when scheduling tasks on a real-time system. The execution of a task may or may not be interrupted (preemptive or non-preemptive scheduling). Over a set of tasks, there may be a prece-dence relation which constrains the order of execution. Specifically, the execution of a task cannot begin until the execution of all its predecessors, according to the prece-dence relation, is completed. The system on which the tasks are to be executed is

(18)

characterized by the amounts of resources available [13, 24, 25, 32, 40, 45, 46, 66]. The following goals should be considered in scheduling a real-time system: [32, 40, 45].

• Meeting the timing constraints of the system

• Preventing simultaneous access to shared resources and devices

• Attaining a high degree of utilization while satisfying the timing constraints of the system; however this is not a primary driver.

• Reducing the cost of context switches caused by preemption

• Reducing the communication cost in real-time distributed systems; we should find the optimal way to decompose the real-time application into smaller tions in order to have the minimum communication cost between mutual por-tions, where each portion is assigned to a computer.

• Minimizing the number of resources satisfying the timing constraints of the system.

• Minimizing the penalty to be paid for overdue soft real-time tasks. In addition, the following items are desired in advanced real-time systems: • Task scheduling for a real-time system whose behavior is dynamically adaptive,

reconfigurable, reflexive and intelligent. • Covering reliability, security, and safety.

Basically, the scheduling problem for a real-time system is to determine a sched-ule for the execution of the tasks so that they satisfy their timing constraints [13, 25, 32, 40, 45, 66]. The appropriate scheduling approach should be designed based on the properties of the system and the tasks occurring in it. These properties are as follows [25, 40, 45, 66]:

(19)

Soft/Hard real-time tasks

The real-time tasks are classified as hard and soft real-time tasks. This is de-scribed in Section 1.2.

Periodic/Aperiodic/Sporadic tasks

Periodic real-time tasks are activated (released) regularly at fixed rates (peri-ods). A majority of sensory processing is periodic in nature. For example, a radar that tracks flights produces data at a fixed rate [13, 32, 38, 45]. Ape-riodic real-time tasks are activated irregularly at some unknown and possibly unbounded rate. The time constraint is usually a deadline. Sporadic real-time tasks are activated irregularly with some known bounded rate. The bounded rate is characterized by a minimum inter-arrival period; that is, a minimum in-terval of time between two successive activations. The time constraint is usually a deadline [13, 32, 38, 45].

Preemptive/Non-preemptive tasks

In some real-time scheduling algorithms, a task can be preempted if another task of higher priority becomes ready. In contrast, the execution of a non-preemptive task should be completed without interruption once it is started [13, 32, 40, 45].

Independent/Dependent tasks

Given a real-time system, a task that is going to start execution may require to receive the information provided by another task of the system. Therefore, execution of a task should be started after finishing the execution of the other task. This is the concept of dependency. The dependent tasks use shared mem-ory or communicate data to transfer the information generated by one task and required by the other one. While we decide about scheduling of a real-time

(20)

system containing some dependent tasks, we should consider the order of the starting and finishing time of the tasks [25, 40, 45, 66].

Fixed/Dynamic priority tasks

In priority driven scheduling, a priority is assigned to each task. Assigning the priorities can be done statically or dynamically while the system is running [13, 25, 40, 45, 66]. The real-time scheduling algorithms are categorized, based on their priority assignment method, into fixed and dynamic priority scheduling algorithms. [13, 25, 40, 45, 66].

Not only for the fixed priority scheduling problems, but also for the dynamic priority problems there exist polynomial algorithms which provide feasible schedules of any task set which satisfy some specific conditions. For exam-ple any set of periodic tasks which satisfyPni=1ei/Pi ≤1is guaranteed to be

feasibly scheduled using the Earliest Deadline First algorithm (EDF) [25, 32, 40, 45, 66, 67].

Many researchers have extensively worked on real-time scheduling algorithms. The Rate Monotonic (RM) scheduling algorithm is one of the most widely studied and used in practice [25, 32, 40, 45, 66]. It is a uniprocessor static-priority preemptive scheme. The RM algorithm and the rate monotonic Deferred Server (DS) scheduling algorithm are in the class of Preemptive Static-priority based algorithms [25, 45]. The

parametric dispatching algorithm ([25, 29]) and the predictive algorithm ([25, 63])

are non-preemptive algorithms that attempt to provide high processor utilization while preserving task deadline guarantees and system schedulability.

The Earliest Deadline First (EDF) algorithm is a priority driven algorithm in which higher priority is assigned to the request that has earlier deadline, and a higher priority request always preempts a lower priority one [25, 32, 40, 45, 66, 67].

The Dynamic Priority Exchange Server, Dynamic Sporadic Server, Total Band-width Server, Earliest Deadline Late Server, and Improved Priority Exchange Server

(21)

are examples of Planning Based algorithms [32], which work under EDF scheduling. There exist many Best Effort real-time scheduling algorithms [32]. Two of the most prominent of them are the Dependent Activity Scheduling Algorithm (DASA) [20] and the Lockes Best Effort Scheduling Algorithm (LBESA) [51]. DASA and LBESA are equivalent to the Earliest Deadline First (EDF) algorithm during underloaded con-ditions [20], where EDF is optimal and guarantees that all deadlines are always sat-isfied. In the event of an overload situation, DASA and LBESA seek to maximize the aggregate task benefit. A system is said to be in overload when the computational demand of the task set exceeds the available processing time. In a real-time system, an overload condition causes one or more tasks to miss their deadlines [14].

For scheduling a real-time system, we need to have enough information, such as the deadline, release time and execution time of each task. Also, it is required to know the importance of the task as compared with the other tasks, its precedence relation, and the other properties of the tasks already mentioned in this section. A majority of systems assume that much of this information is available a priori and, hence, are based on a static design. However, some of the real-time systems are designed to be dynamic and flexible [13, 25, 40, 45, 66].

Recall that an implementation consists of a hardware platform and the scheduler under which the program is executed. We would like to know in advance whether a given algorithm can feasibly schedule a set of real-time tasks on a single processor or multiprocessor platform. Therefore, we should look for the conditions that are

necessary to ensure that an implementation is feasible. The aim is to find necessary

conditions that are also sufficient, so that if they are satisfied, an implementation is guaranteed to be feasible [25, 32, 40, 45, 66]. An optimal scheduling algorithm is one which may fail to meet a deadline only if no other scheduling algorithm can meet the deadline. Therefore, a feasible scheduling algorithm is optimal if there is no other feasible algorithm with looser conditions. In order to prove the optimality

(22)

of a scheduling algorithm, the feasibility conditions of the algorithm must be known. For example, there is no dynamic-priority scheduling algorithm that can successfully schedule a set of periodic tasks wherePni=1Ci/Pi >1. Therefore, EDF is an optimal

algorithm. The optimal algorithm for a real-time scheduling problem is not unique. For instance, in addition to the EDF algorithm, there is another optimal dynamic-priority scheduling algorithm, which is the Least Laxity First (LLF) algorithm [31, 57].

In some real-time systems, the number of events occurring close together is high. In this case, the number of processors serving real-time tasks should be increased. The number of available processors is one of the main factors in deciding how to schedule a retime system. In multiprocessor retime systems, the scheduling al-gorithms should prevent simultaneous access to shared resources and devices. More-over, the best strategy to reduce the communication cost should be provided [32, 45]. If tasks have dependencies, calculating task completion times on a multi-processor system is inherently more difficult than on a single-processor system.

The nature of the application may require distributed computing, with nodes con-nected by communication lines. The problem of finding completion times is then even more difficult, as communication between tasks can now take varying times [66].

Multiprocessor scheduling techniques fall into two general categories: • Global scheduling algorithms

Global scheduling algorithms store the tasks that have arrived, but not finished their execution, in one queue which is shared among all processors. Suppose there exist m processors. At every moment, the m highest priority tasks of the queue are selected for execution on themprocessors using preemption and migration if necessary [45].

(23)

Partitioning scheduling algorithms partition the set of tasks such that all tasks in a partition are assigned to the same processor. Tasks are not allowed to migrate, hence the multiprocessor scheduling problem is transformed to many uniprocessor scheduling problems [45].

For systems that contain more than one processor, we not only should decide about the appropriate scheduling algorithm on each processor, but also we have to specify the allocation algorithm which assigns the tasks to the available processors. For multiprocessor real-time systems, calculating the utilization bounds associated with (scheduling, allocation) algorithm pairs leads us to achieving the sufficient con-ditions for feasibly scheduling, analogous to those known for uniprocessors. This approach has several interesting features: it allows us to carry out fast schedulability tests and to qualify the influence of certain parameters, such as the number of proces-sors, on scheduling. For some algorithms, the sufficient condition bound considers not only the number of processors, but also the number of the tasks and their sizes [25, 40, 45].

Global strategies have several disadvantages as compared with the partitioning strategies. Partitioning usually has a low scheduling overhead compared to global scheduling, because tasks do not need to migrate across processors. Furthermore, partitioning strategies reduce a multiprocessor scheduling problem to a set of unipro-cessor ones and hence they allow the use of well-known uniprounipro-cessor scheduling algorithms for each processor. However, partitioning has two negative consequences. First, finding an optimal assignment of tasks to processors is a bin-packing problem, which is an NP-hard problem. Thus, tasks are usually partitioned using non-optimal heuristics. Second, as shown in [16], task systems exist that are schedulable if and only if tasks are not partitioned. Still, partitioning approaches are widely used by system designers. In addition to the above approaches, we can apply hybrid partition-ing/global strategies.

(24)

1.5

Thesis Contributions

This thesis contains the results of my research on three major subjects in the field of real-time scheduling algorithms. The contributions in my thesis include the following original work:

1. We consider a set of soft real-time tasks under overload conditions. Due to limited resources, it is not feasible to schedule the tasks such that they all meet their deadlines. Since the tasks have soft deadlines, we have to pay a penalty for missing the deadlines of tasks. The problem is to minimize the total penalty to be paid. The problem is NP-hard. Our contributions are as follows. We derive and prove some of the properties of any optimal scheduling algorithm for the problem, provide a class of heuristic algorithms, and compare the performance of the proposed algorithms. We also find an upper bound for the objective function, present the simulation results, and compare the upper bound with the optimal solution and the best heuristic algorithm. The upper bound is very tight. 2. We consider a number of hard real-time tasks with high arrival rates. The tasks have hard deadlines, so missing the deadline of one of the tasks will cause failure of the system. The problem is studied under overload conditions and one processor is not enough to handle all of the tasks. In other words, there is no algorithm to guarantee all deadlines can be met using a single processor. Thus, the number of processors should be increased. Increasing the number of processors is costly. The cost should be minimized while the system does not fail. The problem is to find the minimum number of the processors required to guarantee meeting the deadlines of all hard real-time tasks. The problem is NP-hard. Our contributions are as follow. We derive upper and lower bounds for the number of processors required by any allocation algorithm which satisfies the EDF schedulability condition on each processor. We compare our bounds

(25)

with a number of heuristic algorithms using simulations. We observe that the lower bound that is obtained in this thesis is very tight.

3. We study the problem of designing a scheduling algorithm for uplink trans-missions in telecommunication systems with two-dimensional radio resources, such as WiMAX. The problem is a real-time scheduling problem, where QoS requirements should be satisfied while scheduling. The objective of the prob-lem is to find a time-efficient algorithm which optimally schedules the data packets waiting to be served. The optimal algorithm should consider the dead-line of data packets, the spectral efficiency, and the most requested type of the packets. In addition, the algorithm should satisfy QoS requirements. The solution to the problem is in high demand in the telecommunication industry. Solving the problem, we derive a reliable, adaptive, flexible, and time-efficient optimal scheduling algorithm for the problem.

1.6

Thesis Organization

The rest of this thesis is organized as follows.

In Chapter 2, we study the first problem discussed in Section 1.5; namely, for a set of soft real-time tasks that are to be scheduled on a single machine under overload conditions, our objective is to minimize the total penalty paid.

We study, in Chapter 3, the problem of scheduling a set of periodic preemptive independent hard real-time tasks on the minimum number of processors required.

In Chapter 4, we focus on the third problem in Section 1.5. In other words, we study the uplink scheduling problem for WiMAX systems. Our objective is to derive optimal time efficient algorithms for the problem. The algorithms derived in Chap-ter 4 are self-adaptive algorithms that consider QoS of the system and the deadline of data packets.

(26)
(27)

Chapter 2

Penalty Minimization for Soft

Real-Time Tasks

2.1

Introduction

The purpose of a real-time system is to produce a response within a specified time frame. In other words, for a real-time system not only the logical correctness of the system should be satisfied, but also it is required to fulfill the temporal constraints of the system. Although missing deadlines is not desirable in a real-time system, soft real-time tasks could miss some deadlines and the system will still work correctly while certain penalties will have to be paid for the deadlines missed. In this chapter, we focus our attention on scheduling of a set of soft real-time tasks under overload conditions.

The problem under study in this chapter occurs in overload conditions where it can not be guaranteed that all tasks can meet their deadlines. In this case, it is compelled to miss some deadlines, while we aim to minimize the penalty that should be paid.

Consider a system that consists of a set of preemptive aperiodic independent soft real-time tasks, T = {τ1, τ2, ..., τn}. A release time ri, a penalty factorGi, an

(28)

exe-cution time ei and a deadlinedi are given for each taskτi ∈ T (see Section 1.1 for

the definition of these terms). The release time, penalty factor, execution time and deadline for any given task take positive values. The penalty factor is the penalty that should be paid per time unit after the deadline of taskτi. The finishing time of each

task τi ∈ T, denoted by Fi, depends on the scheduling algorithm which is used to

schedule the execution of the tasks. Suppose that the tasks are scheduled by some scheduling algorithmA. In this work, we consider a single processor on which only one task can be executed at any given time. Except for the processor, there are no other shared resources that we need to take into account. We define the penalty func-tion of task τi as G(τi) = (Fi −di)+Gi. In other words, if Fi ≤ di, G(τi) = 0;

otherwiseG(τi)>0. The value ofG(τi)is a non-decreasing function inFi−di. The

penalty function of a given scheduling algorithm A for a given set T is denoted by G(T) =Pni=1G(τi).

As mentioned in Section 1.4, a system is said to be in overload when the compu-tational demand of the task set exceeds the available processing time. In a real-time system, an overload condition causes one or more tasks to miss their deadlines [14]. For any given set of hard real-time tasks, it is shown in [9] that no on-line scheduling algorithm operating in a uniprocessor environment can guarantee a useful processor utilization greater than 0.25 under conditions of overload. In [8], a method is pro-posed to improve overload performance in environments where there is a limit on the tightness of task deadlines. In particular, they present a scheduling algorithm that efficiently takes advantage of these limits to provide improved overload performance. In this chapter, we study the scheduling of a set of soft real-time tasks under overload conditions. This problem occurs in many real-world situations, including economical systems, commerce, operating systems, etc. As an example, assume that there exists only one machine in a small factory. The machine can be used to manu-facture various kinds of products ordered by customers. We assume thatncustomers

(29)

in various times arrive and order their desired products. Each product is needed to be worked on for a specific time (execution time). The factory manager makes a sepa-rate contract with each customer mentioning that the later the product ordered by the customer gets ready after an agreed deadline, the higher the penalty the factory owner should pay. Assume that there is not sufficient time to finish all of the orders on time, so we should schedule optimally to minimize the penalty that should be paid.

In fact, the problem under study occurs in overload conditions where it can not be guaranteed that all tasks can meet their deadlines. In this case, it is compelled to miss some deadlines, while we aim to minimize the penalty that should be paid. A simplified version of the problem can be stated as finding an optimal scheduling algorithm that minimizesPnj=1wjCj, whereCj is the completion time of task τj in

some schedule and wj is a weight associated with that task. Since the problem is

NP-hard [28], it is not known if there exists any polynomial optimal algorithm for the problem. In spite of that, we are interested to be informed about the behavior of any optimal scheduling algorithm.

So far, there has been a lot of progress in the design of approximation algorithms for a variety of scheduling problems in the aforementioned class [4, 5, 6, 17, 18, 30, 33, 64]. Also, in the real-time literature, several scheduling algorithms have been proposed to deal with overloads (see for example [14, Chapter 2] and the references therein). In [60], the problem is studied for the special case of non-preemptive tasks. Moreover, there has been plenty of algorithmic work in the context of imprecise com-putations [49, 62]. In the imprecise computation technique each task is divided into two subtasks, namely a mandatory subtask and an optional subtask. The mandatory subtask is required for an acceptable result and must be computed to completion be-fore the task deadline. The optional subtask refines the result. One of the problems in that context is to schedule a set of monotone imprecise aperiodic real-time tasks with the goal of minimizing the total error. Such scheduling problems differ from the

(30)

prob-lem studied in this chapter since there is no optional portion for our tasks. In other words, each task is required to be executed until it finishes. Therefore, the tasks of our problem are all mandatory. In our problem, a task may finish its execution after its deadline, but we should pay a penalty for missing the deadline. The penalty to be paid depends on the finishing time as compared with the deadline and the value assigned as the penalty factor to each task. In the problem under study in this work, it is possible that a task starts its execution even after its deadline. As mentioned earlier, the later each task finishes its execution after its deadline and the higher the value of its penalty factor, the more penalty we should pay. Minimizing the total tardiness in scheduling is another problem that has been studied extensively [3, 10, 26, 39, 65, 68, 69]. The problem of minimizing total tardiness is a special case of the problem studied in this chapter. In our problem, if the values assigned to the penalty factors of all tasks are identical, our problem will be reduced to a minimization of total tardiness prob-lem. In this work, we address a more general problem; namely, the scheduling of a set of preemptive independent soft real-time tasks (see Section 1.1) where the objec-tive function is to minimize the total penalties that should be paid for the deadlines missed. Since the tasks are soft real-time tasks, a task may miss its deadline, but it is not dropped after missing its deadline. We let the task finish its execution after its deadline. The remainder of the task should be executed later.

In this chapter, we formally define the problem and derive a number of prop-erties of any optimal scheduling algorithm for the problem. Knowing a number of properties of any optimal schedule for the problem will lead us in designing heuristic algorithms which, in some properties, have the same behavior as the optimal sched-ule. We provide a set of heuristic algorithms that satisfy the properties proved here. The heuristic algorithms differ in the way that the task priorities are assigned. These algorithms assign priorities by using functions of task execution times, penalty factors or deadlines. We use numerical results to compare the algorithms that are provided.

(31)

Finally, we derive a tight upper bound for the optimal solution. Since running time of finding an optimal solution grows exponentially with the number of tasks, we com-pare the upper bound with the optimal solution for small sets of soft real-time tasks. We also compare the upper bound with the heuristic algorithms provided in the chap-ter.

The remainder of this chapter is organized as follows. In Section 2.2, we formally define the problem to be solved. In Section 2.3, we derive and prove some of the properties of any optimal scheduling algorithm for the problem. Then, in Section 2.4, we provide a class of heuristic algorithms, present simulation results and compare the performance of the proposed algorithms. In Section 2.5, we find an upper bound for the objective function, present the simulation results and compare the upper bound with the optimal solution. We also compare the upper bound with the best heuristic algorithm provided in the chapter. Section 2.6 contains the conclusions.

2.2

Problem definition

Consider a set ofnsoft real-time tasks. There exists one processor and only one task can be executed on the processor at any given time. Except for the processor, there are no other shared resources to be taken into account. The tasks are preemptive, independent and aperiodic. For each taskτi, we assume thatri,ei,Gi, anddi ,which

are respectively the release time, execution time, penalty factor and deadline of the task, are known.

We define the penalty function of taskτi as

G(τi) = (Fi−di)+Gi, (2.1)

(32)

and (Fi−di)+=    Fi−di ifFi−di >0 0 otherwise.

A slot is the smallest time unit.

The objective is to minimizePni=1G(τi). Therefore, we can formally express the

objective function as follows. Let us define

xi,t=         

1 if the processor is assigned to taskτi

at time slott

0 otherwise Our goal is to minimize the objective function

n

X

i=1

(ri+ξiei−di)+Gi, (2.2)

subject to the following conditions

n

X

i=1

xi,t = 1,

which means only one processor is working at any given timet, and ∞

X

t=1

xi,t=ei,

meaning that the total time slots assigned to any given taskiover time is equal to its execution time.

As mentioned earlier, the problem defined in this section is known to be NP-hard [28]. Thus, the known algorithms for obtaining an optimal schedule require time that grows exponentially with the number of tasks. Assume that the tasks are prioritized by a function for the optimal algorithm. Since the problem is NP-hard, it is not known if there is any polynomial time function for prioritizing for any optimal algorithm of the problem. Despite that, in Section 2.3, we demonstrate and prove the behavior of any optimal scheduling algorithm, when the optimal order of priorities is provided.

(33)

τi idle τi Fi

- -

-Figure 2.1: Status of processor in the proof of Lemma 1.

Knowing a number of properties of any optimal schedule for the problem will lead us to designing heuristic algorithms which, in some properties, have the same behavior as the optimal schedule. We provide a set of heuristic algorithms that are based on the properties proved here. The heuristic algorithms differ in the way that the task priorities are assigned. Also, it is desired to find an upper bound for the objective function which, unlike the optimal algorithm, would be computationally feasible. In this work, we derive a tight upper bound for the optimal solution.

2.3

Optimal scheduling algorithm properties

In this section, we prove a number of properties for any optimal schedule of the problem of minimizingPni=1(ri +ξiei −di)+Gi. For all of the following theorems

we have one processor and a set of independent preemptive aperiodic soft real-time tasks. Except for the processor, there are no other shared resources that we need to take into account.

Lemma 2.3.1 In an optimal schedule for the problem defined in Section 2.2, the

pro-cessor is not idle as long as there exists a task to be executed.

Proof: We prove this lemma by contradiction. Suppose that in a given optimal schedule the processor is idle while all or a part of taskτi is ready to be executed (see

Figure 2.1).

There exists at least one other schedule which has a smaller value for the finishing time of taskτi (i.e.,Fi∗ ≤Fi, whereFi∗denotes the new finishing time of taskτi) and

(34)

the finishing times of the other tasks in the system remain unchanged, this schedule will result in a smaller value forPni=1(Fi−di)+Gi. The new schedule is achieved by

moving the starting point of the remaining part of task τi to the starting point of the

idle time. This replacement does not affect the finishing times of the other tasks that are possibly in the system (see Figure 2.2). Therefore, the first algorithm (Figure 2.1)

is not optimal.

τi idle

F∗

i

-

-Figure 2.2: Status of processor for an optimal schedule in the proof of Lemma 1.

From the above lemma, it follows that if there is a task to be executed, the pro-cessor cannot be idle. In other words, if the propro-cessor is idle in any optimal schedule for our problem, there is no task to be executed during that time interval. Considering the fact that idle times are time intervals during which there is no task to be executed, it is sufficient that we prove the following theorems for time intervals during which there is no idle time; these are henceforth referred to as task-bursts. Any schedule, including the optimal schedules, is a combination of idle times and task-bursts.

If the priorities of the tasks for the optimal scheduling are given, we could use the following theorems to achieve an optimal schedule whose running time grows polynomially with the number of tasks. Unfortunately, we do not have the priorities. However, we can define the concept of priority for any optimal schedule for the prob-lem studied in this chapter as follows. Suppose that taskτjarrives while the processor

is executing taskτi. Taskτj has a higher priority than taskτiif preemptingτi by task

τj will result in a smaller value inPni=1(Fi−di)+Gi. In this case, taskτj preempts

τiimmediately after it arrives. This is proved in the following theorem.

Theorem 2.3.2 Suppose that task τi is currently being executed by the processor.

(35)

taskτj arrives, taskτiwill be immediately preempted and taskτjwill begin execution.

Proof: Since the tasks are independent, starting of execution of a task (taskτj)

does not depend on the finishing of another task (task τi). Also, there are no other

shared resources except the processor. Therefore, preemption of taskτiby taskτjwill

not be postponed because of their competition in gaining any other resource, except the processor. Considering the aforementioned cases, we prove that when task τj

arrives, taskτi will be immediately preempted and taskτj will begin execution. We

prove the theorem by contradiction. Suppose that in the optimal schedule, taskτi can

be preempted some time after taskτj arrives (see Figure 2.3).

6 τi τj τi Fj 6 rj - -

-Figure 2.3: Status of processor in the proof of Theorem 2.3.2.

Because there exists at least one other schedule that has a smaller value for the finishing time of taskτj(i.e.,Fj∗ ≤Fj) and the finishing times of the other tasks in the

system remain unchanged, this schedule will result in a smaller value forPni=1(Fi−

di)+Gi(see Figure 2.4 for an example).

6 τi τj τi F∗ j 6 rj Fj - -

-Figure 2.4: Status of processor for a more efficient schedule in the proof of Theo-rem 2.3.2.

Lemma 2.3.3 In an optimal schedule for the problem defined in Section 2.2, if task τiis preempted by another taskτj and the execution of taskτj is not finished yet, task

(36)

Proof: We prove the theorem by contradiction. Suppose that in an optimal sched-ule, taskτj can be preempted by taskτi(see Figure 2.5).

6 ri 6 rj 6 Fj 6 Fi τi τj τi τj τi - - - -

-Figure 2.5: Task preemption in the proof of Lemma 2.3.3.

On the other hand, there exists at least one other schedule that has a smaller value for the finishing time of taskτj (i.e.,Fj∗ ≤Fj) and the finishing time of the other tasks

in the system remain unchanged. The new schedule will result in a smaller value for Pn i=1(Fi−di)+Gi (see Figure 2.6). 6 ri 6 rj 6 F∗ j 6 Fi τi τj τi Fj - -

-Figure 2.6: Example of a more efficient schedule for the proof of Lemma 2.3.3.

Theorem 2.3.4 In an optimal schedule for the problem defined in Section 2.2, a task

can not be preempted more than once by another task.

Proof: This is a direct consequence of Lemma 2.3.3.

2.4

Heuristic algorithms

2.4.1

Algorithms Description

Although it is not known if there exists any polynomial time optimal scheduling algo-rithm for the problem, we have developed a set of heuristic algoalgo-rithms for which the properties discussed in the theorems in Section 2.3 hold. Class of algorithms, which

(37)

will hereafter be referred to as algorithmS, represents a set of algorithms which are the same, except in their priority function. The heuristic algorithms differ in the way that the tasks priorities are assigned. For each algorithm, we consider a priority

func-tion fa,j, where a is the name of the algorithm and τj is a task in the task set that

should be scheduled by the algorithm (refer to Table 2.1). In other words, the pri-ority function is the relative urgency of a task in a given algorithm. We perform the scheduling based on the priority function. For an algorithm aand a pair of tasks τh

and τj with respective priority functionsfa,h andfa,j, byfa,j ≺ fa,h, we mean that

taskτh has a higher priority than taskτj.

The priority function for each algorithm in the aforementioned class of algorithms can be found in Table 2.1. One of the data structures, which we consider for each algorithm, is a matrix called priorityq. priorityq contains all of the tasks that have arrived and either so far have not had a chance to be executed or preempted by a higher-priority task. The matrix is always kept sorted based on the priority of the tasks. For each task in the priorityq we have the following information: release time, remaining execution time, penalty factor, and deadline. The tasks are soft real-time tasks. In the algorithms, when the deadline of a task is missed, we do not drop the task from the queue. We let the task finish its execution, but a penalty should be paid for missing the deadline. The penalty to be paid depends on the overdue time of finishing the task and the penalty factor of the task. An arbitrary algorithm a in the class of algorithmsS has the following steps:

• When a new task τi arrives, we check if the processor is idle or busy. If it is

idle, we load the task on it. Otherwise, we verify if the execution of the current task (τj) on the processor is finished.

If execution ofτj is finished, its termination time is computed. Then, the

pri-ority of task τi is compared with the task located at the top of the priorityq

(38)

Otherwise, the position of taskτi in the priorityq matrix is found and the task

that has the highest priority in the priorityq matrix is taken.

If execution ofτj has not been finished yet, we check iffa,j ≺fa,i, whereτj is

the task that is running currently by the processor.

• Iffa,j ≺fa,i, thenτipreemptsτj. Taskτjshould be inserted into priorityq

at the appropriate position. Tasks are sorted in priorityq based on their priorities. The position of taskτj can be found by comparing its priority

with the priority of the tasks in priorityq.

• Iffa,i ≺ fa,j then the processor should continue executing taskτj. Also,

taskτishould be inserted into its appropriate position in array priorityq.

• When there in no other task to arrive, the algorithm computes the termination time of the current task. Then the task which is on the top of array priorityq is popped up and its termination time is computed. The process continues until

priorityq becomes empty.

• Finally, the algorithm computes

n

X

i=1

(Fi−di)+Gi,

whereFiis the finishing time of taskτi.

As mentioned earlier, we consider different priority functions each of which is used by one algorithm. For example, the priority function used in algorithm S1 is

diGi (see Table 2.1). This means that the priority of taskτi is higher than that ofτj

if djGj < diGi. The priority function used for each algorithm in this chapter can

be found in Table 2.1. All of the algorithms in Table 2.1 are different versions of algorithmS, which we discussed earlier.

Consideringnsoft real-time tasks, each task should be inserted into its appropriate position in the sorted priorityq matrix. We use the binary search algorithm to find the

(39)

Table 2.1: Priority functions considered for each algorithm. The parametersei,diand

Gi are the execution time, deadline, and penalty factor ofτi, respectively.

Name of Algorithm Priority Function

S1 diGi S2 1/(diGi) S3 di S4 1/di S5 ei S6 1/ei S7 ei/Gi S8 Gi/ei S9 di/Gi S10 Gi/di S11 Gi S12 1/Gi S13 eiGi S14 1/(eiGi)

(40)

position of each task in the matrix. Hence, The running time of the algorithm is O(nlogn), wherenis the number of soft real-time tasks.

2.4.2

Simulation Results: Comparing Algorithms

We have implemented the algorithms for comparison purposes. Simulation conditions are as follows.

Each set of data includesnsoft real-time tasks. For each task, we randomly gener-ateri,ei,diandGi, which are the release time, execution time, deadline, and penalty

factor, respectively. The randomly generated data for this simulation are uniformly distributed. When randomly generatingdi, the condition thatei+ri ≤dishould hold.

In addition, the conditions0≤riand0< eiare effective. For the purpose of having a

time limit in gaining the simulation results for this chapter, without loss of generality, when we let ri andei be randomly generated, the conditions that0 ≤ ri < 200and

0< ei <200are enforced.

We generate 20 different data sets with sizen. We execute each of the aforemen-tioned algorithms on each data set. We compute the average of the penalty paid for the 20 simulations with data set with sizen. The simulation is done for the algorithms forn= 1to 500, with step 10.

Each algorithm computes

n

X

i=1

(Fi−di)+Gi,

whereFiis the finishing time of taskτi.

As mentioned earlier, the heuristic algorithms differ in the way that task priorities are assigned. We observe in Figure 2.7 that in the algorithms where the priority as-signed to each task is non-decreasing inGi, non-increasing inei, or non-increasing in

di, the total penalty to be paid is decreased. AlgorithmsS3 andS4 assign the priority

to each task in non-decreasing and non-increasing order ofdi, respectively. As a

(41)

tasks is said to be feasible if every execution of the program meets all its deadlines. It is shown in [45] that on uni-processor systems, if the EDF algorithm cannot feasibly schedule a task set on a processor, there is no other scheduling algorithm that can do so. However, we study the problem under overload conditions. Therefore, there is no algorithm that can feasibly schedule the task set. As we observe in Figure 2.7, there are better algorithms as compared with S4. As indicated in the figure the best

performance belongs to the algorithm S8 whose priority function is non-decreasing

inGi/ei. The optimal solution is smaller than the output of algorithmS8.

One may suggest to derive an algorithm whose priority function is non-decreasing inGi/(eidi). We refer to the new algorithm asS15. In Figure 2.8, we observe that the

results ofS15is not better thanS8.

0 50 100 150 200 250 300 350 400 450 500 0 2 4 6 8 10 12 14 16 18x 10 8 Number of tasks Penalty to be Paid S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14

(42)

0 50 100 150 200 250 300 350 400 450 500 0 1 2 3 4 5 6 7 8x 10 8 Number of tasks Penalty to be Paid S8 S15

Figure 2.8: ComparingS8 andS15.

2.5

Upper bound

In this chapter, we designed a number of heuristic algorithms that satisfy the proper-ties of any optimal solution of the problem. Corresponding to each algorithm, we de-rive an upper bound on the penalty to be paid. In other words, we can use the penalty function of each heuristic algorithm to design an upper bound. In this section, we use the penalty function of the best heuristic algorithm amongst the algorithms in this chapter to derive an upper bound. The upper bound derived in this chapter is tight; the upper bound of the penalty to paid is even smaller than the penalty to be paid using the best heuristic algorithm provided in this work.

2.5.1

Deriving an Upper Bound

We observe, in Figure 2.7, that algorithmS8 has the best solution as compared with

the other algorithms discussed in Section 2.4. In other words, when the number of tasks grows, the penalty that should be paid by the schedule provided by theS8

(43)

algo-rithm is smaller than the other algoalgo-rithms. The priority assigned to each task in al-gorithmS8is non-decreasing inGi/ei. The optimal solution should perform equally

or better than algorithmS8. We take the priority rule of algorithmS8to find the best

upper bound on penalty amongst the heuristic algorithms in Section 2.4. As a matter of fact, corresponding to each heuristic algorithm in this chapter, we can find an upper bound for the problem. Each of the upper bounds can be computed in O(n2) time,

wherenis the the number of tasks.

Theorem 2.5.1 A tight upper bound on the optimal penalty function of the problem

defined in Section 2.2 is computed as

min n X i=1 (ri+ξiei−di)+Gi ≤ n X i=1   ri+ei+ n X j=1, Gi/ei<Gj /ej ej −di    + Gi. (2.3) . Proof:

We find the upper bound as follows. As mentioned in Section 1.1,Ci =ξieiis the

maximum time taken to complete the task, after the task is started. Therefore, ξiei =ei+ n X k=1, Gi/ei<Gk/ek,rk<ri<Fk ek+ n X l=1, Gi/ei<Gl/el,ri<rl<Fi el, (2.4)

whereτkis any task which has arrived beforeτi, has a higher priority thanτi, and has

not been finished when τi arrives, andτl is any task which arrives afterri and has a

higher priority thanτi, and finishes beforeFi. From Theorem 2.3.4, recall that a task

cannot be preempted more than once by another task. It can be verified that

n X k=1, Gi/ei<Gk/ek,rk<ri<Fk ek+ n X k=1, Gi/ei<Gk/ek,ri<rk<Fi ek≤

(44)

n

X j=1, Gi/ei<Gj /ej

ej. (2.5)

Therefore, from (2.4) and (2.5), we obtain the following inequality ξiei ≤ei+ n X j=1, Gi/ei<Gj /ej ej.

Therefore, we conclude that

n X i=1 (ri+ξiei−di)+Gi ≤ n X i=1   ri+ei+ n X j=1, Gi/ei<Gj /ej ej −di    + Gi.

We hence obtain the following upper bound for the optimal penalty function

min n X i=1 (ri+ξiei−di)+Gi ≤ n X i=1   ri+ei+ n X j=1, Gi/ei<Gj /ej ej −di    + Gi. (2.6) Note on the right hand side of the inequality 2.6 that all of the parameters in this upper bound are known before scheduling and it is not necessary to run a scheduling algorithm to find them. Also, the upper bound can be calculated inO(n2)time, where

n is the number of tasks, while findingminPni=1(ri +ξiei −di)+Gi is an NP-hard

problem.

We need to find the optimal solution to compare it with the results of the upper bound. We do not claim that the following algorithm is the best possible optimal algorithm for the problem, in terms of running time. In order to find the optimal solution, we use the following steps: we find all of the n! possible permutations of order of priorities, which are assigned to a set of n soft real time tasks. Then,

(45)

we call algorithm A for any individual permutation of priorities, which computes

Σn

i=1(Fi − di)+Gi for each of them separately. Finally, we find the minimum of

Σn

i=1(Fi−di)+Gi that corresponds to the optimal schedule. The running time of the

optimal scheduling algorithm proposed in this section isO(n!).

2.5.2

Simulation Results: The Upper Bound

We have implemented the optimal algorithm and computed the upper bound forn = 1,2,· · ·,8 for simulation purposes and comparison. Simulation conditions in this section are the same as those used in Section 2.4.2, except that the simulation is done for the algorithms forn= 1to 8.

The optimal algorithm findsmin Σn

i=1(Fi−di)+Gi,whereFiis the finishing time

of taskτi. Figure 2.9 compares the results of the simulations by plotting the penalty

to be paid versus the number of tasks.

As mentioned in Section 2.4.2, for any given task τi, di is randomly generated

under the condition that ei +ri ≤ di holds. When there exists only one task to be

scheduled on the processor, there is no possibility to miss the deadline of the task. Therefore, the upper bound and the optimal value on the penalty to be paid are zero. In other words, the upper bound coincides with the optimal solution atn = 1. When there exists only one task to be scheduled, the upper bound and the optimal value on the penalty are not shown in the logarithmic figure (Figure 2.9). In general, we may have a set of one or more tasks that can be feasibly scheduled by some algorithms on the processor without missing any deadlines. In this case, the penalty to be paid by the algorithm is equal to zero.

Also, we observe that the ratio of the upper bound to the optimal solution becomes smaller, as the number of tasks increases. For instance the ratio of the upper bound to the optimal solution is less than 1.09 forn≥13. We have also computed and plotted, in Figure 2.10, the upper bound for the penalty to be paid versus the number of tasks

(46)

for n = 1,2,· · ·,500. Note that while it is computationally infeasible to find the optimal penalty for large numbers of tasks, our upper bound can be easily calculated in polynomial time. 1 2 3 4 5 6 7 8 2 2.5 3 3.5 4 4.5 5 5.5 Number of tasks log 10 (penalty) Upper bound Optimal schedule

Figure 2.9: The total penalty of the optimal solution and the upper bound in (2.6). We have compared the upper bound with algorithmS8. As we observe in Figure

2.11, the upper bound of the optimal penalty to be paid is smaller than the penalty paid by algorithmS8. However, the upper bound just determines an upper bound for

the penalty to be paid by the optimal solution and it does not determine a schedule. Therefore, in practical problems, where we have to provide a schedule, we propose algorithmS8.

2.6

Conclusions

In this chapter, we study the problem of scheduling a set of soft real-time tasks un-der overload conditions on a single processor, where our objective is to minimize the total penalty paid. Since the problem is NP-hard, it is not known whether an

(47)

opti-0 50 100 150 200 250 300 350 400 450 500 5 6 7 8 9 10 11 Number of tasks log 10 (penalty) Upper bound

Figure 2.10: The upper bound of the total penalty for a large number of tasks.

0 50 100 150 200 250 300 350 400 450 500 0 1 2 3 4 5 6 7 8x 10 8 Number of tasks Penalty Upper bound S8

Figure 2.11: Comparing the upper bound of the total penalty andS8.

mal schedule can be found in polynomial time. In spite of that, we are interested to know the behavior of any optimal algorithm for the problem. Hence, in this chapter, we prove a number of properties of optimal scheduling algorithms for the problem.

(48)

Knowing the properties helps us to gain insight into the behavior of any optimal al-gorithm for the problem. Furthermore, the more we know about the properties of optimal algorithms, the better heuristic algorithms we can derive. Designing better algorithms means designing polynomial time algorithms that behave as close as pos-sible to an optimal algorithm for the problem. In this research, we provide a number of heuristic algorithms which satisfy the properties obtained herein. The heuristic algorithms differ in the way that the tasks priorities are assigned. We compare the penalty to be paid by various algorithms that are proposed in this chapter. We observe that in the algorithms in which the priority assigned to each task is non-decreasing in Gi, we pay a smaller total penalty as compared with the algorithms that proceed in the

opposite direction. Similarly, we pay a smaller total penalty for the algorithms whose priority assignment is non-increasing ineior non-increasing indi, as compared with

the algorithms whose priority assignment is performed in the opposite direction. We conclude from the simulation results that algorithmS8has the best solution as

compared with the other algorithms discussed in this chapter. The priority assigned to each task in algorithmS8is non-decreasing inGi/ei. The total penalty of the optimal

solution should be equal to or smaller than the output of algorithmS8.

We also derive and prove a tight upper bound for the objective function. We observe that the ratio of the upper bound to the optimal solution becomes smaller, as the number of tasks increases. The running time of computing the upper bound is O(n2), wherenis the number of tasks. Therefore, it is feasible to c

References

Related documents

its own internal pressure and would lack position equi- librium. In order to maintain the plasma position equi- librium throughout the discharge, an additional set of windings,

There are infinitely many principles of justice (conclusion). 24 “These, Socrates, said Parmenides, are a few, and only a few of the difficulties in which we are involved if

PROCEEDINGS Open Access Use of admixture and association for detection of quantitative trait loci in the Type 2 Diabetes Genetic Exploration by Next Generation Sequencing in Ethnic

My main message is twofold: first , as legal educators, all of us can participate in this professional identity social movement if we are willing to approach our work as a

A common approach to processing and consuming IoT data is a centralized paradigm: sensor data is sent over the network to a comparatively powerful central server or a cloud

Develop Asset Register Failure Modes: •Capacity •Physical Mortality •Level of Service •Financial Efficiency Future Funding Requirements Determine Physical &amp; Economic

If he wanted to repair the leak quickly by installing slide guards near the eave just like we have for the past 15 years, here is what my employee would have to do under the new rule:

In order to study the influence conditions of the spreading of well-known brand recognition in the crowd and the influence of network heterogeneity on the spreading