EE514 - Real-Time Computing
EE514 - Real-Time Computing
Basic Concepts of
Real-Time Systems
Department of Electrical Engineering
The Hong Kong Polytechnic University
EE514 Real-Time Computing
Real-Time Application
Hard Real-Time
While many hard real-time applications require highspeed responses, the granularity of the timing is not the
central issue in a hard real-time application.
An example of a hard real-time application is a missile guidance
control system where a late response to a needed correction
leads to disaster.
Soft Real-Time
10
It is an extended machine
Hides the messy details which must be performed
Presents user with a virtual machine, easier to use
11
12
Real-time
Systems
13
User Programs
User Program
Operating
Including Operating
Hardware
Hardware
System
Typical OS Configuration
System Components
14
What is a Kernel?
User Programs
Hardware
Kernel
Other layers
EE514 Real-Time Computing
15
Kernel Hierarchy
Kernel can be further broken down into smaller modules
including executive, kernel micro-kernel, nano-kernel.
Users
Complexity
EE514 Real-Time Computing
Operating
System
Memory management
File and disk support
Executive
Inter-processor communication
and synchronization
Kernel
Tasking scheduling
Micro-kernel
Nano-kernel
Hardware
Basic Concepts on Real-Time Systems
16
Real-Time Kernel
17
One process,
one thread (MS-DOS)
Multiple processes,
one thread per process (Unix)
EE514 Real-Time Computing
One process,
multiple threads (Java Runtime)
Multiple processes,
multiple threads (W2K, Solaris, Linux)
Basic Concepts on Real-Time Systems
18
19
20
21
Event types:
Synchronous events are those events that occur at predictable
times.
22
Pros:
Allow for fast response to single devices but cant do much else
Work well when
a single processor is dedicated to handling the I/O for some fast device
overlapping of events is not allowed or is kept to a minimum
simple to write and debug
response time is easy to determine
Cons:
often fail because of bursting of events
not sufficient to handle complicated system
inherently waste CPU time
23
/* do forever
/* check flag
/* process data */
/* reset flag
*/
}
EE514 Real-Time Computing
*/
*/
24
25
/* do forever
/* check flag
*/
*/
26
Cyclic Executives
27
Example
for (;;) {
check_user_input();
do_flight_simulation();
check_user_input();
do_screen_update();
}
28
State-Driven Code
29
30
31
Context Switching
32
Stack Model
33
save()
- saving of registers to a stack
restore()
- restores those registers from
the stack
34
Round-Robin Systems
35
36
Systems that use preemptive schemes instead of roundrobin or first-come-first-serve scheduling are called
preemptive priority systems.
37
Preemptive Scheduling
38
39
Rate-Monotonic Systems
priority
The task that collects gyro data, and compensates these data
and the accelerometer data every 40ms has the 2nd highest
priority.
The task that updates the pilots display every second has lowest
priority.
40
41
Hybrid Systems
42
Foreground/Background Systems
43
44
However, the task control block (TCB) model, rather than the
simple stack model, is most often used because the number of
real-time tasks is indeterminate and dynamic.
45
46
Factors to be considered
Language support
Development environment
Licensing arrangements & price
EE514 Real-Time Computing
47
48