You are on page 1of 82

• Introduction to Operating System Concepts

• • • • Multitasking Multiprogramming Multiuser Multithreading … Batch Operating System Time–sharing Systems Distributed OS Network OS Real–Time OS

UNIT–I: Introduction

• Types of Operating Systems
• • • • •

• Various Operating System Services • Architecture

• System Calls and Programs
• Exam Questions
Unit-I: Introduction 1

Introduction to Operating System Concepts
• Prerequisites • Operating System (OS) • Resources of a Computer System • User View

• System View
• Objectives and Functions of OS • Multiprogramming • Multitasking • Multiuser

• Multithreading
Unit-I: Introduction 2


• Basic Data Structures • Computer Organisation • High–Level Language (C, …)

Unit-I: Introduction


Operating System
• Collection of System Software (Programs), which makes it User friendly and Most efficient • Controls and coordinates use of Hardware among Various Applications and Users Kernel Program running at all times on the Computer

Unit-I: Introduction


What is an Operating System? • A program that acts as an intermediary between a user of a computer and the computer hardware Operating system goals: – Execute user programs and make solving user problems easier – Make the computer system convenient to use – Use the computer hardware in an efficient manner • Unit-I: Introduction 5 .

I/O devices – System Programs Operating System • Controls and coordinates use of hardware among various applications and users – Application programs – define the ways in which the system resources are used to solve the computing problems of the users • Word processors. machines. video games – Users • People. web browsers. compilers.Computer System Structure • Computer system can be divided into four components: – Hardware – provides basic computing resources • CPU. database systems. other computers Unit-I: Introduction 6 . memory.

Most Popular Operating Systems • AT & T / BSD Unix |<< • Sun Microsystems’ Solaris 2 Linux • Microsoft MS-DOS Windows 95 / 98 / NT Windows 2000 (Windows Me) Windows XP Windows Vista Windows 7 / Windows 8 • DEC VMS (Virtual Memory System) TOPS–20 (Total Operations Processing System) • IBM OS/2 • Apple Macintosh Unit-I: Introduction 7 .

Resources of a Computer System

Hardware and Software required to solve a problem

CPU Time
Memory Space File Storage Space I/O Devices …

Unit-I: Introduction


Architecture : Four Components of a Computer System

Unit-I: Introduction


User View
• Goal • To maximize the work, the user performing • Ease of use • Don’t care about Resource utilization • Shared computer Mainframe / Minicomputer • Share Resources • Exchange Information • Designed to maximize Resource utilization • All Available CPU Time, Memory and I/O used efficiently

Unit-I: Introduction


User View
• Workstations • Connected to Networks of other workstations and Servers • Dedicated Resources at disposal • Also Share Resources such as Networking and Servers

• Handheld Computers • Standalone units for Individual users • Connected to Networks (Directly by wire / through wireless Modems and Networking) • Perform relatively few remote operations (Power, Speed, Interface limitations) • Designed mostly for individual usability • Embedded Computers in Home Devices and Automobiles • Have Numeric Keypads • May turn indicator lights on or off to show status • Designed primarily to run without user intervention

Unit-I: Introduction


• Decides to allocate Resources to Specific Programs and Users so that OS operates the Computer System Efficiently and Fairly • Important when many Users access the same computer • Control Program • Controls Execution of User Programs to prevent Errors and Improper use of Computer • Concerned with Operation and Control of I/O Devices Unit-I: Introduction 12 .System View |<< Most intimately involved with Hardware • Resource Allocator • Acts as Manager of Resources.

