Advanced Operating System- Introduction

43
Debasis Das

description

Introduction to Advanced Operating systems. Many university courses run advanced/ distributed operating system courses in their 4 year engineering programs. This is based on WBUT CS 704 D course but matches many such courses run by different universities. If you need to downloaad this presentation, please send me an email at [email protected]

Transcript of Advanced Operating System- Introduction

Page 1: Advanced Operating System- Introduction

Debasis Das

Page 2: Advanced Operating System- Introduction

SyllabusProcess synchronizationProcess DeadlocksDistributed operating SystemDistributed OS ImplementationMultiprocessor SystemsPerformance, co-processors, RISC &

DataflowAnalytic modelingSecurity & Protection

MIT CS704D Advanced OS Class of 2011 2

Page 3: Advanced Operating System- Introduction

Recommended BooksOperating Systems Concepts & designs –

Milan Milenkovic, Tata McGraw Hill

Operating System- H M Dietel, Pearson

Advanced concepts in Operating Systems –

Mukesh Singhal, Niranjan Shivaratri, Tata

McGraw Hill

MIT CS704D Advanced OS Class of 2011 3

Page 4: Advanced Operating System- Introduction

Additional BooksDistributed operating Systems Concepts

& Design – Pradeep K SinhaDistributed Operating Systems- Andrew

S Tanenbaum, Tata McGraw HillModern Operating Systems – Andrew S

Tanenbaum, PearsonOperating System principles=Abraham

Silberschanz, Peter B Galvin, Greg Gagne, Wiley Asia

MIT CS704D Advanced OS Class of 2011 4

Page 5: Advanced Operating System- Introduction

MIT CS704D Advanced OS Class of 2011 5

Page 6: Advanced Operating System- Introduction

Evolution of OSSerial processing: Take one job, complete the

execution, print out results, take the next job

Batch processing: Take a batch of jobs,

process them

Multiprogramming: Manage program

execution as programs come in. Multiple ones

may be in execution.MIT CS704D Advanced OS Class of 2011 6

Page 7: Advanced Operating System- Introduction

MIT CS704D Advanced OS Class of 2011 7

ProgramExecution

ProgramDevelopment

EditCompileExecute

Page 8: Advanced Operating System- Introduction

Serial processingTheoretically at least, I can program

everything to process a program from start to finish

Use of input/ Output devices : punched cards, paper tapes (late fifties)

Add I/O routineLoader, linker, librarian formed the

rudimentary OS

MIT CS704D Advanced OS Class of 2011 8

Page 9: Advanced Operating System- Introduction

Batch processingAutomate sequencingSome housekeeping, like mounting of tapes

required to be done manually.Batch several programs on a single tape,

housekeeping required only oncePhasing = place similar programs in one

batchLoad Fortran compiler only once for a batch of

Fortran programsNeed for a Job Control language (JCL)

MIT CS704D Advanced OS Class of 2011 9

Page 10: Advanced Operating System- Introduction

JCLJob beginning and end markersLoading of programCompiling and execution of the programCommands to define resource requirements

such as execution time, memory requirements

A batch monitor (memory resident part of the batch operating system) would read, interpret and execute these commands

MIT CS704D Advanced OS Class of 2011 10

Page 11: Advanced Operating System- Introduction

Improvements Through the Batch OS

Increased system resources utilization,

throughput by reducing the idle time between

programs

Program development is not helped much

Turn around times were long

Debug was offline and difficult to do from

memory dumpMIT CS704D Advanced OS Class of 2011 11

Page 12: Advanced Operating System- Introduction

Further Changes Program execution becoming quite fast, slow

I/O times started becoming noticeableOverlapping of I/O with batch operations

were the need of the hourDMA channels, peripheral controllers and

even dedicate I/O controllers started appearing

SPOOL, read/write to disk files

MIT CS704D Advanced OS Class of 2011 12

Page 13: Advanced Operating System- Introduction

MIT CS704D Advanced OS Class of 2011 13

Typical program

Compute

I/OComput

eI/O

Possible speed up

Compute

I/OComput

eI/O

Compute

I/OComput

eI/O

Degree of multiprogramming= number of programs competing for resources

Higher the degree of multiprogramming, higher the resource utilization

Page 14: Advanced Operating System- Introduction

Example of Multiprogramming

Time shared systems; program, data stored on secondary storage

Users provide the job control commands interactively; compile, run and so on

Debug is easier with a separate debug system in the OS

Program development is helped by interactive edit, compile, debug etc.

