0% found this document useful (0 votes)
189 views

RTS Unit 4 Notes

This document discusses approaches for scheduling aperiodic and sporadic jobs in priority-driven real-time systems. It describes three main approaches: background approach, interrupt-driven approach, and polled approach. The polled approach uses a periodic polling server to schedule aperiodic jobs. Bandwidth-preserving servers like deferrable servers were developed to improve upon polling servers by allowing unused budget to be retained between periods. Deferrable servers work by consuming budget per time unit when executing and replenishing fully at the start of each period. An example schedule shows how an aperiodic job can be executed on a deferrable server along with periodic tasks.

Uploaded by

SAROJ RAJA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
189 views

RTS Unit 4 Notes

This document discusses approaches for scheduling aperiodic and sporadic jobs in priority-driven real-time systems. It describes three main approaches: background approach, interrupt-driven approach, and polled approach. The polled approach uses a periodic polling server to schedule aperiodic jobs. Bandwidth-preserving servers like deferrable servers were developed to improve upon polling servers by allowing unused budget to be retained between periods. Deferrable servers work by consuming budget per time unit when executing and replenishing fully at the start of each period. An example schedule shows how an aperiodic job can be executed on a deferrable server along with periodic tasks.

Uploaded by

SAROJ RAJA
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Module 4

Scheduling Aperiodic and Sporadic Jobs in Priority-Driven Systems:


Assumptions and Approaches
Assumptions:

 The parameters of each sporadic job become known after it is released.


 Sporadic jobs may arrive at any instant, even immediately after each other.
 Moreover, their execution times may vary widely, and
 Their deadlines are arbitrary.

It is impossible for some sporadic jobs to meet their deadlines no matter what algorithm we use to schedule them. The
only alternatives are:

 To reject the sporadic jobs that cannot complete in time orTo accept all sporadic jobs and allow some of them to
complete Which alternative is appropriate depends on the application.

System Model:

System model consists the separate queue for the aperiodic, periodic, sporadic tasks in a well- known order. The main
objective of this system model is to complete each aperiodic job as soon as possible, without causing periodic tasks or
accepted sporadic jobs to miss deadlines such that aperiodic jobs are always accepted. Based on the execution time and
deadline of each newly arrived sporadic jobs are decided as whether to accept or reject. When the job will complete within
its deadline, without causing any periodic task or previously accepted sporadic job to miss its deadline then job be
accepted. If sporadic job cannot guarantee it will meet its deadline then it is rejected from the scheduling. This is done by
acceptance test. When the sporadic job is accepted then it enters into the priority queue based on known discipline.

Correctness:

o A correct schedule or correctness of schedule is one where all periodic tasks, and any sporadic tasks that
have been accepted, meet their deadlines.
o A scheduling algorithm supporting aperiodic and/or sporadic jobs is a correct algorithm if it only
produces correct schedules for the system.

Optimality:

o The system is said to be optimal when the queuing discipline is well-known and corresponding
scheduling algorithms are optimal to schedule the periodic, aperiodic and sporadic jobs.
o A periodic job scheduling algorithms is said to be optimal algorithm when it always produces a feasible
schedule accepted periodic jobs.
o A sporadic job scheduling algorithm is optimal if it accepts a new sporadic job, and schedules that job to
complete by its deadline, if and only if the new job can be correctly scheduled to complete in time.
o An aperiodic job scheduling algorithm is said to be optimal if it minimizes either the response time of the
job at the head of the aperiodic job queue or the average response time of all aperiodic jobs for a given
queuing discipline.

0.1 with execution time 0.8. when the periodic tasks are executed by using RM algorithms and aperiodic
task be executed in background as :

 If an aperiodic job is in the queue, it is executed for up to es time units


 If the aperiodic queue is empty, the polling server self-suspends, giving up its execution slot
 The server does not wake-up once it has self-suspended, aperiodic jobs which become active
during a period are not considered for execution until the next period begins

For example: Consider a system with two periodic task T1 (3, 1) , T2 (10, 4), a periodic task A with r =
0.1 and e = 0.8 and a poller (2.5, 0.5) then the aperiodic task be scheduled along with scheduling of
periodic task using RM as :

Scheduling Aperiodic Jobs:

Generally three approaches are used as

o Background approach
o Interrupt driven execution approach
o Polled approach

Background Approach:

In this approach, aperiodic jobs are executed in the background i.e. Aperiodic jobs are scheduled and executed
only at times when there are no periodic or sporadic jobs ready for execution.

Advantages:

o Clearly produces correct schedules


o Extremely simple to implement Disadvantage:
o It is not optimal since it is almost guaranteed to delay execution of aperiodic jobs in favor

of periodic and sporadic jobs, giving unduly long response times for the aperiodic jobs. For example consider two
periodic task T1 (3, 1), T2 (10, 4) and a aperiodic task A released at

