NPEDUCATIONS, Electronic circuits development, electronics tutorials, microcontroller tutorials and projects, advanced microcontroller (ARM) based tutorials and projects, Embedded c development, Embedded c for ARM cortex M, Intel IoT based projects, IoT projects, CC3200 launch pad projects, MSP430 Launchpad tutorials and projects, Tiva C launch pad tutorials and projects, 8051 tutorials and projects, sensor interfacing with microcontroller tutorials, data communications and networking tutorials, peripheral interfacing with microcontroller, led message scrolling display, arduino based tutorials and projects, intel galileo based tutorials and project, ADC interfacing tutorials, LED Blinking, LCD interfacing, Embedded System tutorials and projects, projects, projects, online Embedded C training

Real Time Operating Systems Tutorial Part1

Before going to actual things in this chapter, we first look at the basics behind the scene.
What is an Operating System?
An operating System is a set of programs that designed to manages all the resources of the computer.
Memory, I/O devices, communication devices etc are the hardware resources of the computer. File systems, virtual memory, security etc are software resources. Now a set of programs which are used to manage all these resources is called an operating system.
What is the need of Operating System?
Without an operating system, a user cannot run an application program on their computer, unless the application program is self booting.
What are Functions of an Operating Systems ?
The main functions that are handling by the operating system are
Fig 1.1 shows a overview of a computer. In this user may interact the system via application programs which in turn access the hardware through operating system.

Every operating system mainly divided into two parts
1)      Shell
2)      Kernel
Shell:  shell is the program which handles all other programs.
              For  example,  K- shell or Born shell in unix
                                             Explorer.exe in windows
                                              Command program in DOS
Kernelkernel provides the most basic level of control over all of the computer's hardware devices. Time management, task scheduling, memory management, file system etc all are monitored by the Kernel.

Types of Operating Systems
·         Real Time
·         Multi-user vs Single-user
·         Multi-tasking vs single-tasking
·         Distributed
·         Embedded

Here I am not going to discuss all these types. We mainly concentrate on Real Time Operating System. Now,

What is an RTOS?
Real Time Operating System (RTOS) is a multitasking operating system intended for real time applications.

The word Real-Time in RTOS indicates that the system ideally should have zero response time i.e., producing logically correct result within the deadline. Such capabilities define its deterministic timing behavior and limited resource utilization nature.
Examples for Real Time systems are air traffic controllers, missile guidance systems.

Not all embedded systems applications require the RTOS. For example Electronics solar heater does not require the RTOS. But day-by-day application programs running on the embedded systems will become increasingly complex to be managed. An RTOS will be effective to allow the real-time applications to be designed and managed more easily.

An RTOS always includes a kernel which is relatively small but very reliably and effectively program the sequences of all activities in the system. A system with kernel is composed of tasks independently of the other tasks.

Classification of RTOS
RTOS’s are broadly classified into three types,
·         Soft Real Time RTOS
·         Firm Real Time RTOS
·         Hard Real Time RTOS

Soft real-time: In soft real-time systems, missed responses are undesirable, but do not result in complete failure (e.g. video decoder, network switch). In other words, deadlines may be missed and can be recovered from. Reduction in system quality is acceptable.

Firm real-time: missing a deadline might result in an unacceptable quality reduction

Hard real-time:  In hard real-time systems, failure to meet constraints results in complete system failure and is, therefore, an unacceptable condition (e.g. air traffic controllers, missile guidance systems or health monitoring systems where a missed response can have catastrophic results). In other words, degree of tolerance for missed deadlines is extremely small or zero.

What is the need of an RTOS?

There are basically three types of embedded systems.
·         Polled Loop Systems
·         Interrupt Driven Systems
·         Real Time Operating Systems

Polled Loop Systems: (sequence of all activities)
A polled loop program is just a gigantic loop endlessly reads inputs and takes some action based upon inputs. It executes code sequentially, so no other operation can be performed. Therefore, only a single task exists that runs infinitely. No inter-task communication or scheduling needed. 
Polled loop are fantastic solution for some systems. Like high speed data channel, especially when events occur at widely spaced intervals and the processor is dedicated to handle the data channel.

·         Very easy to code and debug.
·         Response time is easy to determine.
·         Cannot handle asynchronous events.
·         Waste of CPU time, especially, when the program is continuously monitoring a status flag or variable.


Interrupt Driven System:
An interrupt is a signal/event typically generated by a hardware device indicating that it needs the CPU service. Whenever the interrupt is occurred corresponding service routine (ISR) is indentified by taking the help of interrupt vector table and then executed to handle that event.
This system is a better solution than simple polled loop, since the system doesn’t ask CPU time waiting for something to happen. Therefore, no wastage of CPU time.

As the applications grows, obviously multiple independent activities increases. For example a simple system is designed to read the numbers pressed in keypad, and update the data and then display it in LCD and doing other activities.
If the number of interrupts increases processing time also increases so the system may not respond correctly to interrupts or asynchronous events which produce undesired results.

Real Time Operating Sytems:
In Real Time Operating Systems, each activity set as its own task which runs independently under the supervision of the kernel. For example in Fig 1.5, one task update the screen, another task is handled the communications (TCP/IP) and other one processor the data. All these three task runs under the supervision of kernel.
When an interrupt is occurred from a external source, the interrupt handler handles that particular interrupt and pass the information to the appropriate task by making a call to the kernel.
Where we opt for RTOS ?
An RTOS is really needed to simplify the code and make it more robust. For example if the system has to accept inputs from multiple sources and handle various outputs and also doing some sort of calculations or processing an RTOS make lot of sense.

Advantage of using RTOS:
·         RTOS can run multiple independent activities.
·         Support Complex communication Protocols (TCP/TI. I2c, CAN, USB etc..). These protocols come with RTOS as library provided by the RTOS vendors.
·         File System.
·         GUI (Graphical User Interface).

Download the Document

1 comment :

Thanks for visiting NPEDUCATIONS. We will contact you soon


Rajsekhar said...

sir pls upload the ppts of ur lectures

Post a Comment

Thanks for visiting NPEDUCATIONS. We will contact you soon

If you really like this tutorial, Don't forget to give the comment or please subscribe to the RSS feed by submitting your E-mail or like our Facebook page.

Powered by Blogger