0% found this document useful (0 votes)
41 views51 pages

Real Time Operating System

rot based data
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views51 pages

Real Time Operating System

rot based data
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

RTOS

B R K SINGH

1
Generation Era O/S used Feature

First 1945-55 No O/S Plug in boards


Vacuum tubes Jumper wired
ENIAC
EDVAC
Analog
computers
Second 1955-65 Batch O/S (Not interact Paper tape
IBM 1401, 7094 system) Punched cards
Offline printing
Third 1965-80 Time sharing O/S (many at Spooling (On-line)
IBM 360 the same time PDP-II Multiprogramming

Fourth 1980-90 MS-DOS User friendly. He


IBM 360 UNIX need not know
about computer
Fifth 1990 KBCS Distributed O/S More advanced
(Knowledge Network O/S
based computer
system) 2
WHAT IS AN OPERATING SYSTEM?

• An interface between users and hardware - an environment


"architecture”
• Allows convenient usage; hides the tedious stuff
• Allows efficient usage; parallel activity, avoids wasted cycles
• Provides information protection
• Gives each user a slice of the resources
• Acts as a control program.
• World without Operating system is like human without heart..

3
Operating systems market share
S.No Operating Market share
system
1 Windows XP 81.94%
2 Windows Vista 4.52%
3 Windows 2000 4.00%
4 Mac OS 3.52%
5 MacIntel 2.48%
6 Windows 98 1.14%
7 Linux 0.71%
8 Windows NT 0.66%
9 Windows Me 0.59%
10 Ninendo Wii 0.17%
11 Other 0.20% 4
The primary functions of an
operating system
• Multiplexing the processor(s)
• Scheduling the processes
• Coordinating interaction among rocesses,interprocess
communication and Synchronization.
• Managing the system resources(I/O, memory,data files)
• Enforcing access control and protection
• Maintaining the system integrity and performing error
recovery
• Providing an interface to the users
5
Examples of computing devices
which use OS
• Computers
• Mobile phones
• 3d televisions
• Video game
• ATM
• Ticket Wending Machine
Examples of computing devices
which use don’t OS

• Speed meters.
• Digital Watches.
• Micro ovens.
• Washing machines.
• Calculators.
Components of OS
Process Management
Memory management
I/O Device management
File system
Protection
Network management
Network services
User Interface
TYPES OF OPERATING SYSTEMS

There are three types of Operating systems


based on their application

• Stand-Alone Operating system


• Network Operating systems
• Embedded Operating systems

9
Stand-Alone Operating system

❑ It is a complete operating system that


works on a desktop or notebook computer.
Examples of stand-alone operating systems :
DOS
Windows 2000 professional
Mac OS X

10
Desktop Operating System
Network Operating systems
• It is an operating system that provides extensive
support for computer networks. A network
operating system typically resides on a server.
Examples :
❑ Windows 2000 server
❑ Unix
❑ Linux
❑ Solaris

12
Embedded Operating system

• You can find this operating system on


handheld computers and small devices. It
resides on a ROM chip. Examples of
embedded operating systems are :
o Windows CE
o Pocket PC 2002
o Palm OS

13
• Commercial RTOSes
• LynxOS,
• VxWorks,
• pSoS,
• Spring,
• ARTS,
• MARS(Maintainable Real-Time System)

14
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

15
RTLinux
• This OS was developed by FSM
Labs(www.fsmlabs.com) and available in two
versions RTLinux Pro and RTLinuxFree.
• The RTLinux Pro is the priced edition and
RTLinux Free is the free open source release.
• RTLinux is a hard real-time operating system
with support for many processors such as
x86,Pentium,PowerPC,ARM,Fujitsu,MIPS and
Alpha
• It does not support priority inheritance.
16
• LynxOS is mostly used in real-time
embedded systems, in applications for
avionics, aerospace, the military, industrial
process control and telecommunications.
• Enea OSE is one of the most widely used
RTOSes in the world. According to mobile
analyst firm, VisionMobile, OSE has been
deployed in over 1.75 billion mobile
handsets, as of the end of June 2010. Enea
OSE is shipped in hundreds of millions of
mobile phones each year and over half of
the worlds 3G base stations
17
MicroC/OS-II
• Microcontroller operating system version –II
is developed by Jean
J.Labrosse(www.ucos-II.com)is a preemptive
real-time operating system which is popular
in academic institutions for teaching RTOS
concepts.
• It can support only 64 tasks out of which
eight are system tasks
• Round-robin scheduling algorithm is not
supported by this OS
18
Other RTOS’s

• VxWorks
– Monolithic Architecture
– Real Time Posix compliant
– Cross development System
• pSOS
– Object Oriented OS

19
Real Time System

• A system is said to be Real Time if it is


required to complete it’s work & deliver it’s
services on time.
• Example – Flight Control System
– All tasks in that system must execute on time.
• Non Example – PC system

20
How RTOS is different from OS
• The key difference between
general-computing operating systems and
real-time operating systems is the need for "
deterministic " timing behaviour,
general-computing non-real-time operating
systems are often quite non-deterministicII.

21
• Real-time operating systems are often uses
in embedded solutions, that is, computing
platforms that are within another device.
While real-time operating systems are
typically designed for and used with
embedded systems.

22
Hard and Soft Real Time Systems
• Hard Real Time System
– Failure to meet deadlines is fatal
– example : Flight Control System
• Soft Real Time System
– Late completion of jobs is undesirable but not fatal.
– System performance degrades as more & more jobs
miss deadlines
– Online Databases

23
Classification of RTOS Kernels
• RT kernels vs modified kernels of standard OS
– Fast proprietary kernels: may be inadequate for
complex systems, because they are designed to
be fast rather than to be predictable in every
respect, e.g., QNX, PDOS, VCOS, VTRX32,
VxWORKS
– RT extensions to standard OS: RT-kernel runs
all RT-tasks and standard-OS executed as one
task on it
• General RTOS vs RTOS for specific domains
• Standard APIs vs proprietary APIs
24
– e.g. POSIX RT-Extension of Unix,Source:
ITRON, OSEK)
R. Gupta, UCSD
INTRODUCTION TO RTOS
• Tasks and Task States
• A task – a simple subroutine
• ES application makes calls to the RTOS functions to start tasks,
passing to the OS, start address, stack pointers, etc. of the tasks
• Task States:
– Running
– Ready (possibly: suspended, pended)
– Blocked (possibly: waiting, dormant, delayed)
– [Exit]
– Scheduler – schedules/shuffles tasks between Running and Ready
states
– Blocking is self-blocking by tasks, and moved to Running state via
other tasks’ interrupt signaling (when block-factor is
removed/satisfied)
– When a task is unblocked with a higher priority over the ‘running’
task, the scheduler ‘switches’ context immediately (for all
pre-emptive RTOSs) 25
A Sample Real Time System (1)