0.1 with execution time 0.8. when the periodic tasks are executed by using RM algorithms and aperiodic task be
executed in background as :

Here, response time for aperiodic job = 7.8 – 0.1 = 7.7 It is a worst case response time.

Interrupt Driven Execution Approach:


Whenever an aperiodic job arrives, the execution of periodic tasks is interrupted, and the aperiodic job is executed
then it is called as interrupt driven execution. This approach reduces response times of aperiodic jobs but will not
be correct and will often cause periodic/sporadic tasks in the system to miss some deadlines.

Polled Approach:

It is a common way to schedule aperiodic jobs using a polling server. A periodic job (ps, es) is a periodic task
called as poller or polling server where ps is the polling period and es execution time. The poller is ready for
execution periodically at integer multiple of Ps and scheduled together with periodic tasks in the system according
to priority-driven algorithms. When executed, it examines the aperiodic job queue then

o If an aperiodic job is in the queue, it is executed for up to es time units


o If the aperiodic queue is empty, the polling server self-suspends, giving up its execution slot
o The server does not wake-up once it has self-suspended, aperiodic jobs which become active during a
period are not considered for execution until the next period begins

For example: Consider a system with two periodic task T1 (3, 1) , T2 (10, 4), a periodic task A with r = 0.1 and e
= 0.8 and a poller (2.5, 0.5) then the aperiodic task be scheduled along with scheduling of periodic task using RM
as :

Response time of task A = 5.3 – 0.1 = 5.2

Periodic Servers:

A task that behaves much like a periodic task, but is created for the purpose of executing aperiodic jobs, is called
as periodic server. A periodic server, TPS = (PPS, ePS) never executes for more than ePS units of time in any
time interval of length PPS where the parameter e PS is called the execution budget (or simply budget) of the
periodic server. When a server is scheduled and executes aperiodic jobs, it consumes its budget at the rate of 1 per
unit time and the budget has been exhausted when it reaches 0. A time instant when the budget is replenished is
called a replenishment time.

A periodic server is backlogged whenever the aperiodic job queue is nonempty i.e. it is idle if the queue is empty.
The periodic server is scheduled as any other periodic task based upon the priority scheme used by the scheduling
algorithm. A polling server is a simple kind of periodic server. The budget is replenished to e s at the beginning of
each period and the budget is immediately consumed if there is no work when the server is scheduled

Bandwidth-Preserving Servers:

o A deficiency of the polling server algorithm is that if the server is scheduled when it is not backlogged, it
loses its execution budget until it is replenished when it again released.
o An aperiodic job arriving just after the polling server has been scheduled and found the aperiodic job
queue empty will have to wait until the next replenishment time.
o Algorithms that improve the polling approach in this manner are called bandwidth- preserving server
algorithms
o Bandwidth-preserving servers are periodic servers with additional rules for consumption and
replenishment of their The working principle or rules of working of this server are:
20. A backlogged bandwidth-preserving server is ready for execution when it has budget

o The scheduler keeps track of the consumption of the budget and suspends the server when it is exhausted,
or the server becomes idle.
o The scheduler moves the server back to the ready queue once it replenishes its budget, if the server is
backlogged at that time.
o If arrival of an aperiodic job causes the server to become backlogged, and it has budget, the server is put
back on the ready queue.

The last rule overcomes the deficiency of pooling server. Different types of bandwidth-preserving server are:

o Deferrable servers
o Sporadic servers
o Constant utilization servers
o Total bandwidth servers
o Weighted fair queuing servers

Deferrable Server
It is a simplest bandwidth-preserving server that improves response time of aperiodic jobs as compared to polling server.

Consumption rule:

 The budget is consumed at the rate of one per unit time whenever the server executes.
 Unused budget is retained throughout the period, to be used whenever there are aperiodic jobs to execute.
 If no aperiodic job is available to execute at start of period then keep it instead of discarding with the hope of new
arrival of new aperiodic job.

Replenishment rule:

 The budget is set to e S at multiples of the period e. time instants k⋅P S, for k = 0, 1, 2, …

For example: consider a system with two independent periodic tasks T1 (F = 2, P = 3.5, e = 1.5) and T2 (P = 6.5, e = 0.5)
with aperiodic jobs A (r=2.75, e = 1.75) be executed in deferrable server TDS = (Ps = 3, es =1). The RM schedule of
periodic task and execution of aperiodic task on deferrable server is:
Limitations of Deferrable Servers:

They may delay lower-priority tasks for more time than a periodic task with the same period and execution time.

