You are on page 1of 10

Module 3

Priority Driven Scheduling Of Periodic Tasks:


Static Assumptions

1. The priority driven scheduling of periodic tasks is perform on single


2. A restricted periodic task is The restricted model means:
o A fixed number independent periodic task
o Jobs comprising these tasks are ready for execution as soon as they are
o Jobs can be preempted at any
o Jobs never suspend
o New task only admitted after an acceptance
o The period of task is the minimum inter release time of jobs.
o There are no aperiodic or sporadic task.
o Scheduling decisions are made immediately upon the job release and
o Algorithms are event driven, not clock
o The content switched overload are negligibly

Fixed – Priority Vs. Dynamic – Priority Algorithms

 A priority – driven scheduler is an on-line scheduler. It does not pre-compute a schedule of tasks, instead if
assigns priority to jobs after they are released and places the jobs in a ready job queue in priority
 When preemption is allowed at any time, a scheduling decision is made whenever a job is released or completes.
At each scheduling decision time, the scheduler update the ready job and then schedules and executes the job a
head of head of the
 Priority driven algorithms differ from each other in how priorities are assigned to jobs
o Fixed priority
o Dynamic priority
 A fixed priority algorithms assigns the same priorities to all the jobs in each tasks. The priority of each periodic
task is fixed relative to other tasks.
 A dynamic priority algorithms assigns different priorities to the individual jobs in each Hence the priority of the
task with respect to that of other tasks changes as jobs are released and completed.

Rate – Monotonic (RM) algorithms:

A well-known fixed priority algorithms is the rate monotonic algorithms. The algorithm assigns priorities to task based on
their periods as shorter period have higher priority. The rate (of job release) of a task is inverse of periods that means
higher rate gets higher priority.

For example: consider a system contains three tasks T1 (4, 1), T2 (5, 2) and T3 (20, 5) then Rate for task T1 = ¼

Rate for task T2 = 1/5 Rate for task T3 = 1/ 20

So the priority be assign as T1>T2>T3

The schedule table be constructed as:

Time Ready to Run Scheduled


0 J11, J21, J31 J11
1 J21, J31 J21
3 J31 J31
4 J12, J31 J12
5 J22, J31 J22
7 J31 J31
8 J13, J31 J13
9 J31 J31
10 J23, J31 J23
12 J14, J31 J14
13 J31 J31
15 J24 J24
16 J15, J24 J15
17 J24 J24
The required schedule be constructed as:

Deadline Monotonic Algorithms:

This algorithms assigns priorities to tasks according to their relative deadlines as the shorter deadline gets higher priority.
When the relative deadlines are arbitrary, DM algorithms performs better in the sense that it can sometimes produce the
feasible schedule if RM algorithms fails that means RM algorithms always fails if DM algorithms fails.

For example: consider three tasks

 T1 (50, 50, 25, 100)


 T2 (0, 62.5, 10, 20)
 T3 (0, 125, 25, 50)

According to DM priority be assigned as T2> T3 >T1 The schedule table be constructed as:

Time Ready to Run Scheduled


0 J21, J31 J21
10 J31 J31
35 ----------- -----------
50 J11 J11
62.5 J22, J11 J22
72.5 J11 J11
85 ------------ ----------
100 J12 J12
125 J23, J32 J23
135 J32 J32
150 J32, J13 J32
160 J13 J13
185 -------------- ----------
187.5 J24 J24
197.5 ------------- ------------
200 J14 J14
225 ---------------- ------------
250 J15, J25, J33 J25
Corresponding Schedule be constructed as:
Dynamic Priority Algorithms:

Dynamic priority algorithms are:

1. Earliest Deadline First (EDF)


2. Least Slack Time (LST)
3. First In First Out (FIFO)
4. Last In First Out (LIFO)

1. Earliest Deadline First (EDF):

The EDF algorithms assigns priorities to individual’s job in the tasks according to their absolute deadlines. EDF
algorithms is a task level dynamic priority algorithm.

