Real-Time Task Model - Chapter 3 - : "Monolithic Approach" Good Enough?
Real-Time Task Model - Chapter 3 - : "Monolithic Approach" Good Enough?
- Chapter 3 -
“Monolithic approach”
Good enough?
• No!
– For a complex system, it is really hard to design a
single superloop
– Really hard to validate cross-related temporal
requirements
• So, we need a more structured way to look at the
problem
– Reference model: abstracted view (look at only core) of
• Workload
• Resource
– Easy to form a structured way of design and validation
– Can be generalized for many variations of problems
1
Why Reference Model?
LeastSquare
Kalmanfilter P
filter PID
control Abstraction
control
Specific
ARM
Problem 1 Model
processor
Problem
sensor actuator Specific
sensor actuator
actuator Problem 2
sensor
Customizing
2
Overview
• Workload model (characterization of applications)
– Jobs and tasks
– Release time (periodic/aperiodic/sporadic)
– Deadline (absolute/relative, hard/soft, single stage/end to end)
– Execution time (deterministic/stochastic)
– Temporal distance and precedence constraints
• Resource model
– Processors and resources
– Utilization of resource
• Scheduling algorithms
– Priority/preemptability/blocking
– Scheduler and schedule
Workload Model
3
Jobs and Tasks
• A job is a unit of computation, e.g.,
– handling the press of a keyboard
– or compute the control response in one instance of a
control loop
job1 Job 2
job1 Job 2
deadline
Release
time
4
Periodic, Aperiodic and
Jitter in Release times
• A task is periodic, if the release times are periodic, e.g.,
every second.
5
Hard and Soft Deadlines
• Deadlines are considered to be hard if failing to meet them
is considered as an application failure leading to
catastrophic consequences on the controlled environment.
• A deadline is considered to be soft, if it is specified
probabilistically. For example, a radar system’s ability to
detect and display a plane by some given time is usually
specified in the following style:
– When a plane is over the horizon, it must be detected and
displayed on operator’s screen no later than 1 second 99.95 % of
the times.
• A deadline is also considered to be soft if a late completion
gracefully degrades the performance of the system without
causing damage to the controlled environment
6
Periodic Task Model
• Periodic tasks are the “work horse” of real-time
systems and they play a key role in real-time
systems.
Temporal Distance - 1
• Sequential temporal distance constraint: how far the
completion time of two consecutive jobs can be separated.
• Example Application: Advanced phase array radar.
Temporal distance and deadline specify the window of
time at which another look (SAMPLING) of a target is
needed. Temporal distance and deadline are computed
online according to the nature and speed of the target.
• Quiz: why not using a periodic model?
relative deadline
Temporal
distance
7
Temporal Distance - 2
• Periodic model is still in use. But it permits bundling,
which wastes antenna resource. If next sample completes
at the end of next period, the wide separation will result in
more error.
• Instance by instance temporal distance (from the current
job’s completion time to the completion time of next job)
gives more precise control on the use of the antenna.
bundling
Precedence Constraints
• Precedence relation says you can’t start until your
predecessor has done.
8
Precedence Constraint Representation
(Task Graph)
(0,7] (2,9] (4,11] (6,13] (8,15]
…
(2,5] (5,8] (8,11] (11,14] (14,17]
…
(0,5] (4,8] (5,20] conditional block
branch join
(0,6]
(2,10]
2/3 1/2
Resource Model
(Processors and Resources)
• Active resources: processor, bus, disks and communication
channels where a job executes or transmits over it. The
size of the job and the speed of the active resources
determine the execution/transmission time. Usually, active
resources are scheduled, for example, scheduling the CPU
or LAN.
9
Utilization of Active Resource
by a task
• A periodic task’s utilization Ui of an active resource is the
ratio between its execution time and period: Ui = Ci/pi
Scheduling Model
“Schedule and Scheduler”
• Given a set of jobs, J= {J1,…,Jn}, a schedule σ(t) is an assignment of
jobs to the resource, so that each task is executed until completion.
• σ(t) is an integer step function and σ(t)=k, with k>0, means that job Jk
is executing at time t, while σ(t)=0 means that the CPU is idle.
Context switch
idle idle
J1 J2 J3
σ(t)
t1 t2 t3 t4 t
10
Schedule and Scheduler
• Scheduler is the module that implements the scheduling
algorithm. Each processor is assigned one job at a time.
– Jobs become ready to execute after their release time and after
requested resources are allocated and precedence constraints are
satisfied
– Jobs are executed in the priority order, preemption carries out and
processor is de-allocated immediate after a job is done.
• A schedule is said to be feasible if all tasks can be
completed according to a set of specified constraints.
• A set of tasks is said to be schedulable if there exists at
least one algorithm that can produce a feasible schedule for
the task set.
Preemptive vs Non-preemptive
scheduling
• Preemption: A preemptive schedule is a schedule
in which the running task can be arbitrarily
suspended at any time, to assign the CPU to
another task according to a predefined scheduling
policy
• CPU is preemptable.
• Communication channel is non-preemptable.
• Passive resource, e.g., shared data, is not
preemptable – mutually exclusive.
11
Classification of Scheduling Algorithms
12