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 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 3
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 4
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 5
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 6
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, of f set • St ack point er: f or procedure calling 7
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 8
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 9
I s t hat enough f or .... Monitor Bus • Component s of a simple personal comput er 10
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 out 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 11
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 12
Cont r ol f low wit h int er r upt s 13
What happens (a) (b) (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 14
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 15
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 … 16
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 17
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 18 t o make r oom f or mor e input
Comput er Hardware Review (7) St ruct ure of a large Pent ium syst em 19
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 20
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 21
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, … ) 22
Operat ing Syst em Overview
Layers of Comput er Syst em 24
Oper at ing Syst em – OS obj ect ives • Pr ovides a set of ser vices • Convenience t o syst em user s – Makes t he comput er mor e convenient t o use • Shield bet ween t he user • Ef f iciency and t he har dwar e – Allows comput er syst em r esour ces t o be used in an ef f icient manner • Resour ce manager : • Abilit y t o evolve – CPU(s) – Per mit int r oduct ion of new – memor y and I / O devices syst em f unct ions wit hout int er f er ing wit h ser vice 25
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 26
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 of OS t hat is in main memor y • Cont ains most - f r equent ly used f unct ions 27
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 28
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 29
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 30
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 31
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 32
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 33
Recommend
More recommend