26
Features of RTOS’s

• Scheduling.

• Resource Allocation.

• Interrupt Handling.

• Other issues like kernel size.


27
Why Use an RTOS?
• Can use drivers that are available with an RTOS
• Can focus on developing application code, not on
creating or maintaining a scheduling system
• Multi-thread support with synchronization
• Portability of application code to other CPUs
• Resource handling by RTOS
• Add new features without affecting higher priority
functions
• Support for upper layer protocols such as:
– TCP/IP, USB, Flash Systems, Web Servers,
– CAN protocols, Embedded GUI, SSL, SNMP
28
Characteristics of Embedded OS
• Device drivers often not integrated into kernel
– Embedded systems often application-specific 🡪
specific devices 🡪 move device out of OS to tasks
– For desktop OS, many devices are implicitly assumed
to be presented, e.g., disk, network, audio, etc.
🡪 they need to be integrated to low-level SW
stack
Embedded OS Standard OS

kernel
29
Characteristics of Embedded OS
• Real-time capability
– Many embedded systems are real-time (RT)
systems and, hence, the OS used in these
systems must be real-time operating systems
(RTOSs)
• Features of a RTOS:
– Allows multi-tasking
– Scheduling of the tasks with priorities
– Synchronization of the resource access
– Inter-task communication
– Time predictable
– Interrupt handling 30
Requirements for RTOS
• Predictability of timing
– The timing behavior of the OS must be
predictable
– For all services of the OS, there is an upper
bound on the execution time
– Scheduling policy must be deterministic
– The period during which interrupts are disabled
must be short (to avoid unpredictable delays in
the processing of critical events)
31
Requirements for RTOS
• OS should manage timing and scheduling
– OS possibly has to be aware of task deadlines;
(unless scheduling is done off-line).
– Frequently, the OS should provide precise time
services with high resolution.
• Important if internal processing of the embedded
system is linked to an absolute time in the physical
environment
• Speed:
– The OS must be fast 32
Programming languages Used
• C is most widely used in RTOS programming