Operating System Definition • OS is a resource allocator – Manages all resources – Decides between conflicting requests for efficient and fair resource use OS is a control program – Controls execution of programs to prevent errors and improper use of the computer • Unit-I: Introduction 13 .

) • No universally accepted definition • “The one program running at all times on the computer” is the kernel. Unit-I: Introduction 14 . Everything else is either a system program (ships with the operating system) or an application program.Operating System Definition (Cont.

Overview • Multiprogramming: Running multiple programs “at the same time” – Requires multiplexing (sharing) the CPU • Transfer of control is called a context switch Unit-I: Introduction 15 .

device controllers connect through common bus providing access to shared memory – Concurrent execution of CPUs and devices competing for memory cycles Unit-I: Introduction 16 .Computer System Organization • Computer-system operation – One or more CPUs.

Storage-Device Hierarchy Unit-I: Introduction 17 .

Objectives and Functions of Operating System • Essential part of a Computer System • Provides an Environment within which Other programs can do Useful work • Program running at all times on the Computer (Kernel) • Program that Manages Computer Hardware • Program that acts as an intermediary between the User of a Computer and the Computer Hardware • Purpose To provide an environment in which a User can Execute Programs in a Convenient and Efficient manner Unit-I: Introduction 18 .

Objectives and Functions of Operating System |<< • Must Ensure Correct Operation of Computer System • Provides Certain Services to Programs and to the users of those programs in order to make their Tasks Easier • Controls and Coordinates the use of Hardware among Various Application Programs for the Various users • Primary Goals User friendly Efficient Operation of the Computer System Unit-I: Introduction 19 .

source program. and printer – Schedule time – Setup included loading the compiler. toggle switches.Evolution of Operating Systems • Serial Processing – No operating system – Machines run from a console with display lights. and loading and linking Unit-I: Introduction 20 . input device. saving compiled program.

Evolution of Operating Systems • Simple Batch Systems – Monitors • Software that controls the sequence of events • Batch jobs together • Program branches back to monitor when finished Unit-I: Introduction 21 .

Hardware Features • Memory protection – Do not allow the memory area containing the monitor to be altered • Timer – Prevents a job from monopolizing the system Unit-I: Introduction 22 .

Hardware Features • Privileged instructions – Certain machine level instructions can only be executed by the monitor • Interrupts – Early computer models did not have this capability Unit-I: Introduction 23 .

Memory Protection • User program executes in user mode – Certain instructions may not be executed • Monitor executes in system mode – Kernel mode – Privileged instructions are executed – Protected areas of memory may be accessed Unit-I: Introduction 24 .

Major Achievements • • • • • Processes Memory Management Information protection and security Scheduling and resource management System structure Unit-I: Introduction 25 .

Uniprogramming • Single User System • Single Program in execution. Unit-I: Introduction 26 .

Uniprogramming • Processor must wait for I/O instruction to complete before preceding Unit-I: Introduction 27 .

OS Keeps several jobs in memory simultaneously. Unit-I: Introduction 28 . Allow time-sharing. the CPU is switched to another job. Job may have to wait for some task (I/O operation) and OS simply switches to.Multiprogramming |<< No. another job. and so on. CPU is never idle. of Programs in execution. When the first job finishes waiting. Increases CPU utilisation by organizing jobs so that the CPU always has one job to execute. Picks and begins to execute one of the jobs in the memory. When that job needs to wait. and executes. it gets the CPU back.

Multitasking Solves the problem by Scheduling which task may be the one running at any given time. Unit-I: Introduction 29 . and when another waiting task gets a turn. • In Uniprocessor Systems. Context Switch • Act of reassigning a CPU from one task to another one. • Tasks Share Common Processing Resources such as CPU and Main Memory.Multitasking / Multiprocessing |<< • Multiple Tasks are performed during the Same period of time.

the processor can switch to the other job Unit-I: Introduction 30 .Multiprogramming • When one job needs to wait for I/O.

Multiprogramming Unit-I: Introduction 31 .

Time Sharing • Using multiprogramming to handle multiple interactive jobs • Processor’s time is shared among multiple users • Multiple users simultaneously access the system through terminals Unit-I: Introduction 32 .

Compatible Time-Sharing System (CTSS) • First time-sharing system developed at MIT Unit-I: Introduction 33 .

Multiuser |<< Allows for Multiple users to use the Same Computer at the Same time and Different times. Unit-I: Introduction 34 .

• Network based applications are ideally suited. Unit-I: Introduction 35 . • Examples • Linux • Unix • Windows 2000 • Applications • Any kind of application which has Distinct tasks which can be performed independently. • Any application with a GUI.Multithreading • Operating Systems that allow Different parts of a Software program to run Concurrently. |<< • Any application which requires Asynchronous response.

Types of Operating Systems |<< • Batch Processing Systems • Interactive Systems • Time Sharing • Time Slicing • Distributed Systems • Network Systems • Real–Time Systems Unit-I: Introduction 36 .

Batch Processing Systems Computer runs one and only one application at a time. Common input devices Card readers Tape drives Common output devices Line printers Tape drives Card punches Unit-I: Introduction 37 . Early Computers were physically enormous machines run from a console.

Unit-I: Introduction 38 . User did not interact directly with computer systems. CPU is often idle.Batch Processing |<< OS always resident in memory. Operators batched together jobs with similar needs and run them through the computer as a group. Programmers would leave their programs with the operator. The operator would sort the programs into batches with similar requirements and as the computer became available would run each job. User prepared a job and submitted to computer operator.

• System Responds. Unit-I: Introduction 39 .Interactive Processing |<< • User and Computer System interact. • The process goes on. • User Requests.

or cannot continue its execution. Unit-I: Introduction 40 .Time Sharing |<< Variable CPU Time to different processes. Once CPU Time is allocated to a process. will not be interrupted till it completes its execution. or waiting for an I/O.

Time Slicing |<< Equal Amount of CPU time allocated among Various Processes. Unit-I: Introduction 41 .

such as High–Speed buses. • Enables Parallelism but speed up is not the goal Unit-I: Introduction 42 .Distributed Systems • Distribute the Computation among Several Physical Processors • Loosely Coupled System • Each Processor has its Own Local Memory • Processors Communicate with one another thru Various Communications lines.

Distributed Systems |<< • Advantages of Distributed Systems • Resources Sharing • Computation Speed up–load Sharing • Reliability • Communications • Distributed Operating System • Less Autonomy between Computers • Gives the impression. Single Operating System Controlling the Network • Types of Distributed Systems • Client–Server Systems • Peer–to–Peer Systems Unit-I: Introduction 43 .

Autonomy between computers File sharing.Network Systems |<< • • • Equal Amount of CPU time allocated among Various Processes. exchange of information between computers Unit-I: Introduction 44 .

Real–Time Systems • • Special purpose OS. Accurate response time. Used when rigid time requirements have been placed on the operation of a processor or the flow of data. • • • • • • • Used as control device in a dedicated application. Well-defined. Processing must be done within the defined constraints. The computer analyses the data and possibly adjust controls to modify the sensor inputs. Fixed-time constraints. Medical imaging systems Industrial control systems Certain display systems Automobile-engine fuel-injection systems Home-appliance controllers Weapon systems Unit-I: Introduction 45 Ex: Systems controlling scientific experiments . Sensors bring data to the computer.

Soft real-time systems Critical real-time task gets priority over other tasks and retains the priority until it completes. Ex: Multimedia Advanced scientific projects Undersea exploration Planetary rovers Unit-I: Introduction 46 .Types of Real–Time Systems |<< Hard real-time systems Guarantee critical tasks be completed on time.

Evolution of Operating Systems |<< Unit-I: Introduction 47 .

of Services. Categories Program Control Status Requests I/O Requests |<< Unit-I: Introduction 48 . Lowest level – System Calls Allow running program to make requests from the OS directly.Various Operating System Services Provides No. Higher level – Command Interpreter or Shell User issues request without writing program.

Operating System Services |<< – User Interface – Program Execution – I/O Operations – File-System Manipulation – Communications – Error Detection – Other Services • Resource Allocation • Accounting • Protection and Security Unit-I: Introduction 49 .

User Interface |<< • All Operating Systems have User Interface (UI) • Command-Line Interface (CLI) • Graphics User Interface (GUI) Unit-I: Introduction 50 .

either Normally or Abnormally (indicating Error) Unit-I: Introduction 51 .Program Execution |<< • Load Program into Memory • Run the Program • End Execution.

which may involve File or I/O Device. Unit-I: Introduction 52 .I/O Operations |<< Running Program may require I/O.

Permission Management. Unit-I: Introduction 53 .File–System Manipulation |<< Programs need to Read and Write Files and Directories. List File Information. Create and Delete Files and Directories. Search Files and Directories.

Communications |<< Processes may exchange information. on the Same Computer or between Computers over a Network Communications may be via – Shared Memory or – thru Message Passing (Packets moved by the Operating System) Unit-I: Introduction 54 .

Error Detection |<< • May occur in – the CPU and Memory Hardware. – OS should take the appropriate action to ensure correct and consistent computing • Debugging facilities – can greatly enhance the User’s and Programmer’s abilities to efficiently use the System Unit-I: Introduction 55 . – I / O Devices. – User Program • For each type of Error.

Resources must be Allocated to each of them. Unit-I: Introduction 56 .Resource Allocation |<< When Multiple Users or Multiple Jobs running Concurrently.

Accounting |<< To Keep Track of Which Users use How much What Kinds of Computer Resources Unit-I: Introduction 57 .

Protection and Security |<< • Protection – Involves ensuring that all Access to System Resources is Controlled • Security of the System – from outsiders requires User Authentication. – extends to defending External I / O Devices from Invalid Access attempts Unit-I: Introduction 58 .

Basic Structure/Components of a Computer System • Hardware • Operating System • Application Programs • Users Unit-I: Introduction 59 .

Unit-I: Introduction 60 .Hardware Central Processing Unit (CPU) Memory Input–Output (I/O) / Peripheral Devices • Provides basic Computing Resources.

…) Web Browsers (Internet Explorer.Application Programs Word Processors (MS–Word) Spreadsheets (MS–Excel) Compilers (C. Mozilla) Database Systems Video Games Define the ways in which the resources are used to solve the computing problems of the users. Unit-I: Introduction 61 . Java.

Users |<< • People • Machines • Other Computers Unit-I: Introduction 62 .

System Calls and Programs • System Calls • Types of System Calls • System Programs |<< Unit-I: Introduction 63 .

Unit-I: Introduction 64 . • Methods used to Pass Parameters between a Running Program and the Operating System. • Typically written in a high-level language (C or C++) • Mostly accessed by programs via a high-level Application Program Interface (API)rather than direct system call use. – Store the Parameters in a Table in Memory.System Calls |<< System call is a Programming interface to the services provided by the OS It provides Interface between Running Program and the Operating System. and the Table Address is passed as a Parameter in a Register. and Pop off the Stack by Operating System. – Pass Parameters in Registers. Generally available as Assembly–Language Instructions. – Push (store) the Parameters onto the Stack by the Program.

API .System Call.OS relationship Unit-I: Introduction 65 .

• The caller need know nothing about how the system call is implemented • Just needs to obey API and understand what OS will do as a result call • Most details of OS interface hidden from programmer by API Unit-I: Introduction 66 .Typically a number is associated with each system call. System call interface maintains a table indexed according to these numbers The System call interface invokes the intended system call in OS kernel and returns the status of the system call and any return values.

Types of System Calls |<< • Process Control • File Management • Device Management • Information Maintenance • Communications • Example Unit-I: Introduction 67 .

Execute • Create Process.System Calls – Process Control |<< • End. Abort • Load. Set Process Attributes • Wait for time • Wait Event. Terminate Process • Get Process Attributes. Signal Event • Allocate and Free Memory Unit-I: Introduction 68 .

System Calls – File Management |<< • Create File. Close • Read. Reposition • Get File attributes. Delete File • Open. Set File attributes Unit-I: Introduction 69 . Write.

Release Device • Read. Reposition • Get Device attributes.System Calls – Device Management |<< • Request Device. Write. Set Device attributes • Logically Attach or Detach Devices Unit-I: Introduction 70 .

or Device attributes Unit-I: Introduction 71 . File. Set System Data • Get Process.System Calls – Information Maintenance |<< • Get Time or Date. File. Set Time or Date • Get System Data. or Device attributes • Set Process.

Delete Communication connection • Send.System Calls – Communications |<< • Create. Receive Messages • Transfer Status information • Attach or Detach Remote Devices Unit-I: Introduction 72 .

Unit-I: Introduction 73 .Example of System Calls |<< System Call Sequence to Copy the contents of One file to another file.

System Programs Provide Convenient environment for Program Development and execution. Categories • File Management • Status information |<< • File Modification • Programming Language Support • Program Loading and Execution • Communications Unit-I: Introduction 74 .

System Programs – File Management |<< Create Delete Copy Rename Print Dump List Manipulate Files and Directories Unit-I: Introduction 75 .

of users … Unit-I: Introduction 76 .System Programs – Status information |<< Date Time Amount of available Memory / Disk Space No.

System Programs – File modification |<< Text Editors To Create and Modify the Contents of Files Stored on Disk or Tape. … Unit-I: Introduction 77 . ed. Screen Editor – vi Line Editor – edlin.

System Programs – Programming Language Support |<< • Compilers • Assemblers • Interpreters Unit-I: Introduction 78 .

System Programs – Program Loading & Execution |<< • Absolute Loaders • Relocatable Loaders • Linkage Editors • Overlay Loaders • Debugging Systems Unit-I: Introduction 79 .

users and different computer systems.System Programs – Communications |<< Provide mechanism for creating virtual connections among processes. Transfer Files from one machine to another. Browse Web pages. Allow users to Send messages to one another’s Screens. Send Electronic Mail messages. Log-in Remotely. Unit-I: Introduction 80 .

8. Explain the concept of Multiprogramming. What are OS Objectives? 6. Discuss the basic components of a virtual computer. 5. Write about Multitasking. Unit-I: Introduction 81 . Explain basic Structure of a Computer System & also Explain its basic elements. 3. 4. Write about Evolution of Operating Systems. What is an Operating System? Explain the functions of OS. 2. Discuss the various approaches of designing an operating system. Define OS. 7.Exam Questions 1. 9.

Exam Questions |<< 10. Virtual Memory 12. What is a system call? Explain the categories of system calls. What is dispatcher? 15. 16. What are the types of real-time systems? 14. What are Distributed Operating Systems? 13. What is a system call? Explain different types of system calls. Unit-I: Introduction 82 . Timesharing c. What are the multi-tasking. Explain the following: a. Multiprogramming b. multi-programming and multithreading? 11.