76
Introduction to Introduction to Operating systems Operating systems & & RTOS RTOS Dr. Y.NARASIMHA MURTHY. Ph. Dr. Y.NARASIMHA MURTHY. Ph. D D Department of Electronics Department of Electronics Sri Sai baba National College Sri Sai baba National College (Autonomous) (Autonomous) Anantapur-515001(A.P)-India Anantapur-515001(A.P)-India

Introduction to Operating systems & RTOS

Embed Size (px)

DESCRIPTION

Introductory information to youngstudents

Citation preview

Page 1: Introduction to Operating systems & RTOS

Introduction toIntroduction to Operating systemsOperating systems & &

RTOSRTOS

Dr. Y.NARASIMHA MURTHY. Ph. Dr. Y.NARASIMHA MURTHY. Ph. DD

Department of ElectronicsDepartment of ElectronicsSri Sai baba National College Sri Sai baba National College

(Autonomous)(Autonomous) Anantapur-515001(A.P)-IndiaAnantapur-515001(A.P)-India

Page 2: Introduction to Operating systems & RTOS

Invocation…. Where the mind is without fear and the head is held high; Where knowledge is free;

Where the world has not been broken up into fragments by narrow domestic walls;

Where words come out from the depth of truth; Where tireless striving stretches its arms towards perfection;

Where the clear stream of reason has not lost its way into the dreary desert sand of dead habit;

Where the mind is led forward by thee into ever-widening thought and action---

Into that heaven of freedom, my Father, let my country awake. ---------RABINDRANATH TAGORE

Page 3: Introduction to Operating systems & RTOS

Prologue …

A computer is a complex system with many resources like CPU, I/O devices, disk, memory etc… For any common user it is always a confusion about the using of the resources effectively. Because, unless otherwise the system is user-friendly, the user cannot use the computers effectively.

Page 4: Introduction to Operating systems & RTOS

So we always require a system software which can take care of all the hardware complexities and shoulder the responsibility of resource allocation such that the user can work with the computer more effectively. This was realised by the people very long back and they tried to develop a software to shield the programmers from the complexity of the hardware.

Page 5: Introduction to Operating systems & RTOS

The result is, a layer of software on the top of the hardware, to

manage all parts of the system and present the user with an

interface or “Virtual machine” that is easier to understand the

program. This layer of the software has become our so-called

OPERATING SYSTEM.

Page 6: Introduction to Operating systems & RTOS

Now Lets answer the Now Lets answer the questionquestion

What is an Operating What is an Operating System?System?

Page 7: Introduction to Operating systems & RTOS

A more formal definition!A more formal definition!

OS is “A collection of software modules to assist programmers in enhancing the system efficiency , flexibility and robustness. Or“Operating system is a piece of software which controls all the computer’s resources and provides the base upon which the application programs can be written”

Page 8: Introduction to Operating systems & RTOS

From the user point of view

OS is “ An extended machine (virtual)”

and

From the systems view point

“It is a resource manager”.

Page 9: Introduction to Operating systems & RTOS

Let us substantiate !Let us substantiate ! The operating system shields the The operating system shields the

programmer from the disk hardware programmer from the disk hardware and provides a simple file oriented and provides a simple file oriented interface. It also conceals a lot of interface. It also conceals a lot of unpleasant business concerning unpleasant business concerning interrupts, timers, memory interrupts, timers, memory management and other low level management and other low level features. So the function of the OS is to features. So the function of the OS is to present the user with the equivalent of present the user with the equivalent of an extended machine or virtual an extended machine or virtual machine.machine.

Page 10: Introduction to Operating systems & RTOS

Contd……Contd…… A computer is provided with processors, A computer is provided with processors,

memories, timers, disks, terminals, drives, memories, timers, disks, terminals, drives, printers, network interfaces and a wide printers, network interfaces and a wide variety of the other devices. The variety of the other devices. The operating system provides an orderly and operating system provides an orderly and controlled allocation of the processors, controlled allocation of the processors, memories and I/O devices among the memories and I/O devices among the various programs competing for them. It various programs competing for them. It also keep track of, who is using which also keep track of, who is using which resource, to grant resource requests, to resource, to grant resource requests, to account for usage and to mediate account for usage and to mediate conflicting requests from different users conflicting requests from different users and programs.and programs.

Page 11: Introduction to Operating systems & RTOS

Contd….Contd….

