Presentation is loading. Please wait.

Presentation is loading. Please wait.

REAL TIME SYSTEMS – SCHEDULING ISSUES Rahul Ohri CS550 – 395 ID# 999-29-6033.

Similar presentations


Presentation on theme: "REAL TIME SYSTEMS – SCHEDULING ISSUES Rahul Ohri CS550 – 395 ID# 999-29-6033."— Presentation transcript:

1 REAL TIME SYSTEMS – SCHEDULING ISSUES Rahul Ohri CS550 – 395 ID#

2 INTRODUCTION The main characteristic that distinguishes real time computing from other types of computation is time. The word time means that the correctness of the system not only depend on the logical result of the computation but also on the time at which the results are produced. The word real indicates that the reaction of the system to external events must occur during their evolution. The objective of real time systems is not to minimize the average response time of a given set of tasks but it is to meet the individual timing requirements of each task. Real time processes may be classified as follows: –Hard Real Time Tasks eg. Sensory data acquisition –Soft Real Time Tasks eg. Displaying messages on the screen DESIRABLE FEATURES OF A REAL TIME SYSTEM Timeliness: Results have to be correct not only in their value but also in the time domain. Design For Peak Load: Real time systems must not collapse when they are subject to peak load conditions Predictability: To guarantee a minimum level of performance, the system must be able to predict the consequence of any scheduling decision. Fault Tolerance: single hardware and software failures should not cause the system to crash Maintainability: the architecture of a real time system should be designed according to a modular structure to ensure that possible system modifications are easy to perform

3 SOME REAL TIME TERMINOLOGY Process: Scheduling Policy. Dispatching. Active Task. Ready Task, Running Task Ready Queue. Preemption. Schedule J1J2J3 t1 t2t3t σ (t) non preemptive scheduling

4 TERMINOLOGY CONTD.. At times t1, t2, t3, and t4, the processor performs a Context Switch. Each interval [ti, ti+1) is called a Time Slice. A schedule is said to be Feasible if all tasks can be completed according to the set of specified constraints. A set of tasks is said to be Schedulable if there exists at least one algorithm that can produce a feasible schedule. t σ (t) J1 J2 J3 Preemptive scheduling

5 TYPES OF TASK CONSTRAINTS Typical constraints that can be specified on real time tasks are of three classes: –Timing Constraints –Precedence Relations –Mutual Exclusion Constraints on Shared Resources. Timing Constraints: a real time task can be characterized by the following parameters: –Arrival Time ai: is the time at which a task becomes ready for execution. –Computation Time Ci: is the time necessary for the processor to execute the task without interruption. –Deadline di: is the time before which a task should be completed to avoid damage to the system. –Start Time si: is the time at which a task starts execution. –Finishing Time fi: is the time at which a task finishes execution. –Criticalness: is a parameter related to the consequences of missing the deadline. –Periodic / a-periodic tasks Ji ai si fi di t Ci

6 PRECEDENCE CONSTRAINTS –In certain applications, computational activities can be executed in arbitrary order but have to respect some precedence relations defined at the design stage. Such precedence relations are usually defined through a directed acyclic graph. TYPES OF TASK CONSTRAINTS CONTD.. J5 J4 J3 J2 J1 The notation Ja < Jb specifies that task Ja is a predecessor of task Jb. The notation Ja => Jb specifies that task Ja is an immediate predecessor of task Jb.

7 RESOURCE CONSTRAINTS –To maintain data consistence, many shared resources do not allow simultaneous accesses but require mutual exclusion among the competing tasks. These resources are called exclusive resources. –A task waiting for an exclusive resource is said to be blocked on that resource. All tasks blocked on the same resource are kept in a queue associated with the exclusion semaphore. TYPES OF TASK CONSTRAINTS CONTD.. J1 J2 t t a1t1t2 blocked on s Critical section Normal section

