You are on page 1of 60

Introduction to Real time Systems &

Embedded Systems
Real-time Systems :
Definitions
What is Real time system?
 Real-time systems are defined as those systems in which the
correctness of the system depends not only on the logical result
of computation, but also on the time at which the results are
produced.
 Real-time system is the one in which logical correctness is based

on both the correctness of the output as well as their timeliness.


 A real-time system must deliver services in a timely manner

– Not necessarily fast, but must meet some timing deadline


 A soft real-time system is one in which performance is degraded

by failure to meet response-time constraints.


 A hard real-time system is one in which failure to meet a single

deadline may lead to complete failure.


What is Real time system?
 Hard real-time systems – systems where it is absolutely
imperative that responses occur within the required deadline
(e.g., Missile delivery system, Flight control systems , Command
& Control Systems).

 Firm real-time systems (e.g., Banking, Online transaction


processing, Robot vacuum cleaner).

 Soft real-time systems allows for some deadlines to be missed


with only a slight degradation in performance but not a complete
failure (e.g., Automatic teller , Video streaming).
What is Real time system?
 A system is a mapping of a set of input into a set of outputs.
 A digital camera is an example of a real time system: set of input
including sensors and imaging devices producing control signals
and display information.
 Real time system can be viewed as a sequence of job to be
scheduled.
 Time between presentation of a set of inputs to a system and the
realization of the required behavior, including availability of all
associated outputs, is called the response time of the system.
 Real-time system
 needs timely computation
 deadlines, periodicity
 temporal dependency
What is Real time system?
 Hard deadline: penalty due to missing deadline is a higher order
of magnitude than the reward in meeting the deadline
 Firm deadline: penalty and reward are in the same order of
magnitude
 Soft deadline: penalty often lesser magnitude than reward
A typical real-time system
A typical real-time system
Example – Car driver
 Mission: Reaching the destination safely.

 Controlled System: Car.

 Operating environment: Road conditions.

 Controlling System
- Human driver: Sensors - Eyes and Ears of the driver.
- Computer: Sensors - Cameras, Infrared receiver, Laser
telemeter, Navigation system, Street maps.

 Controls: Accelerator, Steering wheel, Break-pedal.

 Actuators: Wheels, Engines, and Brakes.


Example – Car driver
 Critical tasks: Steering and breaking.

 Non-critical tasks: Turning on radio.

 Performance is not an absolute one. It measures the goodness of


the outcome relative to the best outcome possible under a given
circumstance.

 Cost of fulfilling the mission → Efficient solution.

 Reliability of the driver → Fault-tolerance is a must.


Real-Time Tasks (Workload)
 Periodic tasks
- Time-driven. Characteristics are known a priori
- Task Ti is characterized by (ci, pi)
E.g.: Task monitoring temperature of a patient in an ICU.
 Aperiodic tasks
- Event-driven. Characteristics are not known a priori
- Task Ti is characterized by (ai, ri, ci, di)
E.g.: Task activated upon detecting change in patient’s condition.

 Sporadic Tasks
 Known minimum inter-arrival time among successive instances of a

(periodic) task, rather strictly being periodic.

pi : task period ai : arrival time ri : ready time


di : deadline ci : worst case execution time.
Task constraints
 Deadline constraint

 Resource constraints
 Shared access (read-read)
 Exclusive access (write-x)

 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
Requirements for RTES
 Environmental – size, power (heat), weight, and radiation-
hardened
 Performance –responsive, predictable (fast?)
 Economics – low cost and time-to-market
 Consequence – safety, faulty-tolerance, security
 Smaller, cheaper, better, and faster
 Standards –http://www.opengroup.org/rtforum/oct2001/
minutes.html
 FDA 247 (medical devices)

 ANS 7.4.3.2 (nuclear power plants)

 Mil-Std 882d (weapon systems)


SW Development for RTES
 Never-ending in a single control loop
 Single execution thread and one address space
 Event- and/or time-driven state transitions
 Small memory footprint
 Multi-tasking for concurrent events
 Machine dependency and portability
 Software abstraction, modular design
 information hiding, OO, separate compilation, reusable

 a sorting procedure – function, input, output specification

 Control timing
 Resource constraints and sharing
 CPU time, stack, memory, and bandwidth

 Scheduling
 Tasks, messages, and I/O
