Operating System Overview Chapter 2. Operating System Definition: A program that controls the...

66
Operating System Overview Chapter 2

Transcript of Operating System Overview Chapter 2. Operating System Definition: A program that controls the...

Page 1: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Operating System Overview

Chapter 2

Page 2: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Operating System

Definition: A program that controls the execution of

application programs An interface between applications and

hardware

Page 3: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Operating System Objectives

1. Convenience Makes the computer more convenient to use

2. Efficiency Allows computer system resources to be

used in an efficient manner

3. Ability to evolve Permit effective development, testing, and

introduction of new system functions without interfering with service

Page 4: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

OS as a User/Computer Interface Hardware and software used in providing

applications to a user can be viewed in a layered or hierarchical fashion as shown in figure below:

Page 5: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

OS as a User/Computer Interface.. OS in 3rd layer masks the details of hardware

from the programmer with a convenient interface for using the system.

OS act as a mediator,making it easier for the programmer and for application programs to access and use those facilities and services.

Page 6: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

OS typically provides services in the following areas: Program development

Editors and debuggers Program execution Access to I/O devices Controlled access to files System access

OS as a User/Computer Interface..

Page 7: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Error detection and responseErrors occur while computer run:

internal and external hardware errors– Internal and external hardware errors– Software errors– OS cannot grant request of application

OS provide response that clear the error condition with least impact to running applications

OS as a User/Computer Interface..

Page 8: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Response:– Ending program that cause error– Retrying the operation– Reporting error to application

OS as a User/Computer Interface..

Page 9: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Accounting collect statistics monitor performance used to anticipate future enhancements used for billing users

OS as a User/Computer Interface..

Page 10: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

OS as Resource Manager

A computer is a set of resources for the movement, storage and processing of data and for the control of these functions.

OS is responsible for managing the resources.

Functions same way as ordinary computer software

It is program that is executed

The differences are OS directs the processor in the use of the other system resources and in the timing of its execution of other programs.

Page 11: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

OS as Resource Manager..

Operating system relinquishes control of the processor to execute other programs and then resumes control long enough to prepare the processor to do the next piece of work.

Figure 2.2 shows the main resources that are managed by the operating system.

A portion of the OS is stored in main memory.

This include the kernel or nucleus which contains the most frequently used functions in the OS and other portions of OS that currently in use.

Page 12: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.
Page 13: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Ease of Evolution of an OS

Major OS will evolved over the time because:

Hardware upgrades and new types of hardware

New services

FixesFix a faults

Page 14: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems

Serial ProcessingNo operating system/ interact directly with computer hardware.

Machines run from a console with display lights and toggle switches, input device, and printer

This mode of operation could be termed serial processing because users have access to the computer in series.

Page 15: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

How it works?Programs in machine code were loaded via the input device (e.g.. Card Reader)

If there is an error (indicating by the lights) halt the program.

Then the programmer will proceed to examine processor registers and main memory to determine the cause of error.

If the program proceeds to normal completion, the output will be printed.

Page 16: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

2 main problems:Scheduling

– Used a hardcopy sign-up sheet to reserve machine time.

– Problem arise when user sign up more that the time needed or can’t complete their job with the time reserve.

Setup time– Many steps involve in running a single program/job– If error occurred, user had to go back to the

beginning setup step.– Much of the time is spending on setting up

program.

Page 17: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..Over the time, various system software tools were developed to attempt to make serial processing more efficient.

Libraries of common functions, linkers, loaders, debuggers and I/O driver routines.

Page 18: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems ..

Simple Batch SystemsEarly machine was so expensive so it is important to maximize machine utilization min the idle time.

To improve utilization, the concept of a batch OS was developed.

Central idea behind the simple batch-processing scheme was the used of software known as the monitor.

Page 19: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

With monitor user have no longer direct access to the machine.

Monitors:Software that controls the running programs

Batch jobs together

Program branches back to monitor when finished

Resident monitor is in main memory and available for execution

Page 20: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.
Page 21: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

How monitor works:Monitor reads jobs one at a time from the input deviceMonitor places a job in the user program areaA monitor instruction branches to the start of the user programExecution of user program continues until

End of program occursError occurs

This will cause the CPU to fetch its next instruction from monitor.

Page 22: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

With each job, instructions are included in a primitive form of job control language (JCL)

Special type of programming language used to provides instruction to the monitor

what compiler to use

what data to use

Page 23: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

Example of job format using FORTRAN language:

$JOB

$FTN…FORTRAN Program…$LOAD$RUN…DATA…$END

Page 24: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

With JCL:Each read instruction (in user program) causes one line of input to be read

Causes input routine (OS) to be invokeChecks for not reading JCL line

Skip to the next JCL line at completion of user program

Page 25: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

