10-08-2011, 03:39 PM
[attachment=15177]
REAL TIME OPERATING SYSTEM
Operating System
Collection of system calls (functions)
Provides a set of basic services to interact with the hardware
Core of the OS is Kernel
Basic structural unit of OS
Typically a library or set of libraries
Operates in supervisory mode
Basic Structure of Operating System
Real Time Operating System
A variant of OS
Operates in constrained environment where computer memory and processing power is limited
Provides services in definite amount of time
Features
Fast
Response times are highly predictable
Small and occupy very little memory
Consume fewer resources
Mission-critical
Unpredictable environment
Life risking applications
Examples of RTOS
Types of RTOS
Hard Real-Time Systems
Soft Real-Time Systems
Hard Real-Time Systems
Meets deadlines with zero degree of flexibility
Missed deadlines cause catastrophe
Cost of catastrophe is high
Example of Hard Real-Time Systems
Weapons defense system
Missile guidance system
Soft Real-Time Systems
Meets deadlines with some degree of flexibility
Missed deadline does not cause catastrophe
Costs rise in proportion to the delay
Example of Soft Real-Time Systems
DVD or multimedia players
Scheduling
Make sure that all tasks meet their timing constraints
It is not a task but a function call [schedule()]
Called at various scheduling points likewise end of ISR, when tasks go to sleep or when they are ready to run
Types of algorithms
Preemptive priority based scheduling algorithm
Round Robin scheduling algorithm
Preemptive priority based scheduling algorithm
Each task has a priority and highest-priority task runs first
Round Robin scheduling algorithm
Each task of same priority uses time slice to achieve equal share of CPU execution time
Tasks
An independent thread of execution
It is schedulable
Characterized by associated name, unique ID, priority, task control block (TCB), stack & task routine
Each task moves from one state to another using finite state machine (FSM)
Semaphores
A kernel object that one or more threads of execution can acquire or release for the purposes of synchronization or mutual exclusion.
Acts like a key
Allows a task to carry out some operation or to access a resource
Types
Binary Semaphore
Counting Semaphore
Mutual Exclusion Semaphore
Message Queues
It is like a pipeline through which tasks & ISRs communicate and synchronize with data.
Ways to use Message Queues
Non-interlinked
one-way data communication
Interlocked
one-way data communication
Interlocked
two-way data communication
Broadcast Communication
Exceptions & Interrupts
Exception is any event that disrupts the normal execution of the processor and forces the processor into execution of special instructions
Types
Synchronous Exceptions Raised by internal events like processor instructions
“An arithmetic operation that results in a division by zero”
Asynchronous Exceptions Associated with hardware signals from external hardware devices
Also called as INTERRUPTS
“Pushing the reset button on the embedded board”
Timers & Timer Services
It is the scheduling of an event according to a predefined time value in the future.
Similar to setting an alarm clock.
Types
Soft Timer Software events that are scheduled through a software facility
Hard Timer Physical timer chips that directly interrupt the processor when they expire
I/O Subsystem
Hides the device-specific information from the kernel as well as from the application developer and to provide a uniform access method to the peripheral I/O devices of the system.
Defines the standard set of functions called API.
Memory Management
Dynamic Memory allocation
Synchronization
Resource Synchronization
Determines whether access to a shared resource is safe and, if not, when it will be safe.
Works on client-server model.
For instance, one task receives data from sensor & writes it to shared memory, a second task periodically receives data from shared memory and send it to display
Activity Synchronization
Determine whether the execution of a multithreaded program has reached a certain state and if it hasn’t, when this state will be reached.
Can be either synchronous or asynchronous.
For instance, a complex computation can be divided among multiple tasks, some are I/O bound, some are CPU intensive and others are mainly floating point that rely on floating point coprocessors.
Communication
Transfer of data from one task to another task.
Signal the occurrences of events from one task to another task
Control the execution of tasks by other task
Synchronize activities
Implement additional synchronization protocols for resource sharing
RTOS Distributions
QNX
RTLinux
VxWorks
Windows CE
OSE
freeRTOS