0% found this document useful (0 votes)
67 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)
67 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

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

Common questions

Powered by AI

Timing predictability in RTOS is crucial because these systems are designed to perform tasks within strict time constraints, often associated with critical applications such as flight control systems where delays could result in catastrophic failures . Predictability ensures that the system can handle tasks and interrupts within known bounds, preventing delays in processing critical events . The deterministic scheduling policy and short durations for disabled interrupts are essential for maintaining this predictability, ensuring that tasks are executed consistently within the expected timelines, thereby enhancing system reliability and functionality . This predictability allows RTOS-based systems to function effectively in environments where precise timing is mandatory, directly impacting the overall performance and safety of the system.

A typical RTOS kernel comprises several key components: processor management, memory management, timer management, task management, and inter-task communication and synchronization resource management . Processor management handles the allocation and execution of processes, ensuring task priorities are respected . Memory management controls how memory is allocated and used, maintaining efficiency and avoiding leaks . Timer management is crucial for handling timed operations and periodic scheduling . Task management involves scheduling and coordinating tasks, adjusting to runtime priorities and states . Finally, inter-task communication and synchronization services manage resource sharing and coordination between tasks, providing tools such as mutexes and semaphores to avoid deadlocks and race conditions . Collectively, these components ensure that the RTOS operates efficiently and meets the real-time requirements of the tasks it manages.

Microkernel architecture, as used in RTOS like LynxOS, offers modularity and extensibility by separating kernel services like scheduling and interrupt handling from higher-level functions, which are implemented as user-mode services . This separation results in higher system reliability, as faults in non-critical services do not affect the core system functions, and facilitates easier updates and customizations by allowing additions without modifying the entire system . In contrast, monolithic kernels bundle many functions, such as device drivers and file systems, within the kernel space, offering lower runtime overhead but at the cost of flexibility and robustness. Modifying or extending a monolithic kernel can introduce risks of system instability, whereas microkernels, despite having higher context-switching overhead, provide cleaner isolation between services and core kernel functionalities .

While Linux is popular for many applications due to being royalty-free and open-source, it has limitations in real-time operations because it lacks inherently deterministic behavior necessary for real-time tasks . Unlike dedicated RTOS like VxWorks, Linux does not consistently guarantee tight timing constraints, leading to unpredictable latency and execution delays, which are critical in real-time applications . VxWorks, known for stability and real-time performance, is specifically designed to provide hard real-time capabilities, including priority-based preemptive scheduling and minimal interrupt latency . In comparison, Linux, even with real-time patches, cannot fully match the precision needed for mission-critical real-time applications, making VxWorks a more reliable choice where determinism and timing guarantee are paramount .

The second generation of operating systems, which occurred around 1955-1965, was characterized by non-interactive batch processing systems such as those found on IBM 1401 and 7094, relying on offline printing and mediums like paper tape and punched cards . In contrast, the third generation (1965-1980) introduced time-sharing operating systems, exemplified by the IBM 360. This period saw the provision for multiple users to interact with the computer concurrently via time-sharing, facilitated by systems like PDP-II that offered multipogramming and spooling for online operations . This transition marked a shift from isolated, batch processes towards more interactive and user-friendly computing environments allowing more efficient and simultaneous utilization of resources.

The primary functions of an operating system include processor multiplexing, process scheduling, interprocess communication and synchronization, system resource management (I/O, memory, data files), and enforcing access control and protection . These functions enable efficient interaction with hardware by providing essential services such as managing hardware resources (e.g., CPU time allocation and memory usage), ensuring efficient execution of user applications through process scheduling, and maintaining system security and reliability by enforcing access controls . By creating a controlled environment where applications can execute safely and efficiently, the OS eases user interaction with hardware, abstracting complex hardware details, thus offering a user-friendly experience and facilitating convenient device use .

The fifth generation marked a significant evolution with the advent of distributed and network operating systems, such as those supporting knowledge-based computer systems . These operating systems expanded traditional computing by enabling resource sharing and process coordination over networks, thereby allowing multiple systems to operate seamlessly as if they were a single entity. This transition allowed for parallel processing and inter-machine communication, which were not possible with earlier stand-alone systems . As a result, it became easier to manage complex computing environments where resources and workloads could be distributed across multiple connected computers, also enhancing the scalability and robustness of computing solutions, fundamentally broadening the scope and capability of traditional software applications .

Non-real-time systems typically employ non-preemptive scheduling, where once a task begins execution, it cannot be interrupted until completion . In contrast, most RTOS utilize preemptive priority-based scheduling, whereby the highest priority task that is ready to run is granted CPU time, essentially allowing tasks to be preempted based on priority . The implications of these differences are significant: in RTOS, high-priority tasks can preempt lower-priority ones to ensure critical tasks meet their deadlines, thereby supporting real-time requirements. This leads to more responsive and timely task execution, which is crucial for applications that rely on determinism and precise timing to function correctly, unlike non-real-time systems that focus on efficiency rather than meeting strict time constraints .

Scheduling algorithms like Earliest Deadline First (EDF) are crucial in RTOS environments as they prioritize tasks based on their urgency, i.e., the task with the closest deadline gets executed first . This approach ensures that time-critical tasks meet their deadlines, thereby enhancing the overall system's capability to handle real-time constraints. Unlike fixed-priority scheduling, EDF dynamically assigns task priorities, allowing for more flexible and efficient resource utilization without requiring extensive knowledge of task load variations. As a result, EDF can improve the responsiveness of an RTOS, particularly in systems where task execution times and arrival patterns are variable, commonly found in applications requiring stringent timing requirements . Such capabilities provide RTOS with superior adaptability to varied operational conditions, ensuring prompt task completion and minimizing deadline misses.

Stand-alone operating systems are complete systems that function independently on a desktop or notebook computer, examples being DOS, Windows 2000 Professional, and Mac OS X . Network operating systems are designed to support computer networks and typically reside on servers, with examples including Windows 2000 Server, Unix, and Linux . Embedded operating systems are intended for use in handheld devices and small systems; they are typically found on ROM chips and examples include Windows CE, Pocket PC 2002, and Palm OS . The primary distinction lies in their application scope and environment—stand-alone systems focus on single machine operations, network systems on interconnectivity and resource sharing, and embedded systems on minimalistic, task-specific operations within devices.

You might also like