Sporadic Server
A different type of bandwidth preserving server that is designed to eliminate the limitation of the deferrable server is
called sporadic server. It has more complex consumption and replenishment rules ensure that a sporadic server with
period pS and budget e S never demands more processor time than a periodic task with the same parameters. Consider a
system T of N independent preemptable periodic tasks, plus a single sporadic server task with parameters (ps, e s) then

 T H is the subset of periodic tasks with higher priorities than the


 t r defines the last time the server budget replenished.
 tf defines the first instant after t r at which the server begins to execute.
 te denotes the latest effective replenishment time.
 At any time t define:

 BEGIN as the start of the earliest busy interval in the most recent contiguous sequence of busy intervals of T H
starting before
 END as the end of the latest busy interval in this sequence if this interval ends before t; define END = ∞ if the
interval ends after t.

The consumption and replenishment rules be stated as:

Consumption rule

1. At any time t after t r , server’s budget is consumed at the rate of 1 per unit time until the budget is exhausted
when either one of following two conditions is true.
C1: The server is executing

C2: The server has executed since t r and END < t

2. When they are not true, the server holds its budget Replenishment rules

R1: When system begins executing and budget is replenished as:

Budget = e S and t r = the current time.

R2: When server begins to execute i.e. at time tf do if END = tf then

t e = max(t r, BEGIN ) else if END < tf then t e = tf

The next replenishment time is set to t e + p S.

R3: The next replenishment occurs at the next replenishment time (= t e + p S), except under the following conditions:

1. If t e + pS is earlier than tf the budget is replenished as soon as it is exhausted


2. If T becomes idle before t e + pS, and becomes busy again at t b, the budget is replenished at min(t b, t e + pS)

For example:

Consider, the budget of the server (5, 1.5) is 1.5 initially. It is scheduled rate-monotonically with three periodic tasks: T1
= (3, 0.5), T2 = (4, 1.0), and T3 = (19, 4.5). They are schedulable even when the aperiodic job queue is busy all the time.
Here the priority order be maintained as: T1>T2>Ts>T3 where TH= (T1, T2)

1. From time 0 to 3, the aperiodic job queue is empty and the server is Since it has not executed, its budget stays at
1.5. At time 3, the aperiodic job A1 with execution time 1.0 arrives; the server becomes ready. Since the higher-
priority task (3, 0.5) has a job ready for execution, the server and the aperiodic job wait.
2. The server does not begin to execute until time 3.5. At the time, tr is 0, BEGIN is equal to 3, and END is equal to
3.5. According to rule R2, the effective replenishment time te is equal to max(0, 3.0) = 3, and the next
replenishment time is set at 8.
1. The server executes until time 4; while it executes, its budget decreases with
2. The server does not begin to execute until time 3.5. At the time, tr is 0, BEGIN is equal to 3, and END is
equal to 3.5. According to rule R2, the effective replenishment time te is equal to max(0, 3.0) = 3, and the
next replenishment time is set at 8.
3. The server executes until time 4; while it executes, its budget decreases with time.
4. At time 4, the server is preempted by While it is preempted, it holds on to its budget.
5. After the server resumes execution at 5, its budget is consumed until exhaustion because it executes (C1)
and then, when it is suspended again, T1 and T2 are idle (or equivalently, END, which is 5.0, is less than
the current time) (C2).
6. When the aperiodic job A2 arrives at time 7, the budget of the server is exhausted; the job waits in the
queue.
7. At time 8, its budget replenished (R3), the server is ready for execution again.
8. At time 9.5, the server begins to execute for the time since 8. te is equal to the latest replenishment time
Hence the next replenishment time is 13. The server executes until

its budget is exhausted at 11; it is suspended and waits for the next replenishment time. In the meantime,
A2 waits in the queue.

9. Its budget replenished at time 13, the server is again scheduled and begins to execute at time 5. This time,
the next replenishment time is set at 18. However at 13.5, the periodic task system T becomes idle. Rather
than 18, the budget is replenished at 15, when a new busy interval of T begins, according to rule R3b.
10. The behavior of the later segment also obeys the above-stated In particular, rule R3b allows the server
budget to be replenished at 19.

Constant Utilization Server

 The constant utilization server is based on the size of the server.


 It reserves a known fraction (ũs) of the processor time for execution of the server.
 When the budget is non-zero then the server is scheduled with other tasks on an EDF basis.
 The budget and deadline of the server are chosen such that the utilization of the server is constant when it
executes, and that it is always given enough budget to complete the job at the head of its queue each time its
budget is replenished.
 The server never has any budget if it has no work to do.

Here

ũs = size of server

es = budget of server d = deadlines

t = current time

e= execution time of job at the head of aperiodic job que

Then the consumption and replenishment rule of constant utilization server is: Consumption Rule:

 A constant utilization server only consumes budget when it executes.

Replenishment Rules:

 Initially, set budget e s = 0 and deadline d = 0


 When an aperiodic job with execution time e arrives at time t to an empty aperiodic job queue then
 If t < d, do nothing (⇒ server is busy; wait for it to become idle)
 If t ≥ d then set d = t + e/ũ s and e s = e

