06 - Rtos Eos-Concise
06 - Rtos Eos-Concise
1
The Operating System
An Operating System is a program that:
› Provides an “abstraction” of the physical machine through a simple
interface;
› Each part of the interface is a “service”
An OS is also a resource manager;
› With the term “resource” we denote all physical entities of a computing
machine : the processor, memory, and I/O devices.
› The OS provides access to the physical resources;
› The OS provides abstract resources (for example, a file, a virtual page
in memory, a thread, an alarm).
2
Why do we Need an Operating System?
OS is an abstraction from hardware and software programming
› Shorter development time
› Less porting efforts
› Better reusability
OS as a resource manager
› Optimize the use of all computational resources
Keep resources busy
Minimize idle time
Avoid resource conflicts / deadlocks
› Satisfy the specific requirements for applications
Minimize response time
Choosing a OS is important
› High efforts when porting to a different OS
› The chosen OS may have a high impact on the amount of resources
needed
3
Characteristics of Embedded OS
Real-time operation
› correctness of computation depends, in part, on the time at which
result is delivered
Reactive operation
› needs to consider worst-case conditions in execution in order to
respond to external events that do not occur at predictable intervals
Configurability
› supports flexible configuration so that only the functionality needed for
a specific application and hardware suite is provided
› e.g., allows to select only the necessary OS modules to load
I/O device flexibility
› handles devices by using special tasks instead of integrating their
drives into the OS kernel
4
What is an Embedded OS?
Generally contain a smaller subset of functionality than a desktop OS
› Less services provided
› Less memory required
› Boots from ROM.
› No keyboard or mouse required.
› Special software developed to control embedded peripherals. (flash disks, touch
screens, tiny displays)
An embedded system may or may not be a real-time system.
What makes a good Embedded OS?
› Modular
› Scalable
› Configurable
› Small footprint
› CPU support
› Device drivers
› etc, etc, etc...
5
Characteristics of Embedded OS
Streamlined protection mechanisms
› requires limited protection because tested software can be assumed
to be reliable
› e.g., I/O instructions need not be privileged instructions that trap to OS
tasks can directly perform their own I/O
› no use of an OS service call avoid overhead for saving and
restoring the task context
Direct use of interrupts
› permits user process to use interrupts directly
› no need to go through OS interrupt service routines
› have efficient control over a variety of devices
6
Characteristics of Embedded OS
Using a general-purpose OS for an embedded system may
not be possible
› constraint of memory space
› constraint of power consumption
› real-time requirements
Special-purpose OS designed for the embedded system
environment is commonly used.
7
Developing an Embedded OS
Two general approaches
› Take an existing OS and adapt it for embedded purposes
› Design a purpose-built OS solely for embedded use
8
Adapting an Existing OS
Examples include Windows, Linux
› familiar interfaces facilitate portability
› slower and less predictable than special purpose embedded OS
› not optimized for real-time and embedded applications require
considerable modification to achieve adequate performance
optimizes for the average case rather than the worst case for scheduling
assigns resources on demand
ignores semantic information about an application
Need to add
› real-time capability
› streamlining operation
› other specialized and necessary functionality for the given device
9
Purpose-Built Embedded OS
Most OS are designed from the ground up for embedded
applications
Typical characteristics include:
› Has thread switch (fast and lightweight)
› Real time scheduling policy
› Small size
› Responds to external interrupts quickly (<10 s)
› Minimizes intervals during which interrupts are disabled
Typical characteristics include:
› Provides fixed or variable sized partitions for memory management
and the ability to lock code and data in memory
› Provides special sequential files that can accumulate data at a fast
rate
10
Purpose-Built Embedded OS
To deal with timing constraints, the kernel:
› provides bounded execution time for primitives
› maintains a real-time clock
› provides for special alarms and timeouts
› supports real-time queuing disciplines, e.g., EDF (earliest deadline
first)
› provides primitives to delay processing and to suspend/resume
execution
11
rtos
Enables execution of concurrent processes or threads or
tasks
Provides a mechanism to let the processor run each process
as per scheduling and to do context-switch between the
various processes (threads or tasks)
Sets the rules during execution of application processes to
enable finishing of a process within the assigned time interval
and with assigned priority.
1b-12
12
Real time operations
Defines the ways in which the system works, reacts to the
events and interrupts, schedules the system functioning in
real time and executes by following a plan to control the
latencies and to meet the deadlines.
[Latency — Waiting interval between the instance at which a
need to run the codes arises for task (or interrupt service
routine) following an event and instance of start executing
the codes]
13
Embedded OS Trends
DOS is not
RTOS!
14
What is a Real-Time System?
“A real time system is one in which the correctness of the
computations not only depends upon the logical correctness
of the computation but also upon the time at which the result
is produced. If the timing constraints of the system are not
met, system failure is said to have occurred.”
- Donald Gillies
15
Classification of Real-Time Systems
Hard real-time system
› Missing a deadline has catastrophic results for the system
› Nuclear Power Plant Controller
Soft real-time system
› Deadlines may be missed and can be recovered
› The reduction in system quality is acceptable
› Multimedia Streaming
16
What Do We Mean by “Preemptive”?
There are two different execution models:
› In a preemptive model of execution a task may be interrupted
(preempted) during its execution and another task run in its place.
› In a non-preemptive model of execution after a task that starts
executing no other task may execute until this task concludes or yields
the CPU.
A preemptive model is necessary for an RTOS to achieve its
deadline
17
Multi-rate operations
Different operations may take place at distinct rates. For
example, the audio, video, network data or stream and
events have the different rates and time constraints to finish
associated processes.
18
Pure Real Time OS
Especially designed for real-time requirements
Completely real-time compliant
Often usable for simple architecture
Advantage: no or little overhead
› Computing power, memory
Disadvantage: limited functionality
Example: eCos, Nucleus, pSOS, VxWorks, QNX, OSE, Lyra
19
OS Real-Time Extensions
Extension of an OS by real-time components
Cooperation between RT- and non-RT parts
Advantages: rich functionality
Disadvantage:
› No general real-time ability
› Computing and memory resources
Example: RT-Linux, Solaris, Windows NT
20
Type of RTOS kernel
Monolithic kernel Microkernel
› Tightly integrated services, › High run-time overhead but
highly extensible
less run-time overhead
› Only contains essential kernel
› Not extensible - Any functions i.e., limited resource
modification requires management, low-level VM
recompilation of the kernel allocation, CPU scheduling.
› Other functions are in system
libraries / modules.
21
Components of a RTOS
Process(task) management
› Scheduler
› Synchronization mechanism
Interprocess communication (IPC)
Semaphores
Memory management
Interrupt service mechanism
I/O management
Hardware abstraction layer
Development Environments
Communication subsystems (Option)
Board Support Packages
22