56
CLOCK DRIVEN APPROACH WEIGHTED ROUND-ROBIN APPROACH PRIORITY DRIVEN APPROACH DYNAMIC V/S STATIC SYSTEM EFFECTIVE RELEASE TIMES AND DEADLINES OPTIMALITY AND NON-OPTIMALITY OF EDF AND LST ALGORITHMS CHALLENGES IN VALIDATING TIMING CONSTRAINTS OFF-LINE V/S ONLINE SCHEDULING Approaches to Real Time Scheduling

Approaches to real time scheduling

Embed Size (px)

Citation preview

Page 1: Approaches to real time scheduling

C L O C K D R I V E N A P P R O A C H

W E I G H T E D R O U N D - R O B I N A P P R O A C H

P R I O R I T Y D R I V E N A P P R O A C H

D Y N A M I C V / S S T A T I C S Y S T E M

E F F E C T I V E R E L E A S E T I M E S A N D D E A D L I N E S

O P T I M A L I T Y A N D N O N - O P T I M A L I T Y O F E D F A N D L S T A L G O R I T H M S

C H A L L E N G E S I N V A L I D A T I N G T I M I N G C O N S T R A I N T S

O F F - L I N E V / S O N L I N E S C H E D U L I N G

Approaches to Real Time Scheduling

Page 2: Approaches to real time scheduling

Clock Driven Approach

It is also called time driven scheduling.

It is used to make the decision about which job to execute as specific time instants.

It is used in the hard real time jobs where all parameters are known and fixed.

A schedule of jobs is computed offline and is stored for use at run time.

Scheduler schedules the jobs according to this schedule at each scheduling decision time.

Page 3: Approaches to real time scheduling

Scheduling decision time are regularly spaced and implemented using periodic hardware timer interrupt.

When timer expires, the scheduler becomes active and schedules the job to execute for next period and block itself until next interrupt.

It is one of the simple and straight forward scheduling but it is not flexible.

Page 4: Approaches to real time scheduling

Weighted Round- Robin Approach

It is commonly used for scheduling the time shared applications.

When jobs are scheduled using round-robin basis, every jobs join FIFO queue when it becomes ready for execution.

Each job in the queue executes for one time slice.

If it is not completed, it is preempted and placed at the end of the queue for its next turn.

When there are n jobs in queue, each job will get 1/n share of the processor.

Page 5: Approaches to real time scheduling

This why it is also called processor sharing algorithm.

By giving each job a fraction of the processor, it delays completion of every job.

If it is used to schedule the precedence constraints job, response time of the chain of jobs may be unduly large.

So it is not suitable for scheduling such jobs.

Page 6: Approaches to real time scheduling

Let us consider the two sets of jobs

The release time of all jobs are 0 and their execution time is 1. J1,1 and J2,1 execute on processor P1 and J1,2

and J2,2 on processor P2.

J1,1 is the predecessor of J1,2

J2,1 is the predecessor of J2,2

Page 7: Approaches to real time scheduling
Page 8: Approaches to real time scheduling

Figure(a) shows both sets of job complete approximately at time 4 if the jobs are schedule at round robin manner.

Figure(b) shows that if the jobs on each processor are executed one after the other, one of the job complete at time 2 and another at time 3.

Instead of giving equal share of processor to all the jobs, if different jobs are given different weights then schedule is called weighted round robin scheduling.

Weight means the fraction of processor time allocated to a job.

Page 9: Approaches to real time scheduling
Page 10: Approaches to real time scheduling

Priority Driven Scheduling

It includes large set of scheduling algorithms that never leave any resource idle.

It assigns priority to jobs based on some algorithms and makes scheduling decision based on the priorities when any event such as release and job completion occur.

So they are also called event-driven scheduling.

In an event driven scheduling, the jobs are placed in one or more queues and at each event the ready job with highest priority is executed.

Page 11: Approaches to real time scheduling

It is also called list scheduling it contains list of priorities assigned to each jobs.

FIFO(First In First Out) and LIFO algorithms assign the priorities according to the release time.

SETF(Shortest Execution Time First) and LETF algorithms assign priorities on the basis of job execution time.

Priority driven algorithms are sometimes also called greedy because it tries to make locally optimal decision.

Page 12: Approaches to real time scheduling

The locally optimal algorithm never leave intentionally any resource idle.

Leaving resource idle, when some job is ready, the algorithm is not optimal.

Page 13: Approaches to real time scheduling
Page 14: Approaches to real time scheduling
Page 15: Approaches to real time scheduling

Dynamic VS Static System

Page 16: Approaches to real time scheduling

In previous example of priority driven approach the system is dynamic as J7 start in P2 is completed in P1.

This scheduling can also be achieved by static system. Let us assign J1,J2,J3 and J4 to P1 and remaining to P2.

Jobs on P1 are completed by time 8 and the jobs on P2 by time 11.

Page 17: Approaches to real time scheduling

Effective Release times and Deadlines

The given release time and deadline of jobs are sometime not consistent with the precedence constraints of the job.

The release time of a job may be later than its successors and its deadline may be earlier than its predecessors.

So rather working on the given release time and deadline we derive the effective release time and deadline from the timing constraints together with the precedence constraints.

Page 18: Approaches to real time scheduling

Effective release time of a job without the predecessors is equal to its given release time,

Effective release time of a job with predecessors is equal to the maximum value among, its release time and effective release time of all of the predecessors.

Effective deadline of job without the successor is equal to its given deadline.