In summary, the monitor or batch OS:Simply a computer program

Relies on the ability of the processor to fetch instructions from the various portions of the main memory to alternately seize and relinquish control.

Relies also on available hardware to effectively alternate execution from various parts of memory

Page 26: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

Desirable hardware features for batch OS: Memory protection

– do not allow the memory area containing the monitor to be altered by users programs

– If it happen, processor should detect an error and transfer control to the monitor.

– Monitor will abort the job, print out error message and load the next job.

Page 27: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

Timer– prevents a job from monopolizing the system

– Timer is set at the beginning of each job.

– An interrupt occurs when time is expired

Privileged instruction– Can be executed only by the monitor

– An interrupt occurs if a program tries these instructions.

– E.g. I/O instructions.

Interrupts– Provides flexibility for relinquishing control to and

regaining control from user programs

Page 28: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

Uniprogramming:Processor must wait for I/O instruction to complete before preceding

Page 29: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

Multiprogramming:When one job needs to wait for I/O, the processor can switch to the other job

Page 30: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

Page 31: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.
Page 32: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

JOB1 JOB2 JOB3

Type of job Heavy compute Heavy I/O Heavy I/O

Duration 5 min. 15 min. 10 min.

Memory required 50K 100 K 80 K

Need disk? No No Yes

Need terminal No Yes No

Need printer? No No Yes

Example:

Page 33: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

Uniprogramming Multiprogramming

Processor use 22% 43%

Memory use 30% 67%

Disk use 33% 67%

Printer use 33% 67%

Elapsed time 30 min. 15 min.

Throughput rate 6 jobs/hr 12 jobs/hr

Mean response time 18 min. 10 min.

Effects of multiprogramming:

Page 34: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

Time SharingDesirable to provide a mode in which the user interacts directly with the computer, i.e. transaction processing

Batch multiprogramming does not support interactions with users so time sharing was developed.

Time sharing extends multiprogramming to handle multiple interactive jobs.

Page 35: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

It is called time sharing because the processor’s time is shared among multiple users.

Multiple users simultaneously access the system through the terminals, with OS interleaved the execution of user program in a short burst of computation.

Page 36: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Evolution of Operating Systems..

Both batch OS and time sharing use multiprogramming.

The differences between batch OS and time sharing is shown below.

Batch Multiprogramming Time Sharing

Principal objective Maximize processor use Minimize response time

Source of directives to operating system

Job control language commands provided with the job

Commands entered at the terminal

Page 37: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.
Page 38: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements

OS is the most complex pieces of software ever developed.

Five major theoretical advances in the development of OS:

Process

Memory Management

Information protection and security

Scheduling and resource management

System structure

Page 39: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Process

Introduced to obtain a systematic way of monitoring and controlling program execution.

Definitions of process:A program in executionAn instance of a program running on a computerThe entity that can be assigned to and executed on a processorA unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources

Page 40: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Process..

Difficulties with Designing System Software Improper synchronization

ensure a process waiting for an I/O device receives the signal

Failed mutual exclusionMust permit only one program at a time to perform a transaction on a portion of data.

Nondeterminate program operationprogram should only depend on input to it, not relying on common memory areas

Page 41: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Process..

DeadlocksTwo or more programs wait endlessly after each other to perform an operation.

Consists of three componentsAn executable program

Associated data needed by the program

Execution context of the programAll information the CPU needs to execute the process

All information the operating system needs to manage the process

Page 42: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Process..

Page 43: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Memory Management

Five principle storage management responsibilities:

Process isolation

Automatic allocation and management

Support for modular programming

Protection and access control

Long-term storage

The key contribution is virtual memory and file system facilities.

Page 44: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Memory Management..

Virtual memory:It allows programs to address memory from a logical point of view without regard to the amount that is physically available

While a program is running only a portion of the program and data is kept in (real) memory

Other portions are kept in blocks on diskthe user has access to a memory space that is larger than real memory

Page 45: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Memory Management..

All memory references made by a program are to virtual memory which can be either

a linear address space

a collection of segments (variable-length blocks)

The hardware (mapper) must map virtual memory address to real memory address

If a reference is made to a virtual address not in memory, then

(1) a portion of the content of real memory is swapped out to disk

(2) the desired block of data is swapped in

Page 46: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Memory Management..

File System:Implements long-term store (often on disk)

Information stored in named objects called files

a convenient unit of access and protection for OS

Files (and portions) may be copied into virtual memory for manipulation by programs

Page 47: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Paging:Allows process to be comprised of a number of fixed-size blocks, called pages

Virtual address is a page number and an offset within the page

Each page may be located any where in main memory

Real address or physical address in main memory

Major Achievements – Memory Management..

Page 48: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.
Page 49: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Memory Management..