MIT CS704D Advanced OS Class of 2011 14

Page 15: Advanced Operating System- Introduction

MIT CS704D Advanced OS Class of 2011 15

Page 16: Advanced Operating System- Introduction

Types of Operating Systems Studied

Batch OS

Multiprogramming OS

Time sharing systems

Real time systems

A combination OSMIT CS704D Advanced OS Class of 2011 16

Page 17: Advanced Operating System- Introduction

Aspects of Operating Systems

Compared

Processor scheduling

Memory management

I/O management

File management

MIT CS704D Advanced OS Class of 2011 17

Page 18: Advanced Operating System- Introduction

Batch Operating System

Program, data, system commands submitted togetherVery little interaction with users, practically noneBetter resource utilizationLong turn aroundDifficult debugPrograms with long execution times are well suited; e.g

payroll, forecasting, statistical analysis etc.Scheduling is first come first servedMemory management is simpleNo time critical I/O management requiredRudimentary file system may be present

MIT CS704D Advanced OS Class of 2011 18

Page 19: Advanced Operating System- Introduction

Multiprogramming operating Systems

System throughput and resource utilization can be improved

Supports two or more active processes, code and data of which needs to be in memory

Hardware and/or software memory protection required

Supports multiple users, user authentication, per user accounting of resource usage needed

Multi access systemMulti processor system

MIT CS704D Advanced OS Class of 2011 19

Page 20: Advanced Operating System- Introduction

Time-Sharing SystemsMulti programming, multi user systemProgram development environment,

Computer aided design, text processing systems

Good terminal response time requiredTime sliced, round robin schedulingMemory management must provide

protection. Data sharing also may be neededI/O management must preserve system

integrity & good performanceMIT CS704D Advanced OS Class of 2011 20

Page 21: Advanced Operating System- Introduction

Real-time SystemsEvents external to the computer must be processedQuick even-response required Industrial control, flight control, telephone switchingMay be necessary to process thousands of interrupts w/o

missing oneUser convenience and resource utilization is on secondary

significancePriority based scheduling of unique processes connected to the

event It is also preemptiveAll processes are memory resident, processes do not die, low

movements of programs between main and secondary memoriesTime critical device management is critical, I/O management,

interrupt managementMIT CS704D Advanced OS Class of 2011 21

Page 22: Advanced Operating System- Introduction

Combination Operating Systems

Real life is a mix of situations. A university system may need to provide program development needs as well as long simulations

Combination of features are thus commonA multi user interactive system OS may

support batch operationTime shared terminal servers may need to

send and accept real time packets

MIT CS704D Advanced OS Class of 2011 22

Page 23: Advanced Operating System- Introduction

Distributed Operating System

Independent systems that communicate and collaborate via hardware and software features

OS coordinates the interaction and presents a virtual machine feel to users

System wide sharing of resources characterizes such OS, remote resources may be shared, computation may be sent to a remote node

Global naming, distributed file systems, distribution of computations are required features

MIT CS704D Advanced OS Class of 2011 23

Page 24: Advanced Operating System- Introduction

MIT CS704D Advanced OS Class of 2011 24

Page 25: Advanced Operating System- Introduction

Types of UsersUsers who get services from the OS through

commands typed at a terminal, or embedded ones

in a batch job (Command language users)

Users who obtain services through system calls

at the run time. Calls that are activated when the

program runs through them (System call users)MIT CS704D Advanced OS Class of 2011 25

Page 26: Advanced Operating System- Introduction

Command Language User’s View

System specific

Functionality is similar though, syntax varies

Typical such functions are log on & house keeping,

Program activation and control, file management,

status reporting and system management

MIT CS704D Advanced OS Class of 2011 26

Page 27: Advanced Operating System- Introduction

Log On & Housekeeping

Typically on multiuser systems

Log on and off

Password management

Setting of some initial configuration; type of

terminal, naming of file system devices

MIT CS704D Advanced OS Class of 2011 27

Page 28: Advanced Operating System- Introduction

Program Activation & Control

Loading of program, run or abort

Quite often just typing the name of the program

will run (load and execute) it

Scheduling may be available

Setting of scheduling priorities also may be

availableMIT CS704D Advanced OS Class of 2011 28

Page 29: Advanced Operating System- Introduction

File Management

Create, delete, rename, copy files

File utilities are available ( comparison etc)

Volume maintenance feat5ures

MIT CS704D Advanced OS Class of 2011 29

Page 30: Advanced Operating System- Introduction

Status ReportingStatus of user initiated activities, devices

