Download Jordan University of Science and Technology

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

RSTS/E wikipedia , lookup

Unix security wikipedia , lookup

DNIX wikipedia , lookup

Process management (computing) wikipedia , lookup

Spring (operating system) wikipedia , lookup

Security-focused operating system wikipedia , lookup

Burroughs MCP wikipedia , lookup

CP/M wikipedia , lookup

Distributed operating system wikipedia , lookup

Transcript
Real Time
Embedded Systems
Done by: Lara Quadan & Lina Sawalha
Supervised by: Dr. Lo’ai Tawalbeh
CPE-746-JUST-Fall 2006
Quadan & Sawalha
Computer Engineering Department
Jordan University of Science and Technology
Introduction



Computer is entering all facets of life from home
electronics to production of different products and
material.
Many of the computers are embedded and thus
“hidden” for the user.
So it is necessary to know about the control and
characteristics of embedded real-time systems to
implement reliable ones.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Real-time Systems



A real-time system is one in which the correctness of the
computations not only depends on their logical correctness, but
also on the time at which the result is produced. In other words,
a late answer is a wrong answer.
A real-time system consists of tasks under deadline constrains.
Real-time systems maybe distributed systems, consisting of
components that are physically distributed. These systems
consists of multiple processing units and communication links.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Functional Requirements



Data Collection
 Sensors
 Signals
 Alarm
Direct Digital Control
 Actuators
Man-machine interaction
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Temporal Requirements





Tasks may have deadline
Minimal latency jitter
Minimal error detection latency
Timing requirements due to tight software control
loops.
Human interface timing requirements
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Application Areas






Customer electronics:
 Cameras
 Camcorders
Customer products:
 Dish washers
 Microwave ovens
Cars:
 Anti-lock braking
 Engine control
 Drive-by-wire
Planes:
 Stability
 Jet engine
 Fly-by-wire
Military:
 Weapons
 Satellites
Industrial process controllers
CPE-746-JUST-Fall 2006- Quadan & Sawalha



Computer/Communication products:
 Peripherals
 Fax machines
Protection & security systems :
 Intruder Alarm
 Smoke/Gas detection
Robotics
Control Theory


A control system is an interconnection of components forming a system configuration
that will provide a desired system response.
Types of control :
– Open-loop control: a system that utilizes a device to control the process without
feedback. Thus the output has no effect upon the signal to the process.
– Closed-loop control: A system that uses a measurement of the system output
through sensors and compares it with the desired output (called feedback system).
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Embedded digital controlled
systems

When a digital controller (microprocessor/Microcontroller) is used in the embedded
system to control the plant or process an analog/digital converter (A/D) is required as
well as digital/analog converter (D/A) to interface the input/output controller digital
signals with the analog signals from the other component in the system.

it is very important to consider the timing for the real-time digital controlled system.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Cruise Control




Regulate the speed of a car by adjusting the
throttle:
Input by the driver  sets a speed and car
maintains it.
Measures the speed through device connected
to the driver shaft.
Hard real-time: driver shaft revolution event.
Soft real-time: driver inputs, throttle adjustments.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Cont.



Disturbances: road surface and grade, wind and obstacles.
Input by the driver  sets a speed and car maintains it.
If the driver give a brake command to the car the cruise control system will
be interrupted and the car speed will slow down or be stopped.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Other car embedded systems
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Autopilot
Objective function: to control the direction
and speed of the plane.
 Outputs: actual direction and speed of the plane
 Control inputs: path markings and speed.
 Disturbances: wind, obstacles.
 subsystems: power system,
engines, steering system,
braking system, . . .

CPE-746-JUST-Fall 2006- Quadan & Sawalha
Cont.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Robot Vacuum cleaner
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Cont.

Operating environment:
closed indoor environments
such as rooms.

Controlling System
– Human : turn on and off the robot
– Computer: Sensors: stairs and wall detection (IR
sensors).
Controls: robot location through controlling the robot
speed and steering to follow the walls.
Actuators: motors and wheels.


CPE-746-JUST-Fall 2006- Quadan & Sawalha
Hard Disk Drive Control





The disk rotates at a speed
between 1800 and 7200 rpm.
The head flies above the disk at
a distance of less than 100 nm.
Position accuracy is 1 micro
meter.
Move the head from track a to
track b within 50 ms.
Motor to actuate the arm to the
desired location on the disk.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Cont.
For DVD
system
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Wireless Sensor Network
Embedded System
Sensor nodes scattered in a sensor field
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Cont.




Collection of sensor nodes in a
field.
Each node collects data and send it
to a sink.
The sink aggregates the data and
send it to a main processing unit.
Each sensor node can manipulate
data using its own embedded
microcontroller (microprocessor),
transceiver and communication
model.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Keck Astronomical
Telescope