Page 50: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Information Protection and Security

Protection of information is needed since the growth in the use of time-sharing systems and computer network.

Work in security and protection as it relates to OS can be roughly grouped into four categories.

AvailabilityProtecting the system against interruption

Page 51: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Information Protection and Security..

ConfidentialityAssures that user cannot read data for which access is unauthorized

Data IntegrityProtection of data from unauthorized modification

AuthenticityProper verification of identity of users and the validity of messages or data

Page 52: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Scheduling and Resource Management

A key task of the OS is to manage the various resources available and to schedule their use by the various by active process.

Resource allocation and scheduling policy must consider three factors:

Fairnessgive equal and fair access to all processes

Differential responsivenessdiscriminate between different classes of jobs

Page 53: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – Scheduling and Resource Management..

Efficiencymaximize throughput, minimize response time, and accommodate as many uses as possible

Page 54: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Major Achievements – System Structure

Because of it’s enormous complexity, the OS can be viewed as a series of levels

Each level performs a related subset of functions

Each level relies on the next lower level to perform more primitive functions

Well defined interfaces: one level can be modified without affecting other levels

This decomposes a problem into a number of more manageable sub problems

Page 55: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Operating System Design Hierarchy

Level Name Objects Example Operations

13 Shell User programming Statements in shell languageenvironment

12 User processes User processes Quit, kill, suspend, resume

11 Directories Directories Create, destroy, attach, detach,search, list

10 Devices External devices, such Open, close,as printer, displays read, writeand keyboards

9 File system Files Create, destroy, open, closeread, write

8 Communications Pipes Create, destroy, open. close,read, write

Page 56: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Operating System Design Hierarchy

Level Name Objects Example Operations

7 Virtual Memory Segments, pages Read, write, fetch

6 Local secondary Blocks of data, device Read, write, allocate, freestore channels

5 Primitive processes Primitive process, Suspend, resume, wait, signalsemaphores, readylist

Page 57: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Operating System Design Hierarchy

Level Name Objects Example Operations

4 Interrupts Interrupt-handling Invoke, mask, unmask, retry

programs

3 Procedures Procedures, call stack, Mark stack, call, return

display

2 Instruction Set Evaluation stack, micro- Load, store, add, subtract

program interpreter, branchscalar and array data

1 Electronic circuits Registers, gates, buses, Clear, transfer, activate,

etc. complement

Page 58: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Characteristics of Modern OS

New design elements were introduced recently.

In response to new hardware developmentmultiprocessor machineshigh-speed networksfaster processors and larger memory

In response to new software needsmultimedia applicationsInternet and Web accessClient/Server applications

Page 59: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Characteristics of Modern OS

Changes not only in modification and enhancement to existing architectures but also in new ways of organizing the operating system.

Much of the works fits into:1. Microkernel architecture

2. Multithreading

3. Symmetric multiprocessing

4. Distributed OS

5. Object-oriented design.

Page 60: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Characteristics of Modern OS - Microkernel Architecture

Only a few essential functions in the kernelprimitive memory management (address space)

Interprocess communication (IPC)

basic scheduling

Other OS services are provided by processes running in user mode (servers)

device drivers, file system, virtual memory…

More flexibility, extensibility, portability…

Page 61: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Characteristics of Modern OS - Multithreading

A process is a collection of one or more threads that can run simultaneously

Useful when the application consists of several tasks that do not need to be serialized

Gives the programmer a greater control over the timing of application-related events

All threads within the same process share the same data and resources and a part of the process’s execution context

Page 62: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Characteristics of Modern OS - Multithreading..

It is easier to create or destroy a thread or switch among threads (of the same process) than to do these with processes.

Page 63: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Characteristics of Modern OS - Symmetric Multiprocessing

Refers to a computer hardware architecture and also to the operating system behavior that reflects that architecture.

Standalone computer system with the following characteristics:

A computer with multiple processors

These processors share the same main memory and I/O facilities, interconnected by a communication bus or other internal connection scheme.

Page 64: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Characteristics of Modern OS - Symmetric Multiprocessing..

All processor can perform the same functions

Existence of multiple processors is transparent to the user.

Advantages over uniprocessor architecture:1. Performance

2. Availability

3. Incremental Growth

4. Scaling

Page 65: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Characteristics of Modern OS - Distributed OS

DOS is a collection of independent computers that appears to the users of the system as a single computer.

Provides the illusion of a single main memory and single secondary memory space, i.e. appearing as a single system.

E.g.. Cluster computer.

Page 66: Operating System Overview Chapter 2. Operating System Definition:  A program that controls the execution of application programs  An interface between.

Characteristics of Modern OS - Object Oriented Design

Used for adding modular extensions to a small kernel

Enables programmers to customize an operating system without disrupting system integrity