Sunteți pe pagina 1din 48

Chapter 1 Introduction to Operating System

Outline
1.1 What is OS 1.2 Computer System Organization 1.3 Computer System Architecture 1.4 OS Structure 1.5 OS Operations 1. !1." #rocess$ %emory$ Storage management 1.& #rotection and Security 1.1'( Systems

1.1 What is Operating System)

An operating system is a program that manages the computer hard*are. It also pro+ides a ,asis -or application programs and acts as an intermediary ,et*een the computer user and computer hard*are.

What do Operating System do)

.he computer system can ,e di+ided roughly into -our components/ .he hard*are .he operating system .he application so-t*are .he 0sers

1. 2. 3. 4.

0S12 3ie* o- OS

1ase to use 45ome #Cs6 1--icient resource utilization 4Wor7 stations6

S8S.1% +ie* o- OS

OS is a resource allocator %anages all resources 4C#0 time$ memory space$ storage space$ I9O and so on6 :ecides ,et*een con-licting re;uests -or e--icient and -air resource use OS is a control program Controls e<ecution o- programs to pre+ent errors and improper use o- the computer

1.2 Computer System Organization


=asic Organization Storage Structure I9O structure

Computer Startup
Bootstrap program is loaded at po*er up or re,oot .ypically stored in 2O%$ generally 7no*n as firmware Initialize all aspects o- system >oads operating system 7ernel and starts e<ecution

1.2.1 Computer System Organization

1.2.1 Computer System Organization

I9O de+ices and the C#0 can e<ecute concurrently. 1ach de+ice controller is in charge o- a particular de+ice type. 1ach de+ice controller has a local ,u--er.

Interrupt .imeline

1.2.2 Storage Structure


Main Memory: %ain memory is the only large storage media that the C#0 can access directly %ain memory is usually too small to store all needed programs and data %ain memory is a volatile storage de+ice that loses its contents *hen po*er is o--

1.2.2 Storage Structure

.here-ore$ most computer pro+ide secondary storage as e<tension to store *e, ,ro*ser$ compliers$ *ord processors?etc

Storage :e+ice 5ierarchy

1.2.2 Storage Structure

Storage systems organized in hierarchy. Speed Cost 3olatility Caching@copying in-ormation into -aster storage systemA main memory can ,e +ie*ed as a last cache -or secondary storage.

Performance of Various Levels of Storage

Caching

In-ormation in use copied -rom slo*er to -aster storage temporarily Important principle$ per-ormed at many le+els in a computer 4in hard*are$ operating system$ so-t*are6

Caching

Baster storage 4cache6 chec7ed -irst to determine i- in-ormation is there


I- it is$ in-ormation used directly -rom the cache 4-ast6 I- not$ data copied to cache and used there

Cache is usually smaller than storage ,eing cached Cache management is an important design pro,lem Cache size and replacement policy

1.3 Computer!System Architecture


1.3.1 Single!#rocessor Systems 1.3.2 %ultiprocessor Systems 1.3.3 Cluster Systems

1.3.1 Single!#rocessor Systems

On a single processor system$ there is only one main C#0 capa,le o- e<ecuting a general purpose instruction set. Some other special!purpose processors may also included. Such as/ C#0 :is7!controller microprocessor Dey,oard microprocessor

1.3.2 %ultiprocessor Systems

Also called Parallel Systems Ad+antages/ Increase throughput 1conomy o- scale Increase relia,ility 4-ault tolerant6

1. 2. 3.

1.3.2 %ultiprocessor Systems

.*o types o- multiprocessor systems/

1. Asymmetric multiprocessing 4master and sla+e processors6 2. Symmetric multiprocessing 4Shared memory system6

1.3.3 Clustered Systems