World largest telescope
The main objective is to collect and focus starlight
using a large concave mirror.
The shape of the mirror determines the quality of the
observed image.
The diameter of the mirror is 10 m.
The mirror is a mosaic of 36 hexagonal small mirrors.
The 36 segments must be aligned so that the resulting
mirror has the desired shape
CPE-746-JUST-Fall 2006- Quadan & Sawalha



Behind each segment are three actuators applying
forces at three points on the segment affecting its
orientation.
In the gap between every two adjacent segments a
capacitor type sensors measuring the local displacement
between segments.
These displacements should be controlled to give the
desired shape and direction for the mirror.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Auto-washing machines
 The user will select the required washing program.
 A set of sensor will monitor the washing process variables such as water level,
temperature, and the rotation speed. Where the embedded controller will keep these
values agree with the selected washing program. through out the washing time.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Classifications of RT systems
 Hard
vs. Soft systems
 Fail-safe vs. Fail operational
 Guaranteed-response vs. Best-effort
 Resource-adequate vs. Resource-inadequate
 Event-triggered vs. Time-triggered
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Hard vs. Soft Real Time Systems

Hard RTS
 A RTS where the tasks have to be
performed not only correctly but also
on time. i.e. a catastrophic system failure can
occur if the system is not responding on time.
 E.g., the aircraft turbulence (instability in the atmosphere)
controller should respond on time, if not there will be a definite
disaster.
 Other examples
 control systems for space probes and nuclear reactors.
 refresh rates for video, or DRAM.
 collision alert.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Cont.

Soft RTS
 A RTS where the tasks have to be
performed as fast as possible, but the tasks
need not be finished within deadlines.
 I.e.
It may go beyond specified deadlines without catastrophic
failures (For example, if the video game is not responding on
time, it’s only a delay where the user may not want to wait,
but even then nothing awful is going to happen).
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Cont.

Another e.g.: Laser printer: rated by pages-per-minute, but can take
differing times to print a page (depending on the "complexity" of
the page) without harming the machine or the customer.

Task execution may also be timed-out: display updates, connection
establishment.

Other examples of Soft real time systems:
 videoconferencing
 stock price quotation systems
 airline reservation systems
 automatic teller
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Characteristics of RTS





Response time: - hard real-time applications, milliseconds or less,
preclude direct human intervention during normal operation and in
critical situations. - Soft real-time and on-line systems are often in the
order of seconds.
Peak-load performance: - hard real-time system: the peak-load scenario
must be well-defined, guaranteed to meet the specified deadlines in all
situations.- soft-real time system, the average performance is important,
and a degraded operation in a rarely occurring peak load case is tolerated
Control of Pace: A hard real-time system must remain synchronous with
all the state of the environment in all cases. This is in contrast to an online system, which can exercise some control over the environment in case
it cannot process the offered load.
Safety: Hard real-time systems are often safety critical.
Size of Data files: Hard real-time systems have small data files and realtime databases. Temporal accuracy is often the concern here. Soft real
time systems has larger databases so long-term integrity of large data files is
the key issues.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Characteristics of RTS

