Vous êtes sur la page 1sur 66

Operating System Overview

Chapter 2

Operating System
Definition:
A program that controls the execution of application programs An interface between applications and hardware

Operating System Objectives


1. Convenience
Makes the computer more convenient to use

2. Efficiency y
Allows computer system resources to be used in an efficient manner

3. Ability to evolve
Permit effective development, testing, and introduction f i t d ti of new system functions without t f ti ith t interfering with service

Obj. 1: 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 b l below: fi
y a set of system p g programs in assisting program creation, management of files and controlling I/O. Application running and pp g will call this utilities to perform function.

OS as a User/Computer Interface 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 f the t di t ki i for th programmer and for application programs to access and use those facilities and services services.

OS as a User/Computer Interface Interface..


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 y

OS as a User/Computer Interface Interface..


Error detection and response
Errors occur while computer run: internal and external hardware errors I t Internal and external h d l d t l 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 Interface..


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

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

Obj 2: OS as Resource Manager Obj.


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 f managing th resources. i ibl for i the Functions same way as ordinary computer ft software
It is program that is executed The differences are OS directs th processor i in Th diff di t the the use of the other system resources and in the timing o its e ecu o o o e p og a s e g of s execution of other programs.

OS as Resource Manager 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 work. Figure 2.2 shows the main resources that are managed by the operating system 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.

Obj 3: Ease of Evolution of an OS Obj.


Major OS will evolved over the time because:
Hardware upgrades and new types of hardware hard are New services Fixes
Fix a faults

Evolution of Operating Systems


Serial Processing Simple B t h S t Si l Batch System Multiprogrammed Batch System Time Sharing System

Serial Processing
No operating system User i t U interact di tl with computer h d t directly ith t 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.

Serial Processing Processing..


How it works?
Programs i machine code were l d d via P in hi d loaded i 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.

Serial Processing Processing..


2 main problems:
Scheduling S h d li
Used a hardcopy sign-up sheet to reserve machine time. Problem arise when user sign up more that the time needed or cant complete their job with the time reserve 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.

Serial Processing Processing..


Over the time, various system software tools were developed to attempt to make serial processing more efficient.
Libraries f Lib i of common f functions, li k ti linkers, loaders, debuggers and I/O driver routines.

Simple Batch Systems


Early machine was so expensive so it is important to maximize machine utilization min the idle time of the processor. To i T improve utilization, th concept of a b t h tili ti the t f batch OS was developed. Central idea behind the simple batch batchprocessing scheme was the used of software known as the monitor monitor.

Simple Batch Systems Systems..


With monitor user have no longer direct access to the machine 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

Simple Batch Systems Systems..


How monitor works:
Monitor reads jobs one at a time from the input device Monitor places a j in the user p g p job program area A monitor instruction branches to the start of the user program Execution of user program continues until E ti f ti til
End of program occurs Error occurs

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

Simple Batch Systems 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

Simple Batch Systems Systems..


Example of job format using FORTRAN language:
$JOB $FTN
FORTRAN Program $LOAD $RUN DATA $END

Simple Batch Systems Systems..


With JCL:
Each read instruction (in user program) causes one line of input to be read Causes i C input routine (OS) to be invoke t ti t b i k
Checks for not reading JCL line Skip to the next JCL line at completion of user program

Simple Batch Systems Systems..


In summary, the monitor or batch OS:
It is 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. available hardware to effectively alternate execution from various parts of memory

Simple Batch Systems 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.

Evolution of Operating Systems.. Systems


Timer
prevents a job f t j b from monopolizing th system li i the t 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

Multiprogrammed Batch System


Uniprogramming:
Processor execute a job, when job need for I/O, processor must wait for I/O instruction to complete before proceed execute the same job

Multiprogrammed Batch System System..


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

Multiprogrammed Batch System System..

Multiprogrammed Batch System System..


Example:
JOB1 Type of job Duration Need disk? Need terminal Need printer? 5 min. No No No JOB2 15 min. 100 K No Yes No JOB3 Heavy I/O 10 min. 80 K Yes No Yes

