Title: Basics of Real-Time Scheduling
1Basics of Real-Time Scheduling
- Jan Madsen
- Informatics and Mathematical Modelling
- Technical University of Denmark
- Richard Petersens Plads, Building 321
- DK2800 Lyngby, Denmark
- Jan_at_imm.dtu.dk
2WAP application
- send requests to server
- translate data received from server
- render data on display
- operating the users control panel
- logically different operations
- performed at different rates
Need structure and to perform multiple processes
3Why use multiple processes?
- Processes introduce structure into the system
design
- understand each process independently
- analyze communication between processes to
determine system behavior
- Timing is easier to specify
- Communication between processes provide test
points
Processes are a neat way to handle complex systems
4What is a process?
- A process is a state and a procedure
- State
- Running
- Suspended
- Deactivated
- Procedure
- Sequence of separate steps
- A process may interact with its surroundings
5Process execution
6Process execution
- Periodic
- the period is the time between successive
executions - the process rate is the inverse of its period
- Aperiodic
- non-periodic process, typical an event handler
- Sporadic
- hard real-time aperiodic process
- usually, a minimum interarrival constraint is
imposed
7Example A software processes
- A process includes
- code
- memory which belongs to the process
- connections to other processes
- A process is a unique execution of a program
- In most embedded systems, processes never die!
8Executing on a single CPU
9Execution of multiple processes
- On a single CPU
- A Pentium processor
- On a distributed homogeneous system
- A network of Pentium processors
- On a distributed heterogeneous system
- A network of differing processors (CPUs and ASICs)
10About this lecture
- Huge literature on scheduling theory
- Aim is to give an overview of problems and
possible solutions to the multi-task scheduling
problem related to RTOS - Structure of lecture
- Some basic concepts and teminology
- Uni-processor scheduling
- Rate-monotonic scheduling
- Earlies-deadlines-first scheduling
- Multi-processor scheduling
11PART I Scheduling Terminology and Basic Concepts
12Design flow
Partitioning/clustering
P1
P2
Allocation
Mapping
P3
Scheduling
Communication
P1
P3
P2
13Scheduling
14Terminology
Application
Architecture
15Architecture
- Components
- Processors
- CPU, DSP, ASIC, ...
- Communication
- Bus, network, ...
- Devices
- sensor, actuator, display, ...
- Architecture may be fixed or (re-)configurable
os
device
a
b
c
mem
device
16Application
- Task
- A module which can be envoked to perform a
particular function - A schedulable entity
- Characterized by its
- Timing constraints
- Precedence contraints
- Exclusion constraints
- Resource requirements
17Timing constraints
1
18Task execution
- Periodic
- the period is the time between successive
executions - Aperiodic
- non-periodic task, typical an event handler
- Sporadic
- hard real-time aperiodic task
- typical, a minimum interarrival constraint is
imposed
19Precedence constraints
- pi precede pj if pi must finish before pj begins
- process interrelate with each other to achieve
- synchronization
- exchange data
pi
pj
20Exclusion constraints
- pi exclude pj if no execution of pj is allowed
between the time that pi starts its computation
and the time that pi complete its computation - Prevent simultaneous access to shared resources
- data
- memory
- devices
pi
pj
21Resource constraints
- R r1, r2, , rm
- Example
- R(pi) r1, r3 resource r1 and r3 is required
by pi during its execution - may be used to
- implement a critical section
- enforce PE assignment of processes
22Scheduling approaches
- Classical scheduling theory
- Uniprocessor systems
- RMS
- EDF
- Distributed real-time scheduling
- Deterministic (static) scheduling
- Dynamic scheduling
23Scheduling
- Allocation
- Determine number and type of processors/resources
- Assignment
- Binding tasks to processors
- Scheduling
- Determine execution order
24Scheduling principles
- Off-line
- A scheduler performing its job before the
scheduled system is put into operation - On-line
- A scheduler performing its job at run-time, when
the system is running - Typically list-based
- When a task is released (ready) it is placed in a
list - Scheduler select which task from the list to
execute next - Selection based on some criteria scheduling
policy
25Scheduling areas
- High-level Synthesis
- fine grained, operation/instruction level
- schedule done off-line
- single time constraint
- Real-time operating systems (RTOS)
- coarse grained, programs/sub-programs
- scheduling done on-line
- multiple time constraints
26SoC scheduling
- Similarity to RTOS
- Time constraints
- Context switching
- Task synchronization
- Task communication
- Difference to RTOS
- Large design space
- Variable granularity
- Wide range of metrics
- Time, power, cost, ...
- Flexibility, reliability, ...
- High degree of optimization
- Dedicated hardware
27Preemption vs. Non-preemption
- Non-preemptive scheduling
- Preemptive scheduling
28Metrics
Schedule length