Clustered computers share storage and are closely lin7ed +ia Local-area network (LA ! or a -aster interconnection.

1.4 OS Architecture
One o- the most important aspect o- OS is the a,ility to Multiprogramming

Single user cannot 7eep C#0 and I9O de+ices ,usy at all times One Eo, selected and run +ia "o# sc$eduling When it has to *ait 4-or I9O -or e<ample6$ OS s*itches to another Eo,

Memory Layout for Multiprogrammed System

Multiprogramming

Fo,s are stored in GFo, #oolH Virtual memory is the use-ul techni;ue -or the limitation size o- p$ysical memory

1.5 OS operations

Interrupt 4dri+en ,y hard*are6 +s. .rap 4called ,y so-t*are or error6


.rap e<ample/ di+ide ,y 'A in+alid memory access

We need to ma7e sure that an error in a user program could cause pro,lems only -or the one program that *as running 4such as in-inite loop6

:ual %ode Operation

%ual-mode operation allo*s OS to protect itsel- and other system components It contains user mode 4mode ,it/16 and &ernel mode 4mode ,it/'6
.he operating system loaded user application starts in user mode. Whene+er a trap or interrupt occurs$ hard*are s*itches to 7ernel mode.

.ransition -rom user to 7ernel mode

C li,rary handling o- write()


IincludeJstdio.hK Int main46 L ? print-4Ghello* *orldH6A ? M

0ser mode Dernel mode Standard C li,rary


Write46 system call

:ual %ode Operation

Privileged instructions/ some machine instructions that may cause harm$ can only ,e e<ecuted in 7ernel mode.
Such as instruction s*itch to user modeA I9O controlA timer management$ and interrupt management.

.imer
.o pre+ent the OS out o- control ,y C#0

Set interrupt a-ter speci-ic period Operating system decrements counter When counter zero generate an interrupt Set up ,e-ore scheduling process to regain control or terminate program that e<ceeds allotted time

#rocess management

A process is a program in e<ecution. It is a unit o- *or7 *ithin the system. #rocess needs resources to accomplish its tas7 C#0$ %emory$ -iles$ I9O de+ices #rocess termination re;uires reclaim oany reusa,le resources

#rocess management

Single!threaded process has one program counter (P'! speci-ying location o- ne<t instruction to e<ecute
#rocess e<ecutes instructions se;uentially$ one at a time until completion

%ulti!threaded process has one program counter per thread

#rocess management
.he operating system is responsi,le -or the -ollo*ing acti+ities in connection *ith process management/

Creating and deleting ,oth user and system processes 4Ch36 Suspending and resuming processes 4Ch56 #ro+iding mechanisms -or process synchronization 4Ch 6 #ro+iding mechanisms -or process communication 4Ch46 #ro+iding mechanisms -or deadloc7 handling4chN6

%emory %anagement

All data in memory ,e-ore and a-ter processing All instructions in memory in order to e<ecute %emory management determines *hat is in memory *hen optimizing C#0 utilization and computer response to users

%emory management acti+ities

Deeping trac7 o- *hich parts o- memory are currently ,eing used and ,y *hom :eciding *hich processes and data to mo+e into and out o- memory Allocating and deallocating memory space as needed

Storage %anagement
OS pro+ides uni-orm$ logical +ie* oin-ormation storage

file 1ach medium is controlled ,y de+ice 4i.e.$ dis7 dri+e$ tape dri+e6

Storage %anagement
Bile!System management Biles usually organized into directories Access control on most systems to determine *ho can access *hat OS acti+ities include 1. Creating and deleting -iles and directories 2. #rimiti+es to manipulate -iles and dirs 3. %apping -iles onto secondary storage 4. =ac7up -iles onto sta,le 4non!+olatile6 storage media

Mass Mass-Storage Management

0sually dis7s used to store data that does not -it in main memory or data that must ,e 7ept -or a GlongH period o- time. OS acti+ities Bree!space management Storage allocation :is7 scheduling .ertiary storage includes optical storage$ magnetic tape 3aries ,et*een WO2% 4*rite!once$ read!many! times6 and 2W 4read!*rite6

1. 2. 3. 4. 5.

#rotection and Security

Protection@any mechanism -or controlling access o- processes or users to resources de-ined ,y the OS 4Ch146 Security@de-ense o- the system against internal and e<ternal attac7s e+en *hen protection is acti+ated 4Ch156
4including denial!o-!ser+ice$ *orms$ +iruses$ identity the-t$ the-t o- ser+ice6

#rotection and Security


Systems generally -irst distinguish among users$ to determine *ho can do *hat

0ser identities 4user (%s$ security I:s6 include name and associated num,er$ one per user 0ser I: then associated *ith all -iles$ processes othat user to determine access control Croup identi-ier 4group (%6 allo*s set o- users to ,e de-ined and controls managed$ then also associated *ith each process$ -ile Privilege escalation allo*s user to change to e--ecti+e I: *ith more rights

Computing 1n+ironments
.raditional computer

0sed to ,e single system$ then modems Oo* -ire*alled$ net*or7ed

Client!Ser+er computing

%any system no* servers$ responding re;uest to clients

Peer Peer-to to-Peer 'omputing


Another model o- distri,uted system #2# does not distinguish clients and ser+ers
Instead all nodes are considered peers %ay each act as client$ ser+er or ,oth Oode must Eoin #2# net*or7

1. 2. 3.

We,!=ased computing

We, has ,ecome u,i;uitous %ore de+ices ,ecoming net*or7ed to allo* *e, access$ such as *or7 stations$ e+en cell phone

Operating System Ser+ices


0ser inter-ace #rogram e<ecution Bile!system manipulation Communication 1rror detection 2esource allocation Accounting #rotection and security

S-ar putea să vă placă și