Heavy compute Heavy I/O

Memory required 50K y q

Evolution of Operating Systems.. Systems


Effects of multiprogramming:
Uniprogramming Processor use Memory use Disk use Printer use Elapsed time Throughput rate Mean response time 22% 30% 33% 33% 30 min. 6 jobs/hr 18 min. Multiprogramming 43% 67% 67% 67% 15 min. 12 jobs/hr 10 min.

Time Sharing
Desirable to provide a mode in which the user interacts directly with the computer, i.e. transaction processing Batch B t h multiprogramming d lti i does not support t t interactions with users so time sharing was developed developed. Time sharing extends multiprogramming to jobs. handle multiple interactive jobs

Time Sharing Sharing..


It is called time sharing because the processors 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.

Evolution of Operating Systems.. Systems


Both batch OS and time sharing use multiprogramming. The differences between batch OS and time sharing i shown b l h i is h below.
Batch Multiprogramming Principal objective Maximize processor use Job control language commands provided with the job Time Sharing Minimize response time

Source of directives to operating system

Commands entered at the terminal

Major Achievements
OS is the most complex pieces of software ever developed. Five major theoretical advances in the development of OS: d l t f OS
Process M t Memory M Management Information protection and security Scheduling d S h d li and resource management t System structure

Major Achievements

Process

Introduced to obtain a systematic way of monitoring and controlling program execution. Definitions of process:
A program in execution An instance of a program running on a computer The entity that can be assigned to and executed on a processor A unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources

Major Achievements
Improper synchronization

Process Process..

Difficulties with Designing System Software


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

Failed mutual exclusion


Must permit only one program at a time to perform a transaction on a portion of data.

Nondeterminate program operation p g p


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

Major Achievements
Deadlocks

Process Process..

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

Consists of three components C i t f th t


An executable program A i t dd t d d by the Associated data needed b th program Execution context of the program
All information the CPU needs to execute the process All information the operating system needs to p g y manage the process

Major Achievements

Process.. Process

Major Achievements
M t Management

Memory

Five principle storage management responsibilities:


Process isolation Automatic allocation and management Support for modular programming Protection d P t ti and access control t l Long-term storage

The k Th key contribution i virtual memory and t ib ti is i t l d file system facilities.

Major Achievements
Management Management.. Virtual memory:

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 disk
the user has access to a memory space that is y p larger than real memory

Major Achievements
Management Management..

Memory

All memory references made by a program are to i t l be ith t virtual memory which can b either hi h
a linear address space a collection of segments (variable-length blocks) (variable length

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) th d i d bl k of d t i swapped i the desired block f data is d in

Major Achievements
M Management.. t File System:

Memory

Implements long-term store (often on disk) Information stored in named objects called files fil
a convenient unit of access and protection for OS

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

Major Achievements
Management Management.. Paging:

Memory

Allows process to be comprised of a number of fixed-size blocks, called pages Virtual dd Vi t l address i a page number and an is b d offset within the page Each page may be located any where in main memory Real address or physical address in main p y memory

Major Achievements
Management.. Management

Memory

Major Achievements

I f ti Protection d Security it Information P t ti and S Protection of information is needed since the growth i th use of ti th in the f time-sharing systems and h i t d computer network. Work i W k in security and protection as it relates t it d t ti l t to OS can be roughly grouped into four categories. categories
Availability
Protecting the system against interruption

Major Achievements
Confidentiality

I f Information P t ti and S ti Protection d Security.. it


Assures that user cannot read data for which access is unauthorized

Data Integrity
Protection of data from unauthorized modification

Authenticity
Proper verification of identity of users and the validity of messages or data

Major Achievements

S h d li and R t Scheduling d Resource M 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 R ll ti d h d li li t consider three factors: Fairness
give equal and fair access to all processes

Differential responsiveness
discriminate between different classes of jobs

Major Achievements
Efficiency

S h d li and R t Scheduling d Resource M Management..


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