For example: consider a system with task

 T1 (2, 1)
 T2 (5, 2.5)
Hyper period (H) = 10

The schedule table be constructed as:

Time Ready to Run Scheduled


0 J11, J21 J11
1 J21 J21
2 J12, J21 J12
3 J21 J21
4 J13, J21 J13
4.5 J13 J13
5 J13, J22 J13
6 J14, J22 J14
7 J22 J22
8 J15, J22 J22
9 J15 J15
10 J16, J23 ----------------
Corresponding Schedule be constructed as:
2. Least Slack Time (LST):

A well-known dynamic priority algorithms is least slack time. It assigns the priorities to individual jobs in the task
according to slack time. If d be the deadline, e be the execution time then at time t slack time be equals to d-e-t.

The scheduler checks the slack of all ready jobs at each time a new job is released and orders the new and existing jobs in
accordance with slack time as smaller slack have the higher priority.

For example: consider a system with two jobs:

T1 (2, 1)

T2 (5, 2.5)

 Two jobs J11 and J21 are released at time 0 then Slack for J11 = 2-1-0=1

Slack for J11 = 5-2.5-0=2.5

Here T1> T2, the job J11 is completely executes in between time 0 and 1 then J21 inters into the execution.

 At time 2, new job J12 is released then Slack for J12 = 4-1-2=1

Slack for J21 = 5-1.5-2= 1.5

Here T1>T2, the job J12 is preempted and J12 enters into the execution and released at 3. The job J21 resumed for
execution after time 3.

 At time 4, new job J13 is released then Slack for J13 = 6-1-4=1

Slack for J21 = 5-0.5-4=0.5

Here T2>T1, the job J21 executes up to 4.5 and J13 enters into execution.

 At time 5, new job J22 is released then Slack for J22= 10-2.5-5=2.5

Slack for J13 = 6-0.5-5=0.5

Here T1> T2, the job executes up to 5.5 and job J22 enters into execution.

 At time 6, the new job J14 released then Slack for J14 = 8-1-6=1

Slack for J22 = 10-2-6=2

Here T1>T2, so J14 executes up to 7 and J22 resumes its execution.

 At time 8, new job J15 is released then Slack for J15 = 10-1-8=1

Slack for J22 = 10-1-8 = 1

Here have the equal priority so J15 completes its execution up to 9 and J22 completes its execution up to 10.

The corresponding schedule table be constructed as:


Time Ready to Run Scheduled
0 J11, J21 J11
1 J21 J21
2 J12, J21 J12
3 J21 J21
4 J13, J21 J13
4.5 J13 J13
5 J13, J22 J13
5.5 J22 J22
6 J14,J22 J14
7 J22 J22
8 J15,J22 J15
9 J22 J22
The required schedule is:

In this approach, the priority order is only changed only when the new job is released or any job finishes its execution
such that there is no follow of LST algorithms at any time. This type of priorities is non strict and corresponding
algorithms is called non strict LST algorithms otherwise it is called strict algorithms. In case of strict approach, scheduler
follow the LST rule during the change of slack at any time and updates the job list of queue according to change of
priority.

For example: in above, at time 2.6 Slack time for J12 = 4-0.4-2.6 = 1 Slack time for J21 = 5- 1.5- 2.6 = 0.9

Here J21 gets higher priority than J12. Due to continuous observation and computation of slacks at each period of time,
strict LST algorithms suffers from run-time overhead.

3. First in, first out (FIFO):

Job queue is first-in-first-out by release time

4. Last in, first out (LIFO):

Job queue is last-in-first-out by release time

Maximum Schedule Utilization-Theorem


A system is schedulable (and feasible) if and if it is schedulable by some algorithms. A scheduling algorithms can feasibly
schedule any set of periodic tasks on a processor if the total utilization of tasks is equal to or less than schedulable
utilization of algorithms. The higher the schedulable utilization of an algorithms, better the algorithms.

