Clock Driven Scheduling PDF
Clock Driven Scheduling PDF
T2 = (10, 3, 6) ⇒ φ2 = 0 p2 = 10 e2 = 3 D2 = 6
J1,1 released at 0, deadline 6
J1,2 released at 10, deadline 16
…
Copyright © 2006 University of Glasgow
T3 = (10, 3) ⇒ φ3 = 0 p3 = 10 e3 = 3 D3 = 10
J1,1 released at 0, deadline 10
J1,2 released at 10, deadline 20
…
Static, Clock-driven Cyclic Scheduler
• Since the parameters of all jobs with hard deadlines are known
can construct a static cyclic schedule in advance
– Processor time allocated to a job equals its maximum execution time
– Scheduler dispatches jobs according to the static schedule, repeating each
hyperperiod
– Static schedule guarantees that each job completes by its deadline
• No job overruns ⇒ all deadlines are met
Feasible intervals
Execution times T1 T3 T2 T1 T4 T2 T1 T2 T1 T1 T2 T1
0 4 8 12 16 20
Copyright © 2006 University of Glasgow
sleep;
end do.
End SCHEDULER.
Structured Cyclic Schedules
each frame
– Can use a periodic clock interrupt, rather than programmable timer
Frame Size Constraints
Feasible intervals
Copyright © 2006 University of Glasgow
Execution times T1 T3 T2 T1 T4 T2 T1 T2 T1 T1 T2 T1
0 2 4 6 8 10 12 14 16 18 20
Job Slices
• Example:
– Consider a system with T1 = (4, 1), T2 = (5, 2, 7), T3 = (20, 5)
– Cannot satisfy constraints: Eq.1 ⇒ f ≥ 5 but Eq.3 ⇒ f ≤ 4
– Solve by splitting T3 into T3,1 = (20, 1), T3,2 = (20, 3) and T3,3 = (20,1)
Copyright © 2006 University of Glasgow
• Less overhead than pure table driven cyclic scheduler, since only
interrupted on frame boundaries, rather than on each job
Scheduling Aperiodic Jobs
• Thus far, aperiodic jobs are scheduled in the background after all
jobs with hard deadlines scheduled in each frame have completed
– Delays execution of aperiodic jobs in preference to periodic jobs
– However, note that there is often no advantage to completing a hard real-
time job early, and since an aperiodic job is released due to an event, the
sooner such a job completes, the more responsive the system
• Hence, minimizing response times for aperiodic jobs is typically a
design goal of real-time schedulers
Copyright © 2006 University of Glasgow
Scheduling Aperiodic Jobs: Slack Stealing
– If more than one sporadic job arrives at once, they should be queued for
acceptance in EDF order
Practical Considerations
• Handling overruns:
– Jobs are scheduled based on maximum execution time, but failures might
cause overrun
– A robust system will handle this by either: 1) killing the job and starting an
error recovery task; or 2) preempting the job and scheduling the remainder
as an aperiodic job
• Depends on usefulness of late results, dependencies between jobs, etc.
• Mode changes:
– A cyclic scheduler needs to know all parameters of real-time jobs a priori
– Switching between modes of operation implies reconfiguring the scheduler
and bringing in the code/data for the new jobs
– This can take a long time: schedule the reconfiguration job as an aperiodic
or sporadic task to ensure other deadlines met during mode change
Copyright © 2006 University of Glasgow
• Multiple processors:
– Can be handled, but off-line scheduling table generation more complex
Clock-driven Scheduling: Advantages
• Conceptual simplicity
– Ability to consider complex dependencies, communication delays, and
resource contention among jobs when constructing the static schedule,
guaranteeing absence of deadlocks and unpredictable delays
– Entire schedule is captured in a static table
– Different operating modes can be represented by different tables
– No concurrency control or synchronization required
– If completion time jitter requirements exist, can be captured in the schedule
• When workload is mostly periodic and the schedule is cyclic,
timing constraints can be checked and enforced at each frame
boundary
• Choice of frame size can minimize context switching and
Copyright © 2006 University of Glasgow
communication overheads
• Relatively easy to validate, test and certify
Clock-driven Scheduling: Disadvantages
• Inflexible
– Pre-compilation of knowledge into scheduling tables means that if
anything changes materially, have to redo the table generation
– Best suited for systems which are rarely modified once built
• Other disadvantages:
– Release times of all jobs must be fixed
– All possible combinations of periodic tasks that can execute at the same
time must be known a priori, so that the combined schedule can be pre-
computed
– The treatment of aperiodic jobs is very primitive
• Unlikely to yield acceptable response times if a significant amount of soft real-
time computation exists
Copyright © 2006 University of Glasgow
Summary
We have discussed:
• Static, clock-driven schedules and the cyclic executive
• Handling aperiodic jobs
– Slack stealing
• Handling sporadic jobs
• Advantages and disadvantages of clock driven scheduling