8 Preemptive: with preemptive algorithms, the running task can be interrupted at any time to assign the processor to another active task, according to a predefined scheduling policy. Non – Preemptive: with non – preemptive algorithms, a task once started, is executed by the processor until completion all scheduling decisions are taken as a task terminates its execution. Static: scheduling decisions are based on fixed parameters assigned to tasks before their activation in these algorithms. Dynamic: scheduling decisions are based on dynamic parameters that may change during system evolution. Off- Line: a scheduling algorithm is off – line if it is executed on the entire task set before actual task activation. The schedule generated is stored in a table and is executed by a dispatcher. On – Line: a scheduling algorithms on – line if scheduling decisions are taken at run time every time a new process enters the system or when a running task terminates. Optimal: an algorithms optimal if it minimizes some given cost function over the task set. Heuristic: an algorithm is said to be heuristic if it tends towards but does not guarantee to find the optimal schedule. CLASSIFICATION OF SCHEDULING ALGORITHMS

9 Guarantee based algorithms: In hard real time applications that require highly predictable behavior, the feasibility of the schedule should be guaranteed in advance so that if a critical task cannot be scheduled within its deadline, the system is still in time to execute an alternative action and avoid catastrophic consequences. In dynamic real time systems, since new tasks can be activated at runtime, the guarantee must be done on line every time a new task enters the system. Best effort algorithms: In certain real time systems, computational activities have soft timing constraints that should be met whenever possible to satisfy system requirements. The only consequence associated with a missed deadline is the performance degradation of the system. The best effort approach tries to do its best to meet the deadlines, but there is no guarantee of finding a feasible schedule. Tasks may be queued according to policies that take timing constraints into account, however, since feasibility is not checked, a task may be aborted during its execution. Algorithms based on imprecise computation: In dynamic situations, where the time and resources are not enough for the computations to complete within deadline, there may still be enough resources to produce approximate results that may at least prevent a catastrophe. In such systems, every task Ji is decomposed into a mandatory task Mi and an optional task Oi. Mi is executed first and Oi becomes ready for execution once Mi is completed. CLASSIFICATION OF SCHEDULING ALGORITHMS – CONTD..

10 METRICS FOR PERFORMANCE EVALUATION The performance of a scheduling algorithm is usually evaluated through a cost function defined over the task set. Some common cost functions are: –Average Response Time : n tr = 1/n  (fi – ai) i = 1 –Total Completion Time: tc = max(fi) – min(fi) –Weighted Sum of Completion Times: n tw =  wifi i = 1 –Maximum Lateness: Lmax = max(fi – di)

11 APERIODIC TASK SCHEDULING JACKSON’S ALGORITHM –This algorithm considers the case when a set of n tasks has to be scheduled on a single processor minimizing the maximum lateness. All tasks consist of a single job, have synchronous arrival times, but can have different computation times and deadlines. No other constraints are considered, hence the tasks are independent that is they do not have precedence relations and cannot share resources in exclusive mode. We assume that all the tasks arrive at time t = 0. the Jackson’s algorithm says: –Given a set of n independent tasks, any algorithm that executes the tasks in order of non- decreasing deadlines is optimal with respect to minimizing the maximum lateness. J1 J2J3 J4J5 t d1 d2 d3 d4 d5 J1J2J3J4J5 Ci11132 Di310785

12 PERIODIC TASK SCHEDULING In many real time control applications, periodic activities represent the major computational demand in the system. Periodic tasks typically arise from sensory data acquisition, low lever servoing, control loops, action planning etc. –RATE MONOTONIC SCHEDULING This is a simple rule that assigns priorities to tasks according to their request rates. Specifically, tasks with higher request rates will have higher priorities. Since the periods are constant, RM is a fixed priority assignment: priorities are assigned to tasks before execution and do not change with time. Moreover, RM is intrinsically preemptive: the currently executing task is preempted by a newly arrived task with shorter period. An example of scheduling by RM is shown below: t t tntn titi Response time of task tn delayed by the interference of task ti with higher priority

