Professional Documents
Culture Documents
Swati Keskar
BITS Pilani
Pilani|Dubai|Goa|Hyderabad
BITS Pilani
Pilani|Dubai|Goa|Hyderabad
Priority-Driven scheduling
Before starting the discussion, we assume that The tasks are independent There are no aperiodic and sporadic jobs Job is ready for execution as soon as it is released Jobs are preemptible and never suspends itself Scheduling decisions are made immediately upon job releases and completion Context switch overhead is negligible
Swati Keskar
Priority-Driven scheduling
It is an on-line scheduler, does not precompute the schedule It assigns the priorities to the job after they are released and places the jobs in ready queue Two main classifications Fixed priority: assigns the same priority to all the jobs in each task Dynamic priority: assigns different priorities to the individual jobs in each task
Swati Keskar
Swati Keskar
Example
Consider a task set T1(7,3) , T2(12,3), T3(20,5)
Swati Keskar
Swati Keskar
Schedulable Utilization
A scheduling algorithm can feasibly schedule any set of periodic tasks on a processor if the total utilization of the tasks is equal to or less than the schedulable utilization of the algorithm Higher the schedulable utilization of an algorithm , the better the algorithm A scheduling algorithm whose schedulable utilization is equal to 1 is an optimal algorithm
Swati Keskar
EDF Algorithm
A system T of independent, preemptable tasks with relative deadlines equal to their respective periods can be feasibly scheduled on one processor if and only if its total utilization is equal to or less than 1
Swati Keskar
10
Swati Keskar
11
Schedulability Test
Schedulability test for tasks with short response times ie where the response times of the jobs are smaller than or equal to their respective periods Every job completes before the next job in the same task is released We have to the critical instant
Swati Keskar
12
Critical Instant
A critical instant of a task Ti is a time instant which is such that the job in Ti released at the instant has the maximum response time. This maximum response time is called Worst Case Execution Time and is denoted by Wi Theorem: In a fixed priority system where every job completes before the next job in 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 in every higher priority task
Swati Keskar
13
Wi(t) = ei + t/pk ek
This Wi(t) t for some t Di
September 21, 2013 Swati Keskar
for 0< t pi
14
Example
A task set T1(7,3); T2(12,3) and T3(20,5) is Given. It is scheduled by using Rate Monotonic Algorithm. Check its schedulability.
Swati Keskar
15
Busy Interval
Here is a schedulability test for fixed-priority tasks with arbitrary response time When relative deadline are larger than their respective periods, we have to determine the schedulability Approach is find the busy interval and then apply time demand analysis test A level-i busy interval (t0,t ] starts at an instant t0 when All jobs in Ti released before the instant have completed A job in Ti is released The interval ends at the first instant t after to when all jobs in Ti released since t0 are complete
September 21, 2013 Swati Keskar 16
and U URM
17
Swati Keskar
Swati Keskar
18
Practical Factors
Assumptions we have made at the starting are not always valid. Considering the practical factors, blocking and priority inversion has to be discussed Nonpreemptivity Self suspension Context switches Limited priority levels Tick Scheduling
Swati Keskar
19
Tick Scheduling
We are assuming that the scheduler is event-driven This assumption is always not valid, sometimes the scheduler is time-driven Scheduling decisions are made at these time instants called clock interrupts This method is also called time-based scheduling and scheduler executes only at clock interrupts
Swati Keskar
20
Example
Swati Keskar
21
16/08/2010
22
Swati Keskar
23
Swati Keskar
24
Alternative approaches
Background execution Polled execution Interrupt driven execution
Swati Keskar
25
Background Execution
Aperiodic jobs are scheduled and executed only at times when there is no periodic or sporadic job ready for execution Always produces correct schedules Simple to implement Drawback is that the execution of aperiodic jobs is delayed and response time is prolonged
Swati Keskar
26
Swati Keskar
27
Polling Server
A poller or polling server is a periodic task whose polling period is ps and es is its execution time The poller is ready for execution periodically and is scheduled together with the periodic tasks in the system When it executes, it examines the aperiodic job queue If the queue is nonempty, the poller executes the job at the head of the queue Server suspends its execution when either budget is exhausted or when the queue becomes empty
Swati Keskar
28
Polling Server
The main disadvantage of poling server is that if at the beginning of a polling period the poller finds the aperiodic job queue empty , it suspends immediately It will not be ready for execution and able to examine the queue again until the next polling period
Swati Keskar
29
Periodic Server
The periodic server is nothing but a periodic task created for the purpose of executing aperiodic jobs It has period ps and execution time es which is called as execution budget or simply budget The ratio us = es/ps is the size of the server At the beginning of each period, the budget of the poller is set to es i.e. its budget is replenished
Swati Keskar
30
Periodic Server
The periodic server is backlogged whenever the aperiodic job queue is nonempty and there is at least an aperiodic job to be executed by the server The server is idle when the queue is empty The server is eligible for execution only when it is backlogged and budget When the server is scheduled and executes aperiodic jobs, it consumes its budget at the rate of one per unit time The server budget becomes exhausted when the budget becomes zero
Swati Keskar
31
Bandwidth-preserving Servers
If we can preserve the execution budget of the poller when it finds an empty queue and allow it to execute later in the period if any aperiodic job arrives, we can improve the response time of aperiodic job Algorithms that improve the polling approach in ths manner are called bandwidth preserving server algorithm These are periodic servers, each type of server is defined by a set of consumption and replenishment rules
Swati Keskar
32
Bandwidth-preserving Servers
Types of bandwidth-preserving servers Deferrable servers Sporadic servers Constant utilization/total bandwidth servers and weighted fair-queuing servers
Swati Keskar
33
Deferrable servers
Consumption rule: The execution budget of the server is consumed at the rate of one per unit time whenever the server executes Replenishment rule : The execution budget of the server is set to es at time instants kpk for k = 0,1,2
Swati Keskar
34
Swati Keskar
35
Swati Keskar
36
Swati Keskar
37
Swati Keskar
38
Schedulable Utilization
Schedulability of a fixed-priority system in which a deferrable server is scheduled at an arbitrary priority cannot be assured Only exception is when the deferrable server has shortest period in a system of n tasks and the system is scheduled ratemonotonically
Swati Keskar
39
Swati Keskar
40
Swati Keskar
41
Swati Keskar
42
Sporadic Servers
Improved version of deferrable servers The consumption and replenishment rules of this server ensure that each sporadic server with period ps and budget es never demands more processor time than the periodic task (ps,es) in any time interval We can treat the sporadic server exactly like the periodic task when we check for the schedulability of the system A system of periodic tasks containing a sporadic server may be schedulable while the same system containing a deferrable server with same parameters is not
Swati Keskar
43
Swati Keskar
44
Replenishment Rules
Replenishment rules of Simple Fixed-Priority-Sporadic server are R1 : Initially when the system begins execution and each time when the budget is replenished, the execution budget = es and tr = the current time R2: At the time tf (first instant after tr when server begins execution), if END = tf , te = max( tr, BEGIN). If END < tf, te=tf. The next replenishment time is set at te+ps
Swati Keskar
45
Replenishment Rules
R3 : The next replenishment occurs at the next replenishment time, except under the following conditions If the next replenishment time te + ps is earlier than tf, the budget is replenished as soon as it is exhausted If the system T becomes idle before the next replenishment time te + ps , and becomes busy again at tb, the budget is replenished at min( te+ps, tb).
Swati Keskar
46
Swati Keskar
47
Acceptance Test
For deadline-driven system For first sporadic job S (t,d,e), the scheduler accepts S if its density e/(d-t) < 1-
For new sporadic jobs , the scheduler accepts the job S if e / (d t) + s,k 1- for all k = 1,2
Swati Keskar
48
Acceptance Test
For fixed-priority systems For first sporadic job, find slack time s,1(t) = (ds,1-t)/ps es es,1 0
For next sporadic jobs, the scheduler computes the slack s,I according to
s,i(t) = (ds,i-t)/ps es es,I (es,k - s,k) 0
Swati Keskar
49