Timing Constraints and Characteristics
 Predicting and controlling timing and events
 Timing relationship: (can you guarantee it?)
 predictable actions in response to external stimuli

 deadline (absolute or relative)

 Instruments play in a band


 miss a note or timing

 Difficult to control timing


 all players of an interactive game in Internet see the actions at

the same time


 Sequence, order, and race condition
Real-time Operating System (RTOS)
Functions:
Task management such as

 scheduling, dispatcher
 communication (pipe, queue)
 synchronization (semaphore, event)
memory management
 time management

device driver

 interrupt service
Sample Applications
 Sample Applications

Agile Manufacturing

Traffic control system


Real-Time Systems - Issues
 Resource Management (RM) Issues
 Scheduling, Fault-tolerance, Resource reclaiming,
Communication

 Architectural Issues
 Computing subsystem, Communication subsystem, I/O
subsystem

 Software Issues
 Requirements, specification, and verification, Real-time
languages, Real-time databases
Real-time Scheduling Paradigms – RM Issue

 Allocate time slots for tasks onto processor(s).


 [i.e., Where and When a given task executes]
 Objective: predictably meeting task deadlines.
 (schedulability check, schedule construction)
Preemptive vs Non-preemptive scheduling
 Preemptive Scheduling
 Task execution is preempted and resumed later

 Preemption occurs to execute higher priority task.

 Offers higher schedulability

 Involves higher scheduling overhead due to context switching

 Non-preemptive Scheduling
 Once a task starts executing, it completes its full execution

 Offers lower schedulability

 Less overhead due to less context switching


Optimal scheduling -- definition

 A static scheduling algorithm is said to be optimal if, for


any set of tasks, it always produces a feasible schedule (i.e.,
a schedule that satisfies the constraints of the tasks)
whenever any other algorithm can do so.

 A dynamic scheduling algorithm is said to be optimal if it


always produces a feasible schedule whenever a static
algorithm with complete prior knowledge of all the possible
tasks can do so.

 Static scheduling is used for scheduling periodic tasks,


whereas dynamic scheduling is used to schedule both
periodic and aperiodic tasks.
Architectural Issues
 Predictability in: Instruction execution time, Memory access,
Context switching, Interrupt handling.

 RT systems usually avoid caches and superscalar features.

 Support for error handling (self-checking circuitry, voters,


system monitors).

 Support for fast and reliable communication (routing, priority


handling, buffer and timer management).
Architectural Issues (contd..)

 Support for scheduling algorithms (fast preemptability, priority


queues).

 Support for RTOS (multiple contexts, memory management,


garbage collection, interrupt handling, clock synchronization).

 Support for RT language features (language constructs for


estimating worst-case execution time of tasks).
Requirement, Specification, Verification

 Functional requirements: Operation of the system and their


effects.

 Non-Functional requirements: e.g., timing constraints.

 F & NF requirements must be precisely defined and together


used to construct the specification of the system.
Requirement, Specification, Verification (contd..)
 A specification is a mathematical statement of the properties to
be exhibited by a system. It is abstracted such that
 it can be checked for conformity against the requirement.

 its properties can be examined independently of the way in

which it will be implemented.

 The usual approaches for specifying computing system behavior


entail enumerating events or actions that the system participates
in and describing orders in which they can occur. It is not well
understood how to extend such approaches for real-time systems.
Real-time Languages
 Support for the management of time
 Language constructs for expressing timing constraint, keeping

track of resource utilization.

 Schedulability analysis
 Aid compile-time schedulability check.

 Reusable real-time software modules


 Object-oriented methodology.

 Support for distributed programming and fault-tolerance


Real-time Databases
Conventional database systems
 Disk-based.
 Use transaction logging and two-phase locking protocols to ensure transaction
atomicity and serializability.
 These characteristics preserve data integrity, but they also result in relatively
slow and unpredictable response times.

