Documente Academic
Documente Profesional
Documente Cultură
Reactive systems
Respond to external events.
Engine controller. Seat belt monitor.
asynchronous input
user interfaces communication systems
2008 Wayne Wolf Overheads for Computers as Components 2nd ed.
Multi-rate systems
Tasks may be synchronous or asynchronous. Synchronous tasks may recur at different rates. Processes run at different rates based on computational needs of the tasks.
engine controller
Full range time (ms) 300 40 30 80 250 500 100 Seconds Seconds 10 80 500
Real-time systems
Perform a computation to conform to external timing constraints. Deadline frequency: Deadline type:
Periodic. Aperiodic.
Hard: failure to meet deadline causes system failure. Soft: failure to meet deadline causes degraded response. Firm: late response is useless but some late responses can be tolerated.
Overheads for Computers as Components 2nd ed.
deadline P1 initiating event period aperiodic process periodic process initiated periodic process initiated by event at start of period
Overheads for Computers as Components 2nd ed.
time
CPU 4
P14
time
Timing violations
What happens if a process doesnt finish by its deadline?
Hard deadline: system fails if missed. Soft deadline: user may notice, but system doesnt necessarily fail.
Task graphs
Tasks may have data dependencies---must execute in certain order. Task graph shows data/control dependencies between processes. Task: connected set of processes. Task set: One or more tasks.
2008 Wayne Wolf
P1
P2 P5
P3
P6 P4 task 1 task set task 2
MPEG audio
MPEG video
Sources of variation:
Data dependencies. Memory system. CPU pipeline.
2008 Wayne Wolf Overheads for Computers as Components 2nd ed.
Utilization
CPU utilization:
Fraction of the CPU that is doing useful work. Often calculated assuming no scheduling overhead.
Utilization:
U =
(CPU time for useful work)/ (total available CPU time)
t1 t t2
=[S = T/t
2008 Wayne Wolf
State of a process
A process can be in one of three states:
executing on the CPU; ready to run; waiting for data.
gets CPU
executing
preempted needs data
gets data
ready
needs data
waiting
Scheduling feasibility
Resource constraints make schedulability analysis NP-hard.
Must show that the deadlines are met for all timings of resource requests.
P1
P2
I/O device
Require:
T Si Ti Cant use more than 100% of the CPU.
2008 Wayne Wolf Overheads for Computers as Components 2nd ed.
Hyperperiod
Hyperperiod: least common multiple (LCM) of the task periods. Must look at the hyperperiod schedule to find all task interactions. Hyperperiod can be very long if task periods are not chosen carefully.
Hyperperiod example
Long hyperperiod:
P1 7 ms. P2 11 ms. P3 15 ms. LCM = 1155 ms.
Shorter hyperperiod:
P1 8 ms. P2 12 ms. P3 16 ms. LCM = 96 ms.
2008 Wayne Wolf Overheads for Computers as Components 2nd ed.
LCM P1 P2 P3
5.00E-03 peirod CPU time CPU time/LCM 1.00E-03 1.00E-04 5.00E-04 1.00E-03 2.00E-04 1.00E-03 5.00E-03 3.00E-04 3.00E-04 total CPU/LCM utilization 1.80E-03 3.60E-01
Cyclostatic/TDMA
Schedule in time slots.
Same process activation irrespective of workload.
T1
T2 P
T3
T1
T2 P
T3
TDMA assumptions
Schedule based on least common multiple (LCM) of the process periods. Trivial scheduler > very small scheduling overhead.
2008 Wayne Wolf
P1 P2
P1
P1 P2
PLCM
TDMA schedulability
Always same CPU utilization (assuming constant process execution times). Cant handle unexpected loads.
Must schedule a time slot for aperiodic events.
TDMA period CPU time P1 1.00E-03 P2 3.00E-03 P3 2.00E-03 P4 2.00E-03 total 8.00E-03 utilization 8.00E-01
1.00E-02
Round-robin
Schedule process only if ready.
Always test processes in the same order.
T1 T2 P T3 T2 T3 P
Variations:
Round-robin assumptions
Schedule based on least common multiple (LCM) of the process periods. Best done with equal time slots for processes. Simple scheduler -> low scheduling overhead.
Can be implemented in hardware.
Overheads for Computers as Components 2nd ed.
Round-robin schedulability
Can bound maximum CPU load.
May leave unused CPU cycles.
Implementing processes
All of these implementations are inadequate. Need better control over timing. Need a better mechanism than subroutines.