assigned and system wide stateStatus, size and content of print queue etc

could be requested by the userPerformance stats may be made availableThese routines that monitor performance are

resource hogs, so they may be accessible to a privileged class of users only

MIT CS704D Advanced OS Class of 2011 30

Page 31: Advanced Operating System- Introduction

System managementFor system managers and maintenance personnel

Creation and maintenance of user accounts,

resource usage limits, specifying default devices

Collecting reports on system performance, behavior

Analysis of error and debug

MIT CS704D Advanced OS Class of 2011 31

Page 32: Advanced Operating System- Introduction

System call User’s View

System calls through the API (Application programming interface)

Provides all the services available through command (except log

on/off), finer and more controls

More direct control to I/O hardware

Program control (run, execute, abort, suspend, resume etc.)

Inter program communication and synchronization

Resource management ( memory allocation, release, etc.)

Device & file management (open & close a device, random access

to block structured devices, init and mode selection, etc.)

MIT CS704D Advanced OS Class of 2011 32

Page 33: Advanced Operating System- Introduction

Typical Command Flow #1

1. Typical command Edit Myfile.txt2. On CR the low level keyboard driver passes

the command to the CLI3. CLI parses the command and searches for

Edit4. If not in main memory starts a search on

disk drive through a disk driver, directory entry tells OS memory requirement

5. Memory managers allocates memory, loads into that space

6. Address maps are updatedMIT CS704D Advanced OS Class of 2011 33

Page 34: Advanced Operating System- Introduction

Typical Command Flow #27. A unique process is created with a PCB8. Program name, system id, execution priority,

pointers to address translation tables, list of allocated resources, etc. Placed into system ready list

9. Scheduler the decides when to start processing the Editor process

10. When started editor issues system calls for opening the files etc.

11. Passes message to user if not found12. Editor asks if a new file should be created,

communicates through standard input and outputMIT CS704D Advanced OS Class of 2011 34

Page 35: Advanced Operating System- Introduction

Typical Command Flow #313.Create “Myfile.txt” through a system call14.Interacts with user based on edit commands

and stores inputs into the file15.On termination, editor writes pending data in

buffers16.Closes file through system call, issues system

call for exit17.OS check PCB for any open files, closes and

terminates the process. Memory and resources are freed, PCB memory freed into the PCB pool

MIT CS704D Advanced OS Class of 2011 35

Page 36: Advanced Operating System- Introduction

MIT CS704D Advanced OS Class of 2011 36

Page 37: Advanced Operating System- Introduction

Problems & Approachesin

Design & Implementation

What are the needs of managing OS objects?

(processes, memory, files)

The structural view for implementationMIT CS704D Advanced OS Class of 2011 37

Page 38: Advanced Operating System- Introduction

Functional Requirements#1

Management of processesCreated based on user request, implicit or

explicitRequires system services, resourcesMultiple processes can compete for processing

resourcesException handling

Allocate hardware/software resources, pro6ection, access control, security

Inter-process communications, signals and message

MIT CS704D Advanced OS Class of 2011 38

Page 39: Advanced Operating System- Introduction

Functional Requirements#2Management of memory

Specific requirements of processesDynamic expansion of needs

Contiguous or non contiguous allocation of memoryFragmentation , mapping issues

(segmentation, paging, virtual memoryIsolation of processes for violating other

spaces, controlled sharing

MIT CS704D Advanced OS Class of 2011 39

Page 40: Advanced Operating System- Introduction

Functional Requirements#3File system needs

Device independent accessProtection & sharingRecovery & restoration

Distributed systemsGlobal namingDistributed file systemInter-process communication &

synchronization

MIT CS704D Advanced OS Class of 2011 40

Page 41: Advanced Operating System- Introduction

MIT CS704D Advanced OS Class of 2011 41

Kernel

Basic I/O

Memory management

File system

Command language interpreter

Page 42: Advanced Operating System- Introduction

Implementation #2Level Name Objects Typical Operations

5 CLI Environment data Statements in command language

4 File system Files, devices Create, delete, open, close, read, write

3 Memory management

Segments, pages Read, write, fetch

2 Basic I/O Data blocks Read, write, allocate, free

1 kernel Process, semaphores

Create, destroy, suspend, resume, signal, wait

MIT CS704D Advanced OS Class of 2011 42

Page 43: Advanced Operating System- Introduction

Implementation #3Goals

ReliabilityEase of maintenance

NecessaryModularityHiding complexityClean interface between layers

MIT CS704D Advanced OS Class of 2011 43