Real-time database system, issues include:


 transaction scheduling to meet deadlines.
 explicit semantics for specifying timing and other constraints.
 checking the database system’s ability of meeting transaction deadlines
during application initialization.
Summary
 Real-time systems require logical correctness and timeliness.

 Real-time system consists of a controlling system, controlled system, and the


environment.

 Real-time systems are classified as: hard, firm, and soft RT systems.

 Workload (tasks) are periodic, aperiodic, sparodic.

 The notion of predictability is very important in real-time systems.

 Important issues include:


 scheduling, resource reclaiming, fault-tolerance, communication,

architectural issues, system specification and verification, programming


languages, and databases.
Industrial Internet & Internet of Things
 Industrial Internet & Internet of Things
Common Misconceptions
 Real-time computing is equivalent to fast computing.

 Real-time programming is assembly coding, priority interrupt


programming, and writing device drivers.

 Real-time systems operate in a static environment.

 The problems in real-time system design have all been solved in


other areas of computer science.
Summery
Characteristics Hard RTS Soft RTS
Response Time Hard - Required Soft required
Peak load performance Predictable Degrade
Control of pace Environmental Computer
Safety Often critical Non critical
Size of data file Small/medium Large
Redundancy type Active Check point Recovery
Data integrity Short term Long term
Embedded Systems:
Definitions
What is an embedded system?
1. Special Purpose Computer System
2. Embedded or ‘hidden’ in another system
3. Has several restrictions in design / development / operation
4. Embedded systems are Reactive
5. Often, it may have real-time restrictions (requirements for
responding before a deadline expires)
What is an Embedded System?
 First, it is a computer system: anything that uses a
microprocessor, but is not a general-purpose computer:
 Consumer electronics:

 cellular phones, set­top boxes, televisions, remote controls, game


consoles, Internet appliances, Alarm Systems, wi-fi systems, home
cinemas,…
4

 Home appliances (“White Appliances”) like refrigerators, washing


machines (…which now-days include microprocessors and may also
have internet connection…)
 Telecommunications systems equipment
 Defense and weapon systems
 Automotive systems
 Systems for Process control
 Robots, Cars, Planes, Nuclear plants,…, include several
microprocessors / embedded systems
What is an Embedded System?
 Second, it is embedded, or ‘hidden’ inside another system:
 the user interacts with a special-purpose system, and not with

the computer inside the system


 the end-user typically does not or cannot modify or upgrade

the internal system himself


What is an embedded system?
 Third, it has many sets of constraints / limitations, from the following:
 Cost

 Processor speed (for cost, size reasons)

 Memory (probably no hard disk, sometimes only few Kbytes only)

 Display and user interface (…also it may target users that are computer

illiterate)
 Network bandwidth (if network connection at all)

 Low Power Consumption (limited battery, lack of cooling system)

 Small Size, Low Weight (handheld devices, transportation cost issues)

 Reliability

 Safety-critical (must function correctly, must not function incorrectly)

 Security

 Operation in Harsh environmental conditions (Heat, vibration, shock,

power fluctuations, RF interference, lightning,…)


What is an embedded system?
 Fourth: Embedded Systems are Reactive:
 computations occur in response to external events, that may

be:
 Periodic events (e.g., rotating machinery and control loops, timers,…)
 Aperiodic events (e.g., button closures, user interactions)
 Fifth: it may have real-time requirements (responding before a
deadline expires)
 Real-Time: timing correctness is part of system

correctness
 Hard real-time
 Absolute deadline, beyond which answer is useless
 Deadline may include minimum time as well as maximum time
 Soft real-time
 Occasionally missing a deadline is not catastrophic
 Utility of answer degrades with time difference from deadline
 In general, Real Time does not mean Real Fast
A Typical Embedded System
An Embedded Designer's View…
CPU: Performance, Compilers, Operating Systems, Cost.
Memory Size, I/O connections, peripherals, Cost.

Functionality, Time­to­market, Cost & Cost. And a customer’s


view…:
Memory Reduced Cost
Increased Functionality

Cache Improved Performance

Microcontroller Increased Dependability

