Professional Documents
Culture Documents
GNIT July 16 2015
GNIT July 16 2015
Sensor
Control-Law
Computation
Actuator
5
Other Real-Time Applications
Real-time databases.
◦ Transactions must complete by deadlines.
◦ Main dilemma: Transaction scheduling algorithms and real-time scheduling
algorithms often have conflicting goals.
◦ Data may be subject to absolute and relative temporal consistency
requirements.
Multimedia.
◦ Want to process audio and video frames at steady rates.
◦ TV video rate is 30 frames/sec. HDTV is 60 frames/sec.
◦ Telephone audio is 16 Kbits/sec. CD audio is 128 Kbits/sec.
◦ Other requirements: Lip synchronization, low jitter, low end-to-end response
times (if interactive).
Characteristics of Real-Time Systems
Event-driven, reactive.
Concurrency/multiprogramming.
Stand-alone/continuous operation.
Reliability/fault-tolerance requirements.
Predictable behavior.
Notion of Predictability
The behavior of the real-time system must be predictable which means that with certain
assumptions about workload and failures, it should be possible to show at design time that all
the timing constraints of the application will be met.
For dynamic systems, 100% guarantee cannot be given since the characteristics of tasks are not
known a priori.
In dynamic systems, predictability means that once a task is admitted into the system, its guarantee
should never be violated as long as the assumptions under which the task was admitted hold.
8
What’s Important in Real-Time
Metrics for real-time systems differ from that for time-sharing systems.
Time-Sharing Real-Time
Systems Systems
Capacity High throughput Schedulability
Resource constraints
◦ Shared access
◦ Exclusive access
Precedence constraints
◦ T1 T2: Task T2 can start executing only after T1 finishes its execution
Fault-tolerant requirements
◦ To achieve higher reliability for task execution
◦ Redundancy in execution
11
Real-Time Workload
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 5 10 15
13
Deadlines: Hard vs. Soft
Hard deadline
◦ Disastrous or very serious consequences may occur if the deadline is missed
◦ Validation is essential : can all the deadlines be met, even under worst-case
scenario?
◦ Deterministic guarantees
Soft deadline
◦ Ideally, the deadline should be met for maximum performance. The
performance degrades in case of deadline misses.
◦ Best effort approaches / statistical guarantees
14
Schedulability
Property indicating whether a real-time system (a set of real-time tasks) can meet
their deadlines
(4,1)
(5,2)
(7,2)
15
Real-Time Scheduling
Determines the order of real-time task executions
Static-priority scheduling
Dynamic-priority scheduling
(4,1)
(5,2)
5 10 15
(7,2)
5 10 15
16
RM (Rate Monotonic)
Optimal static-priority scheduling
It assigns priority according to period
A task with a shorter period has a higher priority
Executes a job with the shortest period
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
17
RM (Rate Monotonic)
Executes a job with the shortest period
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
18
RM (Rate Monotonic)
Executes a job with the shortest period
Deadline Miss !
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
19
Why Are Deadlines Missed?
For a given task, consider
◦ preemption: time waiting for higher priority tasks
◦ execution: time to do its own work
◦ blocking: time delayed by lower priority tasks
The task is schedulable if the sum of its preemption, execution, and blocking is
less than its deadline.
Focus: identify the biggest hits among the three and reduce, as needed, to
achieve schedulability
EDF (Earliest Deadline First)
Optimal dynamic priority scheduling
A task with a shorter deadline has a higher priority
Executes a job with the earliest deadline
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
21
EDF (Earliest Deadline First)
Executes a job with the earliest deadline
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
22
EDF (Earliest Deadline First)
Optimal scheduling algorithm
◦ if there is a schedule for a set of real-time tasks,
EDF can schedule it.
T1 (4,1)
T2 (5,2)
5 10 15
T3 (7,2)
5 10 15
23
RM vs. EDF
Rate Monotonic
◦ Simpler implementation, even in systems without explicit support for timing constraints
(periods, deadlines)
◦ Predictability for the highest priority tasks
EDF
◦ Full processor utilization
◦ Misbehavior during overload conditions
For more details: Buttazzo, “Rate monotonic vs. EDF: Judgement Day”, EMSOFT 2003.
24
REAL TIME ISSUES IN EMBEDDED
SYSTEM
What is an Embedded System
Its not a PC!
Most computer in the world do not have a keyboard and screen
The vast majority of computers in the world are small chips that are hidden
inside all kinds of products
What is an Embedded System?
Embedded Systems
An embedded system is nearly any computing system (other than a general-purpose computer)
with the following characteristics
Single-functioned
Typically, is designed to perform predefined function
Tightly constrained
Tuned for low cost
Single-to-fewer components based
Performs functions fast enough
Consumes minimum power
Reactive and real-time
Must continually monitor the desired environment and react to changes
Hardware and software co-existence
28
Where are ESs?
Embedded computing systems are becoming pervasive in our society (more than
109 units/year):
Robotics
Plant control
Automotive
Consumer electronics
Multimedia systems
Sensor/Actor Networks
Modern day Car as ES
Controlling System
- Human driver: Sensors - Eyes and Ears of the driver.
- Computer: Sensors - Cameras, Infrared receiver, and Laser telemeter.
30
Car example (contd)
31
Target Platforms for ES
Microcontroller-based systems
DSP processor-based systems
ASIC technology
FPGA technology
32
Integration in System Design
Embedded Software Tools
Time
33
What are FPGAs
FPGAs are programmable digital logic chip
We can program them to do almost any digital
function
Here's the general flow of working with FPGAs:
We use a computer to describe a "logic function" that we
want. We might draw a schematic
We compile the "logic function", using a software provided
by the FPGA vendor.
That creates a binary file that can be downloaded into the
FPGA
Binary file can be downloaded to the FPGA by connecting
cable
That's it! our FPGA behaves according to our "logic
function" Xilinx Spartan 3e & Altera Cyclone Board
Why FPGAs are Favorable for ES
Customization
Complete flexibility to select any combination of peripherals and controllers
New, unique peripherals that can be connected directly to the processors bus
Component and cost reduction
Multiple component systems can be replaced with a single FPGA
One can reduce board size and inventory management, both of which will save design time and cost
Hardware acceleration
Ability to make trade off between hardware and software to maximize efficiency and performance
Algorithm with software bottleneck, a custom co-processing engine can be designed in the FPGA specially for that
algorithm
Main processor and co-processor architecture makes the total Hardware system much accelerated
Embedded Design in an FPGA
Embedded design in an FPGA consists of the following:
FPGA hardware design
C drivers for hardware
Software design
Software routines
Interrupt service routines (optional)
Real Time Operating System (RTOS) (optional)
Basic Requirements for RTOS
Requirements
Multi-threading and preemptibility
Thread priority
Thread synchronization mechanisms
Priority inheritance
Predefined latencies
Example of RTOSes for FPGA
RTOSes available in market are VxWorks by Wind River Systems,
ThreadX by Express Logic, Nucleus Plus by Mentor Graphics,
XILKERNEL by Xilinx and many more
XILKERNEL
Small, robust and modular kernel
RTOS
Interface with POSIX API
Works with both MicroBlaze &
PowerPc
Highly integrated with EDK
lightweight (16Kb-32 Kb)
Task 1
Task 2
Task 3
time = 0 1 2 3
43
Global Schedule
Example: 2 processors; 3 tasks, each with 2 units of work
required every 3 time units
CPU 1
CPU 2
time = 0 1 2 3
44
The Big Goal
Design an optimal scheduling algorithm for periodic task sets on
multiprocessors
45
Necessary and Sufficient Conditions
Any set of tasks needing at most
1) 1 processor for each task ( for all i, ui ≤ 1 ) , and
is feasible
Status: Solved
pfair (1996) was the first optimal algorithm
46
New real time task scheduling
methodologies for Reconfigurable Platforms
Why Involving Reconfigurable Platforms
Task 2
Task 3
Task 4
50
Deadline Partitioning
CPU 1
CPU 2
51
DPSFR and DPSPR