• C++ and Ada are the next more popular for large
projects.

• Assembly languages for increasing efficiency and


reusing the previous code

• Java may also be a choice for some applications

33
Which is the Best?
• It is always very difficult to judge which
RTOS is the best and which is the worst. It
depends on the application and interests of
the user. Among the above, Linux is royalty
free but it has serious drawbacks if it comes
to real-time behavior. The VxWorks is a
very old and stable RTOS. Similarly
Windows CE 5.0 version RTOS is a robust
and stable regarding the real-time behavior.
34
Functionality of RTOS Kernel
• Processor management resource management
• Memory management
• Timer management
• Task management (resume, wait etc)
• Inter-task communication and
synchronization

35
RTOS Kernel Functions

36
RTOS Kernel
• RTOS Kernel provides an Abstraction layer that
hides from application software the hardware
details of the processor / set of processors upon
which the application software shall run.
Application
Software

RTOS

Hardware
37
• Type of RTOS kernel

– Monolithic kernel – less run-time overhead but


not extensible
– Microkernel – high run-time overhead but
highly extensible

38
What is MQX?
• Multi-threaded, priority-based RTOS
provides
– Task scheduling
– Task management
– Interrupt handling
– Task synchronization: mutexes, semaphores,
events, messages
– Memory management
– IO subsystems
– Kernel logging
39
MQX Facilities
Required

Optional

MQX, RTCS, etc are structured


as a set of C files built by the
user into a library that is linked
into the same code space as the
application. Libraries contain
all functions but only called
functions are included with the
image.

40
Message passing in RTOS
• In RTOS, the OS copies a pointer to the message,
delivers the pointer to the message-receiver task, and
then deletes the copy of the pointer with
message-sender task.

Message Sender RAM


Task Messag Messag
e e

Message Receiver RTOS


msg_pt
Task
r
msg_pt
41
r
Task Management
• Set of services used to allow application software developers
to design their software as a number of separate chunks of
software each handling a distinct topic, a distinct goal, and
sometimes its own real-time deadline.

• Main service offered is Task Scheduling


– controls the execution of application software tasks
– can make them run in a very timely and responsive fashion.

42
43
Task Scheduling
• Non Real -time systems usually use Non-preemptive
Scheduling
– Once a task starts executing, it completes its full execution

• Most RTOS perform priority-based preemptive task


scheduling.

• Basic rules for priority based preemptive task scheduling


– The Highest Priority Task that is Ready to Run, will be the Task
that Must be Running.

44
Scheduling in RTOS
• Running (executing on the CPU);
• Ready (ready to be executed);
• Blocked (waiting for an event, I/O for
example)

45
Scheduling Algorithms in RTOS

• Clock Driven Scheduling


• Weighted Round Robin Scheduling
• Priority Scheduling (Greedy / List / Event Driven)
• Cooperative scheduling
• Preemptive scheduling
• Rate-monotonic scheduling

46
• Fixed priority pre-emptive scheduling, an
implementation of preemptive time slicing
• Fixed-Priority Scheduling with Deferred
Preemption
• Fixed-Priority Non-preemptive Scheduling
• Critical section preemptive scheduling
• Static time scheduling
• Earliest Deadline First approach
• Stochastic digraphs with multi-threaded
graph traversal
47
Scheduling Algorithms in RTOS

• 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.

48
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
49
Dynamic Memory Allocation in RTOS

• RTOS does it by a mechanism known as Pools.

• Pools memory allocation mechanism allows application


software to allocate chunks of memory of 4 to 8 different
buffer sizes per pool.

• Pools avoid external memory fragmentation, by not


permitting a buffer that is returned to the pool to be broken
into smaller buffers in the future.

• When a buffer is returned the pool, it is put onto a free


buffer list of buffers of its own size that are available for
future re-use at their original buffer size

50
Process & Program
• A process invokes or initiates a program. It
is an instance of a program that can be
multiple and running the same application.
• Example:- Notepad is one program and can
be opened twice.

51

You might also like