lecture02
lecture02
2
Example: Digital Process Control
• Controlling some device (“the plant”)
Controller using an actuator, based on sampled
Control-law sensor data
A/D D/A
•
Reference rk computation uk
input: r(t) u(t) Effective control depends on correct
control law computation, reference
A/D input, and accuracy of measurements
yk
3
Examples: Drive-by-Wire and Telephony
network
Wheel Engine
• E.g., a sensor that sends data to the controller sensors sensors
•
Copyright © 2007 University of Glasgow
control law under time constraints, but must schedule and prioritise communications
•! Network
All rights reserved.
Easier to reason about systems that are more cyclic, synchronous, and predictable
5
Implementation Considerations
7
Jobs, Tasks, Processors, and Resources
• A job is a unit of work scheduled • A resource, R, is a passive entity
and executed by the system; on which jobs may depend
• A task, T, is a set of related jobs, J1, J2, • E.g., system memory, a hardware device
…, Jn that jointly provide some function
• Resources may have different types and
• If jobs occur on a regular cycle, the task sizes, but do not have a speed attribute
is termed periodic
• Resources are not consumed by usage,
• if jobs are unpredictable, the task is and can be reused multiple times
termed aperiodic (or sporadic, if the jobs
have deadlines once released) • Jobs compete for access to resources,
and may block if the resource is in use
• Jobs execute on a processor and
•
by another job
A resource is plentiful if there is enough
may depend on some resources
of it that nothing blocks waiting access –
• Processors are active devices on such resources can’t affect correctness,
and so are generally ignored
which jobs are scheduled
• E.g., threads scheduled on a CPU, data
scheduled on a transmission link
• A processor has a speed attribute, that
determines the rate of progress of jobs
executing on that processor
8
Execution Time of Jobs
9
•! Relative deadline – the maximum allowable job response time
•! Absolute deadline – the instant of time by which a job is required
Deadlines & (often
to be completed TimingcalledConstraints
simply the deadline)
–! absolute deadline = release time + relative deadline
–! Feasible interval for a job Ji is the interval (ri, di]
•! Deadlines are examples of timing constraints
Relative deadline, Di
Response time
Job, Ji
Copyright © 2006 University of Glasgow
Time
ri- ri+
Completion time
All rights reserved.
Release time, ri
Absolute deadline, di
10
Deadlines & Timing Constraints: Example
• The system can be modelled as a task, T, comprising jobs J0, J1, …, Jk, …
• The release time of Jk is 20 + (k × 100)ms
• The relative deadline of Jk is 100ms; the absolute deadline is 20 + ((k + 1) × 100)ms
J0 J1 J2 J3
11
Effective Release Times and Deadlines
• Effective deadline
• If a job has no successors, its effective deadline is its deadline
• It if has successors, its effective deadline is the minimum of its deadline and the effective
deadline of its successors
12
Hard vs. Soft Real-time Systems
13
Periodic Tasks
14
•! The hyper-period of a set of periodic tasks is the least common
Periodic Tasks: Example multiple of their periods: H = lcm(pi) for i = 1, 2, …, n
–! Time after which the pattern of job release/execution times starts to repeat,
limiting analysis needed
•! Example:
–! T1 : p1 = 3, e1 = 1
–! T2 : p2 = 5, e2 = 2
H = lcm(3, 5) = 15
15
Aperiodic and Sporadic Tasks
16
Dynamic vs. Static Systems
17
Overview of Real-time Scheduling
• Jobs are scheduled and allocated • A schedule is feasible if it’s valid
access to resources according to and every job meets its timing
a scheduling algorithm and some constraints
resource access control protocol
• A scheduling algorithm is optimal
• A valid schedule satisfies the if it always produces a feasible
following conditions: schedule for a given set of jobs if
• Every processor is assigned at most one a feasible schedule exists
job at any time; every job is assigned to
at most one processor at once
• There are some scheduling algorithms
that will find some, but not all, feasible
• No job is scheduled before its release schedules, and so may fail to schedule a
set of jobs that some other algorithm
time
could schedule
• The total amount of processor time
assigned to each job is equal to its
maximum or actual execution time
• All the precedence and resource usage
constraints are satisfied
18
Real-time Scheduling Algorithms
19
Further Reading
• Recommended reading:
• Jane W. S. Liu, "Real-Time Systems",
Prentice Hall, 2000, ISBN 0130996513
20