Since, no algorithms can feasibly schedule a set of tasks with a total utilization greater than 1, an algorithms can feasibly
whose schedulable utilization is equal to 1 is an optimal algorithms.

Schedulable Utilization of the EDF Algorithm:


Scheduling Test for Fixed Priority Tasks with Short Response Times-Critical Instants
A scheduling test is required to schedule the fixed priority task with shortest response time which is smaller than or equal
to respective periods and total utilization is less than 1. Generally fixed priority algorithms are not suffers from the
scheduling anomalies and requires following task to generate a schedule without anomalies.

 Find the critical instant when the system is most loaded and its worst response
 Use time demand analysis to determine if the system is schedulable at that

Critical Instant:

A critical instant for a job is the worst-case release time for that job, taking into account all jobs that have higher priority
i.e. a job released at the same instant as all jobs with higher priority are released, and must wait for all those jobs to
complete before it executes.
A critical instant of a task Ti is a time instant such that:

 the job of Ti released at this instant has the maximum response time of all jobs in Ti, if the response time of every
job of Ti is at most Di, the relative deadline of Ti and
 the response time of the job released at this instant is greater than Di of the response time of some jobs in Ti
exceeds Di

The schedulability test involves for checking each task as it is scheduable or not in the critical instant. The critical instant
theorem states that, a fixed-priority system where every job completes before the next job of the same task is released, a
critical instant of any task Ti occurs when one of its job Ji,c is released at the same time with a job of every higher priority
task.

For example: Consider three tasks T1 (2, 0.6), T2 (2.5, 0.2), T3 (3, 1.2) Here T1>T2>T3

The RM schedule table be

Time Ready to Run Scheduled


0 J11, J21, J31 J11
0.6 J21,J31 J21
0.8 J31 J31
2 J12, J12
2.5 J12, J22 J12
2.6 J22 J22
2.8 ---------------------- ------------------------
3 J32 J32
4 J13,J32 J13
4.6 J32 J32
4.8
5 J23 J23
5.2
6 J14, J33 J14
6.6 J33 J33
7.5 J24, J33 J24
7.7 J33 J33
8 J15 J15
8.6
9 J34 J34
10 J16, J25,J34 J16
10.6 J25, J34 J25
10.8 J34 J34
11
The corresponding schedule be constructed as below
Response time for all jobs of Task T1 = 0.6 Response time for Job J21 of task T2 = r21= 0.8

Response time for Job J22 of task T2 = r22 = 2.8 - 2.5 = 0.3 Response time for Job J23 of task T2 = r23 = 5.2 – 5 = 0.2
Response time for Job J24 of task T2 = r24 = 7.7 -7.5 = 0.2 Response time for Job J25 of task T2 = r25= 0.8

The response time all jobs of task T2 never exceed the response time of first job. Hence the critical instant is equal to t=0
and t=10.

Response time for Job J31 of task T3 = r31 = 2 Response time for Job J32 of task T3 = r32 = 1.8 Response time for Job
J33 of task T3 = r33 = 2 Response time for Job J34 of task T3 = r34 = 2

Here the response time for jobs in T3 never exceed the response time of first job in T3. Hence critical instant of T3 are t=
0, 6 and 9.

Time- Demand Analysis:

The process used to determine whether a task can meet its deadline is called time demand analysis. Methods to time-
demand analysis are:

1. Compute the total demand for processor time by job released at a critical instant of task and by higher priority
task as a function of time from the critical instant.
2. Check weather tis demand can be met before the deadline of job as follows:

-Consider the scanning is done one task at a time from higher priority and working down to lowest priority.

-Focused on a job in Ti where the released at time t0 of that job is a critical instant of Ti.

-At time t0+t for ≥ 0, compute the processor time demand wi (t) of this job and all higher priorities job released in [t0, t]
using

3. Compare the time demand wi (t) with available time t as

-If ( ) ≤ ≤ , the job meets its deadline 0 +

-If ( ) > 0 ≤ ≤ , the task may not complete by its deadline and system cannot scheduled by using fixed priority
algorithms.

You might also like