Effective deadline of job with successor is equal to the minimum value among its deadlines and deadlines of all the successors.

Page 19: Approaches to real time scheduling
Page 20: Approaches to real time scheduling
Page 21: Approaches to real time scheduling
Page 22: Approaches to real time scheduling
Page 23: Approaches to real time scheduling
Page 24: Approaches to real time scheduling

We sometime also used latest release time(LRT) or reverse EDF algorithms.

These algorithm treats release time as deadline and deadline as release time.

It schedules all the job backward from latest deadline of all the job in priority driven manner to the current time.

LRT algorithm is also optimal under the same condition that EDF algorithm is optimal.

Page 25: Approaches to real time scheduling
Page 26: Approaches to real time scheduling

Least Slack Time First(LST) Algorithm

Page 27: Approaches to real time scheduling

Non-Optimality of EDF and LST

Neither algorithm is optimal if jobs are non-preemptable or if there is more than one processor.

Let us consider three independent and non-preemptable jobs J1,J2 and J3.

Each has release time o,2 and 4 respectively.

Each has execution time 3,6 and 4 respectively.

Each has deadline time 10,14 and 12 respectively.

Page 28: Approaches to real time scheduling
Page 29: Approaches to real time scheduling

EDF is also not optimal for scheduling preemptable jobs on more than one processor.

Consider 3 Jobs J1,J2 and J3 with execution time 1,1 and 5 respectively.

Each have deadline 1,2 and 5 respectively and release time for each job is 0.

Page 30: Approaches to real time scheduling
Page 31: Approaches to real time scheduling

Challenges in validating timing Constraints in priority driven system

Priority driven schedules are very easy to implement as they do not require most of the information in advance.

The priority driven approach are not widely used in real time system because of its non-deterministic nature when job parameter vary.

It is difficult to validate deadline of all job in a priority driven manner scheduling when job parameter are jittered. This validation problem.

Page 32: Approaches to real time scheduling

Validation problem can be stated as:

Given a set of jobs, set of resources available to jobs and scheduling algorithm to allocate processor and resources to jobs, determine whether all the jobs meet their deadlines.

Page 33: Approaches to real time scheduling

Anomalous Behavior of Priority Driven System

The validation problem occur due to anomalous behavior of priority driven system.

For the given algorithm the system may look like meeting its deadline. But due to various factors deadline can not be meet.

Let us consider two identical processors(P1 and P2).

Four jobs J1,J2,J3 and J4(J1 has higher priority ) are scheduled.

The jobs can be preempted but cannot be migrated.

Page 34: Approaches to real time scheduling
Page 35: Approaches to real time scheduling
Page 36: Approaches to real time scheduling

In figure(a) we assume execution time of J2 is maximum i.e. 6.

In figure(b) we assume execution time of J2 is minimum i.e. 2.

In figure(c) we assume execution time of J2 is 3.

In figure(d) we assume execution time of J2 is 5.

Page 37: Approaches to real time scheduling

Scheduling anomalies make the problem of validating a priority-driven system difficult whenever jobs parameters may vary.

Unfortunately variation in execution time and release time are often unavoidable.

Page 38: Approaches to real time scheduling

Predictability of Execution

The schedule of a job produced by assigning every jobs its maximum execution time is maximal schedule and with minimum execution time is minimal schedule.

A job(Ji) is start time predictable when

A job(Ji) is completion time predictable when

Page 39: Approaches to real time scheduling

Execution of Ji is predictable or simply Ji is predictable if Ji is both start time and completion time predictable.

The execution of every job in a set of independent, preemptable jobs with fixed release times is predictable when scheduled in a priority driven manner on one processor.

Page 40: Approaches to real time scheduling

Off line versus online scheduling

Off-line schedule is computed before the system begins.

All the parameter related to the jobs are supposed to be known prior. E.g. Clock Driven Scheduling.

The major disadvantage of off-line scheduling is inflexibility.

This approach is possible only when the system is deterministic.

It make full use of the available resources.

Page 41: Approaches to real time scheduling

In on-line scheduling, scheduler make the schedule without the knowledge of the jobs that will be released in future.

Parameter of the jobs are known only after when the job is released.

It includes the priority driven schedules. E.g. EDF, LST

It is suitable for system whose future work load is unpredictable.

If all the jobs are preemptable and there is only one processor, optimal online algorithm exist.

Page 42: Approaches to real time scheduling

Competitive factor is used to measure the performance of scheduling algorithm.

Value of job is equal to its execution time if it completes by its deadline otherwise 0.

Value of the schedule is the sum of all the jobs in the schedule.

Competitive factor of any online algorithm is c if the value of the schedule is c times than that produced by the optimal algorithm.

Page 43: Approaches to real time scheduling

Competitive factor of EDF and LST is 1 if jobs are preemptable and there is only one processor.

No on-line scheduling algorithm can achieve a competitive factor greater than 0.25 when the system is overloaded.(Page 93 Liu)

Page 44: Approaches to real time scheduling
Page 45: Approaches to real time scheduling
Page 46: Approaches to real time scheduling
Page 47: Approaches to real time scheduling
Page 48: Approaches to real time scheduling
Page 49: Approaches to real time scheduling
Page 50: Approaches to real time scheduling
Page 51: Approaches to real time scheduling
Page 52: Approaches to real time scheduling
Page 53: Approaches to real time scheduling
Page 54: Approaches to real time scheduling
Page 55: Approaches to real time scheduling
Page 56: Approaches to real time scheduling