Sensors A/D CPU D/A Actuator

Diagnostic Auxiliary Systems


I/O (power, cooling)
tools
Electro-mechanical
backup and safety

External
Environment
Embedded System Examples – Diverse Restrictions
 Pocket remote control RF transmitter
 100 KIPS, water/crush­proof, fits in pocket, 5­year battery life

 Software hand­crafted for small size (less than 1 KB)

 Industrial equipment controller (e.g., elevator)


 1­10 MIPS for 1 to 10 CPUs, 1 ­8 MB memory

 Safety ­critical software; real­time control loops

 Digital TV Set Top Box


 50-350 MIPs, 2-16MB FLASH, 4-32 MB SDRAM

 Software may be handcrafted at low layers, but at upper layers it supports

hardware agnostic applications downloadable over the network!


 Military signal processing (e.g., Radar/Sonar)
 1 GFLOPS, 1 GB/sec I/O, 32 MB memory

 Software hand­crafted for extremely high performance


Trends in Embedded Systems
 Increasing code size
 migration from hand (assembly) coding to high-level

languages
 Reuse of hardware and software components
 processors (micro-controllers, DSPs)

 software components (drivers)

 Increasing integration and system complexity


 integration of RF, DSP, network interfaces,…

 32-bit processors, I/O processors


Microprocessor
 There exists at least one microprocessor in (the heart of) an
embedded system
 Microprocessor: CPU, memory, cache
 Microcontroller:
 Microprocessor, plus:

 Controllers for I/Os, peripherals, A/D-D/As, DMAs,

special devices tailored for specific application, etc.


 Extra Memory / Caches

 Microprocessors are general purpose - target a broad application


area
 Microcontrollers are specialized, tailored for specific
applications (e.g. for DVDs the microcontroller includes MPEG-
2 hardware).
Embedded Systems:
Professional Opportunities
Why embedded systems are important?
 Embedded Systems dominate the worldwide computer system
market
 Yearly:
 The worldwide market of general purpose computers is of the

order of billion US $
 The worldwide market of embedded systems is also of the

order of billion US $
 ~100 million desktop PCs are produced

 ~6 billion microprocessors for embedded systems are

produced (one for each person on earth)


 While Desktop PC market is saturating, embedded market is
growing
 Embedded systems account for 90-95% of all microprocessors
produced worldwide!
Embedded System Categories
 Stand alone embedded system
 Real time system
 Hard
 Soft
 Networked information appliance
 Mobile devices
Embedded System Categories
 General Computing
 Applications similar to desktop computing, but in an embedded package

(lower cost, targeting also computer illiterates,…)


 Set­top boxes, game consoles, internet appliances, automatic tellers,

wearable computers),…
 Control Systems
 Closed­loop feedback control of real­time systems

 Vehicle engines, chemical process, industrial process, nuclear power,

flight control,…
 Signal Processing
 Computations involving large data streams (signals)

 Radar, Sonar, video compression, Digital TV / HDTV broadcast centers…

 Communication & Networking


 Switching and information transmission

 Telephone systems, Internet, satellite systems…


Examples
 Telecommunications
 Wireline Access Systems

(copper enhancement,
DSLAM)
 Wireless Access Systems

(microwave systems)
 Terminal Equipments

(ISDN modems, DSL


modems, IP phones,
payphones,…)

 Defense Systems
 Secure Communications

 Crypto-systems
Examples
 General Computing
 DiTV Set-top boxes, Home-
Gateways, Home Networking
 Interactive TV Applications /
Electronic Program Guides
(embedded software)
 Content Distribution Systems
 Fleet Management Systems
 Systems and terminal equipment
for lottery operations
 Information kiosks
 Smart Cards Applications
 Cash Registers
 Energy Meters
Several Types of Embedded System Functions
 Application­specific interfacing
 Buttons, bells, lights,...

 High ­speed I/O

 Signal processing
 Multimedia data compression

 Digital filtering

 Control Laws
 PID control

 Fuzzy logic

 Sequencing logic
 Finite state machines

 Switching modes between control laws

 Fault response
 Detection & reconfiguration

 Diagnosis

 ...