Redundancy Type: If an error occurs in a soft real-time
system, the computation is rolled back to a previously established
checkpoint to initiate a recovery action. In hard real-time
systems, recovery is of limited use.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Common Misconceptions
Misconceptions about Real-Time Systems
[Stankovic'88]
 faster hardware implies all deadlines will be met
 real-time computing is merely fast computing
 RT systems are low-level coding done using ad-hoc methods.
 Fast is relative. More important that system is “fast enough",
deterministic and predictable.
 Worst-case response times of interest rather than average-case.
 Scheduling theory, software design, formal methods and RTOS
are changing things.
 It is important to note that hard versus soft real-time does not
necessarily relate to the length of time available.

CPE-746-JUST-Fall 2006- Quadan & Sawalha
Real Time terminologies





Synchronous: events occur at predictable times in the flow-of-control.
Asynchronous: interrupts
Multitasking: The process of scheduling and switching the CPU between
several tasks, a single CPU switches its attention between several sequential
tasks. Multiple is like foreground/background with multiple backgrounds.
Multitasking maximizes the utilization of the CPU and also provides for
modular constructions of applications.
Task: A task is called a Thread, is a simple program which thinks it has the
CPU all to itself. Each task typically is an infinite loop that can be in any one
of the three states: RUNNING, READY (-TO-RUN), BLOCKED.
Resource: A resource is any entity used by a task. A resource can thus be an
I/O device, such as a printer, a keyboard, or a display, or a variable, a
structure, or an array.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Real Time terminologies



Shared Resource: A shared resource is a resource that can be used by more
than one task. Each task should gain exclusive access to the shared resource
to prevent data corruption. This is called Mutual Exclusion. For e.g., a global
variable can be used by many tasks, or printer which could be shared by "n"
users.
Critical Section of Code: Also called Critical Region, is code that needs to
be treated indivisibly; once the section of code starts executing, it must not be
interrupted. To ensure this, interrupts are typically disabled before the critical
code is executed and enable when the critical code is finished.
Reentrancy: A reentrant function can be used by more than one task without
fear of data corruption. a reentrant function can be interrupted at any time
and resumed at a later time without loss of data. Reentrant functions either
use local variables (i.e. CPU registers or variables on the stack) or protect data
when global variables are used.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Operating System

Real-time operating systems must provide support for:
 Guaranteeing real-time constraints.
 Supporting fault tolerance and distribution.
 Time constraint resource allocations and
scheduling.
 Time constraint end-to-end communications.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Real Time Operating System
(RTOS)


Fundamental requirements for an RTOS
 The OS behavior must be predictable
 The OS must be multithreaded and preemptive.
 The OS must support thread priority.
 The OS must support predictable thread synchronization mechanisms.
Additional Requirements:
 The maximum time that device drivers use to process an interrupt, and
specific IRQ information relating to those device drivers, must be known.
 The interrupt latency (the time from interrupt to task run) must be
predictable and compatible with application requirements
CPE-746-JUST-Fall 2006- Quadan & Sawalha

Kernel
 Is the core program of the Operating System, and determines its behavior
 Is responsible for System Resources and for “context switch”.
 Also responsible for task scheduling.
 In RTOS since the size of the kernel is small, its also referred to as Micro
Kernel.
Kernel types
 Microkernel - scheduler
 Kernel - a microkernel with intertask synchronization
 Executive - a kernel that includes privatized memory blocks, I/O services,
and other complex issues. Most commercial realtime
kernels are in this category.
 Operating system - an executive that also provides generalized user interface,
security, file management system, etc.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
RTOS


Three groups
 Small, fast, proprietary kernels
 Real-time extensions to commercial operating systems
 Research operating systems
Small, fast, proprietary kernels
 homegrown
 commercial offerings:
 QNX, PDOS, pSOS, VCOS, VRTX32, VxWorks
 To reduce the run-time overheads incurred by the kernel and to make the
system fast, the kernel
 has a small size
 responds to external interrupts quickly
 minimizes intervals during which interrupts are disabled
 provides fixed or variable sized partitions for memory
 management as well as the ability to lock code and data in memory
 provides special sequential files that can accumulate data at a fast rate
CPE-746-JUST-Fall 2006- Quadan & Sawalha
RTOS



To deal with timing constraints, the kernel
 provides bounded execution time for most primitives
 maintains a real-time clock
 provides primitives to delay processing by a fixed amount of time and
to suspend/resume execution
Also, the kernel
 performs multitasking and intertask communication and
synchronization via standard primitives such as mailboxes, events,
signals, and semaphores.
For complex embedded systems, these kernels are inadequate as they are
designed to be fast rather than to be predictable in every aspect.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Examples of RTOS

Open source:
 eCos
 Fiasco (L4 clone) [1]
 FreeRTOS
 Linux as of kernel version
2.6.18
 Phoenix-RTOS
 Nut/OS [2]
 Prex
 RTAI
 RTEMS
 RTLinux
 SHaRK [3]
 TRON Project
 Xenomai [4]
CPE-746-JUST-Fall 2006- Quadan & Sawalha

Proprietary:


















Ardence RTX
ChorusOS
DSOS
ITRON
LynxOS
MQX RTOS [5]
OS-9
OSEK/VDX
PDOS
PikeOS
pSOS
RMX
RT-11
RTXC
SINTRAN III
ThreadX
VxWorks
µnOS
- BeOS
- DNIX
- embOS (Segger)
- MicroC/OS-II
- Nucleus
- OSE
- OSEKtime
- Phar Lap ETS
- Portos
- QNX
- RSX-11
- RTOS-UH
- Salvo RTOS [6]
- Symbian OS
- VRTX
- Windows CE
- UNIX-RTR
RTLinux




Real-Time Linux (now part of FSMLabs Inc.)
that is suitable for Real-Time applications.
Its view is that the application system can be split into two parts
 Real-time
 Non real-time
With this approach, it splits the applications to run on either the
Linux kernel, or a real-time kernel!
CPE-746-JUST-Fall 2006- Quadan & Sawalha
RTLinux


Between the real and non-real parts communication is
performed through FIFOs called RT-FIFOs.
These FIFOs are:
 Locked to memory in kernel space.
 FIFOs appear as devices to Linux user processes.
 Reads and writes are non-blocking and atomic.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
RTLinux




RTLinux eliminates the problem of the kernel blocking
interrupts by replacing HW interrupts by SW emulated
interrupts.
Thus, the RT kernel intersects all interrupts!
If an interrupt is to let a RT task execute, then the RT
kernel pre-empts any general application and runs the
RT task.
Flags are used to emulate interrupt disabling.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
VxWorks



Monolithic Kernel
 Reduced run-time overhead, but increased kernel
size compared to Microkernel designs
Supports Real-Time POSIX standards
Common in industry
 Mars missions
 Honda ASIMO robot
 Switches
 MRI scanners
 Car engine control systems
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Software vs. Hardware


Hardware
 Fast
 Power-efficient
 Used for performance and security
Software
 Flexible
 Reusable
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Examples on Software Subsystems

The software components of an embedded system can be diverse.
 Software running on a microprocessor core.
 Written in a “High level language”
 Cooperative multi-tasking software running on one or more DSP
processors

Largely written in Assembly code due to a lack of high quality
compilers




An RTOS kernel running on the microprocessor core and/or DSP core
Control Processes running on a microcontroller
User interface modules running on the microprocessor
Devise drivers for interface protocols e.g. TCP/IP, ATM
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Software Languages





Specifying machine code concisely
Sequential semantics:
 Perform this operation
 Change system state
Raising abstraction: symbols, expressions, control-flow,
functions, objects, templates, garbage collection.
C/C++/Java
Real Time Operating Systems: Adds concurrency, timing control
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Hardware Subsystems









Microprocessor cores
DSP cores
Field Programmable Gate Arrays (FPGAs)
Application specific integrated circuits
(ASICs)
 standard cell/synthesized deigns
 custom ICS
Memory
 RAM, ROM, PROM, ...
 Conten addressable memory (CAM)
 Specialized DRAMs, multi-bank memories,
System Bus structures & interfaces
I/O interfaces
Others
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Hardware languages





Specifying connected gates concisely
Originally targeted at simulation
Discrete event semantics skip idle portions
Mixture of structural and procedural modeling
Hardware Languages:
 Verilog
 Structural and procedural modeling
 Four-valued vectors
 Gate and transistor primitives
 Less flexible, succinct
 VHDL
 Structural and procedural modeling
 Few built-in types; Powerful type system
 Fewer built-in features for hardware modeling
 More flexible, verbose
 SystemC 1.0, Cynlib: “VHDL/Verilog in C++”
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Hardware/Software Codesign





Most systems and mixed between hardware and software.
Traditional Design
 SW and HW partitioning is decided at an early stage, and designs proceed
separately from then onward.
CAD today addresses synthesis problems at a purely hardware level:
 efficient techniques for data-path and control synthesis down to silicon.
ECS use diverse (commodity) components
 uP, DSP cores, network and bus interfaces, etc.
"New fangled" Codesign
 A flexible design strategy, wherein the HW/SW designs proceed in
parallel, with feedback and interaction occurring between the two as the
design progresses.
 Final HW/SW partition/allocation is made after evaluating trade-offs and
performance of options.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Examples of mixed hardwaresoftware embedded systems

Embedded controllers for reactive real-time applications are
implemented as mixed software-hardware systems. These
controllers utilize Micro-processors, Micro-controllers and
Digital Signal Processors but are neither used nor perceived as
computers. Generally, software is used for features and flexibility,
while hardware is used for performance. Some examples of
applications of embedded controllers are:
 Consumer Electronics: microwave ovens, cameras, compact
disk players.
 Telecommunications: telephone switches, cellular phones.
 Automotive: engine controllers, anti-lock brake controllers.
 Plant Control: robots, plant monitors.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
Embedded System Design





Modelling
 the system to be designed, and experimenting with algorithms involved;
Refining (or “partitioning”)
 the function to be implemented into smaller, interacting pieces;
HW-SW partitioning: Allocating
 elements in the refined model to either (1) HW units, or (2) SW running
on custom hardware or a general microprocessor.
Scheduling
 the times at which the functions are executed.
This is important when several modules in the partition share a single
hardware unit.
Mapping (Implementing)
 a functional description into (1) software that runs on a processor or (2) a
collection of custom, semi-custom, or commodity HW.
CPE-746-JUST-Fall 2006- Quadan & Sawalha
References









Kopetz, H. , Real-Time Systems: Design Principles for Distributed Embedded
Applications.
Calton Pu, 1B: RTE Concepts and Examples
A Framework for Hardware-Software Co-Design of Embedded Systems,
University of California, Berkeley.
http://www.ics.uci.edu/~rgupta/ics212/w2002/models.pdf
http://www.ics.uci.edu/~rgupta/ics212/w2002/intro.pdf
http://www.cs.unb.ca/courses/cs4405/lectures/real-time.pdf
http://www.ece.cmu.edu/~koopman/des_s99/real_time/#introduction
http://en.wikipedia.org/wiki/
http://www.ics.uci.edu/~rgupta/iec/introduction/
CPE-746-JUST-Fall 2006- Quadan & Sawalha