Provides an environment in which Provides an environment in which programs can be executed. programs can be executed. Makes efficient use of computer Makes efficient use of computer hardware and peripherals. Hide hardware and peripherals. Hide the peculiarities of the disks and the peculiarities of the disks and other I/O devices.Hence the OS other I/O devices.Hence the OS is also treated as a resource is also treated as a resource managermanager

Page 12: Introduction to Operating systems & RTOS

So,Where your OS sits in your So,Where your OS sits in your System?System?

compilersdatabasesword processors

CPUmemoryI/O devices

Page 13: Introduction to Operating systems & RTOS

Evolution of OS Evolution of OS

The next slide shows the evolutionThe next slide shows the evolution of OS . of OS .

Actually Prof.E.W.Dijsktra is Actually Prof.E.W.Dijsktra is considered as the considered as the father offather of Operating system.Operating system.

Page 14: Introduction to Operating systems & RTOS

Generation Era O/S used Feature

First 1945-55Vacuum tubes ENIAC EDVACAnalogcomputers

No O/S Plug in boardsJumper wired

Second 1955-65IBM 1401, 7094

Batch O/S (Not interact system)

Paper tapePunched cardsOffline printing

Third 1965-80IBM 360

Time sharing O/S (many at the same time PDP-II

Spooling (On-line)Multiprogramming

Fourth 1980-90IBM 360

MS-DOSUNIX

User friendly. He need not knowabout computer

Fifth 1990 KBCS(Knowledgebased computersystem)

Distributed O/SNetwork O/S

More advanced More advanced

Page 15: Introduction to Operating systems & RTOS

The basic requirements of OS:

Usability (Robustness)OS should accept all valid inputs ,even

with errors and gracefully handle all invalid inputs .It should not be crashed under any circumstances ,and could be recovered,even we remove any hardware while they are running .

Page 16: Introduction to Operating systems & RTOS

It should provide every facility for the It should provide every facility for the efficientefficient

development of application software and development of application software and shouldshould

not leave out any part of the facility.not leave out any part of the facility.

AdaptabilityAdaptability :: Should support necessary Should support necessary

activities,and not to impose activities,and not to impose unnecessary restrictions.Adapt as unnecessary restrictions.Adapt as needs and resources change.needs and resources change.

FacilitieFacilities:s:

Page 17: Introduction to Operating systems & RTOS

Cost:

Low maintenance cost and the system should not require constant attention.Efficient service and good algorithms must be provided at low cost

Page 18: Introduction to Operating systems & RTOS

OS ComponentsOS Components Kernel: Core components of the OSKernel: Core components of the OS

Process scheduler :Process scheduler : Determines when and for long each process executesDetermines when and for long each process executes

Memory manager :Memory manager : Determines when and how memory is allocated to Determines when and how memory is allocated to

processesprocesses Decides what to do when main memory is fullDecides what to do when main memory is full

File system :File system : Organizes named collections of data in persistent Organizes named collections of data in persistent

storage storage Networking :Networking :

Enables processes to communicate with one anotherEnables processes to communicate with one another

Page 19: Introduction to Operating systems & RTOS

The primary functions of an The primary functions of an operating system operating system

Multiplexing the processor(s)Multiplexing the processor(s) Scheduling the processesScheduling the processes Coordinating interaction among Coordinating interaction among

processes,interprocess communication and processes,interprocess communication and Synchronization.Synchronization.

Managing the system Managing the system resources(I/O,memory,data files)resources(I/O,memory,data files)

Enforcing acess control and protectionEnforcing acess control and protection Maintaining the system integrity and Maintaining the system integrity and

performing error recoveryperforming error recovery Providing an interface to the usersProviding an interface to the users

Page 20: Introduction to Operating systems & RTOS

TYPES OF OPERATING TYPES OF OPERATING SYSTEMSSYSTEMS

There are three types of Operating There are three types of Operating systems based on their applicationsystems based on their application

• Stand-Alone Operating systemStand-Alone Operating system• Network Operating systemsNetwork Operating systems• Embedded Operating systemsEmbedded Operating systems

Page 21: Introduction to Operating systems & RTOS

Stand-Alone Operating systemStand-Alone Operating system

It is a complete operating system It is a complete operating system that works that works

on a desktop or notebook computer.on a desktop or notebook computer.

Examples of stand-alone operating Examples of stand-alone operating systems are:systems are:

DOSDOS Windows 2000 professionalWindows 2000 professional Mac OS XMac OS X

Page 22: Introduction to Operating systems & RTOS

Network Operating systemsNetwork Operating systems It is an operating system that provides It is an operating system that provides

extensive support for computer networks. extensive support for computer networks. A network operating system typically A network operating system typically resides on a server. resides on a server.

Examples of a network Operating system Examples of a network Operating system are:are:

Windows 2000 serverWindows 2000 server UnixUnix LinuxLinux SolarisSolaris

Page 23: Introduction to Operating systems & RTOS

Embedded Operating Embedded Operating systemsystem

You can find this operating system You can find this operating system on handheld computers and small on handheld computers and small devices. It resides on a ROM chip. devices. It resides on a ROM chip. Examples of embedded operating Examples of embedded operating systems are :systems are :

o Windows CEWindows CEo Pocket PC 2002Pocket PC 2002o Palm OSPalm OS

Page 24: Introduction to Operating systems & RTOS

Now Lets see various Now Lets see various Operating systems and Operating systems and

their featurestheir features

Page 25: Introduction to Operating systems & RTOS
Page 26: Introduction to Operating systems & RTOS
Page 27: Introduction to Operating systems & RTOS
Page 28: Introduction to Operating systems & RTOS
Page 29: Introduction to Operating systems & RTOS
Page 30: Introduction to Operating systems & RTOS
Page 31: Introduction to Operating systems & RTOS
Page 32: Introduction to Operating systems & RTOS
Page 33: Introduction to Operating systems & RTOS
Page 34: Introduction to Operating systems & RTOS
Page 35: Introduction to Operating systems & RTOS
Page 36: Introduction to Operating systems & RTOS
Page 37: Introduction to Operating systems & RTOS
Page 38: Introduction to Operating systems & RTOS
Page 39: Introduction to Operating systems & RTOS
Page 40: Introduction to Operating systems & RTOS
Page 41: Introduction to Operating systems & RTOS
Page 42: Introduction to Operating systems & RTOS
Page 43: Introduction to Operating systems & RTOS
Page 44: Introduction to Operating systems & RTOS
Page 45: Introduction to Operating systems & RTOS
Page 46: Introduction to Operating systems & RTOS
Page 47: Introduction to Operating systems & RTOS
Page 48: Introduction to Operating systems & RTOS
Page 49: Introduction to Operating systems & RTOS
Page 50: Introduction to Operating systems & RTOS
Page 51: Introduction to Operating systems & RTOS
Page 52: Introduction to Operating systems & RTOS
Page 53: Introduction to Operating systems & RTOS
Page 54: Introduction to Operating systems & RTOS
Page 55: Introduction to Operating systems & RTOS
Page 56: Introduction to Operating systems & RTOS
Page 57: Introduction to Operating systems & RTOS
Page 58: Introduction to Operating systems & RTOS

Operating systems Operating systems market share market share

S.NS.Noo

Operating Operating systemsystem

Market Market shareshare

11

22

33

44

55

66

77

88

991010

1111

Windows XP Windows XP Windows Vista Windows Vista

Windows 2000 Windows 2000

Mac OS Mac OS

MacIntel MacIntel

Windows 98Windows 98

Linux Linux

Windows NT Windows NT Windows MeWindows Me

Ninendo Wii Ninendo Wii

Other Other

81.94%81.94%

4.52%4.52%

4.00%4.00%

3.52%3.52%

2.48%2.48%

1.14%1.14%

0.71%0.71%

0.66%0.66%

0.59%0.59%

0.17%0.17%

0.20%0.20%

Page 59: Introduction to Operating systems & RTOS

REAL- TIME OPERATING REAL- TIME OPERATING SYSTEM (RTOS) : SYSTEM (RTOS) :

““The ability of the operating system The ability of the operating system to provide a required level of service to provide a required level of service in a bounded response time”. in a bounded response time”.

Or Or

The Real time operating system is an The Real time operating system is an operating system that make it operating system that make it suitable for building real time suitable for building real time computing applications also known computing applications also known as real timeas real time systems(RTS). systems(RTS).

Page 60: Introduction to Operating systems & RTOS

What is a real time What is a real time system(RTS)?system(RTS)?

A RTS is a system where correctness of A RTS is a system where correctness of computing depends not only on the computing depends not only on the correctness of the logical result of the correctness of the logical result of the computation but also on the result of computation but also on the result of delivery time. In a well designed RTS delivery time. In a well designed RTS each individual dead line should be each individual dead line should be met.But in practice it is not possible and met.But in practice it is not possible and also costly to achieve this also costly to achieve this requirement.So, people classified the real requirement.So, people classified the real time systems in to the following types.time systems in to the following types.

Page 61: Introduction to Operating systems & RTOS

Hard Real timeHard Real time: :

Here missing an individual deadline Here missing an individual deadline results in catastrophic failure of the results in catastrophic failure of the system which also causes a great system which also causes a great financial loss .financial loss .

The examples for Hard real time The examples for Hard real time systems aresystems are::

Air traffic controlAir traffic control Nuclear power plant controlNuclear power plant control

Page 62: Introduction to Operating systems & RTOS

Firm Real timeFirm Real time

In this, missing a deadline results in In this, missing a deadline results in unacceptable quality reduction. unacceptable quality reduction. Technically there is no difference Technically there is no difference with hard Real time, but economically with hard Real time, but economically the disaster risk is limited.the disaster risk is limited.

Examples for Firm real time are :Examples for Firm real time are :o Failure of Ignition of a automobileFailure of Ignition of a automobileo Failure of opening of a safe Failure of opening of a safe

Page 63: Introduction to Operating systems & RTOS

Soft real timeSoft real time::

Here the dead line may not be fulfilled Here the dead line may not be fulfilled and can be recovered from. The and can be recovered from. The reduction in system quality and reduction in system quality and performance is at an acceptable level.performance is at an acceptable level.

Examples of Soft real time systems :Examples of Soft real time systems : Multimedia transmission and reception Multimedia transmission and reception Networking, telecom (Mobile) networks Networking, telecom (Mobile) networks websites and serviceswebsites and services Computer gamesComputer games

Page 64: Introduction to Operating systems & RTOS

Components of an RTOSComponents of an RTOS Process (task) managementProcess (task) management

Scheduler Scheduler Synchronization mechanismSynchronization mechanism

Interprocess communication (IPC)Interprocess communication (IPC)SemaphoresSemaphores

Memory managementMemory management Interrupt service mechanismInterrupt service mechanism I/O management , H.A.LayerI/O management , H.A.Layer Development EnvironmentsDevelopment Environments Communication subsystems (Option)Communication subsystems (Option) Board Support Packages (BSP)Board Support Packages (BSP)

Page 65: Introduction to Operating systems & RTOS

Features of Features of RTOS’sRTOS’s

Predictability Predictability Timeliness Timeliness ReliabilityReliability Fault tolerantFault tolerant Efficiency of System Efficiency of System

ComponentsComponents

Resource Allocation.Resource Allocation.

Interrupt Handling.Interrupt Handling.

Other issues like kernel Other issues like kernel size.size.

Page 66: Introduction to Operating systems & RTOS

Types of RTOSTypes of RTOS

Commercial RTOSsCommercial RTOSs VxWorksVxWorks QNXQNX MicroC/OS-IIMicroC/OS-II RTLinuxRTLinux Windows CE Windows CE

( www.microsoft.com)( www.microsoft.com)

Page 67: Introduction to Operating systems & RTOS

VxWorksVxWorks

This is from Wind River (This is from Wind River (www.windriver.comwww.windriver.com).).

One of the most popular real time One of the most popular real time operating systemoperating system

This has been used in the Mars pathfinderThis has been used in the Mars pathfinder It supports a number of processors It supports a number of processors

including Power Pc, Intel strong including Power Pc, Intel strong ARM,ARM,Hitachi SuperH, Motorola ARM,ARM,Hitachi SuperH, Motorola ColdFire etc… ColdFire etc…

It supports multiple scheduling algorithm It supports multiple scheduling algorithm and also priority inheritanceand also priority inheritance

Page 68: Introduction to Operating systems & RTOS

QNX NeutrinoQNX Neutrino It is a popular real time operating system from It is a popular real time operating system from

QNX software systems limited (www. qnx.com)QNX software systems limited (www. qnx.com) It supports a number of Processors namely It supports a number of Processors namely

ARM,MIPS,Power PC,SH-4,X86 &Pentium…ARM,MIPS,Power PC,SH-4,X86 &Pentium… It has support for C,C++ and Java languages It has support for C,C++ and Java languages

and TCP/IP protocol stack.and TCP/IP protocol stack. This supports multiple scheduling algorithms This supports multiple scheduling algorithms

and up to 65,535 tasks. My SQL can be and up to 65,535 tasks. My SQL can be integrated with this OS to create embedded integrated with this OS to create embedded database applications.database applications.

Even small embedded systems can use this OS Even small embedded systems can use this OS as it requires 64K Kernel ROM and 32K kernel as it requires 64K Kernel ROM and 32K kernel RAMRAM

Page 69: Introduction to Operating systems & RTOS

MicroC/OS-IIMicroC/OS-II Microcontroller operating system Microcontroller operating system

version –II is developed by Jean version –II is developed by Jean J.Labrosse(J.Labrosse(www.ucos-II.com)iswww.ucos-II.com)is a a preemptive real-time operating system preemptive real-time operating system which is popular in academic which is popular in academic institutions for teaching RTOS concepts.institutions for teaching RTOS concepts.

It can support only 64 tasks out of which It can support only 64 tasks out of which eight are system taskseight are system tasks

Round-robin scheduling algorithm is not Round-robin scheduling algorithm is not supported by this OSsupported by this OS

Page 70: Introduction to Operating systems & RTOS

RTLinuxRTLinux This OS was developed by FSM Labs(This OS was developed by FSM Labs(

www.fsmlabs.comwww.fsmlabs.com) and available in two ) and available in two versions RTLinux Pro and RTLinuxFree.versions RTLinux Pro and RTLinuxFree.

The RTLinux Pro is the priced edition and The RTLinux Pro is the priced edition and RTLinux Free is the free open source RTLinux Free is the free open source release.release.

RTLinux is a hard real-time operating RTLinux is a hard real-time operating system with support for many processors system with support for many processors such as such as x86,Pentium,PowerPC,ARM,Fujitsu,MIPS x86,Pentium,PowerPC,ARM,Fujitsu,MIPS and Alphaand Alpha

It does not support priority inheritance. It does not support priority inheritance.

Page 71: Introduction to Operating systems & RTOS

Windows CEWindows CE

Windows CE (also known officially as Windows CE (also known officially as Windows Embedded Compact and Windows Embedded Compact and sometimes abbreviated WinCE) is an sometimes abbreviated WinCE) is an operating system developed by operating system developed by Microsoft for minimalistic computers Microsoft for minimalistic computers and embedded systems. and embedded systems.

Windows CE is optimized for devices Windows CE is optimized for devices that have minimal storage—a Windows that have minimal storage—a Windows CE kernel may run in under a megabyte CE kernel may run in under a megabyte of memoryof memory

Page 72: Introduction to Operating systems & RTOS

The system supports 256 priority levels The system supports 256 priority levels and uses priority inheritance for dealing and uses priority inheritance for dealing with priority inversion. The fundamental with priority inversion. The fundamental unit of execution is the thread. This helps unit of execution is the thread. This helps to simplify the interface and improve to simplify the interface and improve execution time.execution time.

A distinctive feature of Windows CE A distinctive feature of Windows CE compared to other Microsoft operating compared to other Microsoft operating systems is that large parts of it are systems is that large parts of it are offered in source code form.offered in source code form.

Page 73: Introduction to Operating systems & RTOS

Programming languages Programming languages UsedUsed

C is most widely used in RTOS programmingC is most widely used in RTOS programming

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

Assembly languages for increasing efficiency Assembly languages for increasing efficiency and reusing the previous codeand reusing the previous code

Java may also be a choice for some Java may also be a choice for some applications applications

Page 74: Introduction to Operating systems & RTOS

Which is the Best?Which is the Best?

It is always very difficult to judge which It is always very difficult to judge which RTOS is the best and which is the RTOS is the best and which is the worst.It depends on the application and worst.It depends on the application and interests of the user. Among the above, interests of the user. Among the above, Linux is royalty free but it has serious Linux is royalty free but it has serious drawbacks if it comes to real-time drawbacks if it comes to real-time behavior. The VxWorks is a very old and behavior. The VxWorks is a very old and stable RTOS. Similarly Windows CE 5.0 stable RTOS. Similarly Windows CE 5.0 version RTOS is a robust and stable version RTOS is a robust and stable regarding the real-time behavior.regarding the real-time behavior.

Page 75: Introduction to Operating systems & RTOS

REFERENCESREFERENCES

Modern Operating Sytems-Modern Operating Sytems- Andrew S. Andrew S. Tanenbaum (PHI)Tanenbaum (PHI)

Operating Systems –W. Stallings (PHI)Operating Systems –W. Stallings (PHI) Operating system Concepts-Avi Operating system Concepts-Avi

Silberschatz & Peter Baer Galvin.Silberschatz & Peter Baer Galvin. Operating Systems-D. M. Dhamdhere- Operating Systems-D. M. Dhamdhere-

TMHTMH

Page 76: Introduction to Operating systems & RTOS