Embedded system characteristics
 Single functioned
 Tightly contained
 Low manufacturing Cost

 Low Power Consumption

 Small size and restricted memory

 High performance

 Real time operations( Operations are completed by dead line)


 Microprocessor/ microcontroller based
 Connected (peripherals)
 Software
 Features

 Flexibility

 Hardware
 Performance
 Security
Some application of embedded system
 Medical System – Patient monitoring system
 Office Equipment – printer, copies, fax
 Tools- Multi meter , GPS
 Banking- ATM, Statement printing
 Transportation – plans. Trains, boats
 Radar
 Traffic Lights
 Signalling system
 Automobiles – engine management, car alarms ABS, ESP
 Building System - Heater, air condition Lighting key card entries Elevators
 Agriculture – Feeding system, milking system
 Space- Satellite system
Embedded Systems:
Education
Embedded Systems Designer’s Knowledge
 Hardware and Software
 The ‘low level’: computer architecture, micro-processors / micro-controllers,
assembly language, A/D-D/A converters, integrated circuit (ASIC/FPGA)
design
 The ‘higher level’: programming languages C/C++, (Java ?), object-oriented
systems
 Operating systems:
 …mainly the “lower half” of the OS (which is connected to h/w):

interrupts, synchronization, process communication, scheduling,


concurrency
 …but also the “upper half” (which is connected to applications)

 Embedded systems often use simple operating system kernels or real-time

operating systems, with typically small footprints and support for real-
time scheduling
 Applications: networking, signal processing, control
Embedded Systems Designer’s Skills
 Global System View
 …the system is not just the microprocessor…

 …not just digital logic…

 HW/SW Boundaries
 …optimal and under constraints (cost, space, performance,…)

 Products
 …from specs to production…

 …performance vs. cost trade-offs…

 …cost, cost, cost…

 …analyzability, how can I be sure that the system functions correctly?…

 …not just design – full product life-cycle…

 Will / Ability for Teamwork


 Communication Skills
 …other field scientists / engineers…

 …marketing, production…

 …end-customer…
Embedded System Designer: Global View
Multi-Discipline
 Electronic Hardware
 Mechanical Hardware
 Software
 Control Algorithms
 Signal Processing
 Humans Multi­Objective
 Society/Institutions  Dependability
 Affordability
 Safety
 Security
 Scalability
 Timeliness Multi­Phase
 Requirements
 Design
 Manufacturing
 Deployment
 Logistics
 Retirement
Education
 Difficulties
 Embedded systems cover a wide spectrum of computer

science and various engineering sectors.


 Embedded Systems Education requires a wide background for

the students.
 Intensive lab training is required.

 Target
 Courses must focus in the System / global view (not just

relevant subjects e.g. operating systems, microprocessors,


etc.)
Embedded System Design approaches
 Embedded problems typically solved using one of the following
three approaches

 Use a combination of custom designed hardware and possibly


some software on an embedded processor that is integrated
with the hardware

 Use custom software designed to run on an off-the-shelf


embedded processor (our focus)

 Use an application specific processor (a processor that has


been optimized to run the specific class of applications
efficiently) with custom software
Pre-Requisite Knowledge/Skills
 Basic, working knowledge of computer architecture

 Knowledge of (and experience with) C programming


 Fundamentals of data structures and algorithms
 Just knowing Java is not enough
 Need to know, understand and manipulate “pointers”

 Some experience with assembly-language programming


 Knowledge of instruction sets of any modern microprocessors
(x86, ARM, PowerPC, 680x0, MIPS) should be a helpful
starting point
Sources and Literature
References
 ARM manuals
 Wayne Wolf, Computers as Components: Principles of
Embedded Computing System Design
 Steve Heath, Embedded Systems Design
 Bryant, O’Hallaron, Computer Systems – A Programmer’s
Perspective
 Ben Ari, Principles of Concurrent and Distributed
Programming
 Jane Liu, Real-Time Systems
 Rajeev Gandhi, Fundamentals of Embedded Systems (CMU
course)

You might also like