0% found this document useful (0 votes)
16 views15 pages

Rtes 07

The document discusses scheduling techniques for real-time embedded systems, focusing on aperiodic and sporadic jobs. It introduces concepts such as slack stealing, acceptance tests for sporadic jobs, and constructing static schedules using an iterative network-flow algorithm. The document emphasizes the importance of minimizing response time and ensuring that jobs meet their deadlines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views15 pages

Rtes 07

The document discusses scheduling techniques for real-time embedded systems, focusing on aperiodic and sporadic jobs. It introduces concepts such as slack stealing, acceptance tests for sporadic jobs, and constructing static schedules using an iterative network-flow algorithm. The document emphasizes the importance of minimizing response time and ensuring that jobs meet their deadlines.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Real-Time Embedded

Systems
Mahmoud Shirazi

Department of Computer Science and Information Technology


Institute for Advanced Studies in Basic Sciences (IASBS)

1
Scheduling Aperiodic Jobs

Aperiodic jobs are typically results of external events.


Aperiodic jobs are scheduled in the background and their execution may be delayed.

the sooner the completion time

the more responsive the system

minimizing response time

Real-Time Systems 2
Slack Stealing

 𝑥𝑘 : The total amount of time allocated to all the slices scheduled in frame 𝑘.
 The slack available at the beginning of frame 𝑘 = 𝑓 − 𝑥𝑘
 After y units of slack time are used by aperiodic jobs, the available slack is reduced to 𝑓 − 𝑥𝑘 − 𝑦

 The cyclic executive can let aperiodic jobs execute in frame k as long as 𝑓 − 𝑥𝑘 − 𝑦 > 0

Real-Time Systems 3
Slack Stealing

Real-Time Systems 4
Implementing Slack Stealing

 Use an interval timer to keep track of available slack


 Set the timer when an aperiodic job begins to run. If it goes off, must start executing periodic jobs.
 Most OSs do not provide sub-millisecond granularity interval timers.

Real-Time Systems 5
Scheduling Sporadic Jobs

 When an sporadic job arrives, the scheduler performs an acceptance test to see if the job can be
completed by its deadline.
 We must ensure that a new sporadic job does not cause a previously accepted sporadic job to miss its
deadline.
 We assume sporadic jobs are prioritized on an earliest deadline first (EDF) basis.

Real-Time Systems 6
Acceptance Test

 𝜎(𝑖, 𝑘): initial total slack in frame 𝑖 through 𝑘, where 1 ≤ 𝑖 ≤ 𝑘 ≤ 𝐹.


 Suppose we are doing an acceptance test at frame 𝑡 for a newly arrived sporadic job 𝑆 with deadline 𝑑
and execution time 𝑒.
 Suppose 𝑑 occurs within frame 𝑙 + 1, i.e., 𝑆 must complete by the end of frame 𝑙.
 Compute the total current slack in frame t through l using:
The amount of time
already spent executing
𝑆𝑘 before frame 𝑡
𝜎𝑐 𝑡, 𝑙 = 𝜎 𝑡, 𝑙 − ෍ (𝑒𝑘 − 𝜉𝑘 )
𝑑𝑘 ≤𝑑

Real-Time Systems 7
Acceptance Test

Real-Time Systems 8
Example
𝑆𝑖 (𝑑𝑖 , 𝑒𝑖 )

Real-Time Systems 9
Executing Sporadic Tasks

 Accepted sporadic jobs are executed like aperiodic jobs in the original algorithm (without slack stealing).
 The aperiodic job queue is in FIFO order, while the sporadic job queue is in EDF order.
 Aperiodic jobs only execute when the sporadic job queue is empty.

Real-Time Systems 10
Executing Sporadic Tasks

From M. Kargahi (University of Tehran)


Real-Time Systems 11
Constructing Static Schedules
Problem:
 choosing a minor frame length,
 segmenting the tasks if necessary,
 and scheduling the tasks so that they meet all their deadlines

Solution:
 Iterative network-flow (INF) algorithm
 Assumption: tasks can be preempted at any time and are independent

Network-flow graph:
 Compute all frame sizes in accordance with the second two frame-size constraints.
 for each possible frame size 𝑓, we compute a network flow graph and run a max-flow
algorithm
Real-Time Systems 12
Constructing Static Schedules

Real-Time Systems 13
Constructing Static Schedules

Flows: A non-negative integer on each edge satisfying:


 It is less than or equal to the capacity of the edge
 With the exception of source and sink, the sum of flows
of all the edges into a vertex 𝑣 is equal to the sum of
flows of the edges out of 𝑣

Real-Time Systems 14
Finding a Schedule

 The maximum attainable flow value is clearly σ1≤𝑖≤𝑛 𝑒𝑖 .

 If the max flow is found with the value σ1≤𝑖≤𝑛 𝑒𝑖 then we have a schedule.
 If a job is scheduled across multiple frames, then we must slice it into corresponding sub-jobs
 Tasks with precedence constraints are no problem
 We can enforce precedence constraints by using effective release times and deadlines
 If slices of two jobs are scheduled in the wrong order, we can just swap them

Real-Time Systems 15

You might also like