-At the deadline d of the server

 If the server is backlogged, set d = d + e/ũ s and e s = e ⇒ was busy when job arrived
 If the server is idle, do nothing

I.e. the server is always given enough budget to complete the job at the head of its queue, with known utilization, when
the budget is replenished.

For example: ũ s = 0.25 T1 = (3, 0.5), T2 = (4, 1), T3 = (19, 4.5)

Total Bandwidth Server


A constant utilization server gives a known fraction of processor capacity to a task but cannot claim unused capacity to
complete the task earlier.

A total bandwidth server improves responsiveness by allowing a server to claim background time not used by the periodic
tasks.

This is done by having the scheduler replenish the server budget as soon as the budget is exhausted if the server is
backlogged at the time or as soon as the server becomes backlogged.

Consumption Rule:

 A total bandwidth server only consumes budget when it Replenishment Rule:


 Initially, e s = 0 and d = 0
 When an aperiodic job with execution time e arrives at time t to an empty aperiodic job queue
o Set d = max(d, t ) + e/ũ s and e s = e
 When the server completes the current aperiodic job, the job is removed from the queue then
o If the server is backlogged, set d = d + e/ũ s and e s = e
o If the server is idle, do nothing

Total bandwidth server is always ready for execution when backlogged and assigns at least fraction ũ s of the processor to
a task foe execution.

For example: ũ s = 0.25 T1 = (3, 0.5), T2 = (4, 1), T3 = (19, 4.5)

Weighted Fair Queuing Server


The constant utilization server and total bandwidth server are used to assign some fraction of processor capacity to an
aperiodic task. During assignment of task, there is an issue of fairness and starvation i.e. the fairness cannot maintained in
case of total bandwidth and constant utilization server approach. A scheduling algorithms is fair with in any particular
time interval if fraction of processor time in the interval attained by each backlogged server is proportional to size of
server.

In such system not only all the task meet their deadlines, but they all make a continuous process according to their share
of processor and there is no starvation. The waited fair queuing algorithms are used to share processor time between sever
and designed to ensure fairness is allocation among multiple servers.

Consumption Rule:

It consumes budget when it executed. Replenishment Rule:

 Its budget is replenishment when it first becomes backlogged after being idle.
 As long as it is backlogged, its budget is replenished each time it completes a job.
 At each replenished time, the server budget is set to the execution time of the job at the head of queue.

Slack Stealing in Deadline Driven System:

 The slack stealer is a periodic server to execute aperiodic job using slack time.
 The slack stealer is ready for execution whenever the aperiodic job queue is nonempty and is suspended when the
queue is empty.
 The scheduler monitors the periodic tasks in order to keep track of amount of available slack.
 Whenever the slack stealer executes, it executes the aperiodic job at the head of aperiodic job queue.
 This kind of slack stealing algorithms is said to be greedy and non-optimal.
 The available slack is always used if there is an aperiodic job ready to be executed.
 Slack computation algorithm is correct if it never says that the system has slack when the system does not, since
doing so may cause a periodic job to complete too late

Consider, a system of two periodic tasks, T1 = (2.0, 3.5, 1.5) and T2 = (6.5, 0.5). In addition to the aperiodic job that has
execution time 1.7 and is released at 2.8, suppose another aperiodic job with execution time 2.5 is released at time 5.5.
These jobs are A1 and A2, respectively. The figure below shows the operation of a slack stealer.
 Initially, the slack stealer is suspended because the aperiodic job queue is empty. When A1 arrives at 2.8, the
slack stealer resumes. Because the execution of the last 0.7 units of J1, 1 can be postponed until time 8 (i.e.,
5.5−0.7) and T2 has no ready job at the time, the system has 2 units of slack. The slack stealer is given the highest
priority. It preempts J1, 1 and starts to execute A1. As it executes, the slack of the system is consumed at the rate
of 1 per unit time.
 At time 4.5, A1 the slack stealer is suspended. The job J1, 1 resumes and executes to completion on time.
 At time 5.5, A2 arrives, and the slack stealer becomes ready again. At this time, the execution of the second job
J1, 2 of T1 can be postponed until time 5, and the second job J2, 2 of T2 can be postponed until 12.5.Hence, the
system as a whole has 2.0 units of slack. The slack stealer has the highest priority starting from this time. It
executes A2.
 At time 7.5, all the slack consumed, the slack stealer is given the lowest priority. J1, 2 preempts the slack stealer
and starts to execute.
 At time 9, J1, 2 completes, and the system again has slack. The slack stealer now has the highest It continues to
execute A2.
 When A2 completes, the slack stealer is suspended again. For as long as there is no job in the aperiodic job queue,
the periodic tasks execute on the EDF basis.

You might also like