Real Time Operating System in Embedded S PDF
Real Time Operating System in Embedded S PDF
EMBEDDED SYSTEMS
Resource Allocation.
Interrupt Handling.
Priority Scheduling
(Greedy / List / Event Driven)
SCHEDULING ALGORITHMS IN RTOS
(CONTD)
Clock Driven
All parameters about jobs (release time/
execution time/deadline) known in advance.
Schedule can be computed offline or at some
regular time instances.
Minimal runtime overhead.
Not suitable for many applications.
SCHEDULING ALGORITHMS IN RTOS
(CONTD)
Weighted Round Robin
Jobs scheduled in FIFO manner
Time quantum given to jobs is proportional to it’s
weight
Example use : High speed switching network
QOS guarantee.
Not suitable for precedence constrained jobs.
Job A can run only after Job B. No point in giving time quantum
to Job B before Job A.
SCHEDULING ALGORITHMS IN RTOS
(CONTD)
Priority Scheduling
(Greedy/List/Event Driven)
Processor never left idle when there are ready tasks
Processor allocated to processes according to priorities
Priorities
static - at design time
Dynamic - at runtime
PRIORITY SCHEDULING
Earliest Deadline First (EDF)
Process with earliest deadline given highest priority
Least Slack Time First (LSF)
slack = relative deadline – execution left
Rate Monotonic Scheduling (RMS)
For periodic tasks
Tasks priority inversely proportional to it’s period
RESOURCE ALLOCATION IN RTOS
Resource Allocation
The issues with scheduling applicable here.
Resources can be allocated in
Weighted Round Robin
Priority Based
Some resources are non preemptible
Example : semaphores
Priority Inversion if priority scheduling is used
PRIORITY INVERSION
SOLUTIONS TO PRIORITY
INVERSION
Non Blocking Critical Section
Higher priority Thread may get blocked by unrelated low
priority thread
Priority Ceiling
Each resource has an assigned priority
Priority of thread is the highest of all priorities of the
resources it’s holding
Priority Inheritance
The thread holding a resource inherits the priority of the
thread blocked on that resource
OTHER RTOS ISSUES
Interrupt Latency should be very small
Kernel has to respond to real time events
Interrupts should be disabled for minimum possible time
For embedded applications Kernel Size should be
small
Should fit in ROM
Sophisticated features can be removed
No Virtual Memory
No Protection
LINUX FOR REAL TIME
APPLICATIONS
Scheduling
Priority Driven Approach
Optimize average case response time
Interactive Processes Given Highest Priority
Aim to reduce response times of processes
Real Time Processes
Processes with high priority
No notion of deadlines
Resource Allocation
No support for handling priority inversion
INTERRUPT HANDLING IN LINUX
Interrupts are disabled in ISR/critical sections of
the kernel
No worst case bound on interrupt latency
avaliable
eg: Disk Drivers may disable interrupt for few
hundred milliseconds
Not suitable for Real Time Applications
Interrupts may be missed
OTHER PROBLEMS WITH LINUX
Processes are non preemtible in Kernel Mode
System calls like fork take a lot of time
High priority thread might wait for a low priority
thread to complete it’s system call
Processes are heavy weight
Context switch takes several hundred
microseconds
WHY LINUX
Footprint
Small footprint (~50kb)
Oskit’s Device Driver Framework
Allows direct porting of existing drivers from
Linux.
Example – Ethernet Driver of Linux
OTHER RTOS’S
LynxOS
Microkernel Architecture
Kernel provides scheduling/interrupt handling
Additional features through Kernel Plug Ins(KPIs)
TCP/IP stack , Filesystem
KPI’s are multithreaded
Memory Protection/ Demand Paging Optional
Development and Deployment on the same host
OS support for compilers/debuggers
OTHER RTOS’S (CONTD)
VxWorks
Monolithic Architecture
Real Time Posix compliant
Cross development System
pSOS
Object Oriented OS
PERIPHERAL DEVICES AND
PROTOCOLS
• Interfacing
Serial/parallel ports, USB, I2C, PCMCIA, IDE
• Communication
Serial, Ethernet, Low bandwidth radio, IrDA,
802.11b based devices
• User Interface
LCD, Keyboard, Touch sensors, Sound, Digital
pads, Webcams
• Sensors
A variety of sensors using fire, temperature,
pressure, water level, seismic, sound, vision
AN EXAMPLE: FIRE ALARM SYSTEM
Problem
Hundreds of sensors, each fitted with Low Range Wireless
Sensor information to be logged in a server & appropriate action
initiated
Possible Solution
Collaborative Action
Routing
Dynamic – Sensors/controllers may go down
Auto Configurable – No/easy human intervention.
Less Collision/Link Clogging
Less no of intermediate nodes
Fast Response Time
Secure
RTOS: TARGET ARCHITECTURES
Processors MIPS
Microcontrollers ~20
ARM7 100-133
ARM9 180-250
Strong ARM 206
Intel Xscale 400
Mips4Kcore 400
X86
THANK YOU!