Comput er Syst em Overview I nt roduct ion A comput er syst em - - PowerPoint PPT Presentation

comput er syst em overview i nt roduct ion
SMART_READER_LITE
LIVE PREVIEW

Comput er Syst em Overview I nt roduct ion A comput er syst em - - PowerPoint PPT Presentation

Comput er Syst em Overview I nt roduct ion A comput er syst em consist s of har dwar e syst em pr ogr ams applicat ion pr ogr ams 2 Oper at ing Syst em Pr ovides a set of ser vices t o syst em user s (collect ion of


slide-1
SLIDE 1

Comput er Syst em Overview

slide-2
SLIDE 2

2

I nt roduct ion

  • A comput er syst em consist s of

– har dwar e – syst em pr ogr ams – applicat ion pr ogr ams

slide-3
SLIDE 3

3

Oper at ing Syst em

  • Pr ovides a set of ser vices t o syst em user s (collect ion
  • f ser vice pr ogr ams)
  • Shield bet ween t he user and t he har dwar e
  • Resour ce manager :

– CPU(s) – memor y and I / O devices

slide-4
SLIDE 4

4

Comput er syst em over view: st ar t ing f r om 0 Basic f unct ionalit y of a comput er syst em: I nst r uct ion Cycle

slide-5
SLIDE 5

5

A closer -t o-r ealit y-view of t odays’ pr ocessor s (a) A t hr ee-st age pipeline (b) A super scalar CPU (c – to appear) Multicore CPUs

slide-6
SLIDE 6

6

Basic Element s of a Comput er Syst em

  • Pr ocessor + r egist er s
  • Main Memor y (“r eal” or

pr imar y memor y) – volat ile

  • I / O modules

– secondar y memor y devices – communicat ions equipment – t er minals

  • Syst em bus

– communicat ion among pr ocessor s, memor y, and I / O modules

slide-7
SLIDE 7

7

Regist er s: 1. User -Visible

  • May be r ef er enced by machine lang.

– By bot h applicat ion and syst em programs

  • Enable pr ogr ammer t o minimize main-

memor y r ef er ences by opt imizing r egist er use

  • Types of user -visible r egist er s

– Dat a – Addr ess

  • I ndex: f or indexed addressing,
  • f f set
  • St ack point er: f or procedure calling
slide-8
SLIDE 8

8

Regist er s: 2. Cont r ol and St at us

  • Used by

– pr ocessor t o cont r ol execut ion – oper at ing-syst em t o cont r ol t he execut ion of pr ogr ams

  • Basic C&S r egist er s:

– Program Count er (PC)

  • Cont ains t he address of an

inst ruct ion t o be f et ched – I nst ruct ion Regist er (I R)

  • Cont ains t he inst ruct ion most

recent ly f et ched – Program St at us Word (PSW)

  • condit ion codes (posit ive/ negat ive/

zero result , overf low, … )

  • I nt errupt enable/ disable
  • Supervisor/ user mode
slide-9
SLIDE 9

9

I nst r uct ion Cycle r evisit

  • Pr ocessor f et ches inst r uct ion f r om memor y

– Program count er (PC) holds address of inst ruct ion t o be f et ched next ; PC is increment ed af t er each f et ch – Fet ched inst ruct ion is placed in t he inst ruct ion regist er

  • Types of inst r uct ions

– Pr ocessor -memor y – Pr ocessor -I / O – Dat a pr ocessing – Cont r ol: alt er sequence of execut ion

slide-10
SLIDE 10

10

I s t hat enough f or ....

  • Component s of a simple personal comput er

Monitor

Bus

slide-11
SLIDE 11

11

I nt errupt s!

  • An int errupt ion of t he normal sequence of

execut ion! Why?

– Somet hing went wr ong (div. by 0, r ef er ence

  • ut side user ’s memor y space, har dwar e f ailur e,…

) – Timer – I / O

  • and t hen?

– I nt er r upt handler t akes cont r ol:

  • a pr ogr am t hat det er mines t he nat ur e of t he

int er r upt and per f or ms what ever act ions ar e needed

  • gener ally par t of t he oper at ing syst em
slide-12
SLIDE 12

12

I nt er r upt Cycle

  • Pr ocessor checks f or int er r upt s
  • I f no int er r upt s f et ch t he next inst r uct ion f or t he

cur r ent pr ogr am

  • I f an int er r upt is pending, suspend execut ion of t he

cur r ent pr ogr am, and execut e t he int er r upt handler

slide-13
SLIDE 13

13

Cont r ol f low wit h int er r upt s

slide-14
SLIDE 14

14

What happens

(a) St eps in st art ing an I / O device and get t ing int errupt (b) How t he CPU is int errupt ed

(a) (b)

slide-15
SLIDE 15

15

I nt er r upt s as suppor t f or I / O

Not e:

  • I nt er r upt s allow t he pr ocessor t o execut e ot her

inst r uct ions while an I / O oper at ion is in pr ogr ess

  • I mpr ove pr ocessing ef f iciency
slide-16
SLIDE 16

16

I nt er r upt -Dr iven I / O

  • Pr ocessor is int er r upt ed when I / O

module r eady t o exchange dat a

  • Pr ocessor is f r ee t o do ot her wor k
  • No needless wait ing

BUT:

  • St ill consumes a lot of pr ocessor

t ime because ever y wor d r ead or wr it t en passes t hr ough t he pr ocessor How about using DMA …

slide-17
SLIDE 17

17

I / O using Dir ect Memor y Access (DMA)

  • The pr ocessor is only involved at

t he beginning and end of t he t r ansf er

– Pr ocessor gr ant s I / O (DMA) module aut hor it y t o r ead f r om or wr it e t o memor y a block of dat a – An int er r upt is sent when t he t ask is complet e

  • Pr ocessor is f r ee t o do ot her

t hings

slide-18
SLIDE 18

18

Mult iple I nt er r upt s Q: To int er r upt an int er r upt ?

1. Sequent ial Or der : af t er int er r upt handler complet es, pr ocessor checks f or addit ional int er r upt s 2. Pr ior it ies: High pr ior it y int er r upt s:

  • cause lower -pr ior it y

int er r upt s t o wait – cause a lower -pr ior it y int er r upt handler t o be int er r upt ed – Example: when input ar r ives f r om communicat ion line, it needs t o be absor bed quickly t o make r oom f or mor e input

slide-19
SLIDE 19

19

Comput er Hardware Review (7)

St ruct ure of a large Pent ium syst em

slide-20
SLIDE 20

20

Cache Memory

  • I ncrease t he speed of memory

– Pr ocessor speed is higher t han memor y speed

Hit : t he inf ormat ion was in cache; else, miss

  • I nvisible t o operat ing syst em
slide-21
SLIDE 21

21

Cache Design: I mpor t ant issues

  • 1. Cache size
  • 2. Block size
  • 3. Mapping f unct ion
  • det ermines which cache locat ion t he

block will occupy

  • 4. Replacement algorit hm
  • det ermines which block t o replace

(e.g. Least -Recent ly-Used (LRU) algorit hm)

  • 5. Writ e policy
  • Can occur every t ime block is updat ed
  • Can occur only when block is replaced

– Minimizes memory operat ions – Leaves memory in an obsolet e st at e

slide-22
SLIDE 22

22

Memor y Hier ar chy

Going Down t he Hier ar chy

  • I ncr easing capacit y, I ncr easing access

t ime

  • Decr easing cost per bit , Decr easing

f r equency of access of t he memor y

– localit y of ref erence: during program execut ion memory addresses t end t o clust er (it erat ion loops, subrout ines, … )

slide-23
SLIDE 23

Operat ing Syst em Overview

slide-24
SLIDE 24

24

Layers of Comput er Syst em

slide-25
SLIDE 25

25

Oper at ing Syst em – OS obj ect ives

  • Pr ovides a set of ser vices

t o syst em user s

  • Shield bet ween t he user

and t he har dwar e

  • Resour ce manager :

– CPU(s) – memor y and I / O devices

  • Convenience

– Makes t he comput er mor e convenient t o use

  • Ef f iciency

– Allows comput er syst em r esour ces t o be used in an ef f icient manner

  • Abilit y t o evolve

– Per mit int r oduct ion of new syst em f unct ions wit hout int er f er ing wit h ser vice

slide-26
SLIDE 26

26

Ser vices Pr ovided by t he Oper at ing Syst em

  • Pr ogr am execut ion:

– CPU scheduling, resource (memory) allocat ion and management , synchronizat ion

  • Access t o I / O devices

– Unif orm int erf aces, hide det ails, opt imise resources (disk scheduling)

  • Cont r olled access t o f iles

– And st ruct ure of dat a

  • Syst em/ r esour ce access

– Aut horizat ion, prot ect ion, allocat ion

  • Ut ilit ies, e.g. f or pr ogr am development

– Edit ors, compilers, debuggers

  • Er r or det ect ion and r esponse, when, e.g.

– hardware, sof t ware errors – operat ing syst em cannot grant request of applicat ion

  • Monit or ing, account ing
slide-27
SLIDE 27

27

Oper at ing Syst em: … (r oughly) it is a pr ogr am …

  • r elinquishes

cont r ol of t he pr ocessor t o execut e ot her pr ogr ams OS Ker nel:

  • (r oughly) por t ion
  • f OS t hat is in

main memor y

  • Cont ains most -

f r equent ly used f unct ions

slide-28
SLIDE 28

28

Some hist or y: Evolut ion of Oper at ing Syst ems

  • Har dwar e upgr ades, new t ypes of har dwar e, enabled

f eat ur es

  • New ser vices, new needs
slide-29
SLIDE 29

29

OS hist ory: bef ore t he st one age

Ser ial Pr ocessing

  • No oper at ing syst em
  • Machines r un f r om a console wit h display light s and

t oggle swit ches, input device, and pr int er

  • Schedule t ome
  • Set up included

– loading t he compiler , sour ce pr ogr am, – saving compiled pr ogr am – loading – linking

slide-30
SLIDE 30

30

OS hist or y: f ir st “t ools” appear Simple Bat ch Syst ems:

  • Monit or s

– Sof t war e t hat cont r ols t he r unning pr ogr ams – Bat ch j obs t oget her – Pr ogr am br anches back t o monit or when f inished – Resident monit or is in main memor y and available f or execut ion

  • J ob Cont r ol Language (J CL)

– Pr ovides inst r uct ion t o t he monit or

  • what compiler t o use
  • what dat a t o use
slide-31
SLIDE 31

31

OS hist or y: Har dwar e Feat ur es…

… which made t he f irst t ools possible:

  • Memor y pr ot ect ion

– do not allow t he memor y ar ea cont aining t he monit or t o be alt er ed

  • Pr iviledged inst r uct ions

– Only f or monit or, e.g. f or int erf ace wit h I / O devices

  • I nt er r upt s

– Mechanisms f or t he OS t o r elinquish cont r ol and r egain it

  • Timer

– pr event s a j ob f r om monopolizing t he syst em

slide-32
SLIDE 32

32

OS hist or y: Uni/ mult i-pr ogr amming

f rom uniprogramming… .

Pr ocessor must wait f or I / O inst r uct ion t o complet e bef or e pr oceeding

… t o Mult iprogramming

When one j ob needs t o wait f or I / O, t he pr ocessor can swit ch t o t he ot her j ob

slide-33
SLIDE 33

33

Early bat ch syst em

– bring cards t o 1401 – read cards t o t ape – put t ape on 7094 which does comput ing – put t ape on 1401 which print s out put

slide-34
SLIDE 34

34

OS hist or y: Mult ipr ogr amming, Time Shar ing Time shar ing syst ems use mult ipr ogr amming t o handle mult iple int er act ive j obs

  • Pr ocessor’s t ime is shar ed among mult iple user s
  • Mult iple user s simult aneously access t he syst em

t hr ough t er minals

Batch Multiprogramming Time Sharing Principal objective Maximize processor use Minimize response time Source of directives to

  • perating system

Job control language commands provided with the job Commands entered at the terminal

slide-35
SLIDE 35

35

OS hist or y: mult ipr ogr amming needs …

memor y management !

slide-36
SLIDE 36

36

Summary: evolut ion

  • First generat ion 1945 - 1955

– vacuum t ubes, plug boards

  • Second generat ion 1955 - 1965

– t ransist ors, bat ch syst ems

  • Third generat ion 1965 – 1980

– I Cs and mult iprogramming

  • Fourt h generat ion 1980 – present

– personal comput ers

  • More cont emporary present :

– Personal comput ers become parallel

slide-37
SLIDE 37

37

Zooming in a f ew key services The main j ob of OS is t o: run processes! ...

slide-38
SLIDE 38

38

Process:t he concept

Pr ocess = a pr ogr am in execut ion

  • Example pr ocesses:

– OS ker nel – OS shell – Pr ogr am execut ing af t er compilat ion – www-br owser

slide-39
SLIDE 39

39

Process: I mplement at ion Consist s of t hree component s

  • An execut able program
  • Associat ed dat a needed

by t he program

  • Execut ion cont ext of

t he program

– All inf or mat ion t he

  • per at ing syst em needs t o

manage t he pr ocess

Execut ion cont ext

  • f t he pr ogr am
slide-40
SLIDE 40

40

Processes creat e ot her processes

  • A process t ree

– A (e.g. shell) creat ed t wo child processes, B (e.g. browser) and C (print ) – B creat ed t hree child processes, D, E, and F (various browser services/ windows)

slide-41
SLIDE 41

41

Procs need: synchronizat ion, ...

Two processes connect ed by a pipe

slide-42
SLIDE 42

42

… , t o get CPU t ime and ot her resources, …

Goals when allocat ing r esour ces t o pr ocesses:

  • Fair ness and Dif f er ent ial r esponsiveness

– give f air access t o all pr ocesses – discr iminat e bet ween dif f er ent classes of j obs

  • Ef f iciency

– maximize t hr oughput , minimize r esponse t ime, and accommodat e as many user s as possible

slide-43
SLIDE 43

43

... t o get resources wit hout deadlock, ... (a) A pot ent ial deadlock. (b) an act ual deadlock.

slide-44
SLIDE 44

44

..., t o do I O, access f iles, ...

I mport ant issues:

  • Organizat ion of inf ormat ion
  • Ef f icient access
slide-45
SLIDE 45

45

… , t o get memory

Memory Management

I mpor t ant issues:

  • Pr ocess isolat ion

– Pr event int er f er ence bet ween dif f er ent pr ocesses – Pr ot ect ion and access cont r ol when shar ing memor y

  • Allocat ion

– Cr eat e, dest r oy modules dynamically – Suppor t f or modular pr ogr amming – Ef f iciency, good ut ilizat ion

slide-46
SLIDE 46

46

Virt ual Memory

  • Allows pr ogr ammer s t o addr ess memor y f r om a logical

point of view (wit hout wor r ying about t he physical availabilit y)

  • Tr ansf er memor y disk: t r anspar ent t o t he

pr ocesses

slide-47
SLIDE 47

47

Maj or Element s of an Operat ing Syst em

  • OS = ver y lar ge piece of

sor t war e!

  • Component s: decompose a

pr oblem int o mor e manageable subpr oblems (pr ocess manager , f ile manager , et c)

  • Boot st r ap pr ogr am act ivat es

OS ker nel (per manent syst em pr ocess)

– Shell ( kernel): program t o let t he user init iat e processes

  • User or syst em pr ogr ams

make dir ect use of t he OS via syst em calls

slide-48
SLIDE 48

48

St eps in Making a Syst em Call

st eps in making t he syst em call

read (fd, buffer, nbytes)

slide-49
SLIDE 49

49

Some Syst em Calls

slide-50
SLIDE 50

50

A st ripped down shell

while (TRUE) { /* repeat forever * / type_prompt( ); /* display prompt * / read_command (command, parameters) /* input from terminal * / if (fork() != 0) { /* fork off child process * / /* Parent code * / waitpid( -1, &status, 0); /* wait for child to exit * / } else { /* Child code * / execve (command, parameters, 0); /* execute command * / } }

slide-51
SLIDE 51

51

slide-52
SLIDE 52

52

I ssues in Modern Operat ing Syst ems

  • Micr oker nel ar chit ect ur e

– Only f ew essent ial f unct ions in ker nel; OO design

  • Mult it hr eading

– A pr ocess may consist of sever al sequent ial t hr eads of execut ion

  • Concur r ent comput er syst ems

– Symmet r ic mult i-pr ocessor syst ems – Mult i-t hr eaded/ mult icor e pr ocessor s – Dist r ibut ed syst ems

  • provide t he illusion of a single main memory and single

secondary memory space in clust er-based plat f orms

  • Real-t ime Oper at ing Syst ems

– For t ime-cr it ical applicat ions, mult imedia, …

  • Embedded Oper at ing Syst ems

– Const r aint s: limit ed r esour ces, special f unct ionalit ies

slide-53
SLIDE 53

53

Microkernel

  • Small OS cor e; cont ains only essent ial OS f unct ions:

– Low-level memory management (address space mapping) – Process scheduling – I / O and int errupt management

  • Many ser vices t r adit ionally included in t he OS ker nel ar e now

ext er nal subsyst ems

– device drivers, f ile syst ems, virt ual memory manager, windowing syst em, securit y services

slide-54
SLIDE 54

54

Benef it s of a Microkernel Organizat ion

  • Unif or m int er f ace on r equest made by a pr ocess

– All services are provided by means of message passing

  • Dist r ibut ed syst em suppor t

– Message are sent wit hout knowing what t he t arget machine is

  • Ext ensibilit y

– Allows t he addit ion/ removal of services and f eat ures

  • Por t abilit y

– Changes needed t o port t he syst em t o a new processor is changed in t he microkernel - not in t he ot her services

  • Obj ect -or ient ed oper at ing syst em

– Component s are obj ect s wit h clearly def ined int erf aces t hat can be int erconnect ed

  • Reliabilit y

– Modular design; – Small microkernel can be rigorously t est ed

slide-55
SLIDE 55

55

Concurrent Comput er Syst ems

each instruction executed on a dif f erent set of data by the dif f erent processors a set of processors simultaneously execute dif f erent instruction sequences on dif f erent data sets

slide-56
SLIDE 56

56

Symmet ric Mult iprocessors (and mult icores)

  • Pr ocessors shar e t he same memor y and I / Os
  • Ker nel can execut e on any pr ocessor
  • Scheduling & synchr onizat ion, memor y management &

consist ency (also r esear ch issues)

slide-57
SLIDE 57

57

Clust er Comput er Plat f orms

  • Net wor k
  • Middlewar e layer (par t of OS) t o pr ovide

– single-syst em image (synchr onizat ion, consist ency, global st at es, f ile syst ems) – f ault -t oler ance, load balancing, par allelism

slide-58
SLIDE 58

58

I nst ant iat ion: UNI X

  • Har dwar e is sur r ounded by t he oper at ing-syst em
  • Oper at ing syst em is called t he ker nel
  • Moder n unix ver sions (solar is) mor e complex
  • Comes wit h a number of user ser vices and int er f aces

– Shell, compiler s, …

slide-59
SLIDE 59

59

I nst ant iat ion: Windows

  • Client / Ser ver

comput ing; base f or dist r ibut ed comput ing

  • Modif ied micr oker nel

ar chit ect ur e

– not a pur e micr oker nel: many syst em f unct ions

  • ut side of t he

micr oker nel r un in ker nel mode – modules can be r emoved, upgr aded, or r eplaced wit hout r ewr it ing t he ent ir e syst em