RTOS - Unit-5 Notes
RTOS - Unit-5 Notes
COURSE OUTCOMES:
CO1 Understand the basic set of commands and utilities in Linux/UNIX systems. (Understand – L2)
CO2 Explain the fundamental concepts of real-time operating systems. (Understand – L2)
CO3 Analyze the real-time operating systems objects, services and I/O concept. (Analyze – L4)
CO4 Evaluate various Interrupts and Timers in real-time embedded systems using the concepts of
RTOS. (Apply – L3)
UNIT – I:
Introduction: Introduction to UNIX/LINUX, Overview of Commands, File I/O (open, create, close, lseek,
read, write), Process Control (fork, vfork, exit, wait, waitpid, exec).
UNIT - II:
Real Time Operating Systems: Brief History of OS, Defining RTOS, The Scheduler, Objects, Services,
Characteristics of RTOS, Defining a Task, Tasks States and Scheduling, Task Operations, Structure,
Synchronization, Communication and Concurrency. Defining Semaphores, Operations and Use, Defining
Message Queue, States, Content, Storage, Operations and Use
UNIT - III:
Objects, Services and I/O Pipes, Event Registers, Signals, Other Building Blocks, Component
Configuration, Basic I/O Concepts, I/O Subsystem
UNIT - IV:
Exceptions, Interrupts and Timers: Exceptions, Interrupts, Applications, Processing of Exceptions and
Spurious Interrupts, Real Time Clocks, Programmable Timers, Timer Interrupt Service Routines (ISR),
Soft Timers, Operations.
UNIT V:
RT Linux, MicroC/OS-II, Vx Works, Embedded Linux, Tiny OS, and Basic Concepts of Android
OS.
TEXT BOOKS:
1. Real Time Concepts for Embedded Systems – Qing Li, Elsevier, 2011
REFERENCE BOOKS:
1. Embedded Systems- Architecture, Programming and Design by Rajkamal, 2007, TMH.
2. Advanced UNIX Programming, Richard Stevens
3. Embedded Linux: Hardware, Software and Interfacing – Dr. Craig Hollabaugh
Unit-5:
RT Linux, MicroC/OS-II, Vx Works, Embedded Linux, Tiny OS, and Basic Concepts of
Android OS.
1 Describe in brief about MicroC/OS-II and list out the features of it.
Micro C/OS- II
Micro C/OS-II is the acronym for MicroController Operating System version 2, which is the
second version of the RTOS developed by Micrium Inc, which became a part of Silicon Labs in
2016.it belongs to μC/OS family of embedded software. It is a Real Time kernel written in ‘C’
language for embedded application development. It supports Multitasking & Priority based pre-
emptive task scheduling. It is available for different family of processors/controllers and
supports processors/controllers ranging from 8bit to 64bit like ARM family of processors, Intel
8085/x86/8051, Freescale 68K series and Altera Nios II are examples for some of the
processors/controllers supported by MicroC/OS-II
The features of the μC/OS kernels include:
Scalable: The μC/OS kernels allow for unlimited tasks and kernel objects. The kernels' memory
footprint can be scaled down to contain only the features required for your application, typically
6–24 KBytes of code space and 1 KByte of data space. This means that a product can have just a
few of μC/OS-II’s services while another product can have the full set of features. This allows
you to reduce the amount of memory (both RAM and ROM) needed by μC/OS-II on a product
per product basis. Scalability is accomplished with the use of conditional compilation.
Portable: Most of μC/OS-II is written in highly portable ANSI C, with target microprocessor
specific code written in assembly language. Assembly language is kept to a minimum to make
μC/OS -II easy to port to other processors.
ROMable: μC/OS-II was designed for embedded applications. This means that if you have the
proper tool chain (i.e. C compiler, assembler and linker/locator), you can embed μC/OS-II as
part of a product.
Efficient: Micrium's kernels also include valuable runtime statistics, making the internals of
your application observable. Identify performance bottlenecks, and optimize power usage, early
in your development cycle.
Reliable : The μC/OS kernels include debugging feature that reduce development time. The
kernels provide extensive range checking, including checks for pointers passed in API calls, task
level services from ISRs, arguments within allowable range, and for valid specified options.
2 Analyze the States of task in MicroC/OS-II kernel
Task States: Under MicroC/OS-II kernel, the tasks may be in one of the following state at a
given point of time.
Dormant: The dormant state corresponds to the state where a task is created but no resources
are allocated to it. This means the task is still present in the program memory and is not moved
to the RAM for execution.
Ready: Corresponds to a state where the task is incepted into memory and is awaiting the CPU
for its turn for execution.
Running: Corresponds to a state where the task is being executed by CPU.
Waiting: Corresponds to a state where a running task is temporarily suspended from execution
and does not have immediate access to resources. The waiting state might be invoked by various
conditions like – the task enters a wait state for an event to occur (E.g. Waiting for user inputs
such as keyboard input) or waiting for getting access to a shared resource
Interrupted: A task enters the Interrupted (or ISR) state when an interrupt is occurred and the
CPU executes the ISR.
3 Explain the task creation & management in Micro C/OS-II kernel
Task Creation & Management
The uC/OS-II supports up to 64 tasks. 8 Tasks are reserved for the uC/OS-II kernel. Each task
should have a unique task priority assigned. No two tasks can have the same priority. In effect
uC/OS-II supports 56 user level tasks. Task priority varies from 0 to 63, with 0 being the highest
priority. Considering the future expansions, uC/OS-II advices developers not to use the priority
values 0, 1, 2, 3, OS_LOWEST_PRIO-3, OS_LOWEST_PRIO-2, OS_LOWEST_PRIO-1and
OS_LOWEST_PRIO. Currently, the uC/OS-II reserves only two task priorities for kernel tasks.
The ID of a task is its priority. A Task Control Block (TCB) is assigned to a task when a task is
created.
Memory Management
In VxWorks, all systems and all application tasks share the same address space. This means that
faulty applications could accidentally access system resources and compromise the stability of
the entire system. An optional tool named VxVMI is available that can be used to allow each
task to have its own address space. Default physical page size used is 8KB. Virtual memory
support is available with VxVMI tool. VxWorks does not offer privilege protection. The
privilege level is always 0 (supervisor mode).
Java is one of the most popular object oriented programming languages in the world. Java is
heavily used for software and web development. Recently, Java has become a popular language
for mobile-based applications as well.
Android is a mobile phone based platform developed by Google. Android development is most
of the times java-based. Large portion of Java libraries are available in Android platform, but
there are many other (non-java) librariesexisting in Android (for user interfaces, etc.) as well.
Java is a programming language, while Android is a mobile phone platform. Android
development is java-based (most of the times), because a large portion of Java libraries is
supported in Android. However, there are key differences. Unlike Java, Android applications do
not have a main function. They have on Crete, on Resume, on Pause and on Destroy functions
that should be overwritten by the developers. Java code compiles to Java byte code, while
Android code compiles in to Davilk opcode.
17 Mention the features of android and also define the service in android.
Main features of android:
Headset layout Storage
Connectivity: GSM/EDGE, IDEN, CDMA, Bluetooth, WI-FI, EDGE,3G,NFC, LTE,GPS.
Messaging: SMS, MMS, C2DM (could to device messaging), GCM (Google could
messaging)
Multilanguage support Multi-touch
Video calling Screen capture External storage
Streaming media support Optimized graphics
A service is a component that runs in the background to perform long-running operations without
needing to interact with the user and it works even if application is destroyed. A service can
essentially take two states :
( 1 ) Started:-
A service is started when an application component, such as an activity, starts it by calling start
Service(). Once started, a service can run in the background indefinitely, even if the component
that started it is destroyed.
( 2 ) Bound:-
A service is bound when an application component binds to it by calling bind Service(). A bound
service offers a client-server interface that allows components to interact with the service, send
requests, get results, and even do so across processes with interprocess communication (IPC).
18 What are the core building blocks of android?
An android component is simply a piece of code that has a well defined life cycle e.g. Activity,
Receiver, Service etc. The core building blocks or fundamental components of android are
Activities
Views
Intents
Services
content providers
Fragments
AndroidManifest.xml.
Activity:
An activity is a class that represents a single screen. It is like a Frame in AWT.
View:
A view is the UI element such as button, label, text field etc. Anything that you see is a view.
Intent:
Intent is used to invoke components. It is mainly used to:
Start the service
Launch an activity
Display a web page
Display a list of contacts
Broadcast a message
Dial a phone call etc.
For example, you may write the following code to view the webpage.
Intent intent=new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.javatpoint.com"));
startActivity(intent);
Service:
Service is a background process that can run for a long time.There are two types of services
local
remote.
Local service is accessed from within the application whereas
Remote service is accessedremotely from other applications running on the same device.
Content Provider:
Content Providers are used to share data between the applications.
Fragment:
Fragments are like parts of activity. An activity can display one or more fragments on the screen
at the same time.
AndroidManifest.xml:
It contains informations about activities, content providers, permissions etc. It is like theweb.xml
file in Java EE.
20
What is TinyOS? How is TinyOS different than Arduino?
TinyOS is an open-source operating system designed for low-power wireless devices, such as
sensor networks, ubiquitous computing, personal area networks, smart buildings and smart
meters.
There are three major differences between TinyOS and Arduino:
1. TinyOS and its APIs are designed for low-power operation; Arduino is not.
2. Arduino focuses on sensing, computation, and digital IO; TinyOS also supports this
abstraction adding excellent support for wireless networking.
3. TinyOS is written in nesC, a C dialect designed for the OS, while Arduino is in C. While
TinyOS programmers can write applications in C, the core OS is in nesC.
21 What is tinyOS? What is the difference between normal OS and tiny OS?
TinyOS is an open source operating system used for wireless devices. This operating system
(OS) is small in size and consumes low memory. The application programs that run on TinyOS
are also small in size as compared to normal OS. Another feature of TinyOS is that it is made for
some specific device. Normal OS is multithreaded and consumes high voltage of computer. But
tinyOS consumes low battery. Normal OS that we use in our computer supports all available
devices and has the large source code. But TinyOS has the small source code and it is written in
nesC language. nesC is a computer language derived from C language. nesC has a separate
compiler.
22 Mention the applications of TinyOS
TinyOS and its applications
TinyOS does not support multithreaded applications because it has low computation power.
Main components of TinyOS are tasks, events, commands, and data. Data is getting from the
outside environment. For example in the smoke detection device, when smoke is detected then
sensor of the device creates event and information about that event is data. Then the command is
made which splits water or any chemical which stops smoke or fire.
Applications of tinyOS
Many applications of TinyOS are there that we see in our daily life. Some of the examples of
devices that use tinyOS are below:-
Smoke detection device
Resource monitoring
Environmental monitoring
Industrial measurement