Major Achievements
S t System St t Structure Because of its enormous complexity, the OS can be viewed as a series of levels Each level performs a related subset of functions f ti Each level relies on the next lower level to perform more primitive f f i iti functions ti Well defined interfaces: one level can be modified without affecting other levels This decomposes a problem into a number of more manageable sub problems

Operating System Design Hierarchy


Level Name 13 12 11 10 Shell User processes Directories Devices Objects User programming environment User processes Directories Example Operations Statements in shell language Quit, kill, suspend, resume Create, destroy, attach, detach, search, list

External devices, such Open close devices Open, close, as printer, displays read, write and keyboards Files Pipes Create, destroy open Create destroy, open, close read, write Create, destroy, open. close, read, read write

9 8

File system Communications

Operating System Design Hierarchy


Level Name 7 6 5 Virtual Memory Local secondary store Objects Segments, pages Example Operations Read, write, fetch

Blocks of data, device Read, write, allocate, free channels Suspend, resume, wait, signal

Primitive processes Primitive process, semaphores, ready list

Operating System Design Hierarchy


Level Name 4 Interrupts retry programs Procedures P d Instruction Set Objects Interrupt-handling Example Operations Invoke, mask, unmask,

3 2

Procedures, call stack, P d ll k display

Mark M k stack, call, return k ll

Evaluation stack, micro- Load, store, add, subtract program i t interpreter, t branch b h scalar and array data Registers, gates, buses, etc. t Clear, transfer, activate, complement l t

Electronic circuits

Characteristics of Modern OS
New design elements were introduced recently. In response to new hardware development
multiprocessor machines high-speed networks faster processors and larger memory

In response to new software needs


multimedia applications Internet and Web access Client/Server applications

Characteristics of Modern OS
Changes not only in modification and enhancement to existing architectures but also in new ways of organizing the operating system system. Much of the works fits into:
1. 2. 3. 3 4. 5. 5

Microkernel architecture Multithreading Symmetric multiprocessing Distributed OS Object-oriented design Object oriented design.

Characteristics of Modern OS Mi k l Architecture Microkernel A hit t Only a few essential functions in the kernel
primitive memory management (address space) Interprocess communication (IPC) I t i ti basic scheduling

Other Oth OS services are provided by processes i id d b running in user mode (servers)
device drivers file system virtual memory drivers, system, memory

More flexibility, extensibility, portability

Characteristics of Modern OS M ltith di Multithreading A process is a collection of one or more threads that can run simultaneously Useful when the application consists of several tasks th t d t k that do not need to be serialized t dt b i li d Gives the programmer a greater control over the timing of application related events application-related All threads within the same process share the same data and resources and a part of the processs execution context

Characteristics of Modern OS M ltith di Multithreading.. It is easier to create or destroy a thread or switch among threads ( f the same process) (of ) than to do these with processes.

Characteristics of Modern OS S t i Multiprocessing i Symmetric M lti Refers to a computer hardware architecture and also to the operating system behavior that reflects that architecture. Standalone computer system with the St d l t t ith th following characteristics:
A computer with multiple processors These processors share the same main memory and I/O facilities, interconnected by a facilities communication bus or other internal connection scheme.

Characteristics of Modern OS S t i Multiprocessing.. i Symmetric M lti


All processor can perform the same functions f ti Existence of multiple processors is transparent to the user user.

Advantages over uniprocessor architecture:


1. 1 2. 3. 3 4.

Performance Availability Incremental Growth Scaling

Characteristics of Modern OS Di t ib t d OS Distributed DOS is a collection of independent computers that appears to the users of the system as a single computer. Provides the illusion f P id th ill i of a single main memory i l i and single secondary memory space, i.e. appearing as a single system system. E.g.. Cluster computer.

Characteristics of Modern OS Obj t O i t d D i Object Oriented Design Used for adding modular extensions to a small kernel Enables programmers to customize an operating system without disrupting system ti t ith t di ti t integrity

Vous aimerez peut-être aussi