This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.
An embedded system can be defined as computing device that does a specific focused job. Appliances such as air-conditioner, VCD player, printer, fax machines, mobile phones etc. are examples of embedded systems. Each of these systems will have a processor and special hardware along with embedded software that is executed by the processor to meet specific requirements. The desktop/laptop are general purpose computers that can be used for variety of applications. In contrast, the software in embedded systems is always fixed. The hardware and software are optimized for that specific job.
Embedded systems in which some specific work has to be done in a specific time period are called real-time embedded systems. Meeting the deadline is the most important requirement of the real-time systems.
What are real-time embedded operating systems?
An operating system is a collection of software that manages the system hardware resources and provides services to optimize performance. The operating system in which the software is fixed to perform certain functionality/application is termed as embedded operating system. Embedded operating systems that provide necessary functionality for achieving real-time performance is called real-time embedded operating systems (RTOS).
As defined by Donald Gillies "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 in which the result is produced. If the timing constraints are not met, system failure is said to have occurred." Based on this, Real time systems can be classified as:
Hard real time systems: Missing the deadline may produce catastrophic results.
Soft real time systems: Late completion of jobs is undesirable but not fatal.
These are termed as "Deterministic" operating systems, i.e. the worst case response time can be predicted.
Some of the examples of real-time embedded systems in our daily-life:
Wake-up alarm, Microwave oven, Home safety system, Traffic signal, Printers, Fax Machines, Xerox Machines, television set, digital camera etc.
Examples of mission critical controls : Nuclear plant, Aircraft Navigation, military equipment etc.
II.Why Real Time Operating Systems for Real Time Applications
A simple system such as Microwave oven does not a require software platform (OS) to perform its functionality. But as the complexity of applications increase beyond such simple tasks in both hardware-wise and features, there is a requirement to run such systems on an RTOS codes, as it allows real-time applications to be designed and expanded easily by making changes to the software whenever required. The use of an RTOS further simplifies the design process by splitting the application code into separate tasks. With a pre-emptive RTOS all time critical events are handled as quickly and efficiently as possible. An RTOS allows one to make better use of the system resources by providing valuable services such as semaphores, mailboxes, queues, time delays, time outsâ€¦etc.
III. Features required for a good Embedded RTOS
Task and Task states - A Task is a process or a program thread as it performs a series of sequential operations and arrives at a result in a multi-tasking system that executes under the control of an RTOS. Each task has a memory block called task control block(TCB) allocated to it which saves the task's(i)state, which specifies the present state-
ready state-the task is ready to run but cannot because a higher priority task is executing.
blocked state-the task has requested a resource that is not available, has requested to wait until some event occurs, or has delayed itself for some duration.
running state-the task is the highest priority task and is running.
(ii)Priority number,(iii)context, stores bytes for the program counter that load when it blocks to let another task take CPU or resource control or when it finishes.
http://www.transitmagazine.com/images/0502_0.jpg Task Control Block
I. Figure indicating Task States II. Task Control Block
Scheduler- How does the kernel decide which task to run? Scheduler is the heart and soul of the operating system that decides which ready task has the right to use processor at a given time, based on various scheduling algorithms that have been developed depending on the embedded design requirement. There are different ways of scheduling the tasks: (i) First In First Out- Tasks which are Ready to run are kept in queue and the CPU serves them on First-cum-first served basis. This is a good algorithm for embedded systems which have to perform few small tasks without any time criticality. (ii) Round-robin Algorithm- Each task waiting in the queue is given a fixed time slice. The kernel gives control to the next task if current task has completed its work within the time slice or if the current task has completed the allotted time. This algorithm is sufficient in systems where time-critical operations are not involved and all tasks are of equal importance. (iii) shortest job first- The task that takes minimum time will be given priority. The advantage is that a high number of tasks will be executed, but tasks with highest amount of time will have to wait, perhaps forever! The kernels used in embedded systems that implement priority based multi-tasking is, (iv) Non-Preemptive scheduling- Its is also known as Cooperative scheduling as the tasks have to cooperate with one another to share CPU time. The main disadvantage is that the highest priority task has to wait for a long time.
If the embedded system is a hard real-time system then none of the above scheduling algorithms can be used at all. (v) Preemptive multitasking scheduling is the widely used scheduling algorithm in the RTOS embedded design. The highest priority is always executed first by pre-empting the lowest priority task.
Inter Process Communication (IPC) and Task Synchronization - Inter Process communication describes several ways to communicate between tasks to share CPU and resources. (i)Signal- A Signal is the simplest IPC. Signal permits a task run after signaling and notifying RTOS, which lets task or ISR waiting for the signal to run.(ii) Semaphore- When multiple tasks are running, two or more tasks may need to share the same resource. To access the shared resource or task there should be a mechanism so that there is a Discipline. This is known as task synchronization. Semaphore is a kernel object that is used for both resource and task synchronization. To control the access, semaphore is created. Semaphore is like a to enter house, semaphore is given to the task based on the priority after completion of the job the semaphore is released. (iii) Mutex- Mutex stands for Mutual Exclusion. It is a special binary semaphore, similar but powerful than one. It can be achieved by disabling the scheduler, disabling the interrupts or test-and-set operations. (iv) Mailboxes- A Mailbox is an object just like Post mailbox, anyone can post a message and host can take it. Similarly, a task can have a mailbox into which other tasks or ISR sends the message. If a task has an array of messages then it is known as a message queue.
III. Kernel Object.
Timing Constraints- Tasks in RTOS have real time constraints-the time limit up to which it must respond to an event(s) and time limit within which it must finish.
Task Switching Time Interval: The time interval taken to switch between tasks either on completion or upon receiving an IPC.
Context Switching Interval: Change of context on Interrupt or blocking of the tasks and running another task or ISR.
Time Slice: A Time slice allotted to the tasks, after which the cycle start again.
Interrupt Latency: The sum of maximum time for which the interrupts are disabled and time to start the execution of first ISR Instruction.
Interrupt Response time: Time between the receipt of interrupt signal to the start of execution of code that handles interrupt.
Interrupt Recovery time: Time required by the CPU to return to the Interrupted code/highest priority task.
IV.RTOSs that are currently available and actively used in embedded applications.
ARM,IA32,Intel 6 4, MIPS, strong ARM
ARM, MIPS, SH, Others
MIPS, ARM, Strong ARM, Power PC
ARM, MIPS, PPC, SH, x86,xSCALE
Available under license
ARM7/9/11/CORTEX M13, COLDFIRE, 8051,x86, Win32, MIPS, 6800, Power PC
ARM, AVR, AVR32, CORTEXM3, PIC, PIC32, 8052.
V. Case Study
Some of the popular RTOSs are reviewed here to identify their features, which make them suitable for different real-time embedded applications
QNX Neutrino: QNX Neutrino is a real-time operating system of QNX software systems limited. Board support packages and device driver kit help in fast development of the prototype. It provides an excellent integrated environment. It supports C, C++ and JAVA languages and TCP/IP protocol stack. It supports multiple scheduling algorithms such as round robin, FIFO etc. Up to 65535 tasks are supported and each task can have 65535 threads. Minimum time resolution is one nanosecond. It requires 64k kernel ROM and 32k kernel RAM.
VXWorks(Wind river Systems): VXWorks supports both preemptive and round robin scheduling algorithms.256 priority levels can be assigned to the task. Priority inheritance feature is provided in this system.
MicroC/OS-II: Micro Controller operating system version 2 is a preemptive real-time operating system used extensively in academic institutions. It is also used widely in many commercial applications including mission-critical applications. The features of this OS are source code availability, scalable, preemptive, portable, multitasking, deterministic, reliable, supports different platforms. The application can have up to 56 tasks. Round robin scheduling algorithm is not supported by this operating system.
RT LINUX: RTLinux pro is a priced-edition and RTLinux free is open source release. RTLinux is a hard real-time operating system which supports processors such as x86, Pentium, power PC, ARM etc. A footprint of 4MB is required for RTLINUX. It does not support priority inheritance. Mini RTL, a tiny implementation of RTLINUX, runs on PC/104 boards. This OS is an excellent choice for 32-bit processor based embedded systems.
pSOSystem/x86 2.2.6: pSOS+ is a small kernel suitable for embedded applications. This uses the software bus to communicate between different modules. The choice of module to be used can be done at compile time making it suitable for embedded applications. System has a flat memory space. All threads share the same memory space and also share all objects such as semaphores. So it has more chances of crashing. Around 239 usable thread priority levels available making it suitable for Rate monotonic scheduling. The drawback of this RTOS is that it is available only for selected processors and that lack of mutexes in some versions leads to priority inversion.
Real time Operating systems play a major role in the field of embedded systems. Especially when mission critical applications are involved. Selection of a particular RTOS for an application can be made only after a thorough study of the features provided by the RTOS. The choice of Operating System generally comes after the selection of the processor and development tools. Every RTOS is associated with a finite set of microprocessors and a suite of development tools. Hence the first step in choosing an RTOS must be to make the processor, real-time performance and the budget requirements clear. Then look at the available RTOS to identify the one which suits our application.
Even though most of the current kernels (RTOS) are successfully used in today's real-time embedded systems, but they increase the cost and reduce flexibility. Next generation real-time operating systems would demand new operating systems and task designs to support predictability, and high degree of adaptability.