Rtes 07
Rtes 07
Systems
Mahmoud Shirazi
1
Scheduling Aperiodic Jobs
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
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
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
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
Real-Time Systems 14
Finding a Schedule
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