13 FIXED PRIORITY SERVERS Many real time control applications require both periodic and a-periodic processes. When dealing with hybrid task sets, the main objective of the kernel is to guarantee the schedulability of all critical tasks in worst case computations and provide good average response times for soft and non real time activities. –BACKGROUND SCHEDULING This is the simplest method to handle a set of soft a-periodic activities in the presence of periodic tasks. Scheduling of soft a-periodic tasks is done in the background, that is, they are executed when there are no periodic instances to execute. The problem with this scheduling is that under heavy periodic loads, the response timings of a-periodic requests can be too long for certain applications. t1 t2 A-periodic requests

14 DYNAMIC PRIORITY EXCHANGE SERVER This is an a-periodic service technique. The main idea is to let the server trade its runtime with the runtime of lower priority periodic tasks in case there are no a-periodic requests pending. In this way, the server runtime is only exchanged with periodic tasks but never wasted. It is simply preserved even if at a lower priority, and it can be later reclaimed when a-periodic requests enter the system. Below is an example showing the DPE logic: DPE t1

15 EXAMPLE REAL TIME SYSTEM - MARS MARS – Maintainable Real time System is a fault tolerant distributed real time system developed at the University of Vienna to support complex control applications, such as air traffic control systems, railway switching systems, where hard deadlines are imposed by the control environment. The MARS architecture consists of a set of computing nodes (clusters) connected through high speed communication channels. Each cluster is composed of a number of acquisition and processing units (components) interconnected by a synchronous real time bus, the MARS bus. Each component is a self-contained computer on which a set of real time application tasks and an identical copy of the MARS operating system is executed. The MARS configuration is shown as follows: component CI MARS bus sensors actuators cluster CI = cluster Interface

16 The software residing on a MARS component can be split into the following three classes: –Operating System Kernel: its primary goals are resource management and hardware transparency. –Hard Real Time Tasks (HRT): HRT tasks are periodic activities that receive, process, and send messages. Each instance of a task is characterized by a hard deadline. The set of HRT tasks consists of application tasks and system tasks, which perform specific functions of the kernel, such as time synchronization and protocol conversions. –Soft Real Time Tasks (SRT): SRT tasks are activities that are not subject to strict deadlines. Usually, they are periodic tasks scheduled in background during the idle time of the processor. COMMUNICATION –In MARS, communication among tasks, components etc occurs through a uniform message passing mechanism. All messages are sent periodically to exchange information about the state of the environment or about an internal state. State messages are not consumed when read, so they can be read more than once by an arbitrary number of tasks. Each time a new version of the message is received, the previous version is overwritten and the state described in the message is updated. EXAMPLE REAL TIME SYSTEM – MARS- CONTD..

17 SCHEDULING –In MARS, the scheduling of hard real time activities is performed off line considering the worst case execution times of tasks and their task interaction by message passing. The static schedule produced by the off line scheduler is stored in a table and loaded into each individual component. At runtime, the scheduling table is executed by the dispatcher, which performs task activation and context switches at predefined time instants. The disadvantage of this scheduling scheme is that no tasks can be create dynamically, so the system is inflexible and cannot adapt to changes in the environment. On the other hand, if the assumptions on the controlled environment are valid, the static approach is quite predictable and minimizes the runtime overhead for making scheduling decisions. INTERRUPT HANDLING –In MARS, all interrupts to the CPU are disabled, except for the clock interrupt for the timing signals. Allowing each device to interrupt, the CPU would cause an unpredictable load on the system that could jeopardize the guarantee performed on hard tasks. Since the interrupts are disabled, peripheral devices are polled periodically within the clock interrupt handler. EXAMPLE REAL TIME SYSTEM – MARS- CONTD..

18 REFERENCES Hard Real Time Computing Systems – Giorgio C. Buttazio Real Time Computer Systems –Freedman.


Download ppt "REAL TIME SYSTEMS – SCHEDULING ISSUES Rahul Ohri CS550 – 395 ID# 999-29-6033."

Similar presentations


Ads by Google