You are on page 1of 97

Syllabus

___—
A ‘
Mumbai University
emic Year 2011-18
Revised syllabus (Rev-2016) from Acad
Mutual Exclusion : Requircmcma, Hanlwm Suppon. Open-ling
System Support (Semaphoms and Mulex). W E Languap

Operating System Support (Monitors). Clmical synchmuunon‘ ' pmbhm


Kudzu/Writers Pxoblem. Producer Ind Consumer pmblem.
:

cudlu
Gaul-o God- Goum Nam . ' or ' :r m -- '
-, symm 4 ahs. Deadlock Pmlenlion, Deadlock Avoidance : Budu'
news Algorithm for Single 3; Multiple Ram. Deadlock m
and Recovery. Dining Philosophers Pmblem. (fidu- Chantal!)
Course Ohj-ecti‘3 : Mum-y Mallory Managua“. : Memory Management Requimeun.
Dynamic humming.
1. T o " b a s i c r a n d " o f , ' , Mnmary Pal-imam; : Fixed Mining.
mums management. Mammy Anne-non Stu-negle- : Beat-Flt. Flm Flt. W m F“.
2. To understand the concept of moms, thread and
Next Fit. Buddy Syslcm, Relocation. Paging. Segmmian.
nizafion and deadlock.
3. To understand the concepts of process synchro
management techniqus. WMHMry:l-hrdwmdonmlSmmmDemmd
4. To undersmnd various Memory, 1/0 and File Paging. Structure of Page Tablas. Copy an Write. Page
Outcom es : A! the end of the course student should be able to layman Sll‘lllfifl : FIFO. Opfimnl. LRU. LFU.
Cause
ement. Approximniun. Counting Based. Allooafion uf Elam. Thmh‘mg.
in terms of process, memory, file and 1/0 manag
1. Understand mic of Operating System (Refer Eta-purl)
and analyse the concep t of a procws , tlmd. mutual exclusion and deadlock.
-2. Apply :C ’‘ , file
I‘
and Acacia. File
ling algorithms and lPC. F“:
3. Evaluate performance of process schedu Dimctoxies. Fxle Sharing. Secondary Stung: Management. Linux
y management techniques.
4. Apply and analyse the concepts of memor Vimnl File Syslem. (Rater Chlplfl' 5)
te the perfon nzncc of memor y allocat ion and replacement techniqucs.
5. Evalua [/0 Management Ind Dink Scheduling : IIO Devices,
ues of file and I/O management. InpulIOIltpul
6. Apply and analyze differe nt techniq f‘
MIMI/0. ' ,l‘ ' SystemDe-ignlmu.

Prerequisite : Computer Organization & Archite


cture no Buffu'ing. Disk Schnduling algorithm: PCFS. sm. SCAN.
CSCAN, LOOK. C-LOOK. Disk Min-gm“. Disk Cachc. Linux
;
IIO. (Riel-W6)

and . The " of


System C'; '
s, OS Design Consideration s fur Multipmcessor
Operating System
f‘,
' system Symm
and ‘ ' '
(Refer Chip” 1)
Calls. Linux Kernel and Shell.
Process
2. hoes-Wand Proms: : Concept uf'a Pmcegs. Pmom Smes,
ion on Processes.
Scheduling Description, Pmcess Conn-n]Block. Operat
of Mullithteading.
Thrall! : Definition and Types. COneept
Mulficom processors and flueads.
Scheduling :
Scheduling : Unipmocssor Scheduling - Types of
Pnemptiv e and, Non-plum pu've. Schedulin g Algorithm s: FCFS.
SJF. SRTN. Priority based. Round Robin, Multilevel Queue
scheduling. huoduction to Tlnead Scheduling. Mullipmoessor
Scheduling and Linux Scheduling. (Refer Chapter 2)

3, Synchronhaflonand Concurrency : Principles of Concurrency, Inter-Process


|; Mind! ConunIInicntion, Proccssmunad Syuclmmization.

Scanned by CamScanner
Scanned CamScanner
"’5'.

Er :- gmumu-SomA-ooun Tandem-i- _
2.1 m__——_34
J ””1””: m-mam—_M
mm" emu: Clam-r 1 :
f‘
Syn-m Oct-Mow 1-1 h1-11
uncoo- 2L! mm ‘0W--MZ«I

esuu .7 .._ WI.» 1 WIMMIIWWWMFWTM 22 www-mw-.__n


mummmmummsmmmn ’ W 709k: Pma- ”m“
mmwmme W M W M
01mm: 23 mmmummuu.tn_n
can. Unux Kan-land shell.
Undnsund basic open-sling syswm commands. h m h Ops-Irina mm
I m Twlc : Pne— m.—M
Undamnd and uxploxe various sysmn calls. (Doc. 1‘. Jun. 15, Nuv.15).. ......................... I4 1.4 Plus— m...“ N
Wtitc shell scripts and shzll commands using kernel APIs. :ylhbul 1098:: Q)!!!“ m OMVII and ”.1 m Said m....____—.—.N
Implcmenl andanalyze different process scheduling algomhms. ’ M Tqalc : m Gala m (”)...—.24
Implement and analyu different memory managemnnt algorithms. :wmmswunmmmm
25 Pm:- and Bud:(PCB)
moons _, and ‘ “ ‘ handling using simulator. (Jul-15M". 15)...
mull‘l’oplc: msmmomm (30‘ 1‘. 0‘ 1|) ._... 2-4
Syn-III Puma—~25
I m Topic: W m
1.8
2.5 W m PM“. W “
1.4
1.5 6’) 25.1 Prue-u M.~__...___._._._-N
0! linux like ls.chdir.mkdlr,mawn.ohmod,ohgrp.ps ate. Sym‘fople: m w m m
1. Explore theInternal MWWMM mm ....... 1-6
262 Hw-Tmm._-___fl
1.6 05%am I Spu- k: Tm- Min—“N
7. Writs shall scrim: In do the following:
2.7 m.~~_.____.—H
> Display lop 10 processes in desceMIng order 1.6.1
2.7.\ m i [ M
1.6.2
) Display processes wi1h highest memory usage. 15200Pull-hm withinW 2.5 WWW-hm
.
> Display current loggedin user and logname. 1.6213)
Win-l Mum»: Agra-m... 1-! (Ihy m , ________.___..u
> Display current shell. Mm dlrectoty. operating systemtypo, w m m p m setting. current
I swam- Toplc: Opal-tho W swam 1-8 .r spun-rope: mum-a...__a»7
1.7 Opal-lung Syn-m Swan- 1-!
working diromry. 1.7J mic 5pm 1‘! 29 Typ- d m . 5"
> Display OS version. release nunim. kennel version. 1.7.2 Layarad mn- 1-D 29 1 Um lol MM_—Z~7
|.7.3 VIM Mm -I0
> Iluslram the use a! son, grep. awk. ale. 2.9.2 Kan-l [ W m - w “
1 .7.‘ ClilnlsorvevModol 40
3. a) Crease a chlldprams:In IJnux usinglhs fork system call.Fromma child prunes:obtain 1.7.5 I W 7* : W Um 4
(Jun. 15. Nov. Is)...,..,.,...,‘ 210 We! “Mm—fl N
the pauses:ID of both child and param by us‘ng geipld and aatppld system all. Explore
SylbbulTopic: Symncu-
wait and waltpkl before terminafion of pm. I a“. Toph : m m Ifl
1.8 m cub (Jun. 15. Nov.15.In 13).. mm____ 2.
b) Explore Ihe following system calls : open. read, write, close. gelpld. selpld. getuld. getgld. 1.8 TM)" of m m CIIS(JIIIO15. MW. 15').
Sylllhll Teal: : L'llux Knmol “SM! 2.11 W Hm In T M a
gabgld, geteuid.
L10 " WY“: M 240
4. Implement basic commands a!linux like Is,op. rm and other:using kemal APIs. 1.10.1 2‘2 m._~.__~.__—.—__I-IO
1.10.2
5. Wm a program to implementany Iwo CPU schaduflng algorithms Ilka FCFS, SJF. Round Robin 1.11 2.12.! My Gnu- lfl m _. 2-10
m ZIZ‘IW Wm..m.ml~ll
2111(3) Mm: Mmfill
a. Wlfle a program to lmplemem dynamic panlfloning plammam algorithmLa Bast Flt, Flvst-Frl, ell-Mu 2: Prue-u Cone-pt
112.1(0) Winn Schad- _______...—.....I-II
Worm-Fa. etc. and Schodullllg 2-1 h m 1“
ZIZHD) M Thu.
7. Write a program to Implement various page replacement pollclas. sylm: Puma: ConavllM.lm I W Topic: 1w. cl M
Pm Mann Pm control and. W on W “WWI-12
5_ Using the CPU-OS simulauw analyze and synthesize the following : Pm
a. Process Scheduling algoriMs. 1122 mumm‘n~_ an
TIM: Dlflnlfimand m e a n - m u m .
MMamdmm. ’ WT“: WWW—......6‘2
1:. Thread creation and symrmlzmbn.
Tim-Id 21: 0mm ...... W‘s-12
1:. Outlook prevention and avdthnee.
Prumvlvo and Notwrumflve sum MIMI: FOFS. 2.13.1mammm_mw__,__mz
81F. S H M P M W M M R M W M I who»: ww-__.ma
w'l'mud 2‘12 scam-n W.m_._....~.__.._..a-1a
UDD W IMLhId-dui

Scanned by CamScanner
Scanned CamScanner
MW 2 Table(i Crumb

’ WToph: MW.m._.2-Ia I mmu-SuM-cow


2.132“) Faun fimmmro) .__._.._..——- 243 mu 0!Can-i.
112.1(0) mum-um. ' * ‘
’ Mannie :MW-sfi 3.1 I ”flu nun : Ian-no,9,...
smu-~~__.__w_m._____._.. 2-14 3.1.1 us swarm-um“. 4o.
I 47 _ u '
21m) smufimm____ __w_, 2-14 I Sinai-Topic:
" aple 32 114 Mum“. _ . 4..
:Sdllailp W u =-
v/ I *_ “A
mm.____..._.__.__ 2-15 whim-Topic: DiningManon-r M _ _ . . m
3.3 ME MMIMMM.
sum-topic = Pun_~—_.__fiu
”.16).. -m Flinn
3.3.1 8.18 EnmPflWMmWHWM-L...“ ‘9 (m "Luann
43.1 “Wyn-M“
4s; wmm MEMO
4.93 ' .4,
4.9.4 MdSzahMI
r syn-um Tcplc: Soul-um _ _ ...._M:
4.10 W___ fi___ a12
Plfllionlng,MsmovyAflmm‘ sum“ :Bm-Hmn
mfinww 4.10.1 Mm
F'LNmfiLBuddy
synan,fim.Fadng.Semmmm. bum Pam In Sow-mam
swam-rcpt“ mmmamn 1s)_~ _____ ___.‘_ us
Vlnml llama-y : Hardware and Comm! Savann (on;
114 mummmma (Sum-mm .. a. Datum
Fudm.smmadPageTablo-.Co
pyonWflp.Pm 4.11 Sam-mm Fusing—“mu:
I mucus: WW~ 2-18 Magnum Shaman: FIFO, cum, LHU. LFU Amman-mum, I ‘ W Topic: vn-I laugh—+15
Cami"
BundJllomIimoflnntmhhg ‘
4.12 mm Manx-y any1c).________.__4-15
I swam-Topic: Ham-mean Swan-‘-
Danna M m . - . us
us Hardware IndCalm swam._ 4-15
mm Danna mm (In: 14.Due.II)...——__._‘-1E
r SylhhulTople: mung-Tun 4.1:
4.14 swam u v.93Tau.- (Doc.u)_._~___uc
sylhbus'roplc Prodweramcawm 4.14.1 w Pldm
m. ...............................
L16
4.142 flashedPlgoTm._.__ __._.__ ___._m 1
mmcauwwi’maumufl,

I Swim-Topic: mmfim—l—Il
4.1a Pros WWW- =10 ' 4-1:
(June 15. MW. 1 5 , May 18, DIG. I S )..................... 3-12
Syn-bun Topic Fn'ndplaa 0 1 W 4.2.3
I Mum-m: HFO_~..__.._.. Ho
Mummmlnfl will find W ValiumPlflflionl
Wm (Contiguous Album) .........
4.1m FIFO Alum"..... no
.. .
I syn-nu-Topic: 0mm~~~~~~~___.4-19
Sylmbuu Topic : Resource Mutton G «152 ommalFag:Rama-umMalawi!)
chant-r8: , lnd" adios-25
3.10.8 Manama Allocation Grlpho (Doc. 1!). “A .r SyllImTople: mu-__m._,. un_
I syllabus Topic : Dow Prevention
4.25 mu LustEmmy Used (LHU)PlgeRon-cum
swam : Cancun-my : Prindnlsa d Cammcy. Inm- 3.11 Dudlock Pmmion Naomm..................
Pmoau Ommunlnlkm. Pincus/111mm!muhronlnflon (Doc.14, Junu15,Nov.15)............. 4.3 mm
Mutual Exclusion : Requlvmenn, Hardware Suppon. Opernflng SyllabulTopic : Balm Avddam 4.4
System Suppod (Semaphore: and Mulex). Programming Deadlock Avo‘danm 4.5
1 Support ' Classical (M14. June 15. Nov.15)..... I
mum) worm:- Alumna-” .
Readers/Writers Probllm. Ploducu and Calm niobium. Dearlock Avoldnnoo Naomi!“ 4.18.4(6) Enhanced Snail-Ollie.Wm.m“.m .
4.5
Prlnelplnl of Bullock .' Cmflflm and Emma We" Mly18. Doc. 16)................ 4.134(0) momma:W W “.mn
I SYIIIIIUI Topic :
Graphs, Deadlock Pmanllon, Dnadlnck Avoidance:W I ’ SylllbulTopll:: IfU ............
I ”ml-21
Algodlf‘lm ’0! Single Ind Mlflple mus. Syn-b u- Topic : Banker- M m Sylhbul Topic :
W 0min for Single and ‘ 4.135 Gunman-u Pupmum-n __..___m
and- Di ablom. Muffins R m ...... ’ Syn-bun Topic :
3.121(3) BankahNucflmm (Jun.
15, 0 & 1 ! ) ’ Syllabul Topll::
3.121(6) Emma-Rem Ngumhm.......

Scanned by CamScanner
Scanned CamScanner
gamumsiummu-Summflm 5
E mmlMu-SmH-OOMP)

#165“) No!m y u m cl Last FM us sumSomlnu murmu- (nu. 1a)m 6.1.3 andBlock-...... .. _~...._.....~ _._._._.o-1a
Una Plu- nephew-n!Nonnum- I SAW Tank: t sand-mumom-n - 4 SWIM-Tm Ducam-”www.mmo-w
m“...— ..... #2‘
(NFU or LFU) ........... ........... ...M CSCAN ....... 0.8 Dime-autumn) ......
Used Plot M 35A WAN Sdlwlhg Algorithm (no: 1‘) 640 I
4.185(3) MGR F m ._..
Algorithm (MFU)...
4-2 55.43) Liikd mm.....m...a~.—..~ I sum Topic on sen-Mm Alwmn as
IMW.
La 554(0) U M L K I W W I T H LOOK.c-Loox..‘. 5.9.1
MT
m 3.5.5 Lock wugmflmmm 1s) 10 smut) .
1 10
4-3 u Enmplosanm saumnng Momm- 511.1(5) Unux PageM. ........................ ".649
{18
m I sylm‘roph: mung-m 9.10 m m m m m w m p m m o '
I u . m l-m-I ._.
M ._..._........I..-1n has
4.19
4450 5.1.1
an
56 [IUD
.
SJ mM(mwm)w
Module 6

Mpummummm-m Dlok
MG:
Schedullng 0-1 In on
ES

W030:- 'nh~—~.mn_mu
I “If“:mm .
SUN M-.. 9 “I" MMMM6-9

Scanned by CamScanner
Scanned CamScanner
Table at
8
mm MU-SImJ-OOM

l’ s
List of Practica
Operating System Overview
Alfi

Qfikeh.c.mW-°Wmod.chm
Explomfiwménmwmmnflin
Wxile m u scu’plx m dn the following:
1. Disphylop laminaeseendinsmifl
Display pmcessu with highmmemory usage
and. The ‘ 01" OS design m u m - (or
Disphycunentloggedusermdloginmme
systamCdII. LinuxKonwlandShol.
current
Display aim! shell. home dismay, opening gym type. man! path setting,
working (memory
— User's
'pmgnm
should get me M g unit «2
. . a” . M ' I n
5. Display 05 mm, release number.Irma] vem’on 1.1 Introduction t o Operatlng System
6. Illuslme Il'u:use nfmn, yap. Iwk,etc. _) (Dec.14,.luna15 ,Nuv.1l) 05:: the service to allocat: Ming unit In men

(I) Camachfldpminmumingthefukmmnemfivm mechfldpms obtain [,5 'afiaraiingsysflam?


v
thepmeessDofbahohildmdpmtbyMnggptpidmdgetppidsysmmcdl. — Theopemfingsystemaflmwsmemcrywmmm
mu - Dec 2014. June 2015‘ Now 2015. 2 l\ rks
wagid.8mm
(b) Explom the following sysm calls : open. read. me.

close.
Mud. salad.
‘ smudge
asperneod.1nlh esmway,uscrpm gmmsimnln
‘ ‘ 'tyd. An operating system i s system softwm which withmemhuuserpmyamsthmghdevioesflbby
manages. opemes and communicates with she bouim’amuuseorevcnnjuysfick.
Implement basic commands of linux like Is, cp, luv and odms using hurl APIs
L-7 computer hardwaxe and sahwm.
em
Wflmapm gnmmimp lmman y two CPU scheduhng To complain the exaculinn u m pmgnm need many Sylllbul Topic
' Ilgnnlhms Ilka
' RIPS. SJF. Round Robin I#10
'
moms.
Operating
Symm Obhc‘llvuand Functions
The main Job of [be wasting system is to movide 1 2 Operating System Oblectlves and
Write I pmgmnl o mplem
' enl dynm‘ c pamnon
. - 'mg placeme nt algorithms i.e Best Fit. First- L14 and servicca to the usar prom. S o without
fiLWmsI-Fit ac. mums Functions
opeming sysmm. a computer would be useless.
Writea pmgmm m' , ' variouspage ' -) (Jun. 15.Nav.15)
policig Doflnlllon of operating system
Using the CPU-OS simulator analyse Ind synthes
ize Ill:following - An upemting system acts as an inm'k'ace between Eh:
I. Places: Scheduling algon'rhma.
L— 19
. L. 25 um and hardware of the computer and also normals
b. Thad creation and symlmnjmm the execution of application prognms.
c- Dudlnck mwnfiun and avoidance“ Operating system is also called asmince manager.
Need of Opemllng System
Basically ape-sling sysmms perform tasks. for amp]:
identifying input fmm the input deviccs such as
keyboard. mouse etc and sending output to the mnpul
devices such as marfilor, prinu-r an: and keeping track
of files and dimming on the disk, and conuolling Fig.0.] :Threeohjuflvuofopsnflngm
peripheral devices such as secondary stung: devices. 4 l. Commune: I
pdnlm,scannm,audiomixer.
,compuwrsysmclnbemveqienflyuudmm
mmdawmmuerxyktemislpmceéfihg'unil
‘ upemingsyswm.
calledcm.
s
'
9
9

Scanned by CamScanner
Scanned CamScanner

i "rlhn.\
é, _
IF“
Operating Syllem (MU - Sam 4 - COMP) 1%
w
*2- Eflhlency S hodllljl's of (GUI). Thmugh this inurfaoe user mlkas intenmion If any ”0 lequimd then placemen- would wnil :3
C°mputer 5. 5 _ ,0“. inmPoW communicafim, w
ayslcm comprises of many W - A" with the applications and ummachinchardwm. mar speed is high wilh camps: to [lo speed.
these resources are utilized by user‘s W W ” " -D 7. Boollng the Computer
a Mockhfldlinsfofl’w‘
in A : a cansequeme of this processor ufiliulion was poor
efficient manna due to opening Swill - The process of starting or naming the computer is and would mmain idle for most of the time. In this
its. _’ z. M M W ‘ only
Ablllly to evolve follnvlills '1! m m : all“ functions:
_-
known a: booting. wen-do one [mm was kept in the memory .1
- If computer i s switched off complmly and'if aimed on the time of execution.
The design of the operating system pumils undid!”
devdopmcnt. lasting. It is also supports for 113ii mama-MOS: V then it is culled cold booting. A warm booting is the. S o it was needed to have better ufiliulian of processor
m”
by Illowing for addilion of new system W lumo wesdl el'im‘ ” “WV prawns o f using the upemdng system to team the and multiple pmgnlnls in memory al a firm: so {hut
' In! WU lo the user and s oompumr. multiple users would cam: no me Iyslcm.
without inmriering with service.
' 9 8. Perform:basic computerLulu In the dad: of 19705, the operating systems daignen
'5 Functions oi Operating Symm PW fmrn
mm the moaned mummy all ,1 — The mmmmenl of various peripheral devices such as developed the concept of mnllipmgmmnfing. In
-) (Doc.14,.luno15,uov.15)
Mmhwmiumfion.
. the mom. keyboard and primus is carried out by multipmgramming, physical mum-y was divided in
" iifieremmmotOS‘t 3' lilac-m h operating symm. many partitions. . -
MU, Dec. 201-1 June 20‘5,Nov 2015 5 mmks . m m m m m o s
— Today most of the operating systems are plug and play. Ind
‘ Path partition was holding exactly one [Imam
mmuw These operating systcms aulomafically moguize and
Opeming system comprisa diffmnl modules each of operating system was miding in exactly we pmifiom
‘_ Main! “4 W ; track of how .. .‘ configure the dcvioes with no user interference.
having i n own wuecfion of defined inpuls and wtpms Along with this policy of memory allocation, I policy
WMWWP‘N- was needed to switch the procusor [mm mm mom
Thane diffmnl module: or componuls of wanting Syllabus Toplc
HEWK
Iyshm carry out specific lasks In off: the eomplet: + 3 . The Evolutlon o f Operallng Systems to other.
functionality of [he npeming system 1}. file W Imivin'es of opcming » u.” It has solved the problem of pmssbr mmlining idle
consist“: 1 . 3 The Evolullon of Operating Systems while IIO forging-unis going in.
The mask important functions o f the opcming system
are shown in Fig. C 1 2 . l. fi l m m d i m m ' i a m m l e d n n d d e l m . This is what the opentins system provided leading to
In. Explain Evolmlo'n'ofgpamungsystem.” (.1 Mum]
Functions n l (Jpn-ling OS. flu high throughput. A sysum‘sfill was flpfl‘lflng in
Syn-m
Following are the developments that have occurred in batch processing mode.
2. OSofia'Ihesavicelowcusme files andalsofl
Illoulslllsmngesplce forfilesbyusin; computing facility in [he last four to five decades. In the In the Bally decad: of 1930:. sysmn dcsignéls added I
1. Process Management 1960!, people were using mainframe computer system as I feamxe to give interactive m to flu: system. In thi:
diffamnedndmhlloufion.
computing facility. period time sharing systems came in togimme.
2. Memory Management 3. llkeapshack—upoffila.
— The mninfnme computer system would be normally ‘Idm behind me time sharing is to let the us:fill up:.11
a. FlleManagement 4. Ilofiasflleseunilyl'orfiles. is given to his pmgnm while
kept in a computer cenur with a continued system m o m
Wham: environmenL execulion. To achieve it. each user plug-am Wll
4. Dovlce Managemenl 1‘
- ushinclude: fiensetsus edmptapm dwirpmgn mlsadnk of allmmda slice of firmof processor.
‘ ‘ -
punched cards with encoded list of prognm In this allocmd time. user pmgnm panly oomplét:the
5. tacliun and Sewrily '- gm Mm an opened. closed and written by: immumions. execution.
a . User Interface or Commmd Inlsrpmu K“? eye — Among the dock header cards which wen “job onmml tnflmcslice enda.mepm cumrswim hesmulqer
In on device driver. Communiwr. cards" would specify compilers needed to compile the program one by one and again com: back In fint
Windmurhedevioedrivcr.
7. Booting the Cunpumr
5~ MedinlndSemrlty program. program in very short time.
B. Performs bask: m m r m
" — The openlors a! lhe computer system wuuld may the This gives (h: illusion tn usermn. “1: W m is only
The m m file 3ystnm m J '
, of pmwcmd by up; job as per pmgramming languages. The jobs which availabl:to him alums.
Fig. C12 : hmcflnns owl: openflngsynan mm
— h m m o fi u m ‘ono _ required long pmusing time were classified as long In the dead: “1970-80 . there was In exaqnioml
'31. MW! v
9‘3“" jobs and which had shmt [mousing time was clusified 3;t in bulk flange. [1 has helped to mliu the
M m “Md. ”led Plot“." _
suchas
Mile.“
use:minis: filefnflm as “short jobs". mommpmposemeideaofexundedsmmga.‘
111a pluses:management activin'“ involves: on {Ill basis utilize ,
like '. 6. Unrl "cup“ . -up a - The ends: promising was batch processing Again the concept of “virtual storage" helped Io
. 1. Toplovidc control access to sham! mama Comm-11d ‘ of set ofjobs.
-
lbisextcndedsmgeasanenhancedaddmm

Use in with hummer
file. may. [/0 and CPU. . njobs. fmmwin.
ns. 5m H m OS :2m syslcm duough 0951:: — Thmw asnou winmn ‘ ninpmcesn'ngfi nyswapp inginnma éfivepmo
2. Control the execution of user applicatio
cm!
as . Thnpmccssorwouldnmlinbulya
tatimein memory from disk and swapping W“
“ n e w Jaimwe betwem lhew
3. Geafio n. exewfi on anddc lefion ofua-m processing one program. prey-1m to the disk suppomd to enhance the cow
lldw
hung“ at of w m m m d s o u g n p h i c5 user Interface 0
aluserinmf'«_
system pm

Scanned by CamScanner
Scanned CamScanner
V
-
h
nu

' -, ~WM-Som: E 02mins; imam QMU - Sam 4 - COMP) Opeman


' °f “WWW; m u to the lugs W m " "5 OleMaw
"Sen using fl): gym - Due In parallel execution _of the Ihluds. efficiency Ind
Ihemid 1 perfonnance can be Ichieved. V.
1n of l w o m m m m m w m o f Multiuser. “Wax-i , l
— Folluwing are sum example: of mnlu'procem'3
“chunky
Iyswm
(MJ.T.) developed am me sharins networked. clusIeMnsY operating syslams :
called Comp-lib): 1m. Shuins SM“ 1. User Imamoe
( C'I'SS). Windows X? (to, Linux, UNIX. Windows 1000.
In Claude a!1930;m m cane in me and $01: “5")- Windy“.
1'
-) 3. Multitasking
01”“
W"
was fim openling syslan for um plum n - flux. #1 - Operating syslem which supports for multitasking. 3. V0 Opalaunns
developed an 1m 8080 in 1974. MPIM. me
vGlil'on
M‘flfipmcessor. , ‘ permits for execution of many software processes a the
4 . Flu Symom Manlpulallan
of CPIM. was designed as mulliusef. Mulliuser and ‘ sum: time. Multiple mks are handled conclmenfly.
timesmflng with me]time capabilities. networked. w — Following an:some examples of mulfilalking spar-fin;
Amulea m‘v-Ior mmpcw edonlml m symms.
1.4 Types of Operatlng System
PC-DOS o f IBM and MS—DOS was developed
. a UNIX
A M the arrival 0f IBM 286, IBM and Micmsofl Fig. CM : Openflng lyllllll units
Symm; 0 Windows N00.
developed 08/2 for 286 Ind 386-mlchims.
II W The chsifiwion of the diffemnx apemting 9 4. Multithrudlng -D 1. thermal-[Ice
mulfiusu'synem. given below along with I few examples of W
— A singla pmgrnm can have multiple thud: that can — U m interface i s casentinl and Ill apeming synams
Am the Inival ass and m m commas. to symms that fall into each of the categories. Many Comp W run in parallel. provideir.
facilim: and reduce lhe development time, M‘cmofi wpemingsysmswill fall imo more um one a r m
v - The operating system supporting for mlfltithmading can — Ugm either interface: with the operating tyslem
develnped Graphical User Imam: (GUI) based folluwingcmgon’u.
MS~WINDOWS. It was uwd on top ofDOs topmvide divide the prop-am in mulfipln tinned: that can run in through cammmd-line inlarfme or mphinl user
umfi'iandly parallel. immune or GUI. Cmmnand inwi-pmu' m m mm
GUI.
- Such operating systems that would fill inlo this mar-specified command. ‘
Am: min] of Pentium mamas, Micmofi — ‘AGmofierstheuscramxse-buedwinduwmd
developed mulu'user Windows NT and
category m :
single user menu symm as an interface.
Windows 95. than to Windows 98 and Wmdaws XP. 0 Linux
-) 2. nnmExemtion
Aflar this, Windows 2000 was develop a UNIX
ed us I tingle
um walling sysnem for desktop a Windows 2000. - The operating system pmvides an environment ‘0 mi:
users Ind Is a
mmxiusersystemforbusinessusenlowmbimtha u m mgr-ms efficiantly.
bom '3 5. Real Time
mums. — The mum: needcd to the plums In camping
— Fox-Real fimeopenfing syslunsfinnwnsn‘ains m l
Nowfi nuxis emag edasm mumfi domfi execution an pmvidad by operating lynem ensuing
system which is a Vll'ilfll of UNIX.
summarizes this evolun'an o f operatin
ng
Table 13.1
g system .
_: —
key panmewn
If the completion of panicular task should happen in
given time ounsuainls or action completely must Ink:
-
upfimum utilizalion of compumsystem.
Memory allocation and deal localion. pumm-
l"34713:’Wlle‘lfl'operaflngsystem allocation and schcduling, multitasking etc hmmions
Table 13.1 place at a certain inslam or within I cumin range.
4 ] . an: pa‘fmned by operating syslnm.
Mada...” — Real time opeming systems must Expand quickly.
— The operating system has all rights of resource
1'3 — All nbova OS like UNIX, Windows are not ml time
My
M3
fll-lfllber
‘Y‘m mulliuser means it supports 1"! management. User pmgram does not given these light.
OS.
“me time. Mum lo workon same computer a{the. -) 3. [IO Opmllons

:mw mmm m-
_ Sm users W 8 0!! the system concllmflflY-
1.5 Operatlng System Services

9 (my1s)
— Banh pmgram requilcs cannot produce output withq
taking any input. This involves 1h: use at 110. During
execution. program requims to perform IIO upemiou
Linux mm“. operating ‘opéivaflng‘ .aystem. for input at outpuL
°’ ”"15““ 2000.
system:‘- ‘ — Until 1/0 is completed. pmgmn goes in wailing mm.
4 1 WIMW‘ WindowsNET. :
[Jim
110 can be performed in three ways i.e. plummet!
Following are the six services provided by operating
Wndows-95, Windows ' Mulu' - _ . IIO. Inlet-mm:driven[IO and!I0 using DMA.
system for efficient execution of user: application and to
98, Windomxp(:9, cm inI‘ '3Tm":system suppom for mum" mak:convenience In use compmet syslcm : — The underlying hamlwan for the IIO is lidrkn by
@019 mm”: W for allocation of diflafl‘ operating sym- from um.
them, of the Wm. ‘

Scanned by CamScanner
Scanned CamScanner
Ea 'P'Lystem (MU — Sam 4 - com-J,
,,,‘7#, , , , dc” 1““;1“
“““W «n‘‘ .‘'
‘ These
[/0 open-dons malt: it convenient m m “ mania
EMMMU-SMMCOMP) 1-7 25:3! 3 D ‘
the — such '5 [ , c mayxnth m 1 4"
“5“ nnm. Opeming syswm pmvx'des "“5 ”mu m " Kay dulgn lawn oi mulflprochuor OS' —W
Imp! Wi'h user mommy“ “l: J H " should know [he unlvlillhflily ofpmm
use: nfllfl’l for efficient execution. of and hence. m i um:
opemnng 7 k 09mm,“ SY V. nun-m
9 4. FileSystem Manipulnflnn 3°"5'de'_\s
Key Ila-Ian
mulllpmnm
blue: of
as
‘ u ‘ “bk. for u

.h, '
m
_ nmm mm mm m m a: m P M me Syllab‘fiulzgmwssor and Muluoore -D 1 .62 Mullleora OS
oulpul. The input can be mad fmm the files ”"1 1. Slmullanaous comm pm or Wands
pmduced output again can be wrinan inlo the filfi — Adnflepmc emrchipfin hnvcflumem mk
to.-
1 5 0 5 Deslgn Consideratlons — mduiylchallc ngcformhmu ymufln‘m
- This service is provided by the opening 515“” All Mulllcore
Multlprocessor and Iynemislaimpmvelheprmsingmofmfi
files axe stored on secondary slang: was "“1 3. Synchronization
mnnipulnlcd in main memory.
Architecilfl’es m a l n n g w i d l mginglhcemfidanblcm-chip
4. Mammy management mum.
— The user does not have to worry about second"!
— Izismrymmachinn insicpmuafl-uifing in
storage management. Opemling system alwmflpliS"ms 5. Rellabfllty and faulllolalance many-consystemwithfllepufmnaenfliuof
ulc task of mding from files or writing info the 5 ' 5 5 5 ” W " "W”’ npplicafions.
per the conunand specified by user. M WP“ of OS are considered for . 1 3 Fig. C145 : Key dulgn lanes ofmulliprocusor OS A _
— Follmng three kvels of parallelism: exist In moduli
— Although III: user level programs can provide film considerations. These are -) l. Simllllanmus concurrent prunes or filled: mulficote gym
servica, it is better to keep it wilh opemliflx system. (71a s cannldurnd for The data corruption must be avoided whnn mulliple 1.‘ H a l d w m p m l l e l i n n i n u c h m fl fl e d u
The reason behind [his is that,pmgmn execulian speed pm execute same or diffemm pan of the kernel. inmunion lavel panllelism. Applicuinn
i s fundamenml to 1/0 operations. kernel tables and other man-gem! snuctuxu. pmyammquromupilumyormynmuh
-, 5. Communications 1. symmetric Multiprocessor (SMP) OS
-D 2. Scheduling ‘n‘dmmge ofit.
— Cooperating pmccssm communicalcs with each other.
If Communicating pmcesses are running on diligent ' — A: scheduling can be carried out by any m m , the
task of pruning scheduling pnlicy inn: eflea become:
7— Thm can be mullipmgnmming or mulliunuded
execution within each m .
machines then messagm are exchanged among them Fig. C15 : Typu of OS difficult. 3. The single application an be execulcd as m y
and they gels msfar through network.
4 1.8.1 Symmetrlc Multiprocessor — The gunnmee should be given In avoid the corruption lhmd: or p m in parallel tummy cues.
— This communication can be realized by making the us:
(SW) 05 of scheduler Msmm- - Unix and until 05 pmvid: ma mung support hr
of user program by customizing it to the hudwm um '3 3. Synchmninfinn secondmdlhildtypesol'punllefim. lheoptimumme
facilitam in msmission of the message. — In SMP symm, each processor can carry '. I
As several processes can be active simulunnuuly and °f M W “ at: “3”” 9033115-
— Customization of the user programs can be done by
scheduling by ils own from group of avai n
shams addms space and 110 processes. the effective ' Ways to extract parallalllm from glvll
mus of offering the service interface to operating pm or threads. Any processor can be chosen v
Is 10 ,
system to realize communication among processes in km] m means.
for mutual exclmion. Ways to man Pll'llllllllll
distributed systcm. - Theku'nel is built as multiple threads or mouse!” 1mm g M n appllcfllon
'5 4. Memory management
— In this way the communication service will hepmvided that was: can run in parallel. This approach in h
the — The memory management must be in line will (A)Plnlsllsm withinW
by operating system and user programs firm will be complexity ofos.
issues slated to uniprocessor system.
free from taking can: o f conummicafions. - Thesamdamsltucmlesandmsoumescanbemq"
— As multiple processor: may share pug:or semi. the
4 6. Error Detecfinn by different pans of the OS simu
ltaneously. paging mechanism should ensure cootdinafian among
mcm : Waysloexlnd punfldlsmlhmfivtn
— In order In pmvent the entire system fiom ‘ The magcmcnt symmet
of processors and many lemme: II different pmcusms to achieve consistency. Ippllutinn
malfunctioning. the operating system continually beps carried «fut by ric
OS in such a way thif‘ ‘ The OS should talc: advantage of available pmllnlism
watch on the system for detecting the mats. > d 1.62(A) Parallellsm wllhln Applications
” m s '1'“ “816 Processor system. ' in hardware.
— User pmgmms kept free from such cnur detecliou to The IPPIimIions built by user may contain "" The paging mpchanisms also must ensure no:to mess The developer of the application mun decide about
improve the performance. the physical page with its old contents befom the pug: how to split up 1h: Ippliuu'on's work in independently
. tflspacfiveofseveml- ‘*"‘ ~ ' ~
— On the contmry. i f this right would have been kepg with or Single Pmeessar. is put to a new use. execudng mks.
user programs, most of the user program would have 1‘ 4 5. Rallahilltylnd fnulltounm — mmmlpmgunlninghlmmflmy
Hana?
fflulfipmMr 05 should offer , supportedby lugging:fauna mdeompllen.
wasted time in error detection and actual work would mullipmgmnming The OS should elegantly degrade the failure of
be minimized resulting in m m (lewd-lion. m mMalay
the°fmultiple Mm“. system along “I"
. plum.
Operating system needs to carry 0'“ 00mph Elk:
0””
during the process “mm“

Scanned by CamScanner
Scanned CamScanner
L ' , ~; . "'r
77
' 1-5 CHIS r ‘
£5
, 1:54;; 7M-” , 4 Mondm‘lcw
1_-,_1
- Mmeflpmmmmmwoswmdfl . _“(ova-mg
. ”manly; W
. 1-9 5' 3 "
parallel «ask can m optimum use “ W m - WW system is w. ,, "’
mmwmpletemacxeculjaninefimwy‘ WSW”
mopeming
“M” with Bond pmpeniu. mm of a...
WWMmMypeculiuim
“mm“,un-
- GlandCenualDispamhmcpfismmulmm 5510‘w Ma‘-
clpnbilityoacosx no.5.mM-cosxm.6; aflwbfll‘ m . ‘ ° “’R‘:mm”‘“g‘“""""‘d°“m‘
layer. They did not hm lobecancemednbcm
"mmgstmm xmlcmormu mx-mw“ _ win-Wmfl'm . Mmvmfiofl/OMWL
Wgsymm. WO‘MMMB.
Yo W5:msymmopmmrpmuwahated
- TheGCDheIpsfmefiecfiuexxufiofldW Emwmnmmllmyomumgum
inhyers.
ushlhumdecidedbychvelnpudw ' 0" omwmfiuwmpmfionmh
;.\
6CD makes us: ofanilnble pudlelismol‘nllhf” I
smmocomapsusnmnommm . . a
Fm“
concunenlexecutian. _ In this W oomplkhon °f all the LIE
9 1.5.205) Vlrlual Machlno AppfoICh pm!“ or 51?
“m”?! "w Mme: n;
_. Moveflnaqmndinswilchingofmmbmd mmélinifl’lsmdmbmddlemalllmr FIE-L7.1:Aslmpk$umflngmodnlfarn
m°“°"
“3“”
scheduling can be nvoidedifmnmmecuum WOW”- 1-7-2
Layered
Systems
fullydedicamdmpam‘nuarpnm _ Eva'y W is able to be seen [0 avg, .» "
Mnmismhfimafim hiding. 7 A - -
- Walloclfionofcaresmnppliufiouismbyflios O. Wmmtoonuyemdsystm.
. . . ‘ _ Ammkmbh to impose in ” M 1 “
Inddoeshnlcmmmaflounm.
synm pm mum In In! calls ofiemd by the
The M _j - Anotherappmach ofm’ganizing lheopenn‘ngsyslemi;
_ 1n unlpm
u: I by pulling the V _ ‘ asahieraxchyoflayemeachonewnsuucwdupmum
mode and kernel modc. [I is jun Iih m with!!!
'3 ' " U " '» onebelowil.
pm d place (eg. on the suck) “ I "x
. such mm; . . H:. mm of undefine — Thefintsymmbuiltin dfiswaywumemwmm
_ Then I:. overhead m . "I'll" .m
“m m dzveloped anhe Technische Hog schoolEindhovenin gm fallow}9:1m ._ , ' V ‘i;
luponaivmeuif mullicom syazns an induced
_ dim-mien m be W in mm,
mm
- DI “this
W0“
Whine 8m switched . - L the Netherlands by a w. Dijkstra (1968) and his
m, “&1_7J:smmufmm.,pmmmfl
wwos‘umlm “WW. ml!) lune! mode Ind transfers mud: sludenll.
— As shown in Fig.1.7.2 the systemhad total 6lxycn. _
— The msponsibilixy or mm W m m m m"
i,
- The Wanna-n then fetches the u - at 0 Layer 0 : This layer wns lupamihle to ma]: _ fungmrmh “ m °f "I“ mm
out by pmgmn itself and os album the W ys ‘ . ‘ _
ll" finial with m all is to be executed. allocation of the processor. wnlcxt switching when 1‘7'3'MW“
memory '0 twin-anon. I“
“W“ approach-mum 1n fig.
This W W I basic m fir, inlerrupts wcuned or timers expired. This layer _
- Plum labs decida- aboul how lament-ulna by - ”3"“‘5”mm“1’“"°“Mb" "my“
using - . ~ was responsible to offer the basic
maxim generated by compiler. mululmgramnung of the CPU. — The bomm layer winch :3 layer 0 . x: thehndm and
,
o uyerl-Tiwmamorymamgemmtishmdledby thehighmlnyerislayerN.vihi¢histheuurimxfm.
SyllabUIToplczolaenflngsvmsn-mm o Amman that calls the dcmandfll'
. _ ‘ this layer. It was responsible to allow: space for
1.7
Opelatlng System
Structures
a Amuecumofmpmeedmcs limpet! ‘ pmcesmin main memorthemisnuspmein
Mulh. > main memory. [Mn it also albums space an I
99“", mm .1 512K word drum used for hulding pans of
E" Wammmnm- if}?! a Acollecfion of mm, mm
macs (pages). The layer 1 soflwm wu
mum . COW of making needed pages was [nought
- In Ihis up , _ . ‘
m“
' into memory wtwncvertheywmmquimd.
o layer2:Handledcommunicnlinnbetweenmh
for” on. m " single
mummmm'" V
_ m .
m", M“
Perform lhings that ll? paces: and the opmwrconnole. Above thislayer
each process effectively had its own operator
b

"I m
gymmar Honduras. such as f I ‘r .‘L .
m console.
3.VmualMachmes - m
into m I v: 0 layer 3 : The management of 1/0 demos and
"I‘m“ 0f the W Waingmeinfmmnfionmemtomdfinmthem
inns. 1.7.], ‘ -,
.
W” M“
”Y ““‘' “V:$1"t 3 each
:10 mg,1.7.3: A Wow-mum \
m could be able
fig.C18.- Opulflnzsystelnfirm

Scanned by CamScanner
Scanned CamScanner
P,

‘ A chanclclistic openfing system llyer call!”8 “a: E. Operaling


System (MU - Sam 4 - COMP) 1-11 Wmsmmm
and
‘5c
Mylar-level
I set of routines (ha!CIII be “mm — Asaoonsequence. i f : bugin the file milnisgemd.
layers. the file service may crash, but this will not wally bring
- W
W‘
fi w n u0‘ movum-1.
mmmumfi
‘ nemelayercanwoinvohwfimsm
the whole machine down. mm M
nliabililymrminlainability. . '
lower-level layels. — Another advantage of the client‘scrver model is i s
Fig. 1.7.4 — "firminssywmnmmmmu
A " Operating
‘ system layer is m implmmm on" Idaptablenm to use in diurilrulad system.
mwvidzmelkxih'lily.
lbw-act object made up of am and lb:011mm"am — The cammunicafion of climl will: a server lakn plane
" h o a - n m m o r m m m m
can mm‘puhle The meme of VMI370 is tn completely up I by sending messagps.
Ihose dull. kno M khflwfiammmkw-
' Advantages of layeredapproach two mcfions. The heart of the system — When client sends a message to scrvcr. it i s no! inusermodg.
W We monitor, runs on the I,“ ‘ necessary for slim! to know whcer the message. i s - Fwexmvkwrmvymummwm
- It keeps much better control over (he «:0u and .‘: ’L
w, processed in its own local machine. or whether it was dfiuwmfllm
over the applications that utilizes that compulfl‘. m a does the mulfipmmmming. viding no. J; senllouerveronammnlcmachincinuclwark. _ Ilisuqed' mminkumlmdexwlim
- Implementers have more liberty in chmging "3' snvml virtual machines to the next layu- up, I: l,
u — Either server i s present on client machine or on I who: mm of the Manny M u m Uni!
internal workings of the system and in creating moduli! “dig. 1.7.4 remit machine in network. from client: paint of vizw (MMU)ucsea.
operating systems. Swizz; il appeals to be : a request was sent and I Mpome - Asmllmicmhmelmuimuflywkflmm
However, unlike all olher opeming
- Ease of construction and debugging. U: came back. emwinkmwlmodgllismmdpmoffll
0'
vinual machines am not extended machines, m L:
m openingsystem.
Umnatlons of layered approach >
and other nice features. - Actually. a mimkaul mqm' only cam-h I]: and:
— The major trouble with the layexed appmach is to fat. conical writhing. satin: his: mom
- Instant]. they an exact copies of the bare m»;
define various layers pmperly. As a layer can use only mlpulann'' g U I e W U . m d u p n n - m ' g m
including kemelluser mode, I/O, imp-nun L imam-ms
lower-level layers, cautious planning is new-say. Fig. 1.75: Client-Server Model
Llyaed
everything else the ma]machine has. ' — Mimkmlelalsocunlainsdwcodelomsynunglk
implementation inclined to be less efficient 1.7.5 Monolithic Kernel vs. Microkemel
mallsonlllepmpermcrlewlopulfingm
$

than other types. 1.7.4 Client-Sewer Model — The majority of CPU: support at last two modes of modules. andlo mun-n dwirruulls.
4 1.7.3 Virtual Machines As a large part of die tradilional operating syn“. :1 operation i.c. kernel mode and user mode. — Following is III: organinlion of walling symmwilh
moved into a higher layer CMS. the VMI370 go on: — In kernel mode. all insuuclions m allowed to be llliuppmnch.
- The early releases of 08/360 wm strictly batch wan—Immun-
systems. But, due [0 requirement, m y 360 ofsimplicily. ‘ executed. and the entire memory and set of all legislcls
/ I \ \
um
decided to have timuharing. so various groups, both - Hawever, VMI370 itself is still a complex n is accessible throughout the execution. W“
inside and oulside IBM dacided to write limesh because simulating a number of virtual 3703 um.- - Onmeconmlumisinmermde.mmxymd .3; m 3:
_§_
m'ng entirety i s : tough and complex task. mgisler nccm is testriclcd.
systems for it. ,
A tund- in modern opcrating systems is to take "lull" The CPU gels switched to kernel mad: while emailing mu W
— The 788/360, the first time sharing system.
mived late operating systemcode. to.-
and it was so big and slow Um few sites conven °f “Wing 0013: up into higher layers even funhsm
ed toil. Mrtove as much as possible fmm kemel mode. The only means to swim]: from user mod: In kernel
II was finally neglected. V1 fig. 1.7.6: Stunting Implication from m
a mnnimal microkemel. mode is through sysmn calls Is implemented by the
— And it its development cost was very high 4 system coda[hm-:1:- mkeflll
around some ‘ “'9 “FM appmach is to implement mos! " ‘5‘ operating system.
$50 million (Graham,1970). 0'
Dflhunco between monolithic and minor-mu
WWII": system in userprocesses. The opeming system can be put in full control as
- But a group at IBM's Scientific Center in Cambr ‘' -) (JImI15.Moms)
idgg T ° 1&1q
a service, such as reading a block of II 1"“ system calls are the only basic services an cpeming
Massachusetts. produced a radically differen systemprovides.
t system :3 process (client process) sends the
that IBM eventual ly accepted as a product, PWW. requfit
and which
rm- which then does the work and. The operating system can also be put in full comm] u:
i s now widely used on its remaining mainframes. back
the answer, hardwm helps to mum memory and “sister access.
This system, originally called CP/CMS and latex-
their:mode-l. slfown m Fig 1.7.5, all the kernel " _‘‘ If vimlnlly entire operating system code is executed in
renamcdVMI370 (Seam-fight and MacKinnon, 1979) By :mmucauon bctwaen clien kemnl mode, then it is a monolithic program um run
was based on an astute observation : ts and serve”.
’ SP
flin - . CI in a single address space.
o A timeshan'ng systemProvides which onlyghlrdfperanng system up mto P m at? 111: disadvantage of this approach is that it is difficult
Scrvice es one face! of the system. Such‘1‘1‘
o Mulfipmgmmming 3"“ Sfil"’iw- 0"
In change or adapt operating syslem compcnzms
mac-$5 Small service.
lamina] W without doing a total shutdown and perhaps even I full
D An extended machine with a mom (:t ~ A: a" ' lmrlbecmnes and manageable. - tacompilalion and ninslallmion.
interface than the bare hardware. kemelmm “In as user-mock processes, and '
hm?” the, ‘10 not have direct access ‘° "

Scanned by CamScanner
Scanned CamScanner
/

W Topic :SVsmm Call , Operaflng


IE System (MU - Sem4-OOMP) 1-13
18 system calls — Arm- this. control Mums no meaning pmgnm whxch‘
m
We: : the hand Iraq» Witching the m '
persists executing. mformhpm rbehinddw m
-) (June15, Nay-15 ' :
Mmaysrorunmmwmmm

usermodewmelnemelmodejlmm: H'-

1. Ampmoessmaxpflcinynqummemin
0"
V‘


z “'1'“s
the nu /
Thus I: spams Th“ '3 m
a. .snar}note ”519'““"5' hmelmodebyissuingasyswmcm.

1'- 1C 2. Dudngmeexecufionofumpxmwm
- Maximum W W " “its " ‘‘ ‘ E
Wu“ mommunymmmsyxmhmmng'
‘ services and Immal m u m “ mmmface 05 ““d “3"mm isam
by the set system calls that the operating task.
Isms. M— of 5‘
Fig.1.8.1: Th: keflul - Whethelmodeisb mhlwfiwmmdha Idwmm
Size Miamhsnul size ls mum!“ offux. System call is the call for the Operafing Mndempmoeasm uficraadvnnlagednecufllmmk.
mmmmb mm W m W m some task on behalf of the user's . .1"; A — As shown in Fig. 1.8.1 the [mm] is acemnl modal: nf calladasSupem'sorMochin which anlykzmclnun.
mum! W system calls make up the interface u ‘ most campuwr openn‘ng systems. Its main
myrivilegedopenfimummmhumodifym‘ glpecul‘
W ml the opening system. responsibilities in shown in Fig. Cl.9.
regislas, disabling intanupu. accessing mummy
. j}, «and mmmmmom rum m
>4 lumsL W
_ The m m an; as functions used in the1mm.“ J, Main mponllbllllhl of
mummmhmdwmorwmpmpefiplmfll.
t; Hum pmfilmm‘r's point of View, the system call: ; Komll I f i t i s l l o l i n supervisnrmodgmepmrmllmjea
a Hulls nlanmfluflh.My ” m m " Ihnaeopemimls.
modulamnbamm'" norm!C fimaion call.
1.Aclasaalandardh19rfaualu|hasystamhnmwaro System ullsmkeplmeindifi'umwnys,dependlugun
— Dwmsyslemcalljwcode isexwumd in the m , », Ihccomputainuse.
that that must he a mechanism to change 1h: . 5 2. Manage compular rasaumes
Apmfmmlheidenfity otmedahedayslmamma
mode frumusermodc to kernel mode. ~ 7’ 3. PM into Elise! lsolaflon hatwean processes infmmflmismded.
_ In the UNIX operating system. user applications do‘9
Thaptedxetypeandlmmlofinfamlflandiflu
have dime: m m to the computer .‘ H» 4. Implamem mummldng
" atoms, ' ‘ syslunandnlL
Applications first [equal to the kernel to get hand. Fig. 01.9 : Rmnslblllfls of [Kn-ml — Cumidatbeexampkofpningmeiaemy
was and access to computcr resumes. mquiwspecifyingfllesoumwhichmbefilenr
4 1 . Actuastnndnrdlnterfnutnlhesym
— During execution whnn application invokes a » WWII! ’devioe. '
call. it is interrupted and the system switch: to ‘3 Weflsoneedmlpecifydwufilmmdlmmhofme.
For example. while reading a file. application does not
395°!-
The kemcl than saves the process cw' ‘ memorybufierinmwhichlheinputflmldbemd. :
have to be aware of the hard-drive model or physical
comm of interrupted process and determines p geometry as kennel provides abstraction layer to the " Thedevioeorfileandlmmhmybelmphn'‘ ‘tinthe
offlwmfl. hardware. call.

Mnmgeeomputerresmnrm — Pmmemmcmbepasse dmmopmnn' gsymmby


The kernel watily makes sure that the requut is‘. m -) 2.
folluwing three different ways: .
“d “m “1‘ Process invoking the system caljt ' As sevamlnsmandpmgnms shims machineamlits
sufficim: privilege. Some of the system calls Clli ;‘ i.’ devices, access to [base msnus must be l. Pmmeparamdflsinregism ‘
context mulching and luvs diam bemvoked b y a use: with super user privilege. i synchmniud. The kernel implmnts and ensures a fair 2. Ifmmmmampannmfimmgms.‘ Mme
Mheviswpu'u ‘ thing a m mmuroesswhasmepmoessornhennmmy
If the "t is fine, the kernel P W r" panmemmmgenmflymmdinnblockmuble.‘
and the devices. www.mdmemcfl hchlockispm
3:3: “PM! mode and can norms the dc 7"
-D 3. Put into effect isolation between prom
of flu: munharge ofcommng the hardware. The “" unpanmrinamgislfl-Miflhflw“
“men”: [Muss can be read and modlfifl‘liré‘ The kernel guarantees um one process cannot camp! taken by Linux Ind.Semis. .
the execution environment of another process. Any
. “we“ ‘0 memory in user space.
~ Wlll
But,. ". p m : cannot access the mum-y that the lam-.1has
3. n u m m p m m m m m m h m k v
app
not execute any code fmm I '4
allocated to other process.
wmmmwppedofimemkbytheopu‘lfi
cauom for clear Security masons ‘ ‘ ‘ system. V
9 4. Implement mulflmking
Whm lhe hm]
”Storm the While:. ' ‘ 1‘
flj Somopmfinawmmmmhl°°k°‘”-‘"
the processing of M Each pmess gets the false impussicn that it is mnnm'3
when mm an execution context that w “ 9!, (
Acmlly. Mombmusemosemundsdomfimkihcnmbflfl
CI" was without interrupted on its own p m .
length ofpammmnbeiflBF-‘wd-
invoked. 1. seven] process“ compete constantly for
sysm

Scanned by CamScanner
Scanned CamScanner
1-15 093mg M Olelvlmv
E Operallm sIsm(MU-Sem4-OOMP) gamed
E 099mg Salem SMU - Sam 4 - 009m a — Linux is duigned m be mm: with um
- The process which mules mew process is called
are called the POSIX documu; at least two Linux dimibmions
1.9 Types of System Calls pm: mucosa. and the new pmcm
h m olmined official POSIX cenificllion.
childmll of lhnl ploccss.
-) (J...— 15.Nov.15) — Fig. 1.10.1 shows laym in Linux sysIcm.
new
— Newly mated processes may in mm cream mher
,jéxbmawmé‘mwmuh.
d: mass. creating a nee of proccssa.
MU - June 2 0 1 5 . Nov ems s u m .
in five gaunt. Thu: Ir: Sylllbus Topll: : Llnux Kcmal Ind shell
Syllcm can: an «(gained
shown in F15. CLIO.
1.10 Llnux Kernel and Shell

" Deslgn prlnclplu at Llnux

sapltaBmd." -v :r- ‘
undllianal,
— The design of Linux looks lik: any other
a!“ is a
Hg,c m : Enmpkla r m non-mimkcmnl UNIX implementation. It in ”nu: Syltllll
of Fig. 1.10.1 : Linn
mulliuscr. multitasking system consisting
-D 1. Open UNIX-cmnpnlible lools. ‘7 Syshrn Hardware
operating system for
- Open sysum all request lo the — The filc system of Linux slick: on m ndilionnl
UNIX disks.
— I t consist of consisting of the CPU. mummy,
using I file. sammics. Linux also completely implcmcnm stand-Id
specify the file. Icrminall. and other devim.
- Th: files pub is used as argument to UNIX nelworking model.
specifies 0'
Llnux Opera‘lng Symm
The 'flags‘ Ind 'mode' arguments lo this call - The intcmul dcmils of Linux's dnign have been
lb: W of using the file. the hardware and make
influenced heavily by Ihe history of this operating — I n function is m comm]
Examples - On W M approval by opcmling syslcm. it mums syslcm's dnvclopmcnl. nvnilnbls a system call interface to all Ihe programs.
- “file "' which is a positive hugger. lniliully Linux was develuped snluly an PC Thus: system calls permit user ptngnms In mean,
-
to I'll: files. and other mus.
end. then. loud. execulc. create Renaming of vnluc-l indicates denial of m nrchilaclnre. From the bey'nning of the design. Linux delue andmange W .
places. tannin-nu: mm. gel Ind "m" needs lo b1: checkcd|n gel mason of
denial.
tried lo acquire as much funclianulity as possible {tum 0 ' Sundard lrary
prunes: attributes. sci pm -) 1.. Close limilod resources.
alu'ibules, wail for lime. wnil - Programs issm a map insuucfian to switch fmm user
Closeo infunns to the operating symm dull file
will: — Linux can nm on mullipmceswr system having min
cvem. :i111 event. allow: Ind mode In kerncl mud: and makes a system call by
memory said file descriptor is used. Anzr this. same file Immory in sever.“ ungubyles wilh disk span: of
putting argumnl in slack or Ingmar. Libmry contains
descriptorm he musedby operating syslcm. several gigabytu. Apart fmm mis. it cnn run an syslcm
1. Davies requesl device. talus: device. procedums implemented in assembly laughs; for
9 3. Bad with 4 MB of RAM.
mmlpulldon Md. write, reposition. gel “lean syslcm calls.
devicc amibulcs. sex civic: Rado specifies I» III: 05 the number of (size) bylcs — With Ihe enhancement in muhin: configuration and 0 '
nllrihulu. logically lunch or cfficicncy. Linux kcmcls grew to implement more stand-rd Utlllfles
to lead from the file upcnadin I'll: descripwr 'I‘d".
dclmhdcvices UNIX funclionnlily. Apart from speed and efficiency, - These programs In: invoked by um: while working on
- II also specifics In pul um: bytes inlo 1116 location
create. delctc communication Ihe cumnl work and design focused an standardization. terminal. l l includzs the shell. compilers. aditms. lax!
3. Gummluu'ons pointed In by 'bul". The mum value is number of
cannecu'on. send. leccive — Due to variety of UNIX implementations at pmscnl amassing ptogmms. and file manipulation utilities.
hyws Icunlly read.
mm. lmnsfcr smus available the problems faced are : source cod: wrillen
-) 4. eI: — User : All the users intcmming with system.
infonnalion. much or dcuch for one may no!essemially compile or run comedy on
mnotedeviccs. eleO i: similar In mdo syflcm all. only i l wrilc! number. That: are three inlerfaoes. that is. true syslun CI“
the bytes insmd or ruding them. I I mums the number inmrfnee. [M Iibmy inmfacc. and we inlarfwe fanned by
4. File manipulation mm: file. delete file. npcn. — Thu identical system calls on two different UNIX
close. 1nd. wrile. mpodu‘on. of byla actually written. which is almost invariably [he set of standard utility program:
systems do no! essentially perform equally. The POSIX
gel file amibulu. set file “d2". standards includa n sel of specifications for diverse 1.10.1 Llnux Kernel Structure
Imn'bules 4 5. Crate process of opcmting-syslem hehnviar.
farm -) (006.16)
5. lnfomlnlion gal lime or due. so! lime or
'
Whetheuecufimwmmmm
proceuby — The POSXX documents are in exiswnce for oonunon
maintenance dale. gel system dm. :el symm functionality of opemtingvsysmm and also for
dam. gel ptoccss. file. or device “fins maltpmcu: syslcmcall.
addilionnl aspects such as process Ihmads andmil-Lima
attributes. set process. file. or
operations.
device nnn'butgs

Scanned by CamScanner
Scanned CamScanner
@WmU-Semb-OOMP) "‘7 w Obi-alive-
0mm
Ummwflmpmmufingmgcmumm ' iv”lllhm
mgr:
: Syn-n
mmafledshcll scdptaodIerwua
Th: 511:]! an is own has maximal apabififia. if we 0. Explain d‘fllatam mm of 099mm sysbm.
us: it it u a "glue" languag: m cambina the standard (Balsam 12m Marks)
they
es. but are UNIX utilities. and custom sohwale. then useful mol
gm .1: in fact chm-nu devic (Jun- 2015. M1015)
. mberenliudinsmad ofusingcompamlpaflsflme.
mmummmmm
Mammal-ammu- Ashellsuiptcanbewrimbyusingmysmfljonh'u
a. mu ammuos-J
e‘im-dfimmflwwdfl
ls
Abovedtd the first lixw of every script is: #Upadlllolshell lfidersewun 12)(5 was)
AsminfinolmlmflaslenW June 2015. Mama)
meachdcvieetype- (Lg. #llhinlksh). (la-c.2914.
rmdhnvempm
mgwufingsoflwateismdm
synux: W Syllabus Toplc :The Evolution of Opening
A i n p m w a s h e l l cmbeaa nyfilaby usinglhe
mools. Systems
for diffuemdevimsandpm
defies. kshmyscript
Al m hval. kin—levelW medullifl n is
Tbhwmwmmmkdfim
wfilk‘indof Itchmodis used to make file executable.it was into a 0. ExplainEvolution 01opening system.
+x
IcI-igmpackais dehverm new command and av-ilable for use chmod
mmwmmmum muting fumfion. ensuIiIIgfl (Hahrseefion1.5)
ofillmql. the righx device or protocolIund
ler. "IMP! 0. Explain service.pmided by opening syn-m.
slhn
donmpofdledisk AMscfipliilfimplsseqnmofwmmmd
Themingmishflledbylowkvclmdemd IIOschedtflerwfichissinmn muflznqpes.lfwepuuhcminlnasaipt.itm
be {Helslsmn 1.5) (5 Marla)
-opmfionmqmlsin
“mania hwmmn ddversisordeundissucmedisk mduwd lo a single command. sh III: aka "Home" ' SyllabusToplc : 05 Design conduct-florist”
astefi fldisklmd
shell. ah the "C" shell. ch the "TC" shell. fill
amnn ermu u-ics wpm ervew the Multiprocessor and MuIfleom Architect“:
Mmflaflm y.
mvzmnlorwmsomcmhersymmpolic ‘Kom' shall we the examples of diffmem shells
mmdwkwmflmhh dgviccs 0. Explaln us Design Considerations hr
file syslzm is pmem on the top of block — Unux offer GUI but sfill it offer the facility
of
file systems MulfiproeessornndMulfimraAmm
hmdfinisbsmopalfimmdilismmmw column. Linux can have multiple shall us many pmgramnms and users 11a
lo we
nmpmagain. coexisl’iIIgconcmcnfly. the shall. (Referseafionm)
iL The command line interface is called
of ‘7 , Toplc:-. . , SI.
Theodefordispudwingisimgalcdinmbluand 0'
Mallory management Componem Bum-n: shell (sh ) . k s h . b a s h m d w “

ismherdifl'uullfimwlndfling. the shell. Esplain vaflous operating symamMm.


Thiscomponcmwdm out memory management tasks. Whn til:
0.
ing the - Hm: we will discuss Illa Baum: ml]. (Helersacfion 1.7)
Memory management tasks include maintain
ing a shell suns up. it initialize ilself. than types a Write note on ‘Layemd Symm'.
virtual ID phys'ml-mcmory mappings. maintain 0.
prompt characlzr. oficn a pawn! or dollar sign. an
cache of recently accessed page: and implemen
ting a (Refersscflan1.72)
d thesaunandwaivsfonhenscnotypeacommmd and mm
good pay-[cplacemml policy. and on-deman O. Dmeramlme bemeen mm:
line. When the user gives command by using
hinginginnewpagaofnudedcodgmddalainm command line, the shell removes Ihe first word
(mm 1.7.5)(5 Mail‘s)
memory. (Jun- 2915. NW. 2015)
fromit
syllabus Topic : 51mm Calls

1
0'
Process Management Component — Aflfl exu'acfian of this fi m wmd. the shell assumes
it
[beau-management component carry out nation and am. it is th: name ofnpmyam to be run. Then 0. What are symam calls?
Inminafiun of W finds this magma. And i f found. it nuns 1h: (Hefersscflon 1.8) ( 4 Mania)
program. Until [he ploy-am terminates. shell (JunIams.NW.2015)
The [mass scheduler pm! in this component
suspends itself. a! which time it attempts to read the
chooss the [Mud to be ensued next. the mousse: shodn01! on Hymn calla.
nan command. 0. te
Ind mm an unused as simply as executable amides N15)
— The shell is just a simple cmnlnon user prom (Rater section 1.8) (5 Marks) (HIV
FIg.Ll°.2:ImK£rndStrudnfl by linux. and global scheduling policy is used for
having capability to read inn: and wn'te lo the u. Explain any fiva sys'arnmus.
scheduling purpose. Finally. cod: for sigml handling
Theta-udwbsymmisdividedmwmmmzin also belongs to this may.
lei-mini]. and the power to run other programs. (Hak im 1.3)(6Marks)
‘IIO may Following is the descriptiun of bourn:shell. (Jun. 1015. Nov. 2015)
1.10.2 Shell
Wmdmmmwmpomt
1.11 Exam Pack (Unlverslty and nevlew
0'
Syllnbus Topic : Linux Kernel and Shell
J
Explalnunux Kernel.(Hararuwon1.10)
0‘
“DI/0W Ewmashéhmi'egn'f" Questions) a.
xa
1h": [IO component includs all kzrnel components — A user interface is provided by pmgnm called as shall. 0. Explainuuux opemungsyswmwnm
whichlle lpstoinm mvfifllde vioesmdw wom Emma,” 0. Whal h operating system? 1.10.1 ) (1o Marks) (me. am)
”mmwmmmamdm (mm
n1.1o
wworkandszmge llOoperalims. UNKsyslemwitlusheu . pm (Refersecflon 1.1) (2 Marks)
a. wmmnotaonshell.(flnf9rudlo
All lhcllOopemfionsueinmgnedmderaVFS sun readin mummmuymwmm by (Doc. 2014. Jun- 1015.H.201 Dun
l
(VII-tullFlleSysmnHayerlsshownuhighmleve m'mmmmmddiwhymeompmofm
e
opcnfio n:
in fig. 1.10.2. A: the lowest lewl. all IIO commands.
passmmugh some device driver .

Scanned by CamScanner
Scanned CamScanner
mmgquigdbylhepmmmcomplmm;
_
execution. "mmmMWBwumtcI-n
ling
Process Concept and Schedu
The dm on which pmgnm will apemg, 1. New“:
"05m executionmm Mmmheingm
2.2 Context Swltch 2. Helium
Amhmmmmhimghau
J beingnmignedlnil.

- When CPU switches from one process In omega Exewfingm


context switch occuls. A context switch IS m : switching Apmecssisuidlobeinnmningueifwflumlyml
of the CPU (Central Processing Unit) from one pious; isallocamdloiundilisemning.
0"
PM : Coneem 01a Process. Process States. Process Description, Process Canto!Block. Operations Processes or thread In another. wmwwm
Thmds : Definition and Types. Concept of Mulfimreading.Multioora Processors and Threads. When context swim: occuls, opemfing system moms Amcan'lmflnmlhueunimmixh
Schedullng : Unlproeessor scheduling. Types 0! J . and J... r Algorithms:
the information of currently cmuling [amass fur the waitingforc vmllohappm mchummpl ah
FCFS. SJF. SRTN. Priority Based, Round Robin. Multilevel Queue Scheduling. Introduction to Thread Scheduling. lam use. Emislblclomnwhnm’mmlm
Mulflproeessar Scheduling and Linux Scheduling. — tnCPUagaingelsafl ocamdmlhesamcpm ,me happens.
maimed information is used to resume the execution. Tennnu' lean-I:
Thccanlextofapmeessism pmscnledinlhcm Themhascompldadm‘
- A program or application under execution is called as Conuol Block (PCB) of a process. Theprmmmnsiflmdilg-Imkmin
2.1 Introduction pmeess. A process includes the execution context. A The infommion needs to be restored includes addtuss FigJJJ.
program msidcs on the disk. On disk it does not require o f the next instruction [ 0 be executed (pmgmm
- Pmcess manager implements the process management
any mom A program gets executed in main counler). CPU legisler contents. pointers to the memory
functions. In mulfiptogmmming. single CPU is shared
memory. S o it should be transferred from disk In main allmmd to thc process. scheduling information.
unong many 13mm.
memory. changed slate. IIO stale, accounting information etc.
- If m y [mom remain busy in completing 1/0, CPU
To compute execution, program needs many lemmas While camext switch. system does not perform any
is allocated to only one proccss at a given point of time.
and compcws for it. Now it becomes proccss. useful work. So context switch is pure ovemud on the
Her: some policy is required to allocate CPU to system.
— From the computation context point of vinw, a process
process, called as CPU scheduling. If multiple users am The speed of conlaxl switching depends on lhc number
is defined by CPU slate, memory contents and ‘
working on the system, operating system switches the o f regimen that must be copicd. memory speed. S o
execution environment.
00 from one user process to other. context switch speed varies from system to system.
A CPU sale is defined by the content of thc varimm
User gets the illusion that only he or she is using the
registers such as Instruction Ragisler (IR), Program Syllabus Toplc : Process Slates “57.3.1 :Procmmtemxflundhgnm
sysnem. Pincus synchmnintion mechanism is required
Counter (PC), Slack Paine: (SP) and general purpose v
no ensure that only one process should use crin'cal — WWmkmilmm' inmate.
registers. 2.3 Process States Afierlhepmcusadmined formfimilgoain
action.
A small amount of data is stored in CPU registers. - -) (Dec.14. June15,Nov.15) mdyslalc.Apmoessinthi smc.waixinxhcmdy
Process communication, deadlock handling, suspension
Memory contains program code and its predefined data 4 qme. Scheduler dispalchfi the mdy [mass for
and mumpu‘on of processes and cmfion and deletion execufinn i.e. CPU is now allownd In the m .
smwtures.
of the processes etc are soul:of the activities pufomd tn CPU is executing
{he
pm. il is in amountin
in process management. — Heap is reserved memory area for dynamically ' {mm
executing
slate. Afiu context swimh. process 30!:
" of memory to the program atnm firm. to may sum. If :xecunng plum inning an IIO
53; Topic: F -" , of? In stack. program local operation befole its allotted rim: wins, the exec-fling
variablu are allowed and
return values of function call are stand. Some registflf process valunmrily give up u: CPU.
— During exccution. process changas its state. P m
2.1.1 Process
values are also saved in slack. hmiscmpmuansilfiommfingmmiflng
state shows the cunent activity of the prom. Process
5mg. Whenlh ecmma levcmf orwhic hlpmw
Execution environment slate contains five states.
includes open waifinghappenspmcusnnsilfiumwaifingmmdy
communication channels to other processes etc. - Bath pm tannins in one of these five states. Than smWhenpmeus finishadnuacunonfilmnsilm
following are the components of the process: is a queue associawd with each state of the pmcess. terminmcd stam
0 The object code that Is to be executed.

Scanned by CamScanner
Scanned CamScanner
_———fi
5"“d!
PM among and
E mg Sjsmm sMU - Sam 4 - COMP)
23
control structurfis WMMU-Sem-wun 2* P W
“ — I 2.4.1 Proas, 0'
Pointer
syllabus Topic : Process Control Block (PCB)
SylllbuuTopic : Process Duedpfloll and canl “W PM- “ OS
-Thisfieldpo:ms‘ m a h r p r m ' n P C B . T h e
1“ wk! In manage
location md am'ibllm such a;
2.4 / Process Descrlptlon shawl/ill” known to i n 2.5 Process Control Block (PCB) ' link ' ‘hypmnm‘.
_
Mmmm.
-) (Dec. 14,.Dec.16) V Current Ihtl
nemnqukedbypmmlowmymm
5.41
- 0' PING" Locfllon - Cunenflypmunbainuyoflhemmm.
exemnionuepmvidedbyapenfingsymm. mady.exmning.wail.inguclsdunibedlhov¢.
mwMammwmmmmmqW meonninsiupmyflmlldmmsl’mm
mmtymmtlm " Proms-ID
ruidualminloufimin
>"
process. The mum um processes had In mu - Dec, 2015. 5 Mark
lglobal variables and - Idenufiwu''onnumberofmmomnl' sym
m.V0devicu.andmninmmrymd0Ihus. have cumin locations of lncal ' ‘nfwm
— Any pmcess is identified by its Prams Canlml Block nssiplhisnumhulopmlodmum"
TbeOSconnolsLhep-owsscsmdpmvidesmsaumsm consult“- .
(PCB). PCB is the data structure used by the operating album
mmOSshouldh avemmeinfm-m nfimtom pmcedm
Hawkiulsopmvidedwkupmkm system to keep track on due pmcsscs. 7 Priority
Mmmdmoum. en these pmcedules.
calls and pmmcms passing betwe All 1h: infnmafion associaled will: pmcess is kzpt in - Differempmoessmhxve M I M E - 1 m
TheOSshauIdlmawcun-emsumofeuhmand is maintained in
usoume. The various Im-ibum of the p m process ountml block. Then is 55pm: P03 for each field indium thepriority of thepm
m Com-m] Block (PCB). process. 3'
Prognmcoumar
'l‘heOSmlinninsublecofinfomafionnbmHh:
alumnus such - Traffic comm: modul: keeps track an m: sums of
quid-s. These entifiu m memory. 110, files and Thus pmom image includes the above WmmtswimhflUisgivmmahnm.
(hepmeusesJCB'sofdwprm-ssuwhichminme
plum. 3 1mm. dam. sunk andprocess comm]block. Whenmmohhepmvionslynmfingyxmwm
um: slaw (my. executing. waiting etc) are linked
Mammymbln skeeplheinfn rmfiwnbomm fin The m y magnum scheme is responsible for wgetbergivinxaspecificmmzwlheflstsuchunady again CPU gen allowed Io il. Rug-am m
myandseoonduymemorylumwdmlbe image. contains an of the inmwfinn hum which
deciding the location of M list.
M execufionmsumcsaflgroomnlswilch.
Ixcmhe ‘, or block of mzmnry on E m m y mocesscs wnil for the sum davice. thu- PCBs
lllboknzps' ' r ' of all time process: all linked mum in chin ‘7 Registers
mchlswhichpmmaecssthapmicuhrslmed woundaryslonge.
wniling for that device. — llincludesgenenlpnwmy‘flndnkxnfim
mymgians. mmgemnlofmpmeemlhesmllpom’onofits Ifdeviubecumfifrulbmhfficcomllmdnckslh: stackpaimasandancmulmsmmumberofnginu
tumfionmededtomnagethcvimmmmmy imlseiskcplinmainnmnmy. PCBchninmseeifmypmusiswaifingfmthe andtypeofmxislfldifl'asuperlhemhimol
kllsomliminedbyos. homwmulhepmmOSshouldbelmnwn device. compum.mstale Marmafionswndlflninmvpli:
Sampufiunfmhamgmmyismvndfnrosmin and — Iflhepmcesscsanavaflnblainlhatdevicechaimlhcn agdnusedbyutprmlommlhuxxufim
about Iowiun of each pmcess in main mm
mmamWWM
seeundu'ymemoryaswcu. lgain it is placed back to may sue to request um " Aceountlng
The pm: are swapped film: will my to device again. Inform-lion for calcuhfiug uh: mom's ‘35:!i
ModanOSsupponingpagingaflomsomepagesin
seemduymemy. — A typical process comm] block is shown in F15. 2.5.1. Mafivetoolhflpmshismyinclndemg
main namely and remaining pages on secondary :r'fi’mnur-ft
Mmmgcmnmfllomudchanndsismficd '5”m infomdmaboulmmuscsofnrJulsoindndfl
anhyOSbyusingI/Oubbs. mmpmecssnblemunshuwmelocafionof Plooess ID ammqPUfimeandluldfinlm
Humopaaflmiscmmlyufingplmcdmos “chm Prim-fly pumsnumbetsmdsocn.
Plug-am counter 0'
slmklhowiscwmmmmditslomianin W mAMbum Memmyalloenflon
mammal-claim Regislexs
In mnlu'poyumming system. the infomaliun about — fisinlmmalioqmyincludclhavfluofbmmd
OSflmsmldhwabmmmilis Accounlin
ad: places: is maintains]in pm comm] block fimiltegistflJ: includes paging. segmenmianfllled
Marauilable. Memory infmnafion depending on lb: may sysian used.
(PCB). Event information
ThefiknblesanmainninedbyOkeq: mwaflmfldmmmm
Follwing lypa ofinfatuationismainlaimdinPCB. list of up“ files
infumazionugalding Eh. theirlocafiononseeandary ' Evamlnlonmtlon
mlmandmhamm c Idenlifiufionofplms
- lpxuminthehbckedmlhisfiddm
This infatuation is used by file W m a Infomafionofpmm
infmmafionmmingmemforwmmM
Thcmnemenlof misuniedomby ming. o Processmnmlinfomuion Fig. 1.5.! : m noun-o!block iswfilins,
Wonmimainedinpmuhla ‘7 undopenfllu
wheublmam liuhedandao ssxdmmedi n
Fflesopeoedbylhem
parfimlumnu.

Scanned by CamScanner
Scanned CamScanner
2-5
%M0-&m4.cwp) E Opernflm aster" [MU - Sun 4 - COMP) 2-6 mmmhg
Afler “mil related.
flags
uealion of the pious. hardware msism ”d - chfld'smmflfiuhmmby
are set as pen-lb:deans supplied by Iondusorm W. a Unfilfewwnfllhschfldmmmimlgmwifl
m
4 3. Ammummaumamwp wait Ind will not be minted, It: waito system call. Deans: of this process
_Almymmcpmisblocked.meww P1081“: irknfifiu.pm!pmmmumknawlbmnwhlch
lbs-lslcr's
content at: gcncrauy plmd on the suck and “n In inmfive syswms. users can stun n Withmpecttolh eaddmssspane cnhemm
childixmminmed.Afierlhemnninafionoflhcpuml.
ble) clicking an im again we possibilitins exist :
pfmermtherespecuvcsuck hmeissluedinthePCBJn typing agommandor (dou lhcl'nilptucessisassiyledupmmmfllmminucd
Ihls fashion, the hardware state can be minted when lhe -D 4. Stu-dug o n bitch job a nnmanddmofchfldandpmtpmis childm.Thisinimoesseoumflllumimed
sums. It mums child is duplicate of itsparent.
places is scheduled and mum: execution again. bnchjobs w children's stains and execution swims slur
— In mismusels msuhmit 0 nnmnnddataofchildandpammpmsis tenninnfionofdleirpamnl.
Wlabus Toplc : Operatlonl onProcesses mum:system different. I t means child process has I flaw
lithnslhcmsom Syllabus Toplc : Thread:- Mnltlon
— WhenMOSmkcsadccisiondm program loam! inln in
s I new p m to
2.6 ape. ' m on F. to execute another job. it cream -D 2.6.2 Process Tanninatlon . 2.7 Threads
exam:umnext job from the input qucu:in it. finishes the execution of last summent. i! 2.7.1 Definition afihread
- When p m
terminates. Aflcr this it xequest lb: opeming system In
— Ammuisasin glesequmsn umwiminam
delete it by using the ad! 0 system all.
Threadsamllsocaflndasfighlwdghtpmask
— Just than. Ihepmocss may return an imageno itspallnt
pomsomeofthcpmpemflmmh
process by using who syswmcall. belongsmeucuyonepm. .
— Then all allocaml resources to the process like physical lnopmfingsysmmmalsuppmmummudinamm
and vimlal memory. open filbs. and [IO buffets all
moonsismfmnythmds.
meningakuofpxmcs.
{teed by th: opcming system-L — Theselhmadsmninpulflelimpmingthelppfiufion
— Terminatio n can happen in outer simfion also. performance.
- InUNDKonhe Windows family of operating systems can
Fig. (21 : Opulfiononpm idea — By executing the suitable system call. any pm“ - Eachmhmnudminmcrummdmhm
pm me idgntified by unique p m
terminate the other process. thayshmthexddressmohhepmufllhe
-§ 2.6.1 ProcessCreaflon (orpidhichistypicallyanimgernumber. laminated. environment.
- Normally. parent of uh: pmcss to be
— Plum are amt] because of III {clawing four
— Thepseommndisusedinmmobtain lhelisfing execulgs this symm alL — Thmdscanshamoommmdalasomzydommm
“11mm. — Otherwise. users could mndomly kill each others
jobs. useinterpmcesswmmuninlim.
pincipaleveuuThmeansMwniagm y.
i n g m e Likcfliepmcessmlhmdsalsohavesnmukemd
— Byusingeommmdps-eleomplueinfonmfionforall hisnmar y t h a l a p a m l m q w w —
wmflyactiveinlhesystemmbe idemilics of its childmn. exmningmlockedmpriofityunbclgigmdlome
we identity thmdsjustfikepmoessandhi gbwtp' ‘lylhludis
obtained. -— Thus. whcn a moons mules a new places,
of the childprocess is passed to the pram schndldadflxst.
— Pram requires cumin moms like CPU time,
— Any of the child W execution canbe Inminlled - FachlhmdhasilsownMCmuolBlmkflcB).
memory. files. [/0 davics lo complete its task. The Liknptocessmuntextswilchoocuxsfordwhu
dmd
by child for a divus'uy ofmsons. such as these:
alsonndsmesemuees. mgislcmunumsmsavedinfl'fl).
by child.
0 If the allocaled assume usage is axcwded
1Ausarawealnuaalaamm — r a n g u i t s neededxesoulwsdilecllyfium
mnpmt muslhn vaamn slomm ineun — Asthmdsshmxhesamemspmemdwm
the various
tmdabaflljab I die ( gsysmmorilmybeiamdmasubselof synchronization is also required fat
slat:of its children.)
the ofdlepamnlpm. to acfividmofthcthmd.
There is no longer requirement of allocnwd task
figm:hincipdmnlsofpmmaaflnn — :flzpalflflmnshamlbemunesmngilschfldmof
0
2.8 Difference between Process and
the child. Thread
a 1. Systeminlflnlinflon neandmdethemurcesmnflmloivschfldmn. Him:
Inmany sysmms ,l.fthep ammis
a
— Ifchfldpmismcuicmdmasnbsuofmepamfs m.
Anuboodngosmmanyptm 08 doesmtpmnit achildtocanyonexecufi
mmoverloadhglhesysumbycmfingmomfl)’ permit a child to
4 1. If running p m mulls mu- canon — For example. VMS system does not
submmbeavoided. is minted .
syslunnll any on execution :35! its parent proofs:
mminaled men it
ants me a- male Theinidaflufiondanmaybepamdalmgbym If all childmn of particular pawns are
— Omfly uecufing nous: Am: normal or
mmmhmmmmfimoffl is mllpd as cascading lamination.
pmmesbyimxingwpmsymcanasn termination is
pm. abnormal mm 'on of parent. cascaded
needsmaepmm toasislitincom pledmof by MOS.
Aflaclufiouofanew aniedmr inmany systems. I! is initiated
um _ possibmmexm -mm m‘ the
InUN Kexi lOsys temu llisus edtom
“WWW“:
-
Oelfingncwprw‘sminlyhelpfillwmm dbypmntm
-
o'l‘hcpuentandim m‘ .} process. Thewailo sysmmcnflisuse
Mmbeanbdmnmmflyhefnmhwdhm nbmhuga:
l 5 ul
. wait until child is terminated
par-lid.

Scanned by CamScanner
Scanned CamScanner
5

S “
H:

'
E

MU-Sem4-OOMP 2-3 PM»: me


m1
switch me'tinsln
- Both openlions mum lass tins. Simulate-(ls belong Kmlthmdsmgenmllqmm‘
me TLB as
8.
(”-3) Space mthcumepmeusnoneedloflush'lfluaddm mandmnmthnnnmm
31

space remains same aflcr comm switch. 0'


is Sam Advannguofknmelloulmmds
of coma“; User-lave] threads requircs unruly low overhead.
and an achicvc high computational perfomnae. Th: kernel can schedule another dual! of the sum:
belong memmumhmminamisbmfi.
I Fig. 2.9.! shows the Instr lave!dam-is.
I.l I.l I] u-rmmnuls Blockingufonemmddouwblockmeenfin
x'
plow.

Kn-neleanslmnlunwusl‘yschednlemumple‘ mud:
fiomlhenmepmongflflplepw.
0‘
mm. massof kernelumimm
is
E
§

Context swimhmquimkmdmmn‘ tin.


3

Kuneluh mdsmgen eraflquil amllimel o


in two ways.
.

Mm” mmmed
mmudmmgemnmeusenhmds.
Fig. 2.9.] : User level chm-d:
Tennimon
Advantages of user level thread- syllabus Topic : Concept of Mum-fling
6
§

1.User Level Threads ‘ Thmad switching does an: require flushing of TLB and
doing CPU mounting. Only value of CPU register 2.10 Concept of Multithreadlng
2. Kamal Level Threads unedwbesmmd andmlaadadagain.
lncpenflngsystnmlhmmpponmnlfimpmes
Use: level threads 3:: platform indzpendem. They can unmislofmanylhmds.1‘hfielhmdlnm
in
mmfl‘ypsonhreads
3.

execula on any opemling system. parallel imploving 1h:appliufim pctfcmunne.


4 2.9.1User Level Threads Scheduling canbe as per new of appliaflnm
EachsuchduudhasitsownCPUstamandmbut
by
Thread management are at user lavel and dune they share the names spice of the pm and 1h:
thread library. so kernels burdcn is taken by welding environment.
package. Kcmels (in; is saved for mher miv‘nies
s.

Consuming the advanm of mu level Ind tame!


— In use: level implammion. kernel is unawm ’ Dlsadvantnges of user level threads s
levellhxeadsallybfidthmadingmodclusingbmmyp
thud. In this mammal package entirely pulin“ IfonnlhmdisblockadonI/O.enflmpm
m
ofthludscanheimplemenled.
span. Java language suppons threading packag- blocked.
Th: Solan's opeming sysmn supports this hybrid
The upplicadnns when: nfier blocking of on: thread
f mndeL
jlvnlmguage. odnrmqu immmni npanlleL um-lcvel thmdsmo
- Kernel new this application as a single no use. In this impkmenminn. Ill “I: (head Wm.
II'lliml.
In a user level implemenmion.
8“
‘1‘ 5 funcfiansmulfiednulhyusellevellhrudpuhyn
2.9.2 KernelLevel Threads uleq|fln
usersp am.§oo pemfio nsanlh xuddnn
why. _ kernel intervention.
illhai. if
management
mm creation and The advantage nfhyblid model Shh: and:
' M chm i1 an an
In this. flueads are implemented in operating system‘s
°f M
macs
and dam passing between‘ by kamL
the applications an::11d
kenul. 111:thread management is carried out advuna geofmu lflple CPU: iflhcy “1““lt
that]; . W E lhmd for execution. "“"
. and aficr context switch . ' All these thread management mimics are carried
out Wmmflnuemmakapmwavuinhemwl
_
7. mflwmwuc. in kernel space. So “and context and process
context
blocksonmhreadinasymmfilncfim.
swiiching becomes s'ame.
mmwdwngofmdmfins155““ Application canbe wxiuan as mullithmded
Ind threads
"
of the application at: supported as threads in
m "gmhisflnmofauomfing single
a“
while
amid
”c" deal lowing “1° process.
“smethud.

Scanned by CamScanner
Scanned CamScanner
rafl (MU<Sem4-GOM V 2-10 MW“
3-
- Th: pufmmne: of Ike Inflation running an 4 Jlulpplhflom
mnlwcmesyflzmckpendsmhuwlhisappfiafiunhhs - l m l a n g n : g e s w p u n s f w d
¢velopmcf
admyofpunlklmmhb‘ la. mulmhtuded‘ mm ' llvlvimnlm'nea‘lM)
' Amdahl'slflw Bamnlfilhudedplmdmofimuhednflngmd
-mumm— mymnaganemforlavnwlium
w‘
mmummm-nmdm - lav: appl’nlims M m harm dim-sly [mm
1
11-04% — For example Sun‘s lav: Amm' ' Saw. BEA's
- Mfismehnimofmwhichisinhflwdy Webloy'c. IBM's VIE—kph: and III mm
panllflmblaflenneJl-Dislhefnajmafpmym Toqplicuionm
-D 4. Mnlfihflmwpflnnm‘
amdn-aflmw “gnommnylnnnemodd MkinhfiurflymninscfiaLPncficafly,ifsmall
-. L Danni-Ida! ammofsuialcodeisprmcnnhenilmbelhem — Singlelppliuthnmflsobcbulfndfimnlflfiun
a 3. mM-wm implclonpcrlmmamcofapplimlion. archam' by naming mlliplz m of m:
- huwmmumwm _ m m m ’ m m m m m l e v fl
wmmkmbmhmMMB — mmwmmmlmmm 1“:tk
mdas’nflcm-levdwlolingb mflwlkvcllhfidinlhisml- ovMaverhmdformsignmglhewuklnnnlflple- Hmfipkwpwn'mmmmmmof
Wile-d. _ nm’mmnumbzrofm-Ievellhtudsm Windwzrhadformhgnom Wmvimuliufimwchnohyfloflhemof
— wumwummw .n'gdmequalmlcsumnbernfknncl—k'elm mmgsysummnbeudmnfinmotm
— hmderwaplnilthemulfimsymfmpnlhl
mhwhfigwmm. _ mmfimingmdehmhmlmdm
MmmfiWndnignnsmu-yingmmlb whhitsmsepmilzandmmvimnml.
’ ”.mihmrhdwamtunddlnifa wmwamlofmpkflwmwhm
sail! friction within Inniwm ' OS.
mmaaiwofmlhuikqpfiaim ”manywmnndel. Syllabus‘l'opk : Scheduling
nflddlcwareanddalabascappfimons. Thcnumberof
pin-zufllbem _. mmymmdeLlhiSm odeloffmaneflk-hn c1235 clappliulions benefit by their ability In sci]:
- vmsuhwmmnmuyb Wmmshmlmsym 2.12 Schedullng
lhelhlmghpnfilhnumberafmfivflawingmm
fl fi m u m m m a ails. czamplfiaflheseapplimions. 2.12.1 Scheduling Queues and Scheduler:
n u m m w m m u m
._ m m m fi y o fl m m w m fl h m
m-zonnonzhimdbmu . . m "Fl-mhw,fingwi‘hm“m

mmmMmmIW
”w“
glam...” '1‘: HWW‘” -

-
Sympmfltbeemuedminjohm
Aflflnminlhzsymnsideinjcbqnu.
Whmpmmmdyfankmad‘ifw
CFUJheykquinmdyqur.
- Apnfmmthcjobqunglhcqnlingsymahhs
«hummus.
iguana-mum.“ “9(1aa ofmnlflcoreapplluflou - Whupmmwilfummulzr' duh they-rug:
immeuintkvieuqueue,
4 1. ”loan—u minimum“ 9 1. mmm-ppw
— Mm mom” ofCPU In a: you m It:
- ufimmmmmmm - Mappfialimseomfinsmaflmberofplw
m‘ Whfle' «mm “amusing
Mannie
Wham-dbmylomkmflflmi mmmm whichmhighlyllnnded. nnmhasofevcmsemldm.
m of m y ”and that In a sing:
— Empleislmbomimuswcmwumm — Umflmmfinm' mm‘ hands
‘l W m RelalionshipManaga).
2.11 Mulfloore Promsors and Threads bamvnfiusschednfingqm
- h fl w m k d m i m m m -) 2. Mnlflproeunpplmm — Theqmng' sysmselmsuhmftupafl
“Wade‘zmdhmfltam - These appl'mtim contain m y tingle [lauded .
budmmpolzy‘
_ pm. - mmummwumflds
”whacked. . . .
W W W . l‘lcl d5
- ugmwymmdmmhwm
MummmWMMMWim - mhmOmkdaabn,SAP,mdPeoph§olL scheduler.
. , w , m m m m w w h
nhledlopa‘fommmdduipmfapplmm'' .
parables-WW

Scanned by CamScanner
Scanned CamScanner
PM Cones [and
2-11
plesentin -
11:Iongmmscudnluis um
mmu-SomA-OOM
l
- Then m the: types of W ‘0 Mk 5515””
mhcseamahmnmfigm- °penun' Sm musilion take place gm .
Come into}
my then title long mm scheduler ;
Thmtypunfmndullfl
for swarm“;WW ” II
lhan (he shun fast and invoked between
(8)
.1 5.10“.t Scheduler bod:
.. 2.12 mm frequently than shun lean
my scheduler.
W which an in queue wait in; long mm scheduler and
finm
scheduler.
shon um] scheduler chooses the lam“ long mm
figu'lfl'ypaofm
qmmdassign fl'mlhBCPUb flSflionsumpo
scheduler.
4 l. Non-Wu
m policia an be Fust Come Fusl s e w ‘ 3. Transition of Tmiliou of Nopmoasm:
Nonvpluanpu'v:algomhms' In (biped
mm stale pm sum msiu'nn. no “out: a
Sham:Job first (SIF). priority based andMind fmmNewlnfmmRndym mkcrumdoammmmh
amMainobjectiveis increasing system mmplmitscxecm‘nn.
Rudy. Executing.
Ming the CPUbusy. 7. 1* ,
4. Not pmsenzin Minimalintime Present in time
I: is mg cushion of the process fiom m y ham Ilgomhms' allwukinglnycl’ufiun
time sharing sharingsysmm. shann‘ssyslm
mnmgmmunmlaflncafionofpmw. poms: dining exemm.‘ If him pnonly'' [Inca
syslcm.
doneby dispamltr. . :m'vu in the syslun. CPU fiom cum-runny mm“
5. Supply a Sclacta new Prom me lawpfioritym'uaflmdmlnmh
Smmschedukrismtenhanlongm Humble mix p m to swappedinlnd :lmyshighmpfiodlymwiflhem‘
and shnuldbe invoked mom frequently ”my of jobs. such auowcmCPU omforbalmoed tatcharanddlspabhlahncy
leanscheduler. .
as [/0 bound fiequcnuy. pmwssmix.
and CPU Shonmmschedldaaunulcsmmludym
112.1(0) Medlum-term Scheduler
bound basedonsompol‘mlismmns‘tim-Aoffllm
“5112.1 : Queuing-diagram repruenlaflonof If the k m of the multiprogramming ‘ fivmmdysmalnmnningm
scheduling 6. [l manuals I! has control Reduce the
[rm medium-lam scheduler swap out the pm Ammonfionofmmcl’uisdmeby
dcgme of over days: of degree of
-b 2.12.1(A) Long-term Scheduler main memory. dispamhujhmmscmnuismmugm
mlzln'pmgmn multipmgnmmi mldtipmgnmmi
scheduler and should be invttd mm: M
_ mmmsubmmammesymmfwm The swapped our processes again swapped? min; thmugh ng asit albums as by swapping
cumulonglennschedulu.
mofpmssifle: medium-Kenn schedulgr. " placing process: to the p m in
long mm schedulerwm In
mmflfimdispachuudedmmnmp
pm in CPU for and out.
hawabautit. 'l'hisisdnnnlocomrolthedegleeofmulti mmmdmnmingnfmumkulu
ready queue. executiom
- Milsjohismchmsepmcsssfinmlhflquflcm or tolineup a mmory. udkpalchlalmy.
'l. Itisalsocafled It is also called
plndxminmminmemoryforexecufifln 'l'hisisalsohelpfiutobalancethemixof I
m 6 jnbas CPU Syllabus Topic : Unlprneessor Sdmhlhg
- CPUbuMpmmqnimmomCPUfimeandless Pm. some time sharing operating sysmn
Wfimumilemfioucnmpleles. additional scheduler. 2.13 l.'..:,.. Schedullng
— .Onflfemnm J/Oboundp mccssesuse upmomfim 2.12.1(D) Comparison of Three Schedulfll' Syllabus Toplc : Types of Schedullng
c
IndomgI/Olnd requinlessG’UUmcfarcompumfio Preemptive and Non-pnempflvo 2.13.1 Scheduling Criteria
n.
- Thema inioho flhclon glerm schedn
leristo pmvid
zl 2.12.2 Types of Schedullng
bahneemlxofllobounddPUboun
djnbs.
- mmberof_prmsesinmemoryf 9 (NI-v16)
or ' and
:5: of mulhplvgmnming is lelnta
d to each od'wr.
number of processes in memory
mm“ for emu 'on
_ long-um ubdulu
““9"““Human-mugishigh. mcmmynmcmumhmwrymllo
annuals the degree of
mummy-mung. Selects Choom the SW59“; fig.(2.7. openflmlswhflepcrfomingthzexmflm
processes from process fmm W smmwmmmmmm
_ "M‘Wmofnem ‘ “.1 mg:
depnmue nleolpmoesseg leaving ram
mm: m
the Queue and ready gum: and fmm mphsh‘ will: comp-l: no CPU 1m ‘
a” film-16mm; study. e“ loads ‘hem assigns it to the mmlipmgnmmm‘gsysmnshmdmmmm
“‘9'“ is 1“ inn) memory CPU.
for cxecution.
H .

Scanned by CamScanner
Scanned CamScanner
2-13
3"
no, I .tvakfl
E. Opemung System (MU - Sam 4 - COMP) 2-14 Processcamptandsmedulln
IWW
- w wCPUI 4 2132‘. A) First ll'l Hm o m (FIFO)
Syllabus TopIc adfimeform = (23—2)=21
- ”and???“ 'plgodm - This'uaNowpmcmpuve Scheduling Algorlthms - SJF. SRTN Tm'namundlimcforfl = ( S B - 3 ) : ”
paw d up“: ‘ is to may filmmaum Avenge'l'ummund lime = (10+l4+21+35)/4

$
. I wirmival. 2.13.2(3) Shortest Job First (SJF) = 20
_ 1:: mi in “w”
Aproccssdocsnm ' _ Shortest Job Fusl (SH-7 my be preemptive or non Waifingfiml’orm = 0
WWW} cpummlhellfll
0' Wlilinslimeforln = (10—1)-9
_mhn:!orpfl‘ manna: M W '1' - - - 8"”?
— CPUulIflllleIlhcrlcn-mm pmemplivg Ranrdcring Lhcjobs so as lo run the shortest
jobs first (SIP) improves the average msponse Lima. Wailinglimfu'm = (15—2)=13
“mi: _ longerjobasxiyledtoCPUm Wailinalimefotl" = (73-3)=20
Iowan. Ready queue is nuinuined in ordet ol‘ incrusing job
omi-mnnoffluau
lengths.
Avengew-ilinglime = (o+9+13+2o)/4
mill-y- — Mbflgmfinmuflhm = 10.5
When ajob m m in. insanit in the m y queue based
givu [co/e: fluoughpms,
a wmunbudjobuwwwdwunil on i s lengxh. In preemptive 5110115110!) First (SIB. if newly anived
- Thisalgotilhmanbcasily prom: 118 less exemfion time with compile to
it. SJF minimizes Ihe avenge wait time because it gives
queue. In l.im:: befon: it gins currently executing process. than the CPU will be given
survioe lo lass execution tim: [muses
o T—nulll In: : Tun: elapsed ham newly arrivedprocess.
sen/in to large emulion Lime processes.
mdhbandmphiouofiuemfim. CPU time aI regular inlcrval.
The plumptive Shortest Job first (SJF) is culled as
- SoFFOalgoritisnotusefiuinu While i I minimius average wan time. it may punish
o Whh:mwflsinludyquunm promises with high execution lime.
Sharla! Relmlnlng 11m: Nun Scheduling (SRTN).
pm.5mdmmwhldymh mugmmmisinappmpfimrminm.' Consider lb: nbove Hump]: for pmemptive Short-st
large fluctuations in average Mum If shnmr :xeculiun lime processes In: in ready list JobFirst (SIB. The Gum clan shows theMilt
dun pmccssa with lamp service times (and In be let! in
possible. receive service.
a Inna-1h:'l1nzfmmhn&imfillun the may list whfle small p m
hmkpmdnwd. — lfwemmclhalanivallimcismt- — I! may happen in exutme ens: um always shun 14 23 38
0 l 6
following exam]: : execution time processes will be served Ind large
P1:rriv=sanime0.soganhnCPUnsitisonlypmcess
° “lflfimwmshwldmmrslmor
IIIG’UIime. am m; execution Lime pmccsscs will wait indafmimly. This inmeqmuaAHiml.pm55P2u-flveshlving
2 .5

slarvalion of longpr execution lime procases is the attention time 5 (ICE than remaining lim: 9 ofpl). So
——=——‘
limilalion of this algorithm.
Mahahplusmuunmw Pl 24 P l ispmclnpmd andPZ isscheduled. A! time 2. process
Considcr the sump]: discussed for FCFS algclilhm. In
¢

P3 min: having amnion time B which is W than


2.132 summing Algorithm P2 (73 this example it is assumzd that SIF is non preemptive. remaining lime of??—
P3 05 If the order of arrivnl is P2, P3. P1. the order of 50 P2 will oomplele the cxeculinn. AfterP2,W P3
execution lime will be 3. 5, and 24. will execute us its exeaninn time is less lhan P l (9) and
— Than: is significant reduction in average murmur] P4 (15). Pumas P ! has tumbling execution time So 9.
lime and average waiting lime. it is scheduled nun. Finally P4 will complflc the
- Considcr agnin the following example of non execution.
Tumaluundlimefml’l = (23—0)=23
l

21 Turnamllndlim efmn = ( 6 - l ) = 5
“— ‘mncrorm = (3—o)=3 'I‘In'nuulndtimaforPS = (l4—2)=12

Manama = (8—0)=8 Wmform = (38-3)=35


P2 1 5
= (23+5+12 +35)l4
Wdlimeforl’l = (32—0)=32 fl Avmge’m-nmundlime
P3 2 3
AW¢Nmmundm= = 18.75
(3+8+32)/3‘1
”Hug—1:959???”

P4 3 )5 Waiflngfimcfm'l’l = (l4—l)=13
wiifingfimermm
= o Wailingli meform = ( l — l ) = 0
w'i‘insunform
= 3 Waidngfimeform = (6—2)=4
wlifingfimermm
= s Waiungmmrorm = ( a x - 3 ) : »
A‘msewaifingfim
-_- ( 0 + 3 + 8 ) / 3 ’ " Avmge Waldn gfime = ( 1 3 + 0 + 4
+10)I4
The result shows that then: is signifiwf‘. Tummund time for P1 = (10—0)= 10 = 18.75
Turnaround lime for P2 = (15 — l ) = 14
'Vmsehlmamundfimemdavefllsewm'
mullmics as order ofjcb an-ival M”-

Scanned by CamScanner
Scanned CamScanner
mummwu-mbcofll’)
2-15
. ‘fimfc‘l’l = (24-0)=2A WWW) 2-1!
PmW
SyilnhusTopleScmm'"! Cmfidalhcfouow ingamplalfweml fimc The allocation of pmeess m u: paniwlu mime
mmmmmrorn = (34-0)=34 qlunlumuf4millimonds then LbeGmn chart shows dqnnds on pmpeny of that pm such as m y
Sdndullng Algodfllm - Pflofllv Sin.priority of the prom“. or its xypa
Wmfimcforfl = (9'0)=9 lheresull.
-v 2.132(0) Priority Scheduling Wimfcrfl = (4-0)=4 Scheduling nlgon'uun for different quwu can be
1‘ umdlifllfuPs = (12—0)=12 difl'elcnl.
The round mbin scheduling nlgcrilhm can be used fa
Amnnnumn dlimuu4+34+9+4+12y5=m5 m 7
— Inpxmzyscmwng.eachpuooeshmpduilywm inmactivepmeessuqueuemdfirstwmfimm
isainegavalmassignedmix. Wailinglimforl’l = I ! scheduling algorithm can be used for batch processes
P3 l5
- Smllaimewisconsidaeduhigheflpdndlyud WailingtinnfotPZ = 24 queuc.
P4 4
WWBWEMM-m Wiringlirmfutl’! = 4 In addition In scheduling for and: queue, than muslbe
WMMMWCPU schaduling between the difiezent queues.
Wailinglimcforfi = 0
— hmmmmkmnnm The fixed-priority preemptive schcdnling is used fer
wammturs = 9 0 4 8 1 2 1 6 7 3 2 3 2 7 3 0 3 4 3 7
pr‘niqmdixdependsouimpkmnfln scheduling belween the diffenm queues.
AvulgeWaifinglinn =(12+2-S+4+0+9)I5 =9.B 'mrumundtimeforl’l = (30—0)=30
- pliofiliuucimauflydzfimddimmmlbk 1;! us considcr the five quwcs and its opmtion with
MMBMMMWM Tmmmdtimcform = (23—0)=23 multilevel queue scheduling algun'thm.
fillsbus Topic
mummmmmdawuom Scheduling Algorithm - Round Robln Woundtimcform = (37-D)=37 Following five queues are wrimn below in "I: orda’of
h m CPU bust I: used In mm: d: TmnamlmdtimeforN = (16-0)=l6 pfiofifiesusigncdwlt mberlindmmo
AvuagaTm-namuudlime = (30+23+37+16)I4 highest priority and s is1mm:priority.
- mmmmmwmam 1. System processes queue
= 265
maWommetypeandamn

“99:50
.7
m ' -. 7 Wailingtimefar?! = 0+(l6-4)+(27-20)=19 [um-active processes queue
dfimdshdngpaidfct fl m h ‘
- RmnabinSMflingisd-siyled cspecially for Waidngfimeforl’z = 4 + ( 2 0 - 8 ) = 1 6 hut-active editing prom queua
Mumwubumfimpotm

— “manusnnundmmmcowfingsym lime-sharing sysams whet: manyprmmgct CPU WailingtimcforPS = 8+(23-12)+(30—27) Bmh processes queue
cnfimcsharingbnislnmisilgofilhmasmaflunilof = 22 . Student processes queue
— WV: and non plenum: SIP is a prim-fly
dualledlimquanmmisdefimd.
mmmqhmmumm Wailing Kim: for P4 = I2 Evety higher pliority qucue has complete priority over
alphlnthisalgofilhmhwprinrizymmy Cfllbauowedwachmformisfimcqmmm
AverageWailinglimc = (19+4+22+|2y4=14.75
lower-priority queues.
mamThisisuudmI-nthn. wicdofmTo implemmllhisscheduling. lady Unless and until higbgr priority quell: become empty.
mmwdasFlFOqume.
— sum mmumm mkmhafin‘n Syllabus Topic : Suhadullng Algorithm Wmlowestpflcrityqueuecannmm ‘
mmmmmdhmm - Themprmgowzh cuflofqmmdeach fime Mululovel uueul Scheduling
For ‘ , in ‘ editing pm
mmmfiymgmmvmedmhiw Gumdzmfiomludofqm queue cauld no! axecum unlass and until all Ila
-D 2.132(E) Multilevel Queue Schedullng
Maid-ally- - Whafimmmmexpimoonwxlswimhmcursand names in 1h: queues for system m
- mummmmm mmhmmmwhichisschamlednen interactive processes finish the execution and time
mmmmmm — m m m h fi m m m m m qualms becomes empty.
Sometimes i i is necessary to calegoriu the processes
WMMmmmmfimmm pmcess in Iowan-priority queue is cumin; and at [he
imn different youps.
onetimquznmm. same time other pmss belonging'w higher priority
Pl l2 4 For example. semi-alien is made between him-active
queue arrives than currently executing process in lower
- "mkemlmmforl/Olhcm [licenses and bald: pro-uses.
P2 I0 5 zoninwailingmloeked)m priority queue shouldbe preempted
muspmserfimcneedofmmoproeemsunbe
P3 - Afianncomplcumofllomxmmmm lfabatchpmcessenlemdlhemdyqueuewhiha
5 2 dissimilnn So these pmsses can have diflmm
student process was executing, the student M
P4 4 1
‘Wflfldmflymmmmmmmnm scheduling InquimnenL
would b: pmempled and batch process wwld be
bevuysmauorveryluge,
Also. inmmiv: pmesses my have higher priority
P5 3 scheduled for execuu'on.
3
‘mmkmymwummmwm
' “behvejuszukem-‘s. over batch processes.
hfiisflgofimmnfixcdamountofCPUfinnisgim
In multilevel queue scheduling algorithm. there It: locachqucueandwilhin Msfimediffuenlpm
I w l m I vs I n I n A ‘.'"‘"“ '5’" W
Wmfimkmwmzhwnu
ham
coma: swim multiple ready queues. from this queue are whednlcd.
a 4 9 I2 24 34
W“M¢$dwsesmfim

Scanned by CamScanner
Scanned CamScanner
2-18 Process w and Sd’lflflllllla
E Opernfln system (MU - Sam 4 - COMP)
111‘
P WI" .
. 00mm“ .1 Syllabus Topic : Multiprocessor ScheduIIng
Once Ill Syllabus Topic
- For example. the intencfive[amass 1W and q we 0 wow empty. ”fall!“ Introduction to Thread Schadullng
edulins - l forexwuuon- ,
“lopementnfmecwfimeformundmbinsch MW - qua”
m will 2.15 Multiprocessor Scheduling
m a i l s W.whmasthebawhq\lfl|¢3“3° Aflnr queue-l mamas empty then schfduler 2.14 Inlroductlon t o Thread Schedu llng
pementoflheCPUmgivcmilspmmSflmmFCFs thePM“5565 m
‘ ueue-Z for execuuon"[1
q
wnSidfl We]
basis. Threads an be implemented in two ways: User When multiple CPUs are pm! then scheduling
HWY-l
whmv
In an same way. W55 m queue-ZanWIempty,
only be and Kane!Level.
ewled ifquuwo. queue-1 m d quwc» involve the: inlcnelawd issues‘ Thus: an:

A PM ~ - g for queue1- will preempt a -W


.mvm WIyI m lmplamnnl
— How to assign processes to pmecsson?
film-d Ichadullng
“V55 for
in qWZ. In “I: same way PMS “mSign-1m - The use of multiprogmnming on individual pm“.
!
-l. if?
qmc—O will pump! a 9:006“ in quue 1" - The actual dispalching o f : process
queue.
Inivcs for queue-1pm“!!!ls process
from the ready queueisplaced m queue-o.
[muss
2. KernelIavsl 2.15.1 Assignment of Processes to
3Ap m Processors
uling with 3 queues an:
Multilevel feedback queue sched Fig. C23 : Wnys to implamant lhmfl scheduling
shownin fig. 2.13.2. — lfnlldwpmeessursmsimilarinflnsensemmis
execution within 4 1 . User level no special advantage given to any pm wilh
If the process does um finish 1h:
it is moved to In user level implementation. kernel is unawm
o f the mspectwmemorymessormdevinslhen
Law-n priority allowed Lime quanlum of 8 in queue-0. in user
the tail of queue—l. head. In this casc. thread package entirely put assignment is straightfonuald.
Flg. 2.13.1: Mululnvel qme scheduling m space. lava language supports threading package. — Pmssorscanbeassigncdmpmondemnd.
The pmoess n ma had ofqum—l is given a quantu ' in
4 2.13.2(F) Multilevel Feedback-Queue Usercan ',‘ the " “ , " ‘ ' can be static or dynamic.
of [6 milliseconds if and only queue—0 is empty.
Schedullng java language. Kernel meats this application as a single — Thaleisdediwedshontermquéueforeachprm
If it does not finish. it is preempted and is placed into
threaded application. andprocess finish execution on that W only.
queue-2. Processes in qucue-Z are run on anFCFS basis
In a use: level implementation. all of the work of thread — Thisappmachmuseslesovemeadinthesdwduflng
bum: run only whgn quues 0 and l are empty. Forthcse
— In multilevel queue scheduling promise: me nm magamtnlisdonebylhclhmldpackage. function. as 111: processor mignmcm is done one:and
If III: [1:00:55 am with a CPU burst of 8 milliseconds or
germinal to transfer from one queue In the other. threads scheduling is carried out on a per-pmeessbasis. for all.
lass then this scheduling algorithm gives highest
—- Also queue assigned to the pmcesses are permanent and 1. Kzrnel level — The drawback of static Issignmant is dualpmssorun
priority to it.
cum be changed, leading to the low scheduling cost, Kernel level threads are implemented in operating bcidleifnopm cessesavuila hleiniuqman d
This process will immedialcly get the CPU, finish its
I'm!i! is no: flexible. system's kernel. The thread management is carried out p m w i m m m p m i n q m e m b e
CPUhunt, and go off toits next IIOburst.
The multilevel feedback-queue scheduling algorithm by kernel. ovedoadad.
pm can move from um:queue to other. Ramses Lhal require above 8 but below 24 ‘
milliseconds are also served speedily. allhuugh with ‘ All these thread management activities are carried out This canbe prevented by maintaining global qume (or
-
The CPU-bound processes use more CPU time and
lower priority than show processes.
in kernel space. So thread context and prom context allpmcessorssolhnpmcssmnbeusigxedman
hence it will be tmnsfened lo a lower-priorily queue. switching becomes same. availabic pmcasar.
Long process: automatically go down In queue 2 and
[IO-bound proccsses us: less CPU time. Application can be written as multithreaded and threads — Hence. tillp m finislm the execution. it enema on
are served in FCFS ordnr with any CPU cycles lefi over ‘
Keeping CPU hound pmcesss in low priorily queue of the application are suppamed as threads in single many processors an different time.
Emmqueues 0 and 1.
nummfienlly leads to keeping the 1/0 bound Ind process. Kernel heads are generally requhes more — In use of lightly couplcd shared memory amhimcnne
inlencfive processes in the highcr—primily queues. fine to create and manage than the user threads. Here a u t h c p m r s havelhecoumxtinformafimoflll
Thcnisachameofstarvationbecauseofpmm scheduling is on threadbasis. processes and thus dz: cos! of scheduling I M will
waiting for longer period of lime in a lower-prion'ty 0n unipmcessor syslcm. scheduling is done on single be independent of the identity of the processor on which
queue. CPU. Hence only work involved is which process it is scheduled.
It is avoidcd by aging; by hastening these waiting shouldbe given next to CPU. - Incmofdyn mlicloadb alancingm mdsnemw d
pm in a him-priority qmue. from one pmwssor's queue In a queue of another
In multiprocessor sysm question is of which thread
processor.
Consider the exampl: of a multilevel feedback“ next and on which CPU. Threads may belongs to single
— Linux uses this approach. In mum/slave minimum.
scheduler with four queues. queue-0. queue-I, qmz appllcninn or may be from diffelent applications which
keyhmlfimmionsofmcopemfingsymmn‘ml
and qnule-S. Initially the schedule: slam executing all arenot[claim to eachother (independent).
palfiudupmrforfllmcfimmdmhrpmm
pm inquzwo.
may anly executeuser program.

Scanned by CamScanner
Scanned CamScanner
2'19
raun MU - Sam 4- COM?) 2-20 PmComapund '
MNU-MMW
- mmnjugorjob‘u uniedwbyW-SWF 4 2.11.1Loa'd Sharing - Preempwd threads mly not get same,W to
mmhmmwmflm
mm memenfiun. Th: caching becomes k5 gfidmif
0'
Advantages of load sharlng pmessols have cache memoty.
fwhfwscnicembcwfledom. — Ilisunhkr.‘ l y m g fl a c m i o a l l t h e u n u d s o f l h e
imp-0W — In this appmach. load is equally dish-1mm among all
‘ This W m Muins slishl ‘° '
W MWWMMommmainsidle. pmgmn at the same limc.

— That: is no need of centralized schedlllcr. The - Hmonoooldmau''onisleqmled‘ betweenthmdm


- MMmmisaAfiflmofk scheduling routine of the operating sysmm executes on m swimh may lead to pompeflotmwe.
mmmfiflmofmewholesysmand‘l' available processor to choose Ihe next thread. -D 2.17.2 Gang Scheduling
mmwmmm — The maintained global queue can be accessed by
using
Aficmwmhmfiwmflpdmm 0'
— hpeuaxchimnemypmmmbemdfm - schemes used in unipmcessur scheduling sun]: as Advantages oi gang sch-dullng
m m w m m i u u m y o m Mmlusoverhead- priority based schema or schema: based an amnion — Assynchmmzw‘'on.blockingcanbem|mnnud'' ' Indies
mmmmmxou nmkw ad Schedullng
history. pmswimhingcanbeuhievedhymnmn’glhe
- Withlhis 1 . cs - ' andil 2.17 Thre 7 Load sharing approache s nlaledpmcesesinpamlkllh meidm'min
mnsl M an two [mussels do not salsa me perfmmmc.
9mm Laud sharlng approach“ — Schedulingmrhe adunbeminimiud nslsingl:

4'
‘ "’ decision nfl'ec‘samnnbetofpmcemandpmn
— mosmmuMmmnnqhm-ldm one film.
balnstfiumtheqlnn. Follawing an we four general approaches used for 1, Flrsl-ooma-first-sarved (FCFS)
for the m schdnlingoflhmdsonmultipmmsorsystem. Gang scheduling ishetlu forth: application whosuny
- The claims by eminent plum
2. Smallest number of threads mm part is not running and otlur is nady for execution.
shonldbefillfilledbyopuafingsym
- To [solve this: issues. inmd of astigmn‘g sm‘gle Fourpnu-nlappmchu and
3. Praemplive smallasi number of thmads first It is imphmmled in many multiprocessor upznling
Mancunllngoflhmds systgms. In this scheduling pm swimlm m minimiud
mmmawbwofmunbe on mulflpmeossorlysum
dedicnadmkn'nelpmcmm’qg. Fig. €2.11 : Load sharing approaches asmlatedihm dsmninpanfl el.fience.perf onmmeis
- Inmhenppoachthemquimnmtsofm -D 1. Flm-comefim-served (FCFS) good.
mdmlumonthebasisofpflmitymd - The (heads of the newly arrived job are placed As threads that llqllill coordination run in parlfld.
autumn hislmy is nouidued. they can m file wiflmut additional warhead and
consecutively a! the end of shared qucue.
mum. allocation can be done will:less oven-held.
- The idle pmcessor salects nan manly thmad and
2.15 Th
‘ Jam.."m"'"v~ermm°n mm w m w executes it until it finishes execution or gets blocked. In his schnduling pmcmm allocation is mquimd. KN
4. Dynamic Schedullng 4 2. Smalleflnumberonhrudsfirsl processoxs and M applications with N or {um “and: m
— Emmmwmmfllflm prawn: dun each applicalion could be given lIM of the
the exemion than than is no question of — If the jobs are having smallest number of unschoduled
fig. C110 : Appmchs used for available time o n m: N procusoxs. using time slicing.
threads than highest priority i s given to it.
scheduling o f threads Dedicated Processor Asslgnmem
-. In this use, pm my main id]: fill IIO — The shmd mady queue is like priority queue and equal -) 2.17.3
mmhotdcrmnchievehighpcrfmmmmd -’ 1. landSharing priority jobs are ordund according to jobs arrived first. — In this approach. during execuficn of program the
All the ready threads are present in single global queue Similar to FCFS. mad executes until it finishes number of processors assigned is equal to number of
Wnfiliufiomilisimpommtoswitchme ,
execution or gets blocked. Ihmads available in program.
mamgmnlfiplem and each processor selects thread from this queue when
- If m y poems are pm m an avenge it is idle. 4 3. Preemptive smallest number of threads first — Aumepmcesmmmmslopoolofpmesmm
program complete :11:execution
unufionpflommofappfimfionisimpomt. -) 2. G-ngSchednflng — Job having smalmt number of unscheduled thud: gets
— In this appmach. if thread of an applimfion is blocked
— Nthoughmnlfiplemmdsmmntinappficafiman highest priority.
Aseloftelawdthnadsisscheduledtoexecutennaset waiting for 1/0 a: for synchwinfiun with oflla' thud
shouldbemdyforexecudonuflunemmy. ofpmoessms a1] a!once, on a one-man: basis. - If an arriving job is having smaller number of thud: thenpm ssmnmfl nsidleca nbeadd msedu
with compare to executing job then it prompts the
2.15.3 The Actual Dispatching 01 a Process -’ 3. Dedicated Pneum- Adm! following.
threads of scheduled job.
In this approach. during execution of program the o lftensorh undleds ofwmssonpmemiusymm
- hmflfimpmmhghmipmsymwm number of processors assigncd is equal to number of
0'
Disadvanlagas 01 load sharing men pmessor umiwion does not m m for
anddifl'exunlappmncbesofschednflngmhnpmveme thumb available in program. All the processors mums - A single shawl ready queue may occupy the large perm-mince.
pedumlnoc.
‘0 P001 of processors aha gram comp1““ nnemory ponion and if many processors “Mandy o Asmswmhm‘ ' g i s l w i d e i i l m m l s i n b
em
_
- MWMMWMWMFCFSB cxecufion. pm tbs access itmenilmnybwombmlmck. impmvemem inpafamance-
discussed. " 4 Dymmicsdmduling
Thumb-er of threads in process my changes durinfl
the of that process.

Scanned by CamScanner
Scanned CamScanner
27:“

2'”
.5.“- Opening (MU---Sllll4 -OOMP) PM In!

'9 2.17.4 Dynamlcledullflc


h m m u w d w w

mmmmwwww
hindmimzxmepafam
Mosmwmmmflwu
Th: opal-uh; 5)“ pain: the W '0
filmmlhcjcbs (4) Priority Schodullng (NonpreampflVO)
mmwumfibkmnm"
kgmmhmfamlw‘h
m 0 ‘ 6 15 18 19 Pl 1
(6-1)=5 (l-l)=0
A pupa- decis'xu. in! It‘d: slid! D "- -
"' ” " ' " ' ‘ ' P2 3 (18—5)=|3 (ll—”=6
Wm-MMmm-unmi‘ ..0 ;\
mishflmuinmwwhfimtm‘” l0
Masadm-fimmml
7'
3 0
-"
Pl 3
.,
16 IE 6 P3 2 (11-0):11 (6—1::
)
0 Anna: 9.5 3.“
MWMyRWt P2 I 11 II W P2 1 l I
ll 1‘
“animal [)3 3 '3 ‘3 P3 3 ‘3 13 AvengeTAT = (5+13+lly3=9.6
kiflflufldbflm‘ N 4 I4 l4 l3 P4 ‘ ‘9 ‘9 18 Avenaewaiflngtime = (mks/3:3.“
Ihisfunlrafquxingsym PS 2 l9 l9 [4 P5 2 A‘ VEI'IF
1:4 8'1 an . , morn:
M 5‘“ IS D r —
Followingistheflannchm
album in! para-:yflbv'ng mks It: I“ A 13.4 ” (5) Round Robln (time quantum = 1)
dun-geranium ‘2) SEW) '7
ODEHDDEHEJIEIEEIIEEIEEIEIEIEEIEIU ‘a
o Aflnmeidhplmornm‘slymm Addict-HMS!) 1 l 9 16 II l2 II M II II I1 1. II o 1 6 ‘1

a [fjobismmiulmdncedmhfll
hmfimmflywfibbifl - , ‘
2-“:

mummkwlflflmh Pl 3 9
P2 1 2 2 1 P1 1 (6—1)=5 (1-1).0

o hmifjobsmambeuisfiedhi P1 3 (18-5)=13 (ll—5)::6


P3 3 7 7 5
mains cumming uni! F m buns P4 4 4 3
avflfikordaejobwilhdnudnm .» '7 P5 2 14 ‘ u 9 P3 . 2 (11—0)=u (6-l)=5
ofoneorme Pl 3 l9 l9 9
Aver-g: 9.2 5.4 Aw 9.66 3.66
Sadubcqwmofreqmmamnaslifidfir Pl I l I 0
walkwasingkmmmjnbh [>3 3 4 Avenge'l'A'l‘ = (5+13+ll)r3=9.6
4 2 gummy”
human-ailingncwnfinlsudmaflyhs Avengewlifinglinu = (0+6+5)I3=3.66
mmmmmufim " L.”
N 4 2 2
l ' Calcuhtoavamgewaifingfimasndavsmgemnumm
maniaingprmsasmmFCl-‘Sbasis; whamm. mmazm (iii)!!!
PS 2 9 9 4
2.18 Examples o n Unlprooessor AW
7 3.1 ' ‘ ' Fouwingismeouucm
Schedulin AI orith (3’ ‘
9 9 "35... mm) *EEEILMMQ LEVLH ;
0 2 4 6 8 1 0 1 2 1 3 1 5 1 7 1 3
I -
Ekfldli 0 I . Smmmmammo. 5
1h: P2 7 a
Mal—Wigwam
ummwhm if P3 6 2 o
- ‘ A
[Prom a n t h e m - j (b) WONF
(‘3-1)=1z (2-1)+(s-4)+(12—a]
a.) W M =1
(I) an
P2 3 (1a-s)=ts (s-mnadn =‘6
P: 2 (12-0)=12 (know-I) = I
Annu- 1w m
:

Scanned
Scanned by CamScanner
3
(IN-Sunbm 7 ,,
Ava-ageTAT = ( 1 2 + : 3 + 1 2 ) ' 3 =1233
Avengewaifingfim = a+6+6y3 = 6-33
(a—z)+(2n—12)+(ZS—24):“? Pl 13 =5 Pl 0
Emmi-2.1m (13—0): (5.4—0.4)

WNWWH.P2.P3|MP4VMIW (12—3)+(24—1e)=17 .3! P2 (5.4—0.4)=s (2—1)=1 n "°“’=9


ol epu bum $ 1 3 . t out average m
mmmmmmemugmm
(I) FCFS
limo IN
AWTAT = (20+7+24+22)I4=18.75mt
l P3
Ava-lg:
2 1) ' 1
( '
6.33
1 1) ' o
( '
2
Ann;
m
Avengawaifinglima=m+9+13y3
(15—2)=13
733

s 733ml.
“mammal” = (12+3+1s+11y4= 11.751115.
(i) Rfl(alee=4ms) Average TAT = ( 1 3 + 5 + 1 ) l 3 = 6.33 ms. (2) PlumpflvaSJF
an) s.u= (Ii) PmmpflveSJF Avengewaifingtime = ( 5 + 1 +0)I3 = 2111:. Followinsistheflannchm.
(ii) Non - prumptive SJF -

P1 0 a Following is th: Gaul:chm.

P2 1 4
P3 2 a
Pl (8 — 1) = 7
P4 3 5 ~
, , P2 (4 — 2 - l ) = 1
Solution: ' ( 1 7 - 0 ) = 17
Pl (8-0)=8 0 P3 (2-2):0
a) FCFS p2 (5—1)=4 (1—1)=o ' ‘1
P2 ( 1 3 - 0.4) = [2.6 (9 - 0.4) = 8 . 6 Avenga 2.67
PollowinginheGanllchm P3 (26-2)=2A (17_2)=15
P3 (9—1)=8 (8—1)=-7 Avmgewailingflm: = U+I+D)f3=2.67np_s,
P4 (10—3)=7 (s—a)=2 Avcrlge 953 5.2 (3) Pflorlty scheduling having priority m y 1mm1 m
3, _ ' LfnrprocmPl=3,P2=2, 1 3 : 3 3
6'5
o s 12 21 26 ”W 13 Average TAT = (S + 12.6 + 8)I3 = 9.53 ms. y‘ven.

. AvengeTAT = (17+4+24+7)/4=13ms. Average wailing lime = ( 0 + 8.6 + M = 5 . 2 ms. Following is the Gaul: chart.

:, ‘ M Avengewaifingfime = (9+0+15+2)l4=6.5ms. Exampll 2.10.5 - _


Pl (8—0) =8 0 2.10.4 Consider the following set of processes having malr CPU 0 1o 15 11 ,
bum “me (in rnllllsscond). 7 y
P2 (12-1)=Il (8-l)=7 Supposafllatfllefollowingprmanivaioraxawfion at . v 5 ,mgwe-
Agar
*' ‘ > . V ,
fi'" v . 4 ‘ » l v J ‘ 7 ‘ A
P3 (21 4 ) :
19 (12—2) = 10 ”he” . F1 10 o . ' Pl 0
P4 (26-3)=23 (21—3)=13 ' ' P2 5 1 P2 (10- 1)= 9
2 P3 (15 - 2) = 13
Average 15.25 8.75 P1 °‘° s Pa 2
A 733
0'4 venge
AverageTAT = (8+ll+l9+23)l4 P2 4 Calculate average walling time using folloMng CPU
time = (0 + 9 + 13)f3
scheduling aIgorithrns. Avenge waumg''
= 15251115. ‘ - P3 "° 1 : 7 3 ms. (Same a m )
3"“9' (1) FCFS (2) SJF
Avmge waiu'ng m = (o +7 + 10 +18)l4= 8.75ms. “m” WW ““9 '"d “We ewnd “"19 (4)
(ll) R R ( s fl : e = 4 m s ) usingSRTFandSJF. (a) Priority schedullng having priority range [mm 1 m a. RR (slice = 2)
m": mspawvelyiorpvocessP1=a.P2=2.P3=aas Following is th: Gum Chan.
Followingisthe Gumchm. G) PmmpfiveSJFinSRTF glven
(smnmnemainmnmmext) Sim "RM” = 2) o 6 s 1 0 1 2 1 3 15 11
Following is theGann chart. on:

(I) FCFS

Followingisttanltchm. P1 _ (6—2)+(10-8)+(l3-12)=7

(16—4)=12 (2-0)+(s—4)+(l2-10) =7

Scanned by CamScanner
Scanned CamScanner
Egan-Wmmu-sm-comm 2‘25 WWtMScMIm

Solution: (DTheGInltdm-t , " “3““ ""


P3 (4..2)=2 l' Ema-"Imammmmmmm P1 31 a5 (9—1)=8
‘ .
(8—1)=7
o 15 an ‘5 an 75 as loo 115m 145 woman as m u s P2
Ava-lg 533 8-6 _
.. . =533|15
MW
'- = 0+9+3
( +12+
“ P3 212 (12—2)=1o(9—2)=1
Ava-33mm = (“J-*2”
= 8.6113. 1
4M A“? ‘3. 7. m7 , M4] P4 3
I14 (14-a)=11 (12—3)=9
2.18.6 .- w : (0+4+l+1 .,
(2154) = 215 (45 _15) + (115 _ 60) + P5 120 Ilzo—a)=1a|(14—4)=1o
4
AW'M
mummaw = 4.6115. “ I
(166-30)+ (MO—180) mm mums (3315):“
P17” :1» °I W3”
(3) “misugcnnuchafl =140 (II) SIF(Preemflve) -
P2 5
P1 (135—10):175 (15—1D)+(60—30)+ (130
P3 2 2 -75)+(180-145)=125
F4
P5 5
5 ‘3 o ‘ 6 3 1 0 1 1 1 3 1 5 1 7 1 . P2 (BS-10)=75 (80-10)+(75—45)=50

P3 USO—80):?!) (BS—80)+(145—100)
uh.“ average may and W W '0" and!
= 50
W P1 3 (20-0) (13-1)=12
(I) m (2)5)F (S) HR(Si$=2) = F4 (200-85)=115 (100-85)+ (150—115)+
(185 — 165) = 70
Solution:
P2 1 |(2-1)=1 (‘-1)=0
WingislheGInBchn- Avmgs 130 81
(1) m : P3 2 (5-2)=3 l(2-2)=0"
(ii)Average tummund time =(215 + 175 + 75 + 70 + 115)I5
’20
P4 = 130 ms.
N 3 (mm l(5—a)=2
a a 10 15 P5 (20-4)=16 (8—4)+(15- 13 (13-4)=9 l (7-4)=3
0 Average waiting time = (140 + 125 + 50+ 50+ 70)]5 P5 4 ‘

= 87 ms. Aveng- (ms)=u (ma)=u


Away: 17.! 8.!

Pl (3—3) = 0 0 Avalgetm-nammdlimc = ( l l + 1 7 + 4 + Example 2.18.8 (iii) SJF( Nonpreemfive)


P2 (3-1)=2 = 12.8ms. Use [allowing Scheduling algomhms to calculate ATAT and
(s-1)=7
00-2)“ AWT for me following process
P3 “'2’” Amgewamn"glime = (8+12+2+u+,~ ' (i) FCFS
P4 (I5—3)=lZ (l0-3)=7 8 8
(il)Preemptive and non-preemptive SJF
P5 (20—4)=16 (15—4)=u _ 'ms' Gin Preempfive priority.
Ava-age 9.2 5.2 W‘ P1 3 a (3-0)=8 0
Averagemmmdtime = (0+7+8+12+16)I5
= 9.2115. W pg 1 9 (9—1)=a (a-1l=7
Ava-agewaifingfim: = (0+2+6+6+ll)l5 f : . ‘ ’ -.
n,‘ .J‘Busl'flmyAn'lvfl'g Pa 2 12 (14-2)=12 (114i!
= 5.2ms. P2 1 1 ‘ 1
0 75 0 2 F4 3 14 «MM [9-33:]
(1) SW P3 2 a
Following islheGamtchan. 1 50 1o
F4 3 2 9 P5 I 4 an 120-4” “MEL,
4 Awn- (52’5)=1“ (3745):“
F5 4 s
(Iv) Priority (Freer-1mm)

(10-1)=9 (S—l)=4 (I)


and“”399 wait and tumamund til“e
(5—2)=3 (3—2)=1

Scanned by CamScanner
Scanned CamScanner
mun (’40- :
E Mn! slam“ gMU - Sam 4 - COMP) 2-25 Pm Em andSdndulhl

L 3 20 (12-0)=12 (5—1)=4 F1 3 a 15 F5 ‘ 21 = (154)-11


(15a)=12 (m) a 4 (21-4)
’2 I 2 (2—I)=1 (1L1)=°
P“
P2 ' 1 2 (MM (1-1)=0 1,
2 5 ‘(5—I)=s (2-2)=° Amos
Pa 2 2 5 (MM (22)-o m5) = m . ”
P4 3 7 (12-3)=9
(14-a)=n P4 3 a 1 (ma (5-3)=2 u
' F5 4 l 13 (ac—two (14—4)=10 P5 4 4 21 (21.4)=17 (154) "W“ "0“" - warm - 2 unfl:
aumiflme. Priority
(«was » » , :11

Average (87/5) = (17/5)


74 44
, .1»
Non pmmpflve : SJF: (Thls solution ls same for
2i
SJF preemptive)

‘3 7
(mam
4
92 1 1 2 (2-1).: (1-1)»
find
for. PS 2 2 11 (mm (24141044
P‘ (”W
F1 3 3 21 (21a) =13 (133): 3 a a W
10 P5 4 4 w (19 (54)) . (13
P2 1 1 2 (2-1)=1 (1-1)=o “=15 ‘M7-15)=°
Solution:
Pa 2 2 5 (5-2)=a (2-z)=o ”“99 24:5) = (W5)= 8
P4 3 a 7 (7-3) =4 (54;) : 2
Pl (29—0)=29 (10-0)=10 p5 4 4 13 (134)= 9 (74) = 3 Emma]:7.18.11
LPZ I (7.0)=7 o l 2 5 13 15 semi withlenglh 0! CPU bum
Average (35,5) = 7 935,5) given In mllllsaeands as follows
[g I(10-0)=1o (7—0)=7 ‘ ‘
Average 45/3 = 15.33 17/3= 5.66 Non preemptive Priority : (Same as first solution of ‘ ' 1“; _. ‘ -
P,
3 a 13
'' " «v“ FCFS) m a
(133)=1o (54) =2 o a
(ll) Round Robin (HR) wlm quantum = 2 P2 I 1 2 _1 =0 j
(2.1) (1.1) ' I F2 1 1 1
FollowinglsGumman. P3 2 2 5 (5.2) =3 (2-2)=0 j P3 3 2 2
P‘
3 3 15 (15-3) =12 “HF”; P4 2 a a
F5 4 4 21 (214)=17 (154)="a P5 6 4 4
_ 0)mflIeGmnmmmFCFS.SIF.Pmmlvo
(“"2
F1 3 3 13 :10”) ‘ prlomyand an (quantum 2)
(xi) W h a t l s m m m a m u n d u m o f e m l a m b r m
(s- 2) + (11 - a) +(15 -13) P2 1 1 2 (20:1 (I—1)=o - ,
«13-17) =10
F3 2 2 5 (523-3 (2.2).0 (fii) Whatis w a r l n g m o f m m h r u d l o f h ‘
above algorithm?
(2-0)+(8-4)+(13-1o), (1‘2“)
=11 N a a 15 ' "38):” (w) Which algonmm m In mlnlmum Ivor-co My
(17-15)
time?

Scanned by CamScanner
Scanned CamScanner
H mm MU-SOM“°°M
sollflbn:
E gaming SEW sMU - Sam 4 - COMP) 2-30 m w
F°F5(F|l-‘0) PM
mmI‘ ” 'anrfiuim“ ”Mandi-2 Sylhbus Topic : Llnux Schdullng
“IE-Elli. P3 5 3
8 9 P4 3 4 2.19 Unux Schedullng
')(c.18)
0) Draw Gam‘l shall FCFS. 51F preemptive and mum robin
(quantum = 3). 0 WrinmtLhn '
W v . V \ M U - OLE 20!?» 5 M B k 5
m r
1 ‘1' “
Calwlala average waiting time and average
lime. MillwvcrsimofUnuxbdawvuimfiwu
H 3 a (a-a)=a 0
(ii) Eqflain which schedulingpolicy Wad by Linux? supporting a variant 01 lb: mum UNIX
P2 1 9 (9-1)=a (8-1)=7 50a .: scrum-ling nlgprithm. mu. mi. m m u m
m 2 12 (12-2) 10 (9-2)=7 (BFCFSScheduling xclwdnflemwolypuofmnblew:
3 m (12-0)=12 (5. wrm
a) 11 “NH P1 l. Ildnesnmgivemficum'm h m m
P4 3 '14 (u
(~ III-n
I ‘ (an-41:15 (14-4)=10 P2 1 2 (24):, 1 11 15 20 25 2. Knumbcrofmksmlbesymmwdmg‘
PS 20
2 5 (5-2)=3 fl wasmswponed.
A ” , ' Imam; (86):” P3
SlfiPreamm) F4 3 7 “44):" “2 pm " " 1-11- Waflhgflme _ In vusicm ZS. Linux hand have I Mm}

P1 (1l— l)=10 0 algorllhn' um runs in on) Kim: «a. wim'mé


EIZIIZIIZIEIEI "5 ‘ '3 (Mae (1 P2 (15-2)=13 (1|—2)=9 nmhu'ofmksmlhcsysxm

7 13 an Amp (43/5)=83 Enhanced symmetric mum; [again with


5 pa (20—3)=17 (15—3)=12 "
W affinity and load hunting is supported by
HMOImtum)Z P4 (23-4)=19 (20-4)=16
L' n I'm“ lhcnewly included scheduler. llnlsoufiu'equflilymd
lM'Hi-fihl I"
Avange 59/4=l4.7s 3714:4175 suppunfcrinmdvemks.
I “ Is I” Im—mlu a-nzu Pi'Pz P3 P4 F5 F1 pa p5 P1;
_
(ii) SJ'F Preemptive Scheduling mUnusMflummm‘hfil
2) 02357931112141“.
ofp'iorilyassigmdludunmdhisap‘mnive.
ll:—
'1 2 '(2—1)=1'("')=0 ‘.
foflafingmflcmowcgcfladpiaifiesdafiudl’u

[P3 ['2 ['5 'fi-Zha W, 7",. "W 7.3" m pm.


P‘
3 7 - _ 2” (20-0)=20 0mm“ m . TAT Waiflngflme‘ 0 Priorifiufmmomwmmumlfimmy.
P5 4 (73-4 (HM PI 3
\ 415.15), P1 (23- l)=22 ( l 4 - 2) = ) 2
o Pfiailififinmllwmdulledsniecm

E- 13 “NH \"‘4’” r2 §, 3 (3_1)=2 (2_1)=': (6—2)=4 0 — Mlppm'go fnbovemm gamdauin lghhl


(375)=7A “75):“ P2
pfiuityschemmlmimeguvflusdamhghu‘
3‘; '2 (12—2)=1o (32).,“17 P3 (l4—3)=ll (9-3)=6
wiufifiamfiymhmguvdmsmlhem
)
SJ“
“mum“ \ L ,4 ”.3,” (HM, p4 (9—4)=s (6-4)=2 prioriliu.
5 18 Average 42/4 =10. 5 20/4 = 5 “M
o a 9 (IE-4):“ (Hm ‘ Numeric W m
'1 " an M M
NJ.
=8
. (III) R Scheduling with quantum = 3
j:my: o W
31°"
(50/5)=1o (ma,
' mm ‘
Plenum
ve- ‘ . . . Hmmmmmm mm- ' asks
WSW“ Wmmum 7 10 13 16 17 19 22 23 a
Average wailing 99 ‘
Eur-Mm
Prom TAT Walungflnie 1m
2015.10 '
ccI'ISI'deI'
2 ”U ‘ NOV Marks P1 (23- IFZZ (13—4)+(l 9— 1 6 ) : 12 ‘ M
39' 0 ' - m a
lino. "9 Promises with their; P2 (17 - 2)= 15 (4—2)+(16-7)=11 Land ____ mm
120‘
P3 (l9— 3) = 16 (7—3)+( 17—10)= 11
P4 (13- 4) = 9 (IO-4)=6
67J4 :15. 5 4W4=10 1-1;. 2.19.1: Rehflamhlpbum pm”: I!!!“I“
Avenge diam“! ‘

Scanned by CamScanner
Scanned CamScanner
H:

E1 flaming System (MU - Sam 4 - COMP) 2-32 Process 0 W am m y


E = -wmueonmm7mm22)
T"
DIfleramlals beiween long-warm, shall-term and ' Sylhhun Tople : Schedullng Algorithm
— “'5 “HM-Norm lulu longer time quantum it a.
Illocued and to the lower-pdmily mks sham rim: ”bulgTopltHmm” mum-ism achadulsr. (Reform 212.1(0))
Munllaval Queue Schedullng

gram. a. min mumavel m MI“: W


Drawpmesssmm transition dia
quantum is IssiyietL ‘7 Syllabu- Toplc : Typo- oi Schedullng
and Non-prumptlva {Ratersacflon2.132(5)
- 'me relation between priorities and Elmo-slice length is
MWMMSMW) (I Pmmpflve
Ihown in Fig. 2.19.1. quluo Idmdfllnu
(I. DMSronlInte one Preemptive vs Nun-Pmmmlve 0. Explain mulh’level lam
mmmmmtepmmodel.
'- “flunk-hummle Iheuiliseljgibl:forexnculionon Scheduling. (Baler section2.122) (10Maria) algomhm. Wanton 2.151F»
IheCPUIfmdonlyifithufimeleflmeI-iniufime (Macedon 2.9)(5Marks) (Ill! 1013) 3'
SylllbusToplczuumwom Schaduilnu
slice. (Junl 2015.Nov.2015) 0'
Syllabus Toplc : Unlprocessor Schedullng 0. Wain "WW mm.
- H-mkhuusedu pimfimsflmiti nmumdexpile d n dug“. _
(1 Draw and uphln mucus! stats ”amnio (Hefsrsacflan2.15)
Ind is not eligible for execution again until all other 0. views: vuflaua schadurlnu criteria.
(Baler was) (Refer section2.19.1) (5 Mafia) (May 2015) W M are general approach: used for gamma
mkxhlveulsouseduplheirlimqunu. 0.
0'
Syn-bus Topic : Process ControlBlock (P63) ng oi «made on mum tymm‘l Expfln.
— mhmelknepsamcmdohllnmmblemhinldm What are the admin for evaluauan 01 anheddll
Boldnmhdpmoasounbolblodc (Herernwonzm
Imam. As SM? is supported by kennel. cam 0. algorithm performance? (Relarsamkn 213.1)
W preserve: its own nm qucuc and sdwdul: (Reform 25) (5Marks) (Doc. 2014) 0'
Syllabus Toplc : Scheduflng Algorithms Bampla 2.13.1(10 Man) (comm)

itselfindependenuy. Willa m on: PM Comml Block. s. BumplaZ.1B.9(1DMarkl) (Imam)


0. 0. Explain diflarem types 01 schadmlng algomhm
- Evay run queue hold: two priority Imys: the naive (Ram section 2. 13.2) (0.0.2918)
myconmimnflusluufilhflmmflninginflldr
(Rdermzj) (5Marks) (Dec. 2016) ample 2.13.10 (10 Marks)
" Syllabus Toplc : Operations on Processes " Syn-bus Topll:: Schedullng Algorflhm - (NW-3015)
fimifimmdmcexpimdmyconuimlflexpind Frlorlly Schedullng Examla 2.13.12 (10Marks)
lulu. 0. What an Ina opernflnns padonned on process? " *7 Syn-bun Toplc : Llnux Willing
0. Explain pviority scheduling algorllhm.
- Elch o f [hue priority my: main: I list of tasks Expla'n. (Emma’s;
0' (Rafe! section 2.132(0) ) 0. wmmonmmmmlnummn
indexed according topriority. Syllabus Toplc : Threads - Definition (DH:- 2013)
Algorithm - Hound (Reform 219) (5 Mark!)
- The scheduler selects the task with the highest priority
0'
Syllabus Toplc : Schedullng
0. Differentials the Pmoess vs Thread
from the active may for execution on due CPU. In 301‘)
mmams Marks) ("Iv Robin
multiprocessor system, all promos are scheduling 0. With the help of example. explain Round
‘P SyllabusToplc:TypesofThmds
the highest-priority task from its own mu queue " algorithm. (Refer section 2.132(0)) CIDFI
manna. a. Explahdflarmnypeaofmus.
— Whenlumbhavcwomoulmdrdmcslimwm (Helen-mas)
active any is empty). the two priority my: we 0.
Exphh user level lhmad wilh advantages and
exchanged: the expitad array becomcs the active my. W963.
and vice van.
(Harman)
0- Ewhhmumummdwmmmmagesanu
- Swic priorities are migned lo Ital-lime tasks, mm
Remaining other task: has dynnmic prioritia um um (nmmasz)
Swab“!
bued on their nice valua plus or minus the value 5. ' Toplc: Concept o1Mulflttumdlng
— minmfivityofnmkdecih whedwrlhevflues : s“5W" WWWM
mash.(Her-rm 2.1a)
willbenddedtootsubmcwd finmthenicevnlue. InbusToPl c : Mullleou
ThM. Prom and
2.20 Exam Pack (Unlverslty and Revlew
0. Mn mmm,
Questions)
("flame")
0 Syllabus Topic : Pm -concaptomceu T°Plc=schodullng
' swab...
G. Whatdoyou mmnbypmeas‘? o.
(ndamzmuuanu)
(use.2014) mammmwhh maw‘md
(Madman)
“mum"
o. aplalnmeconaeptofpmcou.
Manama”) mm ' mm d difleram d
(Halersembnzmw); m
-~_‘\

Scanned by CamScanner
Scanned CamScanner
3'2 and beam
E! Ogevaung Symm (MU - Sam 4 ~ COMP) Walton
As echo madam is shared by such lpplicllion. straight away me: rammed value gals med ih
mainly can b: saved by keeping single capy of - chinpm. A: xhis imam. the most recently cnuued
‘7 CHAPTER procedure in memory ponian which is gob-l for I.“ chm-mar. m. is stored in variable chinpul.
lock
Synchronization and Dead
sharing applicnfions. (ii) After P l gets inurruplcd. men:is m of p m
3 P2 and i l call up 1h: echo procedure. Al this
situation. process P1 is in suspendad stale andix is
still inside 1h: echo procedure. The was P2 is
not allowud to cum inside lh: eclmo pmcaiure.
Thmfom. P2 is suspended until P1 com um of
j the echo pmoednm
chgjllpul = chinpul;
V,
2‘ (iii) Izm- on. mucus P1 is team and finishes me

Inner-Process I
s/171mm syvdlronizauan
Proces exacunian of echo mundane. The ouqm displayed
' : . .i ’,. I71I
Suppon (Semaphoras and Mumgl,
[min-(0mm): is Iha character m.
Mum-I Exclusion : Wham. Havdwala Suppon. Operating aslsm and
e Support (Monitor s). 01m syndurm izafion pmblems:Heademflvflm Problem. Producer (iv) When P l com out of mo pmcedure. Pl
Programming Languag becoma active. Now pmss P2 um “lawfully
In order to hnvc efficient and close inmufian among
Consumer problem. ce;
' :
f‘
" and Gruphs. Deadloek Frevenlion,.Deadlock Avoidan promises, Iharing of primary memory among call the echo() proceduxc.
of Problem.
Deadlock Detection and Recovery. Dlnlng Philosophers processes is useful. Consider the following sequence : — Thcmfmc it is necessary In use shared global variable
Balkar‘s Algorithmh r Single and Multipb Hmuroes.
1. Initially process P l calls the echo pmcedule. Th: by only one process a: a time.
galehalo m s i s vnluz and slam it in input
syllabus Topic : Inlerpraeess Communlutlon
Both interleaving and overlapping cormpond In variable chinpuL Process Pl gm: ' J
smight away arm rammed value get: stored in
Syllabus Toplc basically diverse mod“ of execution and plum: 3.2 lnterprooess Communication
Concurrency - Princlples of Concurrency chinpuv. M this instant. the most recently amend
diverse pmblems. -) (nay u)
chancm. m, is stored in variable chinput.
I n 1:31i. both inmrleaving and overlapping can be
3.1 Concurrency 2. Aflcr P l gccs interrupted, them is turn of process
mind Is illustration of concurrent processing and both
PZanditcullupme echo, ProcessPZ
the mchniqucs address the similar problems.
3.1.1 Prlnclplas o! Concurrency input: and displays the single character n on the — Synchronization and communication are two basic
16) The compmtive speed of execution of process“ monitor. requimmcnls should be satisfied when processes
9 (my depends on aclivifics and behavior of other processes.
3. Now again. process P l resumes i n execution and communicate with each other.
Ex'plnln1:19p m ayfidnronlznflon Inbrief. how the operating system handles interrupts. and in:
“w. value In gels overwlinzn in the variable - Synchronization of pmcescs is mquimd Io whine the
' policim of lhe system.
chinpm and as a xcsult i! gem lost. The variable mutual exclusion.
— I n a single-pmmmr mullipmgramming system, The difficultles that arise chinput holds value In. which is ‘ ’ to — “ ’ , dnnol with each
pmccsses m not executcd cancunrmly. In older to get variable choutput and displayed. mher but cooperating W my nwd In exchange
Global resources sharing. Fm example. suppose two
Coopamive pm eithu'
the appearance of concunent execution, a fixed time processes use the sum: global variable simultaneously 4. In this way. ma fins: character In is lost and the information.
slot is allocated to each process. communicates through shn‘ed memory or mung:
and both carry out read and write operations on um second charactzr n is displayed two times. All this
passing- '
— Aflcr utilization of this lime slot. CPU gels allocated to variable. Lhnn various malls and wrlms execution happens due to shared gloynl variable. chinpul. If
— Cooperating pm mquiue III M W
other process. Such switching of CPU back I‘lld funk (mining is snrious. nflcr updating the shared global variable. one
Communication ([PC) mechmism Illa! will Illow them
between processes is called as conwx: swim-II. Optimal management of the mum process is intu'rupwd. another mucus may
is no! easy for m :xchange data andinfomunion.
modify the variable before the pleviously
At a u‘mc single process gals cxeculed so panllel the opmfing system.
inlenupmd process can use its value. In above — Them In two fundamenul models of immune“
processing cannot be accomplished. Pmlgrlmming emr tracing is not easy as rssults are example both P 1 and P2 are allowed In use shared communication
— Mm there is n definite amnt of warhead drawn in lyplcally non- demminislic andnot xepmducible. global variable chinpul. M fund-menial mud-ls of
switching back and forth batman processes. 0rd}: 1 single user in m m hummus commnnluflm
by sing]: processor However. i f only one process at :1lim: is allowed to be
— Apart from above ‘ ‘ ' = mum at a time. While working on in pmoedum, above discussed sequence would mull in
offers major benefits in processing efficiency and in "hf aPplicalion.user can switch to other applicatiun in the following :
program structuring. this system.
(i) Initially process Pl calls the echo procedum.111:
- In a multiple processor system. interleaving and The keyboard for input purpose and screen satchaxo mums its value and stores it in input
s is for output cua
oveflapping the execution of mulfipl: processe used
by each application is same. The IBM" Fig, C51 : Two tundnmenul models at Interpro
.purposc variable chinput. Process Pl gets inlermpmd communla flon
achievnble. ls, each application needs to use the
procedure echo-

Scanned by CamScanner
Scanned CamScanner
7 ' blockingnflive: Ind- lam (MU- Seam-COMP) and W
l. Shndmemory o
11'
block“: 33;; over. the sender
o 1115” code! reference one or mote valiablns in I CS fllenoflmptmilmuldnmexecmeinlheir
lnfllelhued—memorymodel.lmgionofmemwym miver both 8‘“ bloom W-updm—wrile“ way. A ! the same lime. any o f cdticnl sections.
illhlmdhycoopenfingpmoessesiseuuhfilhed- = send Ind blocking my,
m “”t those varilbles maybe changed by nnollm' thread. 7. Prop-u
Processes can then exchange infmmlfiun by NIH"! m, messagl. the sender .00a in
mm,“ 0 ”111:5: codcs modify on:or mote variables um can I f m‘: CS is free. means it is not exnculing in its
until Maggi
mdwfifingdanlolhemmdng‘on. work but moeiver tannins blocked be [themed in “mad—updue-wflw" fashion by CS. In this simatiun suppose some processes desire to
one a .
In the mange pissing model. mammalian lab mived In it. This pennils 45 1’10““ ‘0 fem? another thread. go imo their critical sections for execmion. In min to
place by means of was exchanged between the m “wage s lo a multiplf Mingus.“ I: 0 Any pan of dam suuclule used by the codes canbe Lake the decision about who will now enter nan in CS.
need
cooperatingpmsses. quickly as possible‘ Hm ncewcr Is In. modified by number head. . only processes that alenot executing in thair mmindcr
So it
4 2. Munch-ins m so that it can usual: the execuuon. o Codesmodify mypanofadalasm lclmelhatis
secfimsmallmvedmlakepmlomkemisdecifim
Wim-
Mangepsfingmvidummfions. gets blocked until 11155538! cumnlly in m: by another (head.
This decision should be takcnin some dcfinilaEm:and
g naive : Nei should not delayed indefinitely. '
Man-pmshamefimherbemfinhuilhnds o Nonblockins send, nonbindin When one process is curmnlly executing shared
itselfloimplcmufionindimiwmdsysmsuwefl Party is requin d to min modifiable dam i n its critical aeolian. no other process
3. Bounded wnltlng
real“ ,
The mhlocking send md nonblocldng
mmu'pmmsot and unipmcenor gnome A limiuhouldbe selonxhenmberohimumaflm
II inflated-mam 0 is tobe perminnd to in its critical section.
and m
systems. Both sender and receive: will no! wait Hume, the execution of critical sections by the pmcem are permitted to go into their critical section:
Ponawingmmemopdmifivesundhwge will confinu the work. firnccsusis mutually exclusive in time. after a process has mad:I Ivequasl to go into it: ethical
ee M L section and before that aquast isunmoved.
pissing:
— Mung: pasing system should give guarant I n a code culled as cfilica] section, only one process
o send(dsu'nalion.mge) mges will be correctly waived by Deciver. executes at a time. . — Semaphore and monitor an the solutions to whim:
o uselv:(sourw.mesuga) Receiver sends acknowledgment to sender ma In a crilicnl section problem. an algal-1mm needs me ha
mutual exclusion.

This is the two , “for ' ' the _ designed which permit: at most one process into die — A synchronization variable taking positiv: integer
values is called semaphoxc. Bins-y semaphore only has
mmdmeiveflnm - If nhowledgemt nm “waived in defined time than critical section at a time. with no deadlock.
two values 0 or 1.
Amundsdanhlhcfomofamugew sendfl'md the message. It also often authentication The critical sectian‘s problem solution must obey
mmiadiwedbyndsfimfim sa'fioe. mutual exclusion. pmgnss and bounded wailing. Any — Hardware does no! nipply the semaphore. Semphme
process directly cannot enter in critical section. offer me squ'on [0 critical section pmblam. 1f
A M meivu data by executing the noeive Syllabus Topll: semaphore VII-lab]: cakes value greater than 1 than it i s
pinfifivgindiufingflnsumnndmemge. First mucus has to obtain pcnnission far its entry i n its
Wm synchronlzmlon called as counting semaphore.
Commiafion by sending and receiving mange: critical section. The segmcm of code which implunmls
this appeal of pmccss is the entry station. When - Like umnphore. n monitar also sob/:5 critic-l section
laqmsynclnuniufiun.mnccivermnmmceivea 3.3 ProoessIThrsad Synchronization II. is a , which
mmfimhasbeznsembymherplm process comes out of the critical section BM
completing its exwufion. there it has to execul: exit one or man:procedures, an inifializatian sequence and
handingplmisblockedunfilthcmis 3.3.1 Critical Secllon Problem
secfiun. hell dam.Follnvn'ng m the components of manila: :’'
wwwhhmaflntheundpdnfifivenmd -) (Doc.14,June15) Therest of the code is the remaindnr section. 0 Shared dam dcclantiun
byplwss.
Simflndy.whmaplmimunmeciveptimitive. st, w m m m M U
E Any solution to the critical-section problem must o Shmddaninifializafion é,
, Dcc‘2014.5|'.1ark ‘ satisfy 1h:following three necesnry conditions : V 0 Operations on shared dun
fiatnelwopnuififiues:
111m Inc-nary conditlons o Synchmniutinn statement
o " ‘ , m _, is Ind vf critical-locum prohlam
canines. 3.3.2 Race Condition
As discussed mviously. it is necessary to find 00‘
o Khakmwimgmmflmeimeranbe 1. Mutual Exclusion
mishlochdunfilamagemfimmm
samemeanstodisallawmmethanoneprocessfim wants-gaugeonamraw;infm m7 ' "’1:.
Ihemwnfinumemlhmdufingme madingandwfidnglheshmnddmauhesamelime-
— A race condition takes place when mm: than on:
Minna“; heparfianoflhepmgmnwhemflmeshmdmc process write data iwms so lhll the finalresult depends
m 3. Bounded Waning
Thusbodnhexndermmcmbeblocfingor Ismssedis mfenedaslhe Critical Sectio on the order of execution of instructions i n die multipl:
n.
“blocking, Three combination: are In orderlomiduse conditions and faulty mum 00‘ Fig. C32 : Necessary conditions for critical processes.
common . section problem '
Mmymmwinnmanteonly mbea blemm ogxiu meco dninC I-ificd — Consider two W I , 1’, and P1. which shale me
mummfimimpkm Sem‘om-ineachlhmad. .g 1. Mutual excluslnn global variable “x". A! the time of execulim. proces-
fifltypical pmperfies of the code um cum At a lime, single process should be executing in critic-l P|updatas“x”wth: valuclmdmmelime of
CnnmlSecfimareufollows:
pflfl' execution of annular pmms. 1’; updates "x" :9 the
section (CS). If cumufly Process P1is executing in ii:
vduzz.

Scanned by CamScanner
Scanned CamScanner
Vimmwflmm
‘mmmdifionislhcalvflichddue‘ Ewing system (MU - Sam 4 - OOMP) as Synehmflnfionnmw
11lus.lh emmsk sminar wemwfl t¢wfllb k“f— mutt-aim. - ItcunnmexeculesteplSnfiunnmenm-iauPi
Syllabus Toplc: HaldwmSupport '
lnlhiseumplemepmceamumodifiuxvtlumdy is already in i n CR.
decidesthefinal valucof‘k”. - Consider Pi is nglin scheduled and cunning in in
3.5 Hardware Support
nobotopemflngsymn CR. Even “laugh comaxx switch occurs and P] 5:13
The opening system should be capable of keepiIIs The simple L ‘ that are ‘ " “ on ‘ ‘ ' ‘nthismomentilumm-mianACC
w k of the difiemnl pm. many systems can be used successfully in solving 1h: and K values In N (busy waiting).

ofVIflOIB should critical section problem. — Aflet completion of execulion in CR, Pi execute;up 5
Syulbus Topic : Mutual Exclusion- flown- ‘
" ' -= md gm?“ ‘
be done by operating system Hatdvme features can make any programming ask m exiuheCR ms X = "F'.
easier Ind get boner system efficiency. — my scheduled afienhisjtexeumsmp 1 name
Each process's data and physicfl mmdbe 3.4.1 Requlremem of Mutual Exclu
slon
mind by openning syslnm against unintentionl If we manic: the interrupt from taking plwe while I bwomuFasuFinlbovemp.Nowdmtonep [ -

It is oblignory to cnfome a mutual exclusion: If many shared vatinblc was being nmdified. in unipmcessor biACC=“F"d="P". 1
inletfefin gbyodlcr plm.
want to execuu: in critical suction then my environment the critical-section problem could be - Swpzisemmdbimdsumdsmdilentenme.
mapnfiwperfomwdb ylheptma ndthcouw Cl'itiu]
one p m should be allowed to execute in um solved. CR.
am it gamma should not depend on the speed of
m u m m t section 1mg all M Kim have critical seeing. Many systems have special instructions called Test and — This solution satisfies Ill conditions mutual Minion.
uxu fi m w m m w u w w d o f o
for the sum:mum or shared object. Set Luck called as TSL instruction. It is having formal: pmgmss Ind bounded wailing. _, ‘
W
If an pmmss halt: in its mnaindcr section (other um. 'I‘SL ACC. X“. In this instruction ACC is accumulator
mlnmmfi onmbcde fimdls: — Since special hardware is required cannot be {
regislcr and X is symbolic name of memory location. X
critical section) [hell it is allowed lo do so William generalized to all machines. Also due to busy waiting.
o Ihepmoeuesnotwmofachotha‘ ‘ holds character to be used as flag.
inmfu'ing with other pm it is not efficient solution.
o mminamfig hImyorind inalym section then it TSL is indivisible instruction means that it cannot be
If plows is waiting to enter in critical
ore-chum“ inlerrupled in belwun. After ' gets ‘ Toplc : F r ,
should not be dcluyed for an indzfinilc period: um is in (Semaphore: and Hutu)
“mmnflicluccmsbetweenfluconcunmlly cunning ' following action lak: place.
should not land In deadlock or starvation.
pmcfmesepmmpm fordnmoffln 0 Contcnl of X is copied to ACC
mmm If the milieu! section is empty (any process not 3.6 Operating System Support
a Content of X becomes N
executing in aided section). then if any process an
More dun one [mom may requim lhe lune mom: During execution of above two slaps. TSL instmcticm 3.6.1 Semaphores a n d Mutex
mquws entry to its critics! section must be allowed no
while they are cxecuting. i s not interrupted. If w e mum: value of X=N initially.
unflwidloul delay. -) (Jun-15, NW 15)
The cxislcnce of me panicullr process is not known In The meaning of N is critical region is not free and F
Assumptions about lei-live process speeds or number
«her process. The competing plumes do not pm lhe means it. i s flu. Consider the following slaps to entzr in
of W In: no!nude.
infonnalion to each other. critical region.
Any M will not mmlin insidc its ethical sectim
Syllabus Topic: MutualExcluslon 1. TSL ACC. X (Content of X is envied In ACC and — E.W. Dijkstra (1965) abstracted the my notion of
for' ' mushouldslaylhaeforafinilelim
Onnlnnl of X becomcs N') mutual exclusion in his concepts of semaphmes.
only.
3.4 Mutual Excluslon 2. CMP ACC. “F( See if critical region is flue) — The solutions of the ctitical section problem
3.4.2 Mutual Exclusion Conditions 3. BU l ( If critical region not fine then loopback.) mpxesenwd in the section m not easy to generalize to"
9M1!)

A race condition can be avoicbd if we disallow to ban 4. Return (Return to caller and enter) more complex problems.
0: m a m m m ‘ m m m m l
lwoptowssesinlhcircfiliealsecfionltmesamelim Following m the steps far exiting from critical region : — To avoid this complicmdncss, we an use I

Follawing 4 conditions should hold to obtain I synchmniufion tool call a semaphore.


l. MOV X. “F" ( F gets copied to X)
Almesamelinuasnnepmexecuneslbeshuud f A semaphore S is an integer vuilble that, apart from
excellent solun'on for the critical section pmblflm 2. Ramm ( Ram 10 caller)
variable.all mmnining process“ wishing to accomplish initialization. is accessed only through two standard
(mutual exclusion):
so ll 1h:same instant should be kept waiting; whenlhll Consider the two pmecses Pi and Pi.
atomic operations: wait and sign-l. These operafions
mucus has over executing lhc shared variable. one I. “No processes should no: he insia their m'u' Assume initially scheduler schcdules Pi and X = "F".
of wen firstly tanned P (for wait) and V (for signal).
dwprmmwaifingtoperfomsoshmddbepem sections at the sum time. SosheplmnkesACC= FandX=NHmPinfinr
fined 9'
Deflnltlon
Iocarry on. 2. Complnflveapeedsofpmoessesornumb“ executing step 4. prepare to enter CR (crilical my'on).
Inmismnner.uchpmcessemfing¢hcshaxedm CPUsinthesystsmsmnotmm-ned. It" gels scheduled due to context switch befme Pi ‘ '5 ’ i I I

(Mable!) k e e p o m s a l l o d m h o m d n i n g m n u . 3. Fumes: oulside in critical section should “9" mmmgCKPjemlc asmp l andX=N.Inatq32. - AlemphmcSisinlngervafiablewhosevnlucanbe
mfimf‘wymemflmldbeafloww
m block other pm. Pj fails Ihe comparison and loopbanks. accessed and changed only by two operations wait
um m critical section. his is calle
d Mutual 4. Any m should m wait for longer amwn'“
lime arbiurily to cum its critical section.

Scanned by CamScanner
Scanned CamScanner
6mm”
3'7 --
Opemln1§tem(MU-Sem4-ccm)
E In conuasl. it is possible for one process to in:
wukcuP - — Th: fimfl vnluc of x decides which of the two processes
(P or sleep or down) and Signal (V or binnry umnphore and for another to unlock it. 11ml.lime.Pi doesnot china:III: who nflhc Vldlble
tions. is permuted to enter its critical section first. We can
or up). Wail andSignal an atomic opera I: while executing the while mement.Pl will enter the
the lines“ 3.7 Peterson Solution prove lhut solution is come!by showing:
,- Binnry Scmnphotes does not assurm all 0 Mumnl exclusion condifionis satisfied. critical nation (prom) amu- n men on:entry by P}
vnluu. (bounded wailing).
The progress mquimmcnl is mu’nfied.
rwl solution to mutual excluslon.
Iho ecum- 0
- Il mumzs only two values 0 and 1. On 0. againPele
m) can assume o The ‘ Jting 1 also ‘ ' ‘
counting semaphores (general mpha two Pl'Ooesm; ‘u‘ Syllabus Toplc
anly nonncgnlive values.
_ Peterson‘s solution involves only V”
Mutual excluslon Programming Language Support (Monlum)
semap hores S. wriuzn a wnit(S) gives :1good means
of algorithmic cxplnmnim. of W‘,‘
— The wail opera tion on
Every Pl go into its critical suction i f and only i f either
P(S). opemles as follow s :
or
out the crilicnl-scckion problem and exemplifies ' 0 ‘ : —
3.8 Programming Language Support
m ,,
5>0. of the difficulties concerned in designing sofiw y[i] = false or x=i. Also note Um. if both I" and P] (Monitors) ,
fia'a(s;;..w addresses the requirements of mutual exclui fl was in critical sections simultaneously. then y[O] = y
' . mms;=‘ 5.1 - progress. and bounded waiting.
' [ l ] =uuc. 0 a-Hwh Ia_ used to achieve mumal W?m§l I
» ., a] W .3
15.94 g ‘ ELSE (wailou S) The two processes Pi and Pj perform — It implies that Pi and P] could no! hava - If ‘ amused' ',.ilcnnpmduce
S. written 13 .;.
The signal operation on semaphore execution between their critical sections and “mi :xecutcd their whila mmmnls a:about the same time. timing errors that an:handIn detect. These anon occur
signIKS) or V(S),operates as follows : ’ ' ‘ ”code ofthe pmcess). since the vulue of variable x can be eitheri or j but only if some particular cxacution sequences new":Ind
_ these sequences donot always occur.
xiii-MS):
IF(onnormonpm'cmmw-imi§hn5)' " Petelson's solution mqnites the two processes to , . ”I cannot be both.
' two data ixems : In ordcr to 11d: such crmn. when have
_ THENUzloneol‘lheu pmcuneapmcced) — Henna, one of the pmceucs say, Pi must have

developed high-level language conmucu called I
4”
EISE S:'= 5 + 1 in! x; successfully named the while Imminent. whenas Pj;
monitor.
— The two operations. wait and signal are done
as single boolean y[2]: had to execuI: at least one additional slammem
— A monitor is a set of bmedms. variables. ml dm
indivisible atomic operation. 1! means. one:
a _ The variable x decides who will enter in its cli_‘ 1 ("X=.i")- structures that are all grouped together in I pmicullr
semaphore operation has initialed. no cum process can section. if x=', then process Pi is permissibléL However. at that time. y [j] = true and x = j . and this type of module or packnge.
execute in its critical section. .,
mass the semnphom until operation has finished
.
condition will continua as long as Pi is in in critical — W a m y c a l l l h c p m i n n m fl m i f
Mutual exclusion on the semaphme S is enfomed
_ The y array is used to spccify whether process is 1’ :‘
section. mquimd, but dime: new.“ to the monitor‘s internal dm
lo enter its critical section.
within mm) andsign-1(8). "memes fmm procedues declared outside1h:manilar
For example. if y[i] is true. this value indicates 1., ‘1 — 'l'lwmfme we: can conclud: that mutual exclusion is
- If many pmcsses ancmpl a wait(S) at the same time. is ready to enter its critical section. “' is man-lewd to the processes. '
preserved.
only one process will be pen'nined to proceed. The — Following is the example of the monitor.
In order to enter [he critical section. process Pi n » V Progress and bounded wulflng
other processes will be kept waiting in queue. The sets y[i] equal to true and then sets variable x to H- ‘ E fi n - u h p h w . _ g
implementation of wit and signal pmmiscs that value j. Pi sets x=-j because. if the other (P1) - g — Process Pi can be pmhibiwd from entering the critical
processes will not undergo indefinite delay. dashes to cnler th: critical section. i t can do so. ‘
section only if it gm: suck in thn while loop with the
Semaphoms solve the Iost-wakcuppinblem. If bath pmcesses ancmpt to enmer simullnneously. >'; condition y [j] =uuc and x = j ; this loop is the only
0‘
Dlsadvantages of Semaphore will be set to both i and j at approximalely the - w one possible.
time.
the dlSamnnmgas of Semaphom. “3' Only ans of these assignments will last; the cum“ — If P] is not mady to go into the critical section. then
‘ “ occur but will be overwritten straight away. y [i] =false, andPi can go intoits critical section.
l. Semaphoxes are fundamentally shared global
2. From any location in a . it can be ' jdfif, '-. — If Pj has set y[j] to true andis also running in its while
during some of execution . y [T]= TRUE; statement. then either variable x = i or x = j.
3. A lack of command ovu- it or assurance of proper
X=
i: — Depending on the value of x eitherPi or Pj will enter in — Monitors can achieve the mums! exclusion: afly on:
while (y[I] && x= j): the critical section. 13:00:55 canbe active i n I monimr as a time.
usage.
4. A lack of proper linking Sam — Asmanimmmapmgmnuninghngmgewnmthe
the semaphore and — I f x = i , then Pi will enter the critical section. If x = j ,
the dam to which the semaphom emu-o]:access. who'll seclimiJ compilnr manages the calls {0 monitor pmdmfi
thenPj will enm- the critical section. However. one: Pj diffcnnlly from otherpmwdule calls.
5. They plovide two functions, mutual exclusion and exits its critical section. it will reset y[i] to false. ' pmedm' if
— Normally. when I process calls lmnnilm
. scheduling constraints allowing Pi to cum its cxifical section. within the
any other promos is éuncntly amusing
- Mule:is the concept related to'binary semaphore. A [i] mu'ctmunalsosetxtoi.
— IiIesetsy v
heydifimncebetwcmflnetwoisflmmepmcesslhat
locks the mutex (sets the mg; to zero) mfistjr,9159M, > ‘.
tounlockit (sets the value to-l). _.." " " '

Scanned by CamScanner
Scanned CamScanner
Syrdlronlzafion and . 2 _ .3
WP)
Monitor.
M
it . “is,“ (x). which sign]: the Ii
E OperafingSysiem(MU-Sem4-COMP)
5: w- checked. Hm.u:canine m "i" :mdiuan quwe that we condition has
allcmd. ~"
beblockadlmtilwmprmhuldmwmm i" cl"firmer- — Mmmismummmnwflluwmumpcflmwmn
I:is possible forW '° W " -, mlhefileJ'lmwxitzrcmotbeallawedtnwfilellw
-' I! no other pmceu is using Ike monilor. IM “Hing buffn' only byW °‘ “5'“ ”“1"" “”9““!htw:“h )A
-. » file, since wrilcn mun have M W W. to 11"
onmonitor. the producer does not have straig
process may enlzr.
- The cumin-ind“ al' I monitor an the following: writer is suspended.
to buffer. _ ' whilefl'flmu‘mpmm’l
o Onlylhenwnim‘lpmcedmucmmlhelom This procedure initially makcs sure the "wh
ich — Them-filerwill auspendedunlil nomdcrinudinglhe
111:. If a nun reads: arrives continuously with very 'I. .' lhink_up_dnu0:l'nnndliulm9‘on'l‘
din variables. Elm-l pmdum cmnol accent existing in the
full to concludc if then is space short interval and perfoxm leading. Lhc mim- willnever ,_ rdawnwfilnw‘gfladuium‘l
It. ss “eel-Hing P
If space is not available then the proce obtain the access of the file. I wfiu_lileo;l‘wrilelhefilz‘l‘
Apnea-emu! Illenwnllorbyenlflngoneofiu -
a moniloris blocked on that condition. ‘_1:p(&fi|:);l'nluneuchlsinlual‘l
pmdum. — To stop this circumstance, the program is wrinen in a V},
syllabus Topic : Classlcal Synchronlzanon different way: whcn a reader com and at 01: same
0 Only one prooeu may be naming in the mailer a!
Problems - Headers/elers Problem time awrimis waiting, the ruderis , ’ ‘ insult]
n lime; any other pmcm ll'IIIl hII called the
monitor in blockcd. waiting for the monitor to of being allowed reading immediately. Syllnbus Topic
become nvnilnblc. 3.9 Classical Synchronizatlon Problems — Now writer will wait fur readers that war: reading and Producer and Consumer Problem
- Conditional variables It: contained within monium. about to finixh but doesnot have to wait for rum dist
3.9.1Readers/Writers Problem came almlg aficr it.
3.9.2 Producer and Consumer Problem
These conditional vuinblea can be memd only
within me monitor: and used to achieve the -) mm ‘, — The drawback of this solution is that it achieves less -) (Doc. 15)
Iynchmnimdon. concurrency and thus lower ped'omume. Following is 0. Sq: 1 an algodmmlptpmduesrwsumrprmj
mm-hwnph§§§fimfltérs problem um b9’
- Function: wait 0 and csignnlo carry out the operation " ”"Muiaamaphor'afi ‘ mu -June 2015.10 ‘.. the soluliun given,
on condiu'onnl variable and these an: neared u-apecinl
- ”While defining the reader/writers problem, i: 'r‘
lfpedaf inl semaphore; — In producer-consumer problem assums lhal buffer is
mm type inmonitors. / ‘ comnl- men In'readnaunl' ‘/ bounded buffer. This mans llIal 1.t is : filli‘:
assumed that, mnny processes only read the
1. man (1:) : On condition c. the execution of the: 'mnnphme mulex = l ; numbers of slots are available in a buffer. While
(tandem) and runny writ: lo the file (writers).
calling pmccu gm poised. Arm Ibis other , Ielnapllnm file = 1-,!" annual:new to file ‘/ producing lb: items, if the buffer is full the pmdmcr
men now access Ihe monitor. - Fl]: is shmd among a many number of plum, .4 process should h: suspendsd.
imreadmnl = 0; “ 1-1
2. aloud (c) : By executing await (c). process was The conditions that must be satisfied are as follows:‘ — In the same way. while consuming the iwms fmm
voidrender(vaid)
blocked. Now this blocked process mums; its o Simullaneously wading of the file is 811o { . V buffer. if it becomes empty. manner should be
suspended. It is also necessary to ensun: [[131 only one
execuliun. Only one process will be selected to many readers. .' while (TRUE) ( l ‘ rape-tum ' I ‘ :._ .
pmcess at a time manipulaxzs a buffer to avnid race
mum: the execution in case if many such a Writing lo the file is allowed to only one writer I down(&mulex): conditions or lost updaus.
pmcuu were blocked. No action will be taken If the same time. 1' gm exclusive access inmm‘ ’/
there is no suchprocess. - Sleep-wake up system calls is mad in this situalian Io
0 Readers use not allowed to mad the file while wri w mndcounlc = readoonnlc + 1; avoid race condition. Producer m should go to
— Monitor wait and signal operation: are dissimila / ' one reader mole now I‘/
sleep when buffer is full and consumer process should -
r {mm am writing to the file.
Him: for the semaphme. If a process in a monito i_I(ruadcounl = = 1) down(&flle);y _, wakeup when producer will put damin buffer
r In this solution, the first reader accesses the file -‘/
llylflll Indno lusk is waiting on the conditio
n variable ‘ I ‘ if Ihis is the filsneurler... ‘I ~‘ I~
— In the same way, consumer goes In sleep until the
perfonning a down operation on the semaphore fil
thesiyml ls lost.
When one process is executing in monilo
'
Other readers only increment a counter, mad 00"“ . "PW-lulu); , g . , _. pmduwlnu lswmedan inbuffcrm dwnknupm
consume. this data.
r. processes 'l.‘idem :xulnsive acacia lo 'rudimin" Fl
that trying to enmr the monitor When leaders finish the reading, counter n — Hmtwuprocesscs.produocrmdconsumshma
join a queue of ‘ md_flle() Fraud the file 'I .
macs blocked waiting for monit
or availability.
decmmented.
down(&mulex); ‘ - \ - common. fixed-size (bounded) buffer. The producer
- Within the monitor mass may When last one ends by perfon'ning an puts data into :11: buffer and m: consumer lakes flan
provisionally block up 0 " I’ get exclusive access In 'mdwunl' .’/ “
Lise" on.condilion x by mlL
issuing await (x); Amer semaphore, pennim'ng a blocked writer, if there is H 'z mdcounl = mdcnunl - 1;
lasting. 11 then mils in a to wrne. Suppose that while a reader is - Difficnky arises when the producer wnnls to pura'ncw
queue of pmceues lo ente reading fi “ l‘._ one reader fewer now 3/ . V
again the monitor whe r data in the buffer. hm than:is no space in buffer. That
, n the candition alters and another reader comes along. if headcount = = 0) up(&db);
memuuonnlhe im' ' » is.it is already full.
MW"; ' . l ' '1’ thisis [he 1|:l reader... ‘I .
Wewaiitxklll. p0 mmMN ‘ Since having two waders at the same time is no”
- Wayoulmmisploblmismgpmdmu‘gmwdcqz
in”): execudt'm oflpmee trouble, the second and later med mdlobeawakcnedwhenvheommmuhunmoved
sa going anin the ma ias can “15° I”
iler Ind allowedi f they come dow dm. '
n3 execuuon, I! notices n.
alter in candifinn var :
iable

3 ,

Scanned by CamScanner
Scanned CamScanner
synchmnlznflon and . . ‘
3-11
mm Sysmn(MU-Sem4‘°°Mp) n .. _. f
wu keo u!
._ mumwhom ‘fuuv is used for counting a.“ ,l‘
Q gratlgg SW10"!
SMU - Sem 4 - OOMP)
- h m y als oha ppe
nm mc ons um erw ms
is alrea dy emp ty.
dwmmgbufierthllmml- r
Syllabus Toplc : Prlnclples of Deadlock
“2 fia=__
W W
buff er
data from the buffer but The ‘emW’
f“
“Wing the "mm: of “1°“
tli'
4‘C
Syllabus Topic ‘ "
- Io sleep
that. oonsumfl goe
L
empty “d “mph“: ‘mulex‘ to make mu: :. Principles of Deadlock : CondItem
— w-youltolhiSPMb'm" dauin' men-MW!“ 3.10 Prlnclples of Deadlock
Mlmpmdmmpmssome
and oonsumef do not access ”mum" 3.10.2 Condltlons
I
3.10.1 Deadlock Problem
Way. ”do“ ofthe buffer simulmo-ISU-
1"
-) (Juno 15.Nov.15.MIy16. 000.16) Mock. [KW never finish m
0- mmmwodwmw a-
Inltlullullon ‘ 'i wummhddupbyodmmmwm
n
q." Whitlsdbédloek1-‘. -. ' -"'7
mmmmyfim Mmbemdifld“
_ Set full buffer slots to 0. 1 H 5;, > _ MU -Jm\c 2015. N0
Maviillbifllymmmmfmmm
11““ 0‘ execution.
‘ May 2016 Dec 9016. I
Le.96m = {.f
°' Moo-nary Condition.
51°“ N‘ - We know um pmcesses need: different mum in
_. Set empty buff“ ‘°
N‘ onler tocomplele the execution.
..‘.~.: Le. aelmphm“ W = ‘.
‘ ' - So in n multipmgnmming environment, m y
éwdmmiminnulw'm'l — Fol-mun! mmcriticalsecfion set mum processes may compete for 1 multiple numbn- of
whih(wnw==WY_sm;Pd"m‘l ., Le. who]: mum = l. mun-.5. -r.mv,r2016,Dec 2015 NIH.
Tmfinl=wmmd= . ' --: . -1 Maw 0 ,
- masmmwmmfimuSowidlfinlunum
of mums, it is not possible to fulfill the mute:
If am following four conditions hold simmmamnly in
lln=('in+l)%ARRA‘Y-SIZE= V WHILE (true) “equal of all processes.
numthmadfldlocksiunfioncanoocurinlhemm.
Thu: at: Ilmwn in Fig. C33.
,finlflfi) plodmllflll ( ); — When apmsmquefls Immandifunemaume
:- m m m m m m u p m P (m); is not avuilnble at am time. the process ennui I wil
1’ stale. In a multipmgnmming environment it my
mmfmmemumpmmbemm” (mum); happen with many processes.
folluws:
enter-Item ()
— There is chance that waiving menses will tannin In
V (mule!) same sme and will never again chmge state.
Wham» I V (full); — It is because the resources they have mquesled an held
I Consumer ( ) by other waiting pmcesses. When such type of situation
v'lhile (counter = = 9) occurs then it is called as deadlock.
WHILE (true)
- I f them an 5 same type of resources Ire available in
-‘/'donn‘lhiuv‘l V 1’ (full) mm:Necmrymndlflnnflm-dudlock
system then we say that there In 5 inmncu of this
nutConuumd=unylomk P (mum): resoume type. 9 l. Mutunlexcluslon
move-[tun O: — Suppose the pmoess mquesl the inmnce of mm. If This conditionensumthat. msoulce shouldbeusedby
om=(ouz+1)9sARRAY_SIZE:
V (mum): any instance ofthe mm: type i: llloclmd to it, then single process at a time and it remains with using
rm: mqucst willbe fulfilled. pminnmmkmfimmmh
1mm V (um):
.p Nahum I. (Ilem) — I f it is not possible to fulfill the mqunst. lhcn the needndbymochcrpmoessflwnflnnqmningm
instances m not identicnl. and the team type musthepoctponedmusemismuce.keqmg
- Producer and consumer functions an accurate i f 0' -) (Nov.15. ‘ " classes have not been defined appropriately.
Busy Waning pmwillgetdnwmoelflzlehudbyholding
«widened manly. they may mt work correctly — Anmlefirstpmccssmustmquesumcumemdflwu pmoess.
whenunculedmmmfly. “-
Wdoywmunbymsywaifing? wnans__ uscit. Aflermeuseofflflsmuwjlshmldlelase 4 2. Holdlndnn
- Rmmdilionflsomminmiuppmxhjmtlikewe “7 r.‘1U-Nov.2015.Dec 2016,: it. A process may request any number of mum
whichnmneousarylocompleieilsemufion. Themholdsninimmmmmmmto
mminpmviouslmmches.
- Busy waiting is the limitation of semaphore “ " W obuinm‘ningneeded mmlhnmnm
— Mmfiutismimmdmmgupw w"
Fouowingueflwsequcnccwhmnplmmyufilin
If milieu] section is not free (Wmms is beingheldbyofllapxm.
museum:
LY 3. Nopnunpflnn
executing in i!) then other process Wing w ' 1. M a n n l f i l i s n o t p m i b l e w fi fl fi l l t h c m t
mnmconsmfioblmufing criticalsection should loopcontinuously incm:"’ insunuymlenlhereqmsflngpmumnuwfitunfilit
Mutton" ofmemomoevillm tbedomm
"‘7 mmwmmhmiumnfium
— This busy waiting (continual looping) is W ' ' I anathema.
h m m m w e h m m - t o m . oonpbfionoflhciuchownmk.
far asmfipmgnmming environment is ”mi'.79 7— U u z fl w p r m u e m e m m m m p fi m m
NEW-mm»m task.
~ Inthisnseasingle
. adv.
CPU is shared “mm!
3 Maufiuflnm-flam
poem ms busy uniting wast: CPU VJ.
wouldhavebeenusedbyothenzrocessed6mm

Scanned CamScanner
Scanned by CamScanner
~ muonlzaflonw _
348
WMU-SetOMP) are mpmms sinEle i
deadlock. DIX inside squ
4 ' 4. anal-run 31°15”: of that result“.
‘ Emmwu-sm-mn 314
w
minus :-
In this condition. a collection of
acad lock “I‘m
h shown; the I. Mumlexclmian 2. HoldInd wall 3. No
; or Cycle in following grap Pnupuu '
sayU’O. Pl, Pn ) exist such um P0 1s mum nces are sing le. [:1 has “I 3. Nopreernpfion 4. Circullr wit NahummnmmW-mm".
ng for a resume when mom insta a”
W that is held by PI. PI is wniu ZMt “ 7,
lhensomflheldbyl’lnndP ”WWWMMmm-m.
Wu,”
is wailing fit I
that is held by P2, ...., Pn-l R3. 7 ‘. TheIppmachis epIined IS belcw.
ng for a msou uw held byP l.P3 hasrequesledresoum Him-MM“! Milan!
that is held by Pu. and Pa is waiti Mutual exclusion mmmmmkm- ,
is heldby P0. Illocmdlniwmdlmapunzuwm
Non-shin”: mum cannot be stand by any
“km
fill-busTali"c pm simlmmly.
Resourc- AllouflonGraphs If m mflfldflnmfIMmhg-‘fia‘h
an non-shmbl: then MMM
condition must hold for them “WMfi-ewmcdmmum
3.10 .3 Resource Allocation Graphs
9(006-16)
® an: “H3 PormmpleJtisnotpossiblelouseptimarbymy
mimhdedinlhhlifl.
mmmmmusdoawhi
Fig.3.10.1:Rem-m Allocation Graph mummfimmnmismmm
”m mm m AW em. _ If more than one instances of each resume n,
read only file is shmble resource and do not Inuit:
mutually exclusive access.
mguhtkiuoldplwedmhafiun
“lemoneslhalilismqucw'ng.
a ‘3
pawn! in resource allocafion graph khan Thenfom shmble mono: such I: lead only file
ltmmmwmmnw
. 4 .
Amhufledasyslcm "' mm 'has ‘Intlmhw cannot be involvedin a deadlock. Mdbfimmfiemmfalo‘h
graph canexplain the dcadlock precisely. cycle is a necessary condition for the existence“ otherhmdifulcymnouvikhkthnmm
We cannot prevent deadlock by denying mutual
mmgnphm eselofvcrfic uVispaxfifi onedimotw o dudlock but it is not sufficient for the exim exclusion as some resumes at: inhemnly non-
itisfllocandlounptmwh‘thisfimfifingl‘w
Wk. “mummmummm It:
Wtypadmdu'nwm. lhl‘l'lble such as primer.
not being the A mm from uniting pina- Ind Illa than a
o mulcousiszingofnuthemivepmeeminflw '11:: reason behind cycle Hold and WI" 'n3
condition is that, the process can release um
system. Here we have Io sec dial hold and wait will never mmwlfichmflnmufii
mam although cycle exists.
any P=| PLPZ, ...Pn) 1;
occ'hemshouldbemusutaLaplm me if m a: unit: "luau: ant w by
This released msoume than can be 0 W should[equals 3 mm only if il does not hold my
o 111: set consisting of all mane types in me _ wfifinsm
requesting process. othcr resource. Following two protocol: can be used.
symm. Consequently cycle can be broken. Hence. if c f a
lnthisfinuimifomumnhuqufwu
0 Allocal: all the m winded by M before mmheldbywung" manhunt:
say R=l111.112...Rnl not present in resource allocation graph then s
?‘v il mm lhc cxecuu'on. This protocol will keep the madman-wimp“
[nthisyaplnlfmmisaedgewithdirecfionfiom flu imm deadlock sun In case i f cycle exists. allocated resumes unused. 11!: lawn is that. Chum-win
procesl’loinsmuohesomlypekllwnitmms system may or may not be in a deadlocked state. even though some of the lemme: are needed by
To pram! me occurring at chunk-wit own
MPhumadcmqueflforaninsumeofRandnow process in the last sage of execution. it will holdit
Syllabus Topic : Deadlock Prevention from sun of execution.
infliculoulmduingohllmmhfliic.
wai‘ingformatmmlfflmeisedgcwilhdimcfim each plow-s should man! I): mm: in II
fiummnwtypeRmmthenitmemslbman 0 Second protocol allows Ihc process to mqum the ismusingudcroflsigmdnmnbasblhem
3.11 Deadlock Preventlon memes only when it has [classed th: previously
inmofmsomcetypekhubeenallocmdto Consida the collection of mu type:
My lilac-Indnsoulccs. Again the disadvanlage of first
pm]! 9 (Dec.14, June15, “- We] appeals here. Suppose Ihe imponmt
R=lRl.Rz....Rnl.Tomisewhmlypc.a
SuedpfiumumRiamedge uniqueimqernumbu'isusiyled.
0L What-Js diflemnce beMeen deadlock prev ‘ nuance for which many pm compete is
antlerJeei'rmnmsoumeRlopmmal’isassignment Asmammmognizzdbymmilk
avoidance algorithms; , >, V needed only at 111: star! and end of the executionby
WWEMEWWIWM this M mymmnmmllisdsomywmifm
ITIU - Dec, 2014. Nov, 2015
minimum mummmcahuinmm
.’ 5"t deadlockprevention. o lfinifiaflypmcessnleasemomcemduflnecnd
Afigmnlofnwnbuslomcak-m
If mum ”WW“ SHIP“ contains cycle then .’ mu -June 2015~2Wf [equest for the same. then it may no!pom‘ble to 3::
fmclioak—oN.\\'hcleNisthcmofunnIl
MocknnyexistinflnsystmlfiIMnmmmn the same msoulce immedialely. So we must
As dumbed above, for a deadlock lo 065'“: ' mmuflulomvmflcmfm‘
Whmmmmmm mquul all resoumes Ill the beginning.
the four necessary-conditions: mutual exclusv , mmlsunbewed.
Apun from the limitation of the above two protocols.
“mountains single instance of all the resounc o Enchptmnqmmhumg
WP“- I" lfld wait,no Plumption and circular Wflit 5h other limilnlion can be starvation.
"m processes involved in m1. is simultaneously in the system. «dentudgpedmnbaswme m
i I,“ In this. pmesscs will keep significant and popular
BY
Soin flfis mlc ycle inm
ensuring that at least on one these conditiona- mum will: them forcing lo wail 00m W
oum elllo cafi on mph is hOId. we can prevent the occurrence of a dead]? indefinitely which Inquire these mm
Mmmmfficiawondifimfm {4‘}

80dcadlock plevemioncanbe achieved by d” ""


holdin on:last one of the followin. fourc'‘

Scanned by CamScanner
Scanned CamScanner
madamw-su4.can 3-15
r 5*”
° Mmmwdmw
Ii.
i! should m .y m 21‘ sad i: H u m b d fl e l o a fl m W h A Emgflm—sflbm 3—16 mum
mi>=fmj;, mwmbmwhmmm - Mynmhlflowedaflfltmmfiskdfivu - Whl I m m a m h m
- l! M: m mob used. duh Ii: wall Mammksymisinsafcm. andm-nnhcm aflercompledon. (the g y m will dykmvenndmnclm' 50%
mmflmfin’nhmfiwk _ undemmofaflmmnn mmmlodskdrimwfilabkyfigllzl _ Themahcgrlndbymvm' windy
Safe
hddbymmlwyfmfi<rm+umnfli the sym is consisted to be in showsnfeumsafamddudlockmws. loam” wu-mmmmb
- hmmm<mnfln<~wm} lackinmalloamn‘ “Mankind:
< m By My: ram. we y: m a “as; m.

mm;<m;ckmlzwi1dnunmhofl Aha damn: of m if cyde huh


anhfulfimby. algorithm” m m m m i s i n m d ’ e m
WToplmWAvm Themufeminmnlbmm’ ”ism
o The a new! avaible m in the
inn-153.112.
pin:
3.12 Deadlock Avoidance Cychdueaion:0(n3)
a The m held by all oflhe m p,-
9mgu,m1s,uov.15;
wha:y<x. ' 17153.11] :Safqnmlqanddadlockmw
- Emmfimnagamflnmdma
- Alfinull.ifmymssmquesuflnenddifioul
mMavaihMc.i:sho-ndmitunmpjcompme,; maydiskdfivminwexmplcmdifmit
excafimarndbwsdnm. wwwmmmdmumw
MU - June 2015 2!,321'15 - Hunsyuzmisinasafam.lhmcmbe. mtypednemunavailnbilitymznsymmy go
‘ " ' Iffllcsyslmifinmmafeslalmlhaeiu. inunsafcsulc.
- mmfimdflm‘ymmm posfibilhyofwock. Fin: milk
Mnihblelm‘m WM"! PM”
3.12.1 Deadlock Avoidance Algorithms
"“7 9'
Example -) (May15, one.16)
Wflm
kmwmmm
:1m Consideralyslcmwith lOdixk dn'vesand3 - --—«-. 1’ 9119931mm - syllabus Topic : Banker‘s Algorithm for Slush Ind
- .41:ew ". ‘ " (PEPIJM PZ) ' Mum'sHem-rm
'3'“ \\ , 1
Following algorium axe used in the avcidame of '3 3.12.1(3) Banker's Algorithm
”hemmed. deadlock: -) (Jun:15.Dec.1
.. u a: W P0 8 4
in which process will mm
the Deadlock Avaldaneo m’mfimmm in'eflhhanmm"'
manure and will release it known addition Pl 4 2 Algormlms
ally, then We
mwarmmmmmwnmwm ' ambianmsmgmm hdaul: ,. ‘ -.
P2 7 2 (A) Hesourue-Alloenon‘ graph Algoflmm
mauldvnil. - »_ _ u- Dec. w e 10 Marks
~ To avoid the drmlar wait condit — Initially [0 disk drives are available in the system.
ion which. I (B) Bankel’s Algorithm — 11. is Iyplicable to the resource allocation sysmn with
deadlock—am algorithm inspects the m sequence <Pl, P0. P2> is safe sequence. Process P0 of enchmsomcetype.
munipk mm
Mmin dynm icway . nequim 8 disk drives. process Pl mquim 4 disk dxivel-
I! is 1w: efficient than mace-M31: mph
~ Fdlowingmflnfmwlfiehdcfmemdducn md P2 may require up to 7 disk drives.
’b: ' algorithm.
mailman-m. - A! time I]. process P0 is holding 4 disk dl'ives, pm
Newly amend prom should acme mum _
P1 is holding 2 disk drives and proccss P2 is holding 2 ' Fig. (13.4 : Deadlock avoidance algorithm!
o mmbaofuvaihbbmmindntymn. numberofinswmufachmtypewhichitmy
o mmoflllmminlfiem
dlsk drives. (Thusin '11: system 2 disk drives an M ) ‘ require.
-D 3.12.1(A) Resource-Alloatlon Graph
o mmdamm‘mm - A! lime to. the sysmm is in safe state. The 5611M“ Algorlthm — Themumshofldnmbcmmmlowlumnf
1:0.
Dijlfun's Banker's alga-Mm .<PL P2) satisfies safety condition. Pl all. minnsysmm.
is used for Mock Immedmely be allocated its disk drives and — If system has mom allocation syslem with only an: will
avmdance. The algorifllm mqu ram? — Systam checks if nllocnion of requested moms
im prior knowledge of instance of each resource type, then only this algarithm d
numberafmumeachnmnnds.
them after completion. Now loud 4 disk
liltiW!1 3 " leave the system in safe state. If it will the nquum
available. is applicable.
mamfllocmd.
Afie rflm me OS aal ikc !
asi m mall-lownbanker P0 gets all the disk divs. After completion. it mum“ - Claim edge (dotted edge) in mom allocation graph _ u w m a m m m m m W F fl m
osvlldlmuhmoum ' V
ummonlyithu. is like a future request edge.
3them and now [on] 8 disk drives are available in 113°“ nsitwill g o i n m u f e m fl fl m m
, Whmaprocessmquemamsomtheclaim
edgeis
- shouldwaimdlmhermmmm‘ ‘
convened to a mquc’sledge.

——-‘

Scanned by CamScanner
Scanned CamScanner
Smhwnlzationw
~ «—
Er fing§filem(MU-Sem4-COMP) 9-17
iniri
- v Following dam mm In used in Banker's 1, La! W be an integer army of length m.
my A (Available number of resources) Let . [Er cpsmlng Syalam (MU - Sam4 - COMP)
algorithm: . y\ 3-18

a Alm]: Amy A of m 111 shows um number of ”Wk“, "T” ”f ""9“ “' “mud - m“ 01'
A=A—N (3, 6. 2)—(3. o,1)=(0.6.l) Solution:
(determines lfprocess Mt). ..
availlble mums. A=A+C(0.6.1)+(3.
2. 2)=(3.8.3)m:vnllnbl¢(u) Needman-ix
d MIIIIIIII] : Two dimensional my M shows 2. Fund isuch that both: in 1h: syslem after P l finishes.
mnximum requimment of the mum by each F[i]=fnlse 3. ProculP0
. pm. Mlim] = k indicates process Pi can NIi]<=W N<=A (2.2,0)<=(3,B,3) ismle 3'; 1: '1)?
muutumemostkinmncesofmoumetypekj. Ifnosuchiexistsgommpat A=A-N
(3.8.3)-(2.2.0)=(L6.3)> P0 0 0 0 0
o C[n][m] : Two dimensional m y C shows cumnt A = A + C ( l , 6 , 3 ) + ( 5 . 2 , l)=(6.8.4)ueav1ilnhk P1 0 7 5 0
fllocan'on status of museums to each process. in the system after P0 finiahes.
3-
w=w+cm; V P2 1 o o 2]
CfiJfi] = k indium: process Pi allocmd k Prom P4
imam of mourn: typeRj. F[i] = true; N<=A (1.0, l)<=(6, 8,4) i s m P3 0 o 2 o ‘
Nlnllm] A=A—N(6.8.4)—(1.0.1)=(5.3.3) ‘
0 : Two dimensional my N shows the Gotostepz ‘1' P4 0 6 4 2
maining A = A + C 6 . 8. 3) + (5, 0. 3 ) = ( [ 0 , 8. 6) an nvailabl
possible nwd ofNII'JUI
each
"film = MIilfi] . CfilfiD.
mic;
. i.c.,
4
,
flaw
=
:22!!!“
‘ - ~
then the syslamxs m asafe in the syslcm am: P0 finishes. (b) System is in sat: sun because many at: neqmu
Prom P3 . exist such as (m, P2;P1:P3:P4). As availableis(I. 5.
pm: Pi may need additional k insmnm of Run-flme complexl 10).:imcrpmcessmurl’3mmpkwlhe
resource type Rj_ to accomplish the execution. ty : 0071::i) N<=A (5. 2, l ) < = ( l O . 8 , 6 ) i s m
execution. Once mucus P3 finish. it Ideas its
)
- To demonstrate the working of banker
A=A-N(10.
8. 6 ) - (5.
2. l)=
(5.6- 5 memos which permit I" other existing pm to
4 3.12.1(0) Resource-Request Algorithm ’s algozi
constder the following snapshot of the system A = A + C(S.6, 5 ) + (7, 3, l ) = (12, 9, 6) are available execute.
at lime,h in the symm afler P0 finishes.
Bwlainmsouma-mq processes an:numberedP0 to P4 (total 5 proces (c) Yes. request can be granted immedinzly. Aha
" uésiam"”jn‘u: n
ses): So the requimd resources can be allocated in the gaming this. Available willhwomcu, l.0.0).0mn[
- are P, Q, and R (total 3 lescunces) Ram
- This algorithm decidu whether requests processes in the sequence <P2. P l . P0. P4. P3> andit is the safe sequence in (P0. P1. P3. P1. and P4),
of the type P has 12 instances, resoume type a safe sequence. Suppose at time 11. P2 request one
msoumes can be safely granted so as to system Q hum Allocatiun m 1 become:(1,4. 2,0)mdNeedfotPl
will mums. andresource type R has 6 instan additional instance of resume type P and two insuncas becomas (0. 3, 3, 0).
remain in safe slate. ces.
ofresource type Q. so Request R 2 : (1, 2 , 0 ) and i i i :
Let R[n][m]be the two dimensional array, N not gleam than available resources A. Exnmphtuaz
describe the ”(Mum
fur-mm outstanding requeslx of all pm. (Runalnlng So step 4 of the resource request algorithm indicalas Corlsldarhe dilemma
Rfilfil = k Hallmark) n“)
Intimates process Pi mm k instanm that request can be allocatzd.
of mum: type m mac-Mon nun-mm
Roaccomplishdwexecufinn. After allocation of these mamas. new safety
, .Aa-c
E a. H ~ P0 B P OR . WW
1. unri1m<=Nmmm step
2;otherwise. misc an Pa
algorithm is executed to delermine whclher system
remains in safe state. If any such sequence exists.- then
' A B Of T
mar conditio n as process is requuu'ng I I. 1’ ‘
more 3, 0. I 5' 2' 1 2' 2' 0
system will be in safe slate. 0 0 1 1 1 1 '
V msoumlhanitneeds. 0' 2“
g
F1 2-2
- ' ' ' =1
7- 3 i .i-Exumble3-121 [:1 2 0 0 3 2 3
If li] > AU]. men an:pmoess should wait 2.
neededmsoummnot
P2 0 I ‘i, {Consider the ‘ of a system: I _ P2 1 3 2 4 3 1

3_ o: . 8mm“ available. is
P3
0'
2.1.0 7.3' 3.1
2
5.1' 2.1
2‘ 2
2'

3 I “on Max P3 1 0 1 0 0 1
“Mm
Ise leques M mmmmis 4, 0,2 AB 0 D AB c D AB C D M 0 0 1 3 2 1‘
4. mm“ 5. 0.3 I. 0.1 .4’
3 0012 1 5 2 0 'v
altered ,‘PO ("HZ LelABCbemanmumsswhlmmdAh‘lJbalm
Am-Rfilfil
The system currently with “
Afi] = . P1 1 uo o 175 o ' ‘ ' Chassinslmoes.
0mm P3>
_ is in safe stale.The sequen
sequenc <P2'P0.
ce <P2,e p1, Po,P3>
PLP4. M (l) wmxisnmeommotmmrumen
Nfilm
= cmmmum] "m“ 3‘WW"-
"w“my“M“ P2" ' 1 a5 4 2 3 56
(Ii) Is the symmIn asale sum Provo“.
= mum-Ram] ' L ““3“” P3 0632 0652 '
Solution:
Whmmmwm
N<=A
(1. 2.2)<=(1, 6,2) istmc ‘ ,P4,_ 001}: 0656 0) Need=Max—Allomlion '
W m i ; safe. lfunsafanthem“
- A = A ' N (l. 6. 2 ) ., Wilh referenceIn bankers algorflhm7 - x.
mdtheoldmomuxWMismmfust wan —(l. 2. 2)=(0,4.0)
A=A+C(0-4-0)+(3. )‘ Flrgd [iaed matrix -
'D 3.12.1(D) Safety “cerium . z 2)=(a,6.2)u,=‘ ?‘
1 1 o
avatlablcin the system afterP2 finishes Inkesystemlnasalesmé
, ‘ 2f“

mm 2' dime“
“mm '7'“ .. ‘
(GA-47‘
2”!”
‘ 1 2 3
"M findunWheIhg-syncmisinsafem MP1 I . G)
N<=A (3 ah the,muss}be QMWJWFWJ
. '0’1)<=(3.6.2)iskue

Scanned by CamScanner
Scanned CamScanner
3-19 Synchronization and
E Mgwmu-Sombcwfl ‘
Available=Avnnnble+All°cafion[P2]. 77 7.,t -
In this way we can find
that P3, P1 and finally operating System (MU - Sam 4 - COMP)
‘9 3mm and a m
all their Mum -d m
“is! < P0.P2. p3_ p], P4> and We p43“ «5344 ~.
—=E—=_
. Therefore System is (b) S y m m is in safe slue because at: sequence
exit! Ind
— 1 0 0 i! is (m;1>3~,1>4;|>2;m).
state.
3 2 0 _"| P2 2 3 5 6 1254 (t) Yes. xequucanbeynnwd immediamly. T h e m “
(u) Il'iltn'mclnpz"“‘kas additional reque Pa 1a5 s o e as Reques‘GAvailablethalisu.0.2)<=(3.3.2)
(ll) st for“ . -
of type c men Request [P0]<
A=713=3mc=6mtoulinmncesofmoum
= A -5 P4 16 5 s o212 ‘ mum-1m .. 3*;
By adding the Columns ofAflocnlionmlfl'iX (001<= 010) isfflRMdWWCQn-n w: Solutlon: 1WW the snap 0!Ike W m ,
WageLA=4,B=3nndC= 5. granted mP2. System will be indeadlock state.‘«or
Now Available number of resume: mmpla 3.12.4 (i) A—9;B-13;C—10;D-11 = Pm mm... Max AMI-Eru-
g'
=Toul—Allocalion " (n) Need[i,j] = Mum] - Allocationlij] so mum of ’2 .,-, .A B C D Aa c n A,“
It Is Imposed to use bankers algoriihm for h...
WeAavailable =7—4 = 3 deadlock. Tom! number of resources available for am; Imam" 1"”Po 0212 0322 253% t
9.»,
h
RmB-vfllble .= 3—3 = 0 Is 7. 7 and 10 rsspsctiveiy. The current resource all .H A B C D . P1 11 02 27 52 ’
state is shown as below. P0 2 o 1 1- V
RemuClm'hbl: =6—5 = 1
mulomoh m o s s o f” “5‘ “7" ,
By using nbav: available number of mm and Am" P2 1 l o 2 o312 16 4 2 - .1!
WW: Mm Ilsmilhm.sequence > mama *mnzna R1n‘zfm
P1 P3 1 o 2 o 2414 3553
<17).P3. P4,P0.Pl> is safesequence. 223 ass 7710‘
P2 203 433 P4 1 4 4 4
Hence, system is i n safe slate.
P3 124 (Ill) n e s y s m m i s i n n s a f e s m a s t h n p m o ' e s u c m h e _ (i) Why!is the content alMahixIla-d7
344 ' ‘ls
Emmi-3.12.: (0 Is the current allocation in a safe state?
finished in the sequcnoe P0. P2, P4, P1 andP3. {In (he syslemIn sale state? ' _ ‘
Consider the system with 5 plooesses. P0 to P4 and

Eumplemzs , "
mu- June 2015.10Marlrs ' (an nshin“ mmM E'1'u’idvhs‘1b‘r(1;a.2.u_’
(fl) Would the following mquambe grantedin current slam ‘ -
monumelypaA.B.c.Answsrma followingquestions. - Conslaar theldlahlnfi‘sna‘ééfim’ama s’y's
' P1 yequem(1,1.o) s°'““°"=NM:(D
A“
Allow-flan Mu ' 'A'v Nam}
. _
I‘d]
Solution: , . W 5'”
. M. a n "
ABC 4 A ,, a [mac “1]
(1) Consider sequence <Pl, P2, P3> " c ' " SOOOlIII’nIofNeedmflmxls
Total Allocaled msomces are (S, 4. 10). It is ob ‘«-l 312 _ , D:
F0 o 107 _ 7513 ,3
by adding Allocation column. ” O h “ 0
'P1,2oo '32:
RequestIPl] = MaPl] — AllocationIPl] = (1.4 ‘ m 1 6 5 0
P2 3 0 2 902-1. v.
Now available i n system are (7, 7, 10)
P3 . 2 1 1 - 2 2 2 r n 0 1 2 2
The request of P2 satisfied as available in system 11- 1 1'3—3-0- P 3 1 3 3 0
V ” P4 0 0 2 ._ ‘
LatABCbslharesoumeswflhilmneesoM (7,7,10) and then of P3 is satisfied, therefore syslzni"
isTJlasand Answerlollcmingquesflonsuslngbgnkgfigalggflm
P4 l 2 4 4
Chuelnsumea. in safe state.
(I!) Request of P 1 is satisfied as (1.1.0) < = (7, 7. 10) (3) W m Is the content 01needhair-6:?’
(D Islhesysuminasafom’l (ii) ‘10-.Systemis safe and safe ”queue:
(II) n a: time 11, P2 makes addilioml « (1;) is fiha sysiemina safe} 51365
Inquest for an Example 3.12.5 (PO,P2,P1. P4.P3) exis‘. .,
lushnee of type C, Check wheth . (c). I! gmupgjmm pmoesé P1ari'ivesIor‘
er system is In Consider following snapshot of the symam (iii) As (3. 3, 4. 8) remains available i n system, P l m be
deanhck or N01at time h. I .
Using Banker's algorithm answer the following questio granted (1.3.2.1) immediately
Solmhn: ns- -
a) RequmfPOk: Available (I) HawrnanyresourcesoftypeABCDarethere?
@
NM=M“‘A“°“‘i°“ Syllabus Toplc: DeadlockDetection
( 0 0 0 < = 000 ) (Ii) What are the content of needmatrix 7 51L
Hmumqmofmisnfi ' ' ' ' C;
mmfiuflmmm find if system Is In safe state? u n is, find me ”1° m 7 4 3 3.13 Deadlock Detection
(01 0) and Available beco (no
mes (01 0) sequence.
AfierP0.ulmeP2mq Pl 1 2 2 ‘ If the system doesnot mak:use of dgaflock afiun
uutformoumes. Prom-l rAlloc auan
6 0 0 ‘ or deadlock datection algorithm. than aysgem vnll observe
Illux Avlfljih P2
RequeattPo1<= Availab
le ( 0 0 0 < = 0 1 0 ) A B C D '..-A B‘;CD .A v B - Q : 1 1 handicaksimafion.lnmissimafion.immeur
Hammmofl’z system should have :
(3 0 3) and Available
issan'sfied. P2 fie: Ill
mourn P0 601 2 4001 a 2 1 ”i1.
P3
P4
0
4 3 1
becomes (3 I 3). P1
e a 1750 1100

4,

Scanned by CamScanner
Scanned CamScanner
Synchmnizallon and
3-21
mus/sm(MU-9m4-OOMP) dimensional
amy’ _‘
o RIIIJIIII] : be thc two
the sum oflh e system to @pemflngSElem (MU - Sem4-COMP)
42.22
4 AIgorithIn which examines the current outstanding mqucsts at all . 7!. mmmm
ador not.
decide whether a deadlock has nom R[i][i] = k indium procms Pi
Wam
k in H ‘ 1am“!
I PM
i‘
M HIY- We M d
kill“!
MG
deadlock if it is occurred. Sy|labus Toplc : Deadlock Recovery
— Algorithm to recover from “k , whosekilliug willimmimmum' ecu. '
resource type Rj‘to accomplish the “mom
ms the overhead including
- Bad: the algorithms mqui
Dlfleram
3.14 Deadlock Recovery "' par-mum um need to be confide!
ry information and 0 Algorithm
l nInvn'me cost of mainmining unwa to ensure mo mlnlmum can
potential losses
cunning the detection algorithm and mm eadlockDetecflon“:’ ‘A'nmh " o Priofitxofmnpxm.
whichmnatuml in ',fmm' " '
d. o Haw much comwufinn panel! has initial Ind
o- slngleInstance of each resource type I. Let W be an integcr may of length In, iniu' ’ 1L“ — It nwds to recover from (Bullock when it
is damme
hm damn huwmldhmmlimedoailmdmfimme
of a wait— for array A (Available number of msoumes)_ Several options exist after detacfiun Algorit
algorith m makes use . One possibility i s execution?
— A dendlock detection Let Ebe a boolcan may of length n, initials,“ to' that a deadlock exists in the system
for
gnph which is mauve allocation graph. Wait ta inform operator and let them dacide
how to deal wnh ' c mnumofMMmmmhum
1 (damning if process finislwdor not).
mph is used by algan'rhm if all momma have only it manually. a lypcofmommmep mhum
single instance. The wait for graph is obtained from (he Fm all i . if"C[i] I : 0, then F[i] = fllse;
“Vl- — The second option is to allow the system
to recover o Thenmberofmemsomlhcfinculwiflneed
Wanna-lion gnph by eliminating the nodes of Ffi] = hue. There are mcompletedmcxmlfion.
from the deadlock on in; own (automatically).
up: resume and collapsing the suitable edgls. This is 2 Find an i such that bofi'l two solulinm exist In break a deadlock. One solution is o Thennmberofpmoemneedsmhekifled.
shown in mum allocation graph Fig. 3.13.1. It F[i] = false // Pi is cumnuy not involyea m just to nbun one or more plums s o that circular wait
o Wheumflwpmisinmnfiveormh.
shows Mpxwess P1 is xequcsling mum: R2 which
deadlock ’ will be broken. The second option includes preemption 0'
is bald by process P2. ofsnmco fuwresou roesfiom oneormo teofthc Resource Preemption
R[i1<= w , ,
pmcelses which are involved in deadlock. Inclemenlally plump! the m from thé Imus

Ifno suchiexim, go toslcp4 Process Tavmlnatlon (Kill a process) Indmafloalamn'ummuflmwunfilh’mmflfl'


“Ii“! brom-
“53.1.3.1: mmouuon grlpll 3. llmclaimflwmsommofpmoessl’i Wh?“
deadlock ocean. the opemtillg system decidu l0
W=W+C[i];F[i]=mne;Gotoslep2 kill one or more pmoesses. This will whim 1h: mums
— Abavesimafioninmsomuaflocationgnphis
4. IfFIi] = false for some i , acquired by that killad processes. The deadlock Chadian
npzuenled Is clown in wit-mm Fig. 3.13.2. exist or not m killing
algorithm dawn: whether dudlock LSelacflnuav
then the system is in a deadlocked state. Momma,E:
the prongs. Following two minds are used for killing the
Ffi]= false. then process Pi is deadlocked. .
process :
Run-lime complexity : 0(m x 112) mulled: usnd for
M
“8-3-1351 = Waltforxnph «(woven-mum Invocau'on of detecu'on algorithm depends on :
.
kllllng UM prams:
Ilhaflnn mph
Frequency of occurring the deadlock. If it is - v m ( mmfidncremennllyprwmptmm
— In this my system maintains the wait-for graph and if 1. Km I“ deadlocked processes
frequently then algorithm will be called frequently. .p 1. Selecting-mum ‘
it emu-ins the cycle. the deadlock exists in the system.
2. Kill one process a! a lime
By invoking cycle damnation algorithm on wail-fur The number of processes that will be influmoed' Which process and which mourns Ihouldhe when!
mph. the dcadlock can be demand. If n is number of deadlockwhcnitoocuxs. ' for preamptiun to minimize the cost? The pm
Fig. C35 :Mzthodsusedforkllflngtheprm
vertices in wail-for gmph, n2 openu'ons are nixed If the mquut of any plumes cannot be fulfilled . I‘ wfichhasfiniflwdflnwsldlwmvnmfionmdmlyfiew
-
detect the cycle. them mchnnces of deadlocks to occur. ' IL
“D l . Ki|l all «landlocked p m uncut of «mammalian is mined would not he
M ‘0 '
This method is simple and cfiecfive to eliminate the selecwdasnvicfim. -
" Mlnmnmofach mmeuype — m detection algorithm is invoked in rofiawing‘ijm deadlock and clearly will break the deadlock cycle, but -) 2. Rnllbuk
‘ cases.
Th:.wait-for graph discussed Ibove is not applicab
le to at a huge cost.'1f all mes: killed processes hive been Aflmmmpfingthcmmfiommemm
muluple instances of a mum: type. a Extrame : Invoke the algoxithm every time?" perfumed the computation for longer period of lime pmitmnmcminmdnemufiofiumdnd
In this case, we have to use detection algorit mums denied then the partially computed [gm]! would be wastnd. mamm mptni hismq fimdm mflblc kin
hm similar
In Wu. which simply investigam every poss 0 Alternative : Invoke the algorithm It less . " "’ Reoompulafian will be done and is very costly. pmcessmufesmmmdmsumdieexecufimfiommn
ible
Illocauon sequence for the pmccms Iimeimervals: ' 2. Klll one promos II a lime sum. As sat: sun is difficult to define. (ml rollback
which remain to .
becomplaledThcdatasfluctums o Onceperhour Indlism euwdm nepmce ssisldlle dat‘tfim eand' willbeuwsimple solution.
usedmufouows.
auction algorithm is invékcd to check whether .) 3. ShrVIdnn
.,
0 AIM] : Army A of size In o WheneverCPU ufilization<40%
show s Ill: number of ion
. available m m 0 deadlock is still exist or not in the system. Invocat nmayhnppenlhlhnmepimwinbemdmy
Disadvantage of the detection algoriflml afier Idlling each pm”
is ‘ '
o quEml‘mdimensinmlmyc
_ fimestopmemptmcmm’
mar
Cannot dam-mine exact! win' I” considerable madman. We must re-run algorithm
mocfimm mufmmm mhm I y ch pmcess 'cauud'
each kill.

Scanned by CamScanner
Scanned CamScanner
s- L
28
fl mafiwWWU-Seml-COMP}
Syllabus mm" [Er 0pm! Syamn (MU-Seml-OOMP) 3—24 anon-MW
Toplc {010W ’""°'°"'°' Lupbfiflfofli[51={I}? SylllbusTuplcw'odueeundmmmu
3.16 Exam Pack (Unlverslly and Revlew "' '5
..
inli; ' . --
3.15 Dlnlng Phllosopher Problem void phuosoph'er’(in: i) Questlons)
Problem
a.
-) (Doc.14,Nov.15) { . .
W Syllabus Toplc : Concurrency - Principles of
Ewhh an Mm lot W
fiwetm)‘. pmbiam.(MIMI-13.9.2) (1o Mam)
flglning‘phflosophfi!’WW"!“-0“”"9“? w n , ‘ Concurrency
(Bums)
_4‘' mu - Dec. 2014. ov 2015‘10Mark5 . Mk0; ' . ' the mass aynel-ImrfluuaninInlet. ’ What'doywmnbybuymwmhm
upmg'pnnosobnérpwue'vfi WSW” wu‘urorkm); V 0 mm D 3.1.1)(5 Marks)
(Rslarsecuan (May 2016) a wflhIt 7 (Hakim 192(4)) (5 Marla) V
magi-.51); ion
; VI!“(m w+.1) " Syllabus Tople : Immune-s Communicat
_ m pmblem is slated as : The work of five (Nov. 2915,DUI:101.)
eaI0; w-
philosophers is thinking and eating. A table is laid for ‘ ' Explaln the Inter-process oommunlcauon
In brief. SylkbusTopicWflnclpluoIDudlock V
them and Ill agreed that only food that contributed to . ,fimlfl'ork
sigma-m:
[(i+1)mod51): 0' (Referssction 32)(5Marks) (May we) .
What Is deaflod:7
their "linking man: was spaghetti. Each philosopher '. ;} r Syllabus Toplc : Process/Thread
Synchronlnflon (Bahamian310.1) (2Marla)
new"
two forks to eat spaghetti. }- . . 7 ; .
(June 2M5, Nov. 2015, PM 21110,Due. 2015)
voidmiino apla semen I .
Th: pmvision for eating is on a round table with a big
mm m m (Due. 2014) ' Syllabus Topic : Prlnclplm ol Deadlock:
0. (ne’erInsecflon 3.3.1) (5 Marks)
, Conditions
serving polof spaghetti, five plates, and five forks. One { - ..-
,;. 'pubesin-(Philosopha (o), phflmmm (1), > n n 'Y and a _ hr
plat:is given no one philosopher. A philompher sits at Explaln crilical section pmblam with It: dlflusm
0.
0. 3.10.2)(5 I )
assigned place a: die table. He has to use two forks on d I k in occur. (Refer
PWMPher(2).Philosopher (3), . solutions. (Refersecflon18.1)(10 Marks)
gel‘llm' side. of the plate. He lakes and eats same Phflwnhwm
(June 2015) (June 2015. Nov. 2015.[My 2018, Doc. 3110)
kpnghmi. -
w. ' .- ' Topic : r-—
o. What Is race oondnbn? Explain with
— Algnrithm should be designed which will allow the
In mower mmgy consider the helper who 0. Wm. note on Resource Allocufion Graph .
phflosoplm to eat. The alga-Mun must satisfy mutual
four philosophers at a time into the dining
only 0' (Rem 3.3.2)
Syllabus Taplc : Mutual Excluslon
{Hater 310.3)(5 ) (Dec.a“)
ucluuou (two philosophers should not use the same room. I
With at most four sealed philoso phm. a: la . Toplc: J. . . .
fork at m: same time) while avoiding deadlock and .‘1', 0. . Whal Is mutual exclusion 7 Explaln its .
0 WM“ ‘5 mace d F
mrvafion. This problem exemplifies basic problem philosopher will have access to two forks. Follovi (Refer section 3.4) (5 Marks) (May 2015)
s in ilg. "mm”
deadlock andstarvation. the solution using scmaphoxe. ' andav ”90mm"?an “M
3> V Syllabus Toplc : Orders“? System Support oldanos’
- The dining philosopher’s pmblem (Semaphoras and max
can be seen as fl‘Pmsflm diningPhflmphu‘a'v -‘ Hararuwons.11)(5Marks)
(Dee. m“, Mums)
example of pn'mlems related to coordination
of shared lumphorefmkfi] = {1‘}; , 1"; 0. Glue software approaches for mutual exclusion
. (
flail“. which
may occur when an application ,semphore mom =01}; AV (Hefersmlon 3.6.1) (5 Marks)
Expialn deadlock prevention.
tion. In the same m i; ' ‘, I
llldlldel. concurrent. minds of execu (June 2015, Nov. 2015) 0.
‘ way, .015 problem Is a typical test case for assessing void philosoph'er (in!i) ._ ’ (Hefsrsecfion 3.11m Mama) (Jumlms)
approaches
h 9;:( ” E m m a ” )
to synchronization. ' Syllabus Toplc : Deadlock Avoldlm
Whalls samap 0! o_ m1 is we 9
0'
Soluflpn uslng semaphores whil:(uue){ Llst I‘he disadvanrfas of Semaphora.

-‘ lhinkQ;
Follo
. wing is_the solution Iaing semaphores. Fach and avnldanue algorithms
(Ratersection 3. I ) (Relaxation8.12) (5 m)
WW9! picks up first the fork on the left side and . "“‘(Mmk 0. Explain Penman solution to mutual M W .
then the fork on the right
side. .' ” “muffin; (”9” W "
37) (Dun.autumn“)
". “I", the Philosopher is finishe . ' ‘ ‘ "(fork‘lti-Fl)nio65])g ' a- Syllnbus Toplc : Programming Language 0 Emu“ a _ . m m
upland d the two forks
eating.
.;_
""ent'og -' H ‘ .;-
_m on the (able. aim
(fork [ea-‘1) inod SUPP”! detadion. (Rulersew‘an8.12) (2Mafia)
0‘ This
I" ofsolu u’ unfornmamly, leads
the 0:]; (Monlmm) . (JamN15)
In deadlock:If a. How it Is used m achieve mutual exclusion?
I" _ 0%
are hungry visual(fern-1);
' "sixnaltmau‘nm
wfll plck up the forkon mail-leasimu ltaneously Explain. (Refer section 3.6)
IF
, and . :- 0- was
'21) amid
(0(1 deadlodt.
Mark)
. ’ Wham:
fork will notmbe them. In this unse
W'Wherssla
emly ugh! Side "' Syllabus Topic: Classical Synchroa mm mm“. magma)
puma“, all ‘void
amino Problems - ReadersIelers Problem
0 { Explain how Reademlwriters proble
m can be
. ‘ . Addi
solvetional
"1:1:1: fork; (a Incl}: clean
solution!) will 0.
a (éhflnsupza (0).: philoso solved with semqphnres?
' H n bem
e oruse onus: one fork to eat the phe I
Following
a solution. Program Philmaphgrfl)’,phi rtl)
s) (June 2015)
los opher (3); - ‘ (Baler sedlon 3.9.1) (10Mark
mien ,philmnherwhx 5
I-

Scanned CamScanner
Scarmed by CamScanner
A—L‘
,Q'W'lfifi/
8-25 ,,,, fl 7
:, " WTopb:Dendlockmlon
WToplc:WsMgodfllnfnrsuuh Dawn
'
claw m a. wme um on W
{mmam}
0. mmmmmmw

- “mamm‘sm’ “mm” tr syn-nus Topic: Deadlock Recovery 0 CHAPTER memory Management


a” mu m.) (on ms) a Explaindeadlo
1 an)ckmove.”Mm 4
WW
"Wal:
:1. Ma'lmm 1(5))“(10mum
ram-091M!" w- syllabus Topic .
_.......
. ....._,,P"w
Probl-
x
a. Emh'nmu m ,
' mmayzmns Marla) hum
(Damn)
alndlnl:15)
(5’3"
n9
“grampmglem and 0,
mam ' Mann)
(Io W 2m ”"3
Mam:Dec
Emu-1126 (mm; (Jun.2015)
. 4.no“‘
sum-3.127(mum) (mums)
0. Explain Dlnlng philosopher problem
semaphores. (Hefarsection 3.15) Mammy . Fixed . Dymmk:
Memory Mlnlqclmm : Memory
Pan'nlonlng. Mammy Alloctflm Swabs: Baal-Fm Hm FII. Worst Fn. Mm Fit. Buddy SyIMm. Hebe-flan. Plain.
.
Segmsmatlon.
04 Page Tamas. Copy an tn. Page
Vlrwul Mammy : Hardware and Comml struaures. Demand Paging. Mule
01“was. “rushing;
Replacement Simegles:FIFO. Optimal. LHU, LFU Applvflnaflun. Counting Based. Allocation

Background — Mammy m u mav: pm back and funk


hetwun memory and disk during execulion.
— Mammy is an important resource of the comma
syslem llm needs In be waged by the operating - So it is mailed that war-ting system shank! have
system. same sunny fmflmmnagpmmmfmemmy.

— Toemummemmneedswkeepuwpmm Syllabus Toplc


in main memory. Memory Management Bequlremems
— The main'memory is voluile. Therefoa a user needs to
state his pmgmm in some secondary storage which is 4.1 Memory Management Requirement
nan volume. '

— Every process meek main memory since a process


code, suck. haw ' “ “ ‘
and data (variablcs) must all maid: in memory.

support {at mullipmgmmming. Many execumbles


pmcuses exist in main mummy at any y’ven time. Muir-"minim

— Different processes in main memory have diffcmn! mm "mm“


madness space.
— Memory manager is the module of th: opening system
mpcnsible for managing memory. nnms after
completion of execution move out of main memory at
processes suspendcd for completion of IIO can be
swapped out on secondary storage to free lhczmain
memory for nIher processes.
- New mousse! are required to be 1m in main
memory. If available main memory is not sufficient to
hold all processes swapping betwaen main umry and FIgCM:RequinmenlflormumflmmM
secondary memory is done.

Scanned by CamScanner
Scanned CamScanner
Memory Management : Memory Management Requirements. Memory Pannbnlng: Fixed Partitioning. Dynamic
Partitioning. Memory Allocation Slrategles: Best-Flt. First Flt. Wont Fil, Next Ffl. Buddy Syuem. Relocation. Paging.
Segmentallon.
Virtual Memory : Hardware and Control Structures. Demand Paging. Structme 0! Page Tables. Copy an Write. Page
Replacement Strategies: FIFO. Optimal. LRU. LFU Apprmdmatlon, Counting Based. Allocation of frames. Thrashing

Background - Memory managers move processes back and forth


Memory is an important resource of the computer between memory and disk during execution.
system that needs to be managed by the operating — So it is required that operating system should have
system. some strategy for the management of memory.
To cxccule the program, usernwds to keep the program
Syllabus Topic
in main memory.
Memory Management Requirements
The main‘mcmory is volatile. Therefore a user needs to
store his program in some secondary storage which is 4.1 Memory Management Requirements
non volatile. ‘
Every process needs main memory since a process o wnmare when
'reqmremenlg 'foi"
memory
code, stack, heap (dynamically-allocated suuctures).
and data (variables) must all reside in memory.
(mam?
KC

Following an: the mquimments for [namely


The management of main memory is required to management.
support for multiprogmmming. Many executables
processes exist in main memory at any given time. Requirements for
Different processes in main memory have different memory management

addressspace.
1. Raloution
Memory manager is the module of the operating system
responsible for managing memory. Programs after 2. Protection, Logical and Physical Address Space
completion of execution move out of main memory or
processes suspended for completion of IIO can be 3. Sharing I
swapped out on secondary storage to free the-main
4. Logical Organization
memory for other processes.
New promses are required to be loaded in main 5. PhysicalOrganizallon
memory. If available main memory is not sufficient to
hold all processes swapping between main memory and Fig. 01.1 : Requirements for memory management
secondary memory is done.

Scanned by CamScanner
Scanned CamScanner
@: Over-ling System (MU - Sam 4 - COMP) *2
-9 4.1.1 Relocation _ Iflhe same binding occurs at run time then
EL operating slem (Mu - Sen-.4 - com
physical addresses an diffea p) 4.3
The relocation
., 4.1.4 Loglcal Organization w
mlwmwudmplemduipmuwum
Them can be my numbets of m 5000. Physical Edda“ (5200) can he _ The main memory in a liner. m- Win“!
simultaneously in min Iran-cry W‘smulfimmmm'5hwwm
will" follows. Consider lggical address 200 WSW-mmnglhammm‘bm”. Mm'mwunwdedummdhdwa
ys
mummy-Inning appmch i; m program. ”f “I: worth. landed a: the same location.
- Hog-Immcn main mum about which program Physically second-Irv memory Ol'gmiuflnn i: ulna lib
will he in memory during execution of his or her Physical mam- \__—-,7 wsic Jim-"=58
al (Omen' main nwmcry.
mm- +content of base register (5000) n Userpmgrlrn
The pmgnnu written m y be mind inlo modula.
— In mdzr I» improve m : processor utilization. processes aping fmm virtual to physical addmugs is Sam: modulcs cannot be modified (Ind Only. nun-mg
yumappedinnndwlofminmemary.m the memory manngemenl uni: and some of which have um um can
(MMU) almn time ‘ T only)
b: W
mapping of pmcmcs is In get more number of ready The user pmgmm deals with logica modified. swam
plum available for processor for execution. l“ d ‘.
memory-mapping hardware If the opmtin g syslam and hardwam
convc ns logical 1... in Ihl: In handie
- The swapped process from main memaly In disk can be
into physical addlessedlogical addresses. user pmm'ms and data in the form “54.1.1 :Mauprommmlng
:q of modules lhall
mapped ngnin from disk to main memory m y benefits can be realized: 4.2.2 Mulflprogrammlng
Memory protection is done by
- Na: (in: process may not get previous portion ofmnin using two ”Bi; '
usually a base and a limit. as shown
oEnchmodule" ,canbe" —" "
tummy. 1:needs to be relocated to new memory in Fig. 4.1.1, and compiled. with all “aim ".ilmquin dlnimmm uhiple
m from an: modul: mmsimuluneuusly.
— The omfing system managu the memory The base register holds the in member msolved by "In symm at run time.
and it keeps smallest legnl ph
memory address (in our example — Silwemm flplaplmm ruidmlin mum-y ltd-e
Incl: on Iddms fmm which prognm 5000). The different dam of pmlectiun (mad only.
begins the mflm.ilimmrufifiufimiffln
execution. The limit mgister gim the size execute only) can be assignd to difi‘emn modules
o f the range of phy‘m mmUOMI mACPUdn -smmmidl e.
- TheW hudwlle Ind operating system softwm Iddm. For example, i f lhe base regist with small additionul cost.
e er holds 50m - CPU ufilinlion infirm Is it excel-m mulfipl:
is maxim: to m m the memory references and m: limit mgisle'r is 1000. a The mdules can be sham among processes.
than the pram an pm on Iim: staring buis.
band in lhe code of the plum legllly access all Iddmm ‘
inno mull physical from 5000 through 6000. (A M a fi a above - " ' ' ' givu illusion of running multiple
armory Iridiu m. mflecting the
current location of the m I! one: and pmvidu use“ with inlantiv:
pmgram in[min memory. O
-D 4.1.5 Physlcal Organlzatlon
lupunie t o processes.
4-11
" Profecflon. Logical and Physical 1000 Two levels of orgmiution wifll main many and
Synahus Tupi:
Address Space secondary memory is avlilable in system.
Memory Parmlunlng - lsd Plrfltlunlng
— Mfinmmqmnfmfmmm
a
memory with my. cos! and il. is vol-tilc. Secondary 4.2.3 Multlprogrammlng
WWI H M and
mmory provides permanent storage. Variable Panluons
An addr
. ess genealcd by CPU is — Th: information exchange between main memory and (Contiguous Allocation)
called logical addre ss
or vnmul addrm and secondary memory should be handled by system Ind
an flddmss generated 50003“:
by Mzmory
Management Unit (MM not by programmer.
U) is called physical addr
ess. 1000 umn
[rai n ofpm gmn writ
ten by user is 1000 Kan Syllabus Toplc : Memory Pmlflonlng
mmmemry d loaded Fig. 4.1.1: Mem ory Prom
fioniaddrcsssooo otion wlth hue and limit
mfiooo.
- The physical addms; "8M"! 4.2 Memory Partitioning In this scheme man-Ky is divided into I numba’ of
space will become
5000 to 6000 -D 4.1.3 V Sharlng
-

mdlogzcal Iddlusspac fixed-«ind partitions. Elth partition my connin


eisom 1000.
4.2.1 Monoprogramrnlng
‘ ) . r ~ s -

exactly om p m .
Protection nuchanism shou
ld allow many processes 1“ Th: number of panifinns and its sin would be defined
access the same part of mem - In early computer systems and early microcomputer
oxy. by Ihc system adminimlot when the synem suns up.
All the pmcesses execuu‘n Wanting systems, mono-programming concept was _
g same pmgmn should be used. The dayee of mnlfiprommming will be high if the
allowed to use
single cop y ofp mgm
'

- If the binding of n.
- Onlyanep rogmmwa slesidiflgi nminmu
number of panitiolus created it man.
inst ructions and dam in — dCIorzxdmuting pluc
esm should be allo
M um In at com memmy wed to “36 531W g'ven point of lime. Alwnysnsclecmdpmcessfiomfluinwlqlmis
pile time or load tin sn'u mm cnuu Ind onmmllai a
udphysiwlddrm e, the Ingicd was to ‘u should be «' > Operating sysmm wu midi!!! in W PM” °f
placed into the flue pmitian.
qmume.
memory and other portion was fully davoled Inthe — WlwnflncmfingpmessfiniahesMueufionmd
single emutingprocess. - laminMIhepufifionbewmufiwfmmthfl

Scanned by CamScanner
Scanned CamScanner
@WWLMU-Sunl-m ‘4 "'"h'y
mahmflngsyslemmflnuiulubklomp ‘o SlzI-IM E mung filam sMU - Sam 4 -COMF)
4-5
mkonl’lecmdoccupicdpmilionsbym a Sin-2M ( _ 1.. (his technique basic ally I Vlrilble
panilionin
g withI
— Mfimmbeoffixeds'muofvuilbksin.fifld 7 Sin-4M A vuiable number or panifiornl
Mel-mined dynamic."
minglheholeufsim4
m allhecndofmemury
$1..” .. Nanny. all memory is nvniluble (film 4140’).
sizedpufin‘mmulnivelysimplemimpmm for user at: (C)Ind01))
15 OS is and“
pnbkmwimlhefixedsimpum'mm: us one Inge block. of amia
ble memory a
Al mm: point chime none
of “I: allowed m
. hole. In:many.
0 Emmsiuislnguflunlbepmifimm I Operating
mannabeswndinpln'dm mm-V‘Mkhmfim osdn-IM ash-Cu m system swap: out P2 and in in placé new
[film P4 of size I I M]! in mappu
o mmmkmmmlf r mmlnmlandml \
The hole of 2 MB is mind .
d in Fig. 4.14m.
mmmismmmmw mutant-don 7
”‘3'” Again Ifltr some time since none at
”13;“m mun-an the W in
”gallium 3'. m Internal ‘- mm mum in ready and only P2 is
in m y suspend
N" ‘ ‘ sub. is Ivaillhle.
M & Sunni Winn “1m
Exlcmu say-50M To Iwap in P1. liner: in no sufficient space
0 ' I. Definilion Imam] ‘ is avail-bk.
Hit-20M . So opening syslem swaps P l out Ind
7' ‘ ' fragmentation ukcs (”Mum .‘ sun-m
1: shown inFig. 414(1).
"up: P2 back in
’5 I plan: in Fund aka Pinup." \
2’ The example shows um. than in: many mind
31' 0s ‘1
17-116mm:
‘ .l
variable
__
' Sin-14M
size holes.
mull
. 5
. .. x (I)

These holes annual be IllocabdIn the M
mmfihdhm Itchnq ‘
(h) (I) of Intact
size than Illa: holes. This is culled nun-l
Okinawan-Wm 7' Inboulfi,‘ asap-8M
MM HMfimsizeis Sin-m cam,” tramnlatlon.
'
morainmsiumam 5‘"
'flvfllh-nmm w mu‘; 4.2.5 Compamlon
°Nmybp~fifiundinmoniauu “WW“ “Emilia-5 mun-22M P1n o . “ Pain:m
mmmfimkmmm'k Ihcpamuonwnllbc my . G. What Is épwacuon? ExplainMlhmmpla'. aim! _|

W m u m and within that um, m. l‘Wu


‘ Solution to nbuve discussed problem i: compmion.
o hbm—fiLflumxim'udmmlofiuhem .' ”l' “M 3‘ c “
'1 Compaction is n uchniquc In caven many small sin
a w h m d m fi n u m k "in.“ Pun-10M Ndn=lsM scam“! hula into one large size continuoushole.
. :11” an!
nuns mum mm In; W In hm ough ‘ I I is lulocafion of flu: van'ous ptooessu so Is to
sun-2M ——
a.”
Miami“ processes 5" accumulate an m: flee space in one place.
sun-Ion Pamsuu Pam-«1M
‘ ‘mbmrumhduanm“ $135.3“! sun-m sun-m sin-4M
Due In compaction. Ihm is efficicnl use of museum.
whacmuitfwflmplfitim queue fig. 4.2.5 shows [he memory mar compaction.
(I) (I) (D
_ pl‘u‘mm‘lwmm‘MIflM-fi Fig. 4.2.501) shuws III: scmcrcd mull sin holes. If
lo m '1 Fig. 4.2.4 : llon cluttered hale In dynamic
m'hfilwfitmugm“ mflmdmmovadup.wegetonelrgaxiu
{rd . , plrflflonlechnlqu:
"mini v gunman. hole sub: and of memy as shown inFig 4.2.501).
f“-
gum? mum
” mm 3. Many Cm'mmnnary Paging la: - Whmapmcessnnivesandnwdsmnmmmhes ptoccms P2. P4andP3nwved dwnwmwegel
— Muffin-VIII”: minim m M II . s: _ ,‘ {on hole lug: enough to fit for this process. onshrgelizeholeofBauhcmofusnmmry
mflom.mhummmym m A lushmqusisfl‘l‘ - This lechniquc ensures the efficient use of main am as alum in Fig. 42.50:).
8' "Emory. Then is no inlcmn] frngtmnmiun.
M
9""ma "3 “mm“?hl’mfn “Mm solution avg Howevcr in this. 48 M3 processes need to be mowed
hmi‘lf‘ltmym u I ' However. if am: my small 11q are scanned.it can't compared In 28 MB shown in Fig. 4.2.502).
_ npin In . , he Illncntcd to one large size pm. Consider the fig. 4.2.501) Show: the 28 MB shiftingof pm
ofmmflmnimdnom.‘ following cxample of fig. 4.2.4. Compaction should ensure the moving of W
.
wwm'mfwflnm" \problcm.
m’m — Initially 64 MB main memory is minus. 8 MB i1 having minimum [vial size. Compaction inc-luau the
‘ “Mixed - ennmmumyhappm
mau w W - m m b P -Wraps:
rflflon nllocalcd10 operating syslcm as shown inFig. 4.2.40)- degree nfmullipmsmnnfillsr

Mwmmmw““WM For user processes 56 MB memory is awnihbl: Ind llisbecauupmmmhehadedinmmmy


mama as an: large singlehole. whichis lvnflnble by combiningInlay med bola.
“W"Wmmmmwm, ‘24 Dmmlc
Partition Technique - MP1,]72andP3mloadedmdwm
fig. 4-9-3 Show: may]: size
IIIm'fiom — '3’“mm Imam sufficient memory SIMe Cl“
be mm
W

Scanned by CamScanner
Scanned CamScanner
M°’"°
" Emwmmu'w‘mm M3,, r
.. If relocation is done at compile time (static), ' Overlays wen physical division; of
completion is no! possible. It is possible only if mumblishedby"lemma.- me Mr H o . . m n n System ( M U - 9 0 M
Mention is dynamic and done at execun'on time. _ To complete the execution, it is ”quimd. m1: 3 Symbol
_ overlay A contains pass 1 W k , uh}: M
m a n - A d d a m o f a p m m s "mu,“ “hwy cont-i... mCPUMnummam.mwhm
common routines. Overlay 3 m 2 module.

Rim-EM
an -
memory.
Itismquiredtohavepmce sunmdn
_
symbol table and common routines,
Overlay driver of 20 K i s loadgd in “my, Initially
ilmihmmflnmflmmifinm
MlpmiaminmmyJuww-m

‘ and hence physical Men: lindenimdpxm,


OWN“! overlay A is loaded in memory which Equilcs 160 K 01' lfmmrymgionixnmheemmmmm
accomlyndmetheprucess. mummy- .
Min-ill 5m.
_ mpmcesssiucanbeluguthanuwam ., ”kins dispmher swapi on: man new
_ Once overlay A finishes execution. ovulay adm- M fivmflnnmmy.
NIH-Ill Min-Ill
memory allocated to it. E? overlay B in pace of overlay A by mm“! ”W
mum-a namnfmdsmgismandmfmmolmm
_ The overlays allows to have nwded "Mu,“ B. Ova-lay B tequila!160 K of memory, selected p m The mun-switch 6m: in High I
m ma non mu nun
in main memory at any given Kim. Wining
M ‘ 45 Swapping mm is quite high
m (a w
— The data and modules which are
17154.25: Compacdnn not Mailed» Syllabus Topk:: Memory AllouflonShingle!
executio n at that time an swapped out Ofmemoty G. Ex‘pmin Shafifilfiél dell .
f
4.3 Dynamic Loading — Next time. the needed modules are loadsd
into w - Systems in which it is possible In move smite 4.6 Memory Allocation Stmegies
which is freed now by swapping the modula between disk and main mum-y during ‘ m
-—. Dynamic loading ensum :11: better memory space r‘
mquimd fmexecution. called swapping systems.
"walridmemnmumfion mm '
' “H
utilization. Unless and until called. routine is not
loaded An overlay handler exists. in anomal- om 'pamnonselawm'mom-mum: ‘
in min memory in dynamic loading. area of ' — In I time sharing operating system. lymm's memory is
I and is responsible for swapping allocated to multiple pmcuses. Emmmsmfiumlgflmwmhwhinh
- All routines remain stored on disk in I mlocuu overlay
blc load overlay segments. _ In order to have sufficient memory fm.i1will be tsfmwbeaflmvmlhwmw m. ' Fa ' II: ,
fomm. Mamamedmnflmwmefiu
Overlays are implemented by user. no mquimdlo swapdauhetwunmmarymdmduy 3 MI-
- namin pmmm isload adinlo nminm special‘ ’ 2 pmoess. .
enwry nndis needed from operating system, pmgm 810mg: (disk).
execnmd. 'nming claim m‘
ovarlay snucmm is complex. — If we use round robin CPU scheduling algorithm then
The ndvaghge of dynamic loadin ' "
g is that, memory - Consider the example of two pass afiel’ expire of time quantum memory mm.“ will
space is ufiliud only for the assembler. As ‘ . swaps out the finished places: and swap; in the mother
routines which are know that pass 2 is executed afier
cunenuy nwd to be executed and pass 1, 1 1 ; ! ” process.
other unused mutincs necssary to keep both modulus of
with on disk. pass I and p352?
memory simultaneously. — It increasu days: of mulfipmgnmmlng ensures
- Huf ades iyul hepm yam ‘- effeclive management of memory among ' m y
whic hum mny libm y Duling pass 1 symbol table is oonsmmted
muunes than operating syste and pail prooesm. .
m will itself support for genmlns machine-language code
dynamic loading. . T If scheduling is priority blsed, thc'n alter arrival of high
- Symbol table and common routin
No special support tequixe fmm
owning systcm.
es are required in 50 priority process low priority process is swupped out on
passes.
disk. Hg.c4: : Memory I'M-“W W
4.4 Overlays Consider the memory mquinmen
t of pass 1 modal -
Afier
completion of high priority process Igain a law Syllabus Toplc : Flat Flt
pass 2 module, symbol table and comm pfiurily pmcess gels swapped in memory by memory
— In the curly days, as on routines. ‘ "
“Be Ingram: were no “1’83 no fit manager. , -b 1. rim-m
into their partitions.
Pmmmmels created overlays [0
Pass 1 Module
”I” “5 Pmblem. - Swapping needs a backing store to same I “MM Illocuim. the very fin! -
Pass 2 Modu le fllVlflg In first-fit strategy of m m
dam. The backing stone is usually a fast dink and avail-bk hole that is big enough to occupy
III manning
s
Symbol Table Capacit y
enough to sum: copies of I11 memory Image mmdlmtdlodulwm [Ml-IBM
n: uln
Common
for all uses.
1° opdons available In sun the saith. Suda
min times dun'ng “0mm — This backing store must offer dime! a m “‘55 eixher initial: fwm the location when Fwiouy
execution. Routines of the u! of Eula."
Wm involve memory unages. ‘ much was stopped or «1 lb: sun
moving f“ big enmgh w’llnld
"1d Olll of mummy Whi data and Program semen“ in -
The
operating system maintains a ready we“ ‘3” Searchingand whm flee hole Inn is
mun tummy.
“h help! for musing the am in " Total 250 K memory is needad processes which axe mdy lo
emlfl-
“w am p m is locum.
to run the which ‘ 1' W on
only 200 K memory is — These processes have their memory
available than ovedlys
“'3 I ”
N M I5 Overlay A Md weday B, backing more orin mummy. Lf/
___/

Scanned by CamScanner
Scanned CamScanner
EMMWMU-SuM-DOMP) 4—5
Worst-m
Syllabus Topic - M“ - 211K isput in 600 K Paniu'un. 2 Opening 3 % l (MU- Sam 4 - COMP)
7- 4.9
" lid-fit — 417Kisputin500 Kparfiu'on. album:
m Em onl
“WHY 2 '8 the Ill: of lhe Kohl
In [with sunny of memory allocation. the smallut _ l ‘ 2 K is mummy “unluflonlomispmhlemislninficlmodifyme
existing for lllocalion.
' ’ 4. an‘ oomi . imfim-flwludingnfpmmmisdomin
3.17:3 I: Effigy; Ii:of £35m ' “61“"m w“ Initially Whole memory is fluted Is
a single block
having size 2". For request of space siu 1' which is
memory.
trap!in somd order of sin:men the complete list nwds I“. 5"
"“5 2“" < r S 2" the whole block is given or clue block lfprommlmdedinfimpanjiionflmlOOKi:
to be searched. This appmnch leads to create lhe Exnmple 4.6.2 in Iddedtoeachaddms.pmymnsloadedimomd
divimin[weand buddies ofsiu 2‘“.
smallest leftover hole. havezooKIddcdwaddmnndlnon.
Given memory partition" of 150k, 500k, - In cast. of holding um condition 2'” < r S 2'”
.mqum ToflnymmlocalionnfllefimuofludingflkEIhil.
Syllabus Topic : Worst F1!
(in oydar). how would is fulfilled by anyone buddies out of two. .
each of the that fit. lhc binary pmgnm must have linker incllflhd list
_ [ f [equcst is not fulfilc than an: or
_. 3_ Wont-fit algorithm place the pme
esses of 220k. 430k
of the buddy is bitmap indicuing which addmtsu an In be talents!
order). Which algorithm dividad again in {we pmiliom. and which an: opcodm. ounsums. or 0111:: inns no!
In worst-fit strategy ofmflnory allocation. makes the most I
— This process goes on until an smallest block yum nudedlo lulocna.
law hale gas allocated to incom always the m” 7 than or equal to r is produced Ind allocated to
ing pm. Again, Solution Ike
fl'dleh‘st afhnluis nothptin somd = :0q Syllabu: Topic : Paging
otderofsiu [-1.314]:
than the complain list needs to The buddy 5mm keeps I.“ m: lime I list' of 4.9 Paglng
be watched. This
ml) leads to craale the large . unallocated blocks ofeanh sin2'.
an be used again In alloc st leflover hole which - 220 K lsputin 500 K partition.
ale the next incoming ‘ 43° K “ P‘“ i"
m 550 K M m “
A hole or unnllocnted block [my be taken out from I11: -) (Jun.15)
— 110 K isput in 150 (1+ I ) list by partitioning it in half In general: two
k partition . buddies ofsize 2' in lhei 1m
swamTopic: NexlFlt
a. 4“ mm W " _ Whmvarnp nirofbuddi nanmellist bmhbemm Paging is memory management technique which Illom
physical mites: space of the pm
4 m
4. mNani: unallocated,they Ire taken cm from that [in and In he
-
4“ KispurinBOO nonconliguous.
mums Srzflungnfmnmy 220 KpIm'lion.
combined into a single block on lhe( H I).
fmmflnposifion offlle - In some sense. paging mechmismjs similu In India;
block thatIs and.select: lhe nut 430Kitputin500Kpam‘fi syllabus Topic : Relocation
large
Plasm a“, enough
available _ ofnbookWhenwemdnbookmunlyseelndneed
”'4'“ 110Km ‘ put :11
' 150 K partitio
onn. to open the cumm page to lead.
5'1"! ;v I:tZSflK isput in 550 4.3 Relocation All the miner pngcs um um visible Io us Ind Ian-Ins
. K partition.
mzmowmmuona o - t domlnuwnmemmmmecansnylhmevmm
noomsookgooms Consider the partitions of memory as follows.
Olde r.
How would each of
oomand 220 '
we may have n Inge pmgnm available. lhe place-m
the Hist-m, Bas ' first paniticm:100K (Operating symm) only and: I small set of insuucliuls lo enema u my
t-fit and
K 13 Pl“ "1 550 K M
.112Kflm 1i28 ED". time.
“as " KlnaM
lum;"19.9
W wmm!
d m"as K' 4 1 7 ‘ Second partition: 100K
a“We"! n m“21
mm 2m m _ 430K lwut
: mama — llOKISp in50
utin 01<p
330 Kpmamfi om Third partition:MK >. In Em. all then instructions which lhe [ u m needs
iu'o n(550K—220K).
- 4251(t to email: me within a small mximity of etch other.
Hut-m wait. Fourth partition: 300K .
111}: i: lik: a pig: which cumin: Ill Ihe mm
In this example. Bes
t-fit turns out to be the
Considet very fits! instruction is I call no a funcliun ll
":15
21 " ' M m
best. V absolute address 100 within the binary filc crawl by
which we are cum-.nuy Riding.
' 5001:pmiu'on.
— Syllabus Topic : Buddy the linker. In this way paging allows lo keep just the pm: of I
Sy stem
mm
'5P“!in W Kpim‘lim.
mmm -"
If loader loads the program in first partition u addma process that we're usingin memory Ind “lemon the
(Wmfimzsxx=5o
o1(_2um
% I 100K.
then instruction will find OS at ubIqIt. addlm disk.
100. ’
426m; ' 'VEma“ - 4.9.1 Basic Operation
_
l '0' BUM!!!)
If inslcad of first panition, loader loads the Win in
. - I
mxflpulinsaox
..
Fixed
pltfilioning tech ' mud pmition. the instruction will jump to Mess WM:[9' Pagéj'am'v' ‘
417 K' Spac e nique leads ‘ Addict!10Phyulal m h ,7 L
. mum. as number' of active 100K + 100.
number. Dynam. cases ‘0
500K compaction pmc can be m For third partition instruction will jump to Iddmu The problem of extend fnynenlaflon is ‘avaidedby
1 f’m'" mum“
K'Immsooxmm m’ m. Sol 6 '“hnique suffem 20019-100 and so on. This pmblmn is called as "sins mins- -;
v.

412K
26 ' uMfi'
- pmim LSKSmhtmgy'ks
In "is un mlocafionproblem. ' Ply'ng is implemenlcd by inmyning ma paging
3y:
are ofsizezx
hudwue and operating nysmn.
”MM and 2" . Is the least size blo
ck
'3 "'° largest size block that i!

Scanned by CamScanner
Scanned CamScanner
wvm “° ' 0 roll SNam
- lnflfiswduflqmlogiql manoryistfividadinm block: MU - Sem 4 - COMP)
183-1 4-11
cfflnewnesiumfledpagu. — A we remain. in log“. a“ run M m
.. . . . . mcessandin a ‘9'“ 0
—- uphmdnzmorylsdmde dmpfimdocks M :05“
- .
Pgemlmfllplseumflwdwilh vafid - - - .
alledhmes(siuilpowerof2.bctween512b yws
:rmwmkmedwwm wm
_ 0mm” . _ “Wmmtxflllsufioffllfmmmm
. md8192bymnlsollrgcraimw‘blein
' . _ mac). m..." - (i) bu.
. me Is mew and W with invalid mm. Tm M “all be waned due no
mherofpage faults,
‘T'Tfmmmdfim n'f'mm _ Paginglkopmfiduldmmofmn f Mmfimwillbecla psedinmekandm afionfl
— [may fi l m m m m m fl w .. ‘
cm ”Wm“ *hY-"Pagefluislargcmmmwium
(backing {We} When a M " ”d“ ‘1” b ' , [will namepmtmmtbemfiunmym _ m
mad. us pay: at: lauded mm any audible n". M shuelhnswdmonlyOnewpymtokminm
m s mwo f w
M m l mm mmnow
f miem
m ufem
dpmof
“11!:mm memory.
:9. mcmnmaininmcmory.
m2»: 4 Fig-1.9.2:Puglnghardwm The page table of diffmlmp oinulolm physifl] ° m m o m " mm" d i fi d ' d b ’ m w m "
a mm” mm?" 1“ by dime-n
In 1
m
,
Cansidurlheexam leoffi 4931;: ~. "1“ m “a“ used wmmmdmmwmm'w’fmflm“
i n p _g " “Milena“ users can be different so data page: are mapped to I mm""”‘b“°”‘m“m
2 ”Mi Kandmemoryavalhblelflzx. _, - duffewnlfiames. lhfingafewnfnmcswillimunmbuof
o
a n a P... o o By simply Paving page lab]: and: for diffémn P83]: [“1“c of III: lower them in
lun- 0 5 4 pmcesscspmnlmlhepagefimglhecpenfinggysm m‘
4 " 4 "P
a . cannulcmgionsufm emoryMueshuudby m“ ° l“’SE‘PIflHIImIIdIlsawan:Il anealzylnurnal
P-wT-M- momma“.
s Pun-Mm: 'a c” aum‘ .
z a
a mm: mm. E 4 3.3 Translation
o Onllwolhurhmd.“
" W W ' woulddnw' “'
Lookasldeaufler mmmywrm uwunumh unflmnmy
mmhmislinfimdmmmfim.
7 1e mpaginginmdenomssabyufimmmemw
m p needadlobeawmedandthcnbymismcd. 0 law also
was undue: the mate: of 11.3
"54.9.1 =Ply‘ngmddorpllydulandbgulmory
Z _ 2:2: two memory W an W
- E 4.9.! mm
_ [be m - model or PM“- and ..
:0 be " Hardware Support for Fla! n a
’8: l 24 Ilmul'tsinslnwingdownmzmmymbynfmof
_ _n my. _ -) (p.515)
z: I V 2 . Thxs dzlay would be unbearable mldcr most fl »
“momisdmcinpaging; i "-_"_ situations.
,
'WWWW‘”P‘W -a
‘ . . . . ‘~
o Wmlosiwaddmsmditisdividedinm ‘
Mm:lpnguma(p)andamo fl-m
‘ o The above problem can be malved by using A ‘ W“
"‘U'D” ‘0
(d). PhyikalMumry
translation look-aside buffer which is fist — Eachopemfing systemhasiuownmemods for storing
° rial-Inseambqisuwdasmiudexinmapag Fig. 4.9.3: Paging example for a 32 K memo searching hardware cache. The TLB i s mom 've,
e ry pagemhlemallownpageubk fore-chm
with 4 K page high-speed memory.
A poinler to the page lable is Slflmd with the other
o ”Emammhphyflcdmmmy — PageOisinfiamenumberS.Pagelisinfmn- 0 TheeveryemryinTLBisdividedinlwop-mane refiner valucs (like "1: instruction cumin) in 1h:
ilmlmflinedbypagelabh zenum bfi is key and other is valua.
mmbinm‘nn 7mdPageOisinfiamcnumbc1-slngical process control block.
° ofbaselddmss wimmgeofiset addmss4is ‘ o The associative memory is lamented with an item
WWPhyfiedmc inpage l andoff selisO .Page l i s mapped tnthedispazcheristoldw M i m i l m m
Humm er - wfi-amel‘ iscumparedwithallkzysatmeumcfimlflhm
“I lmiL usenllo So phymcal addms 28 = ((7 x 4) reload the user mgism and dafine the comet ham-rm
+ offset 0). is match xhen the conuponding vnhl: ficld is page—uh]: valuu fmmdnslmeduscrpageuhk.
o Thephyfiwlwafionofmedau Logic aladd mlOi sinpa cand offse mtumad.
therefore inm‘yis zisZJ ageZ is - '11:: hudwam implement-Eon of an page table an he
ll offset din Page frame 2'. mapped‘0 m 2’
" o “:2“!!! the “rag: 1:533:13: 255::n dune in seveml ways. >
- Beam of the Pig!-ngthe .
80 - addmss 1 0 : ((2 x 4) + offset 2).
physical 111 m m Tlugpilolds
s
m mmmmgbulhe Normally small number of entries, -
.mumsingle In the simplest case. the page uh]: is implemented a :
fllnsionfllalmemorycomains
contiguous
only M it 9"“ "'9 4‘9'2
”WWW Protection and Sharing often ranging m: numbers betwacn 64 and 1,024. set of dedimod legisuts. Thcse legimn should be
one m
built with very high-speed logic to nub the
Page table contains the hum: {or 4.9.4 Effect of Page Size o n Performance
number. So "19 pagm'g—adduss translation etficicnl.
Manna: of the Page.
Wmflmber. Page table is verified to get Page
size is important factor to decide the performnnoc. — Everymlomemrynmstgothm ughthepsyn‘g
be map. so efficiency is a major oonsidemian.
Plmenial :
bit is asS O C i l l ‘ e d w i fl I e a c h p a g e t o d e n o w r If page size is small then lhe any program vnll
m a
whether page is mad-wr divided
in many numbers of pages leading to h — TheCPUdispam hcrnloadsflmeng imjuuuil
ite or mad only. large _
Ifuyismadetown'tem
d
0‘“!
page table. mloudsdwoihalegim.muuctimwloadm
Page. a hardware nap load the page table
EW‘Oopmfingsymm On some machine, it is mquind to modify the page-table ngisters an. at course,
oeculs.
in
hardwam register every lime when context

Scanned by CamScanner
Scanned CamScanner
w» 4-12

Syllabus
_
mivflngudso matanlyflIe OSmchmgu hemem MU'Sfim4-coMP)
mu $5t
mp.
,if 4.10 Segmentation 4.13 @121 "augment
- nemofmg imforflup sgembleis
s ,
dwpageubleism somblysm-u (forenmple.256 Slum
5“,; "9'“ ° ln 3.3.: no
entries). ‘ . Scum!)
0 500 500
1 1 \ Iaon
Mutcontemponry computers. however. uflowthepay
In segmentation, a . M SWIZ
in 2 .20.: Leon
mblembeveryhrgfifoteumplglmiflianenuim).
— Fmfllesemmlzim.theuseoffmmgjmto
an be subdivided into a number of segmgms.
Difieuent segments o f the can L0!“
5.9,"

Mann 3pm
«m :3: mo
5100 w
impkmemtbep-gembleisnolfusible. Fromm: h m dis mt“ 3300
length. m!
— Rammdlepageuhleishplinmlinmflnmnmdl -
Although them i s a maximum segment 4500
page-um: bu: my‘smr (PTBR) points to the page len
length depends on mimosa of the segment
in l ‘
4600
table. Slum”
program. 5500
2!.
— Chmgingpageublesmquimschnngingonlyfllisone - Segments u: arbitrarily-sized contiguous ranges
ngiuer. subsunfinfly reducing context-swim time. Iddxess space. Fig-4.10.1:Segmmhtlan
at h ample
5 — mpoblemwimflfislppmuchiuhelimerequiredw— m y u: a tool for structur Sgglnmtflisoflmmlnngnndimbmixlm.
ing the npplicau'om A; . ,
I mlmmorylocm‘on. Reference In byte 89 of segment 3 in ukulnted
z the programs:- o r compile r may decide to image“; u WHO:
i — Ifwewmmmlocufloaemmfimindgxinm addmss space using multiple segmens. 1700 + 89 = 1789. Consider”!- fnllowlnn segment hblu
J ‘ ; -.
dummiemsiugmev-Iuinmmkmby
— For example. this may be used to create Enlnpllno.1 <-
sum; din 5 --
Ibepugenumbu- ’ segments that are shamd with other proces On a syslam using simple segmentation, comm
ses, Wk Inn 0 219
shawl-4.9.1
other are noL physical address for «am at following ths mm address If ‘ 23°“
600

— Compila- can create the different segme address a segment taulnhen Indicateso.
14
nt for 3|“ 3 ‘327 59°
— Forum sdsymm flahflnfl olaos.m meRAM variables, code, unread suck, library rm 9,, 4 1952 98
m etc.
Wmlhmm.wTLBmfiah91mns.HM
om — In segmcnminn, a pmgmm may occupy 0 330 124 Whmamphymaddm mfoflwnubglulm
(1) Elrseuvanmrymwimna more than on
pamnon, and Chm partitions need not be
contiguous.' 1 m 125 (00.430 m u n (mum 003.4000 004.112
(2) M W M W M — Imam] fi'agmenlan'on is elimina ted in Sean 2 111 99 Solution:
(3) Hammoninefledvamlkm. m .H
but. like dynamic paniu'oning. it suffers 3 498 302 (i) 0,430:Segmenl0isplmminaegmmtlfl1le.Nww
‘ Solution: from exufl
fragmentation. In segmentation : havelocheck(ofiset<flmit) mnotlfofiutilkl
(I) 0. 9 9 (ll) 2. 78 Oil) 1.268 (iv) 8. 22 000,111 Illnnlimildlenphysiuladm=bls e+ofim
ILBh itnfio ,RAM mfim etmd
time Solution : 430<600 themfore physical addmss = 214 + 430 = 649
Tixgiveninpmhlem.
mg'h .
3"” . . ‘ (ll) 1 , 10 : Segment 1 is p m ! in segment able. 10(14.
(I) Wum mqm wmm mn) '5 ”m““'1"“3mm Themfom physical address =mo+10=mo
EB=(Ul5hitrafio)X(T+lJ)+(I-TLBMm
flo)x(2T+l) (l) 0 , 9 9 : Segmentoispmentinmmuble.N?wwe (iii); 500 : Segment 2 is t in H
o Eel: entry of segment table contains segme an"
nt bile, have to (offset < limit) °" “m If offs: '5 '5‘ 500680 (false) therefore segment faultmdmpm OS.
= (03X(100+20)+(l-0.9)x((2x100)+ Ind segment limit. than limit than physical adduss = base + offal. Not possible In calculate physical m
20)
= 130m. (iv) 3, 400 : Segment 3 is present in 29:25:: “:1;
99<17A themfomphysical address = 3 3 0 + 9 9 :49)!
‘1’ Mum-mw nhoutmm n) the semen: in main memory and semen!
hue" (If) 2,78 : Segment 2 is pmsem in segment labia. 7869
400<5 lhemf
= 112
80
1729: cmenu
o n 1)t 'cal addicts = l +
(v) 4, is m m in "I”; 11266
Em = 21- : 200m denotes
length ofthe segment. themfam physlcal address = 111 + 78 = 189
3
(3) “Whficflnm um ° smtnumbflismdasindextothese (Ill) 1.268 : Segment lis present in segment tabla. (false) mentors segment flu]: Illd trap lo OS. No!
_ EMU/Em) 268425 (false) lhemfom segment fault and trap to possiblem ulculalephysical “1‘1““
mble.
- <5" - 05 - Not possible to calculmPhyliw
Wm“
4.10.1Dlflerenee betweenPaging and
m-‘Mxflmow (‘9
= ° om ”1““ “We" 0 and segment “'1'“;
WWW-S: error 0')
3,271
: Segnwnt 3 is present in scgmcnt table. Segmenmlon
'-)(noc.1o)
= 3595 will occur indicating ammpfinl. 222602
themfom physicnl nddmss=498+222=720
access beyond the end of
(V) 0, 111 : Segment 0 is present in segment :11:
the segmcnt.
0 fig. 4.10.1 indium 4 segm .
ents of the PM?“ 111<124themfmephysicaladdreas=330+lll—
”a“?!mm! sizes. Segment able contains bl” ‘
fi and “Nit“mh segment. .

Scanned by CamScanner
Scanned CamScanner
wwm‘mm ’""
3N0. , ' ~ ‘ _ v ; > ‘ .-.,"_.-,,,- ..
_ 'cnladdnss'g' . .
and]! Is dmded Log 1 I , div: _ sralln clam M u ' s W H - C O M
l. Lo
“a?” cal CPUgenemles
into 1: pageaddress
two pans logical number (p) and a page segment number (a) 4-15
“(large

offs: (d). segment. * t


Syn-bu. Tople : W I...“ r! AWpflp’uhp-finglymmm

2. mm The page number is uud as In index into I Sag: numb: M m m h w u m m m m


met-hie. table 4.12 Vlrlual Memory
3. mm The base address of each page in physical Segment base indicate spam“ When it is needed In m I present. m y
memoryis maintained by pig: table. of the segment in main mm: _‘ Wmixinlomem y.
basedenoleslenguz ofmesegnzm‘m WMWIWiflSI-heaflinmimomy.
WmWfllmmmhodym
4. Physical The combination of hue Iddms with page Segment base indicate staffing . whichuemqufimmruncmioumhafim.
Adams offset definu the physical memory address of the segment in mu'n memmyfiell
Missenuofllememoryunit. Thmmmnycmwhmmflmmigm 'l'lmwillbcflil uminlnoeuing flnmfl‘i hm
basedenoteslenghgfmese ’yllnd ,
needed in min memory at a time. Mymppedwafim'lhhwiumlm
'5. 'Pnymnmion 'Sufferfllroughinmdfiagmenuflon Suffer "* cl - lnmnycm cventhou ghmfilem mixmu fulllwhsch' inspeci-llypeofimmpl. .
mynotfllben eedednuwnm fimg. rommmmmmm‘ Mun-ea"by
4.11Segmenmtlon with Paging OSIIIndIa'InIudmemqmed'” h m .
_ In Application Pmsnms Ilwnys m u: ruling of
e11:53" “an" w:.m pagmg
. .
. advantages of both pagan . . availability of contiguous working adage“ '9'” an In Aflamuwm‘ golplplnfieafnmcisund‘ om.
; md segmenumon an: Implemented ‘03:t- Dmingfllmisopznu'onttnmmns‘ W
lo the idea of virtualmemory.
— In paging
- page size is same Ind probation and during Mg: Actually. this working mommy can be physically
A: won a page banana u m die blockd
also pmvnd ' ed in segmenuuon' . mdmingdiskopmflonismmmu
- ”ML
Inlhlnmchnique,eachoflhe segment 'IS dmde ' ' d 'm multi‘ ple pages and there fragmented and my even overflow on Iodisk muse. plucdmdxexudyquwe.
is also page table maintained forage
]; ,( This mhnlqu: WIDnuhedlflaschedulu uiimitmiu
— mSeynoffse
nloffl.ulpa rtoffl lel ogl‘cll address makes pmmmming of lug:
(conm"mng offset and segment applications easier and use mu phyaiul memory mote mimmainsmlclicmdmmuedlhepphfll.
number) I:' further split in page num.
I:. _,
: ivzyoievngfnmgibl:lenlltiyjncy efficiently than those without vinual memory. Theexeculionwillnominuelnnilllllheinmmm
des segment hue, segment limit
om“ and eddies: of page table of that 0 Although executing process in not entirely pm! inrncmmy.msuppmachoffud|ingmuutheym
. . . , oglcal address has flute particular >
components: segment number needed for notation is culled demmd paging
(SN). page number Ind] -: in memory. il. can complete its execution due lo
- uble.
Memorymaugment um! uses segm virtual memory technique. Befoxe swapping in m: pm in my. the pup
ent number as an index into
segment table in order to I pray-m I'lllkfl we thou whid: pap will be used
0 Vimul memory permits execution of lager in befamdleptmisswappedmm‘ .
Then PN belonging to logical
address’ programs Ilthnugh smlller size physical memory ll
ma table to low: elm-yin Themplmpmossisnmswuppedmmme
page Mable.I available.
Framenum
of” offsetberin page
to obtai fable marblingmnlyflmxequixedplgsimommy.
n ”mo en isuse.d to calculate
dify phyn' cal Iddmss. m s‘ frame 0 1! mm: larger size program: than :vailwle
number is attached to hi9! o - Thiswmldlesmc'llheswappinghofmhmy
- '. : physical mnwry can mplmc the execution. whichuenotnwdedl’orexeulfim.
o vmnmmoqmceptwmm'W mo 0 1 v 0
memory from actual physical M W - m1 1 l 1
0 Thissepanfionoffenveryhrgefimfllmflmmy‘f’ 2 s v 2 no“
m2
"

program although amnl Phfiifll mmry ‘3


d

hlving very mull size. M3 3 I 8


i

Pm: 4 2 v ‘
b

SyllabusTopic m5 5 I I No.5
-

Hardwan and Control Structures- Demand Ml“!


n

me a I ' 0
o

4.13 Hardware and Control StrucIures run 1 l 7 PI!"


e

Louie-1W HGT-3'
4.13.1DemandPaglns '
I
-)(Doc. 14. 0.0.15)
mun-m
law-111:hphhlcwlllnlldnllhnldll

Scanned by CamScanner
Scanned
Ms
4‘“
E MWWU-SHM-OOMP) . . my
_ I! Following are "1' mm “mm
mapfimemd thelmmdl’h y'iwwy mmble» mm +17
. l l WW
hma. I Vlhdfldmv‘Et:
- . M m
- mm mmm'm“mm‘mm
- Emu!
mh ” m
. m o ' maumba’mddaefialdl é
1
dam; um“ WWW mummmmwusmmm
mmmmmmm w.“-
,3.
“mm m I — If match noun than the wagonding
[1251-- [use fume { ‘
p.93 (fieldznfnsedm‘w'mmedaimmfiwm. "_
- Humalsmmnchflmlwceedingenfiainlhe:
- Wrangmmwinmm WEnmmhgdfmamhi-ngvirhflm.
the sum of their may needs ensuing CPU www.mss chemissh wninfigtl lfl.
uliliulionashiylaposibk. - AvafianlofdfilmelhodmisgaodfuM—biuddnn
. . m
_ fig. 4.13.] show: pug: table wnh Vllld and main]
maJ'qmmmcmn‘m-m hm&(w:enuyinmcmmh ;:rmmama
pan- m was which use in main many are 4.1“: A ‘ 81$a I M P' - 9 H - m fi h '‘
-D 4.14.1 Hlerarchlml Paging .
‘ “9'
ddrum hflonfontwo—levelszhit
Ipanama
l mum-c.
Wummmmwmm
Dualnthis.
aim-lid. 5 ? aeeisvfl y 1
— Ifthel081'ealnddmss . - — asingle ”flu”: “mm m
"so suCh a; ‘2“. — Fig. 4.14.2 shows awn-level page-um, scheme. . 8‘ Emmy livid-Page m
- mamzmm4mmmm3oitis 2“,mepagexableise1fbecomesexuem1ylum
‘7 — Aywpedpage ubhmmainly usefulform
Madmvflidmbitl’agclmdfilmminmain _ In this use no], pmcess may require m n y ‘
spies. whaumzmorynfmces mnmnfim ,
mambdwhfiinvafid (i)biLPaga 1.1)!563. physical a m space for the page table Elm-So Indwlflzmdmmnghmmheaddmssspm
msmpémm7mmmvm wmudnotbeadvanlageouswaflocalc thepage:
_ A _ of to the is not conugummlym mam memory. <
. - Solution to this problem is to split the page lablé
hula.” . b; - maflerpim. I
—— m "' my PIS! m
mmfim
w mlo any — Onennhodtoachievemis is louscatwo-lcvel . >' ,
algorithm, in which the page table iLscIf is also paged.
Thefts:
- Hie mm the Walrus-fling - Consitbrlhesysumwithflbillogicaladdm
mdmmmmmmmnofimfln withpagesize4KB.A32billugica.laddmssi5n
mdhvhg mafimblockofnmy. in:
Fig, 4.143: Elihu! Pip Ml:
' manna- um ° mulmnmm -) 4.14.3 Inverted Page Table
- tibhyiuvimflmy. o ufitpageafiset
09mm sync-n
n 3' 4.14.2:A1wo-1m1 album: - Gemnlly the «mm the w
-
- MSWMM; - 8"“
‘ '
mg,“
'1” ”9° 3‘?” f“ “0"" ”mmc‘ wav- mfum inmaphysiculmcmorylddlus.
4'14’2
_ smfilmdmflpmkm
Is
page“)bilpagcnumbu-md subdmdedm; -D flashed Page Table — amuse the table is salted by vinufl Iddnss. me
800d- 0
— Ifflwaddtus spmmlmthanflhumhuh- ed Ais capable
openfing system . inthe
. ofomnpufing when:
m
" ’9‘ «mm 0 .
lobltpagcofrm pagetableisusedinwhichhlshvnlucisusednsvimal filtrfifi P“WTWEW“W

dwwm “WIPE Eng - Mme” ”“n Wis d'Md‘d”


follawfl' pagenumber. , . — The disadvmugas of this scheme In flu! etch ply
In
_ m m mp1: m Page number Page uflfset — Th: elements which are hashcd It same locnuan. 1'8 ablemay mm“ millions cumin
m"
“Topbfifl'wfluolpafl A WH‘mmfimimdmhmF-ymmm - “W “b” m "m“ m“ °‘“"5“
I‘i’mwam‘im'wm‘mmm
mmjus‘mmanimrhowahuphysimlnzmyis
Tabb.
1"
10 12 consists offline fields: ”gum .-
Mdl’agehbles When.
4.“ ' 1. Thevinualpagemmber _ nepmblemismolvedwidlinvmadpagpubln )of
\ ' ‘ '
— P'f‘mmmflwmpagemblcm 2' efnmc _ “mismemyforenchmlpage(mfim. I
d memmofflmmawedl’ll. mell‘nkedlin Inemmyin invmedliaac labialnmisennylhevm
Pzflfllefisplaoemmminmepageommnu
, 3. Apoimerlolhencxtelemun Idmumemenmmmnmumembum'
nemmgofmalsofifl lmislsfouUV/I. is L
1‘"
Wan scheme for this mhiWr' — vmmmssmuimmm" a'm _ Mummismmmflwmfim .
. .m ‘
hed into the hashum. Momafimabwlflwmw “msmm
W W numberisbas
m“
m “We fig. 4.14.1. A; was I

,_____—

Scanned by CamScanner
Scanned CamScanner
P) 4-18
Operalimslalom (MU - Sam 4 — COM
E
. . mfs ysm mmd
xsm
call worked by ““5113 3 WW °f the 9mm 0 amtln 1am MU - 5 3 " ” . m
plge nbb
— Emm ofdfi sonl yme ory. spawforthechild- . 4-19 m m

ageofphymnl mem The
ithas only meenlryfareachp _ Whilc dying so it also duplicatcs the pagcs be]. . import ant factor to damnin umber
:I‘obflngmfinmy upumw‘iW-FBZ
.4 show s the opel ifion of In invumd pig: {nullsis the numbcrofpay fumes :vn'illlbl
fig. 4.14 the parent. 0n the other hand. if we assum¢_ “ _ m
e. of 9'85 I! mil-cad. This process osmium u m In
Shnim-
. numbers of page film: In for n pmicu figAJGJ.
pmcesses call upon the execo System can reference string and for page replacement al '
lnr
0‘ — Whmmfmlumnaithdmdmwfiahm
afler ”mm. the copying “'6 Pmnl's Nth“; given Ivailable number of page hm, gamhm for min3fflmfl.
may be needless. _ The number of frames nvaillble is invmely
- T h m m i n u m l l l (“Humming-.m
_. Capy-on-Wrine allows parent and child to 51131;, pmponiom‘ In number of pig: faults. It means an if
Ilgmilhm sometimes suffer: my: mwll culled II
Sham
saw: [”8“ If pan: or child writes to " . more fmms are available less number of faults will Balady'n anomalshalispagcfammfilIiue-u
occur. cvmdioughnnmberoffllouwdl‘nmum

Syllabus Toplc : F|FO SyIlahul Topic : Opflmll


- Auunmodifiedpagficanbeshuedbymeml
child processes. ‘ 4.16.1 FIFO Algorithm 4.18.2 OptimalPage Replacement
— Pages that cannot be modified such as Page! con . Algorhhm
executable code can be shared by the parent and '
. Compare Omimélf LRU arid
, , algorithmswnh Illustration";
visor 5;: :cmy‘fia’mfmmu m Pump-ad;
I.“
This technique used by Windows XP, Linux, .
fig. 4.14.4: Inverted PagpTable . Oompale FIFO and LRU page
Solaris. “
_ The simplest page-mplmemenl algorilhm and work an — Cmpmm-lloflmpag e—mplmlflguiflmm il
- Inmdcrwaplainxhisappmach.exmpleofm — Assoonasitis known Ihalapageis goingm algorithm has In: Iowa: papfnuk me.
the basis of first in first out (FED). It Ihmws out the
invutedpageublelsedintheIBMRTis pagcs in the ozdct in whichIhey were bmught in. — This algorithm :2l that 933: which will not he
hush-and.
- T h e l i m e i s associatedwilheachpagewhcnitwas
uwdforfiwlangaslpeliodoflime.
Evuyvimalxflmssinmcsyslemiseomposedofa allocated.
- — Thisdchyswmvoidablcpayhultumhu
brought into main mcmory.
uipluqxncss—iipage-numhenofiseb. — Seven! operating sysmms movid: a pool of flu mg posfihlgmdlh mdecmssthzl ualnumbuofp lp
_ This algorithm always choose: olden page for faults.
— As shown in fig. 4.14.4 invemd page-(able elm-y for such requests.
replacement. Asflgofimmm plumcpayonu ubuisonumm
mm: a pairqnms—id,page-numb». is FIFO. 1 queue can be maintained ofpageJtisimpossflalnoimplemL
Syllabus Topic : Page Replacement Strateglee r — Sinca mphcemt
— Themamyunmewmkasaddms s-spm «0 hold all the pagas in main “my. — Theopdml algmimmi smuuliubl emuhin
identifier. impossibkmdumimthenumberofinsuufimfin
— This algorithm doesn't care about which page: In
— Alflufimememorymfmo emkeplmpmoftha 4.16 Page Replacement Strategies ‘ 1 ‘ mdwhichm mflnwemd ti: willbeex ecmdinth efumbefm dnwwiflb e
vinual add-Ix. consisting of mid. page- used in windows 2000. affirmed.
numbmjsgivcnlomcmemorysubsymm. — This algoxilhm do“ not suffer mush Sandy's
Consider the lefennce min; 5. 0. 2. 3, 0. l , 3 . 4. 5. 4, mum-1y.
— Samhingofd‘leinvcmdpageubleiqfmmgdfm. 2. 0. 3, 4, 3 and consider 3 available hm.
mflthereisamhumuyimmephysicu MU - Dec. 2014‘ 5 Ma Againwnsicrmcmnfemmingimzlo.
» - , Reference strlng
Iddmu<ioffsu>ispmdme¢ l.3,4.5.4.2 .0.3.4,3
After Page fault handling, to accommodate me ”WV 5 0 2 3 0 1
LmfislmmhManiflegflmmm page. I! IS not possible that frames will remain always BEBE! E E,
Embmflnmmlofmcmwywmm
Infill H il‘
mmnbbkammmemmormm So it is lauded tn leplaoe the existing page from min IIEE E II-
a” memory. V
9° m “bk "I“ I Page reference coau- — For that purpose then: Flg. 4.16.1: FIFO pig: replacement
Ilgorllhm
“3.4.16.2:WPFNFW‘W
m are man 1W . in
— Theemim. uh]: might need In bcwm algorithms. 3! Page 1°?
‘ - Since fits! three pays were inilidl y not in main Sine efim mme mmi nifill lynm inml
m'msmhwuddwnmmmonlime.
chedm
All these algotiduns can be evaluated by nmnins it °'" ”BMW (5.
0 . 2)
causes page faults and tum; and
memory. mfm nm (5, 0. 2) m m page
”mm: e to page 3
inn) these 3 free frames. Refinanc
B“ a ight
mmmmfluhublembem fled: suing of memory Inference. I! is expecwd that 1”m hmnm hmm sfieet nm
dfimitme . uLTo bfing
tonne-oralmoafew-page— num rof page faults should be minimum to S" m Hgain causes the fault. Refm melo page aagn inuw dwfn
nblecntfies. perFIFO pollmly. page 5 page 3 in mmury as per optimll
mphcemen! ”flex.
performance.

T“
bring page 3 in mummy us 13 M y luchwnflnot
WTwwowym-wma (win ced. Next reference is to page 0 and ll pagezismplaeedbeuuseilismepagcw
' gimme: s_tn'ng is the string of mummy ‘5 memory. .
. _ ”than!“
In [sensed farlongst peflodof lint.
4-15 Copy-omwme of the - string is cam'ed °“‘ lfmpollcy dyin mm- my.
TObringpage l inmmnryagain-spet Nulm facm islom mdi lisflm
ryflnuperppumfl
amfimll y.
\ ' ‘ Tobxingpngelinmemu
The"felmesningcanalso!»geueummbylisting“? page 0 is replaced. rammed. Nexl mfuenen
_ Whom
- — addressofmhm Rafae l-we to page 4 again mpucement policy. page 0 is
no
- emoty.
islopageOmditisukudyinm
out: child m
“Mme-m3"; “m symm U r y m f e m n c e b y t m c m g[hev
PM "My. rorko

Scanned by CamScanner
Scanned CamScanner
w '
. . 1 . ‘2

m
Vfimmmfmmnmm
w:
7
mnwm'ms'”mww
.

m' w a "MTM
#20
0' Implunentltlon of LRU

k “mum: '- W ‘2' m '


, ‘ _ 'u y 1'" n:on the
. ,m
com-mu: mHL 4.162 mun: "' _ Remove the page {mm suck Whenever i?" n net
4.16Ma ) Second-cm
- AW
"h", Mplueilcnlhetopoffllesuck. u _ ’
- mmqhmmdmdmmwflmdm
sl-mroplcflU _ Myfimtwof,mk,howmmpm h — firfiwflmMrephenmiumbnhwummmnomumnxm
:-
termed Ind bouom shows the page “Mull;
0 3 7
II
Recently Used (LRU) Page
I 12 15
4.18.3 Lou! for longs! period of time. MW“"I"I-I-I—I-I-I—I-— ll
”W Oflnll'l'l B E I G E Mm
w...-
B Alg _ Uslng' .-
(I)
0; w w w . m u w n r o FIDO W } _ > _ \ _ Inapagelableld dflmeafmfieldw imm:
”WWW - Atmhnfmwpng eau’uhm-.i. a 12 u 15 In a)
Wmmmuwmwmw
1 3 ' -
enema-naww':
- Thimolpagc'slasluseismiawdwimexhplxe. - Copy clock legisla- content In time of m: fie“-
- MunpgemwlbmplmLRUchmlhupage - Time ofuse field will show lhe time oflag '7 .. (II)
Mwusedfmbackinmm thepay. “3.4.16.4 :wmw
V
- LRUis-gmdlppmximuionwmeopfinnhlgofim _ Replace the page having smallest lime vain; _ HmMmbitilmlol.uecmddmisjm Tuclodthndpoimmtheuldeam
- m. Ilgnn'lhm looks backward in tin): while optimal 4.16.4 LRU-Appmximalion Page Replacem mlhepqeandflmpwededonmnbnmm
Walgotidunlouks famudinfime.
Ana the m of pig: flak. Ih: pap ha
— Not all the syswm pmvides Imam FIFO pigs. Am: a W you a second elm. its poinedlobyunhandhdm
- Thin policy mums lhal replace I page whose last f . [a
replacement. If hardwm support not avai , ,7. mfcnncehitilclwed. flindambilisOJhspphlwlndndkm
wkfmrmmcmemfime.
- WMMe-ubeimplemwdwilhmhudwm
FIFO algorithm is used. 7' — Naw this page is oomidcnd I: arrived annually and i n mammhcmhiuplm
mpponmdiscamidemdlobugoodwlmimforpuge - The reference bit is, usocialcd with each arrival fi m e i s m w d n c m n u i m . mmmmdmmmmhm
lephnemml. stored in page table. M Li
— Becauseofmil.wgemwluoondchmwiuw mpodlion.
— This Ilgorilllm does not suffer Iluough Balsa)”
: _ If page is mfercnoed for read or write than thisbit V beraplaced unfillllothcrplguhnvebeenwplmed (or Unfmb‘uis Lilisclund-ndmhnd‘n
lnomaly. Initially this bit is set to 0 by 08. Once given second chances). advancedlolhemlpuge.
- We will agxin considerlbesamemfemnce string 5. 0, 2. nfmncedmenseno l . — In addition. if a pig: is used oflcn enough Io keep in - This plum i! W until I ' M ‘3 feud with
3.o,1, 3,4,5,4, 2 , o. 3,4,3. Following k themunof - This information is used for LRU-Appmximafiu’n‘ reference b “ sel- i! will we“: Nplmd- Mm hit equfl In I.
applyingLRUpagemplacemem algal-Mm. Raplacemem. - ‘ — Page A was initinlly loaded ll time 0 and given I S Topic _ LFU
5 o 2 3 0 1 4.16.4 LRU-Approxlmatlon Page Repla ’ u sccand chance. It: mini lime is now m to mum Wm '
3 4 4-16.4(A)AddnlonaI-auevence-aus
E a a a E HE! ‘ 3 Algo . J “me 20‘ 4.13.5 Counting-BasedPage Hopi-canon!
g E] u H I"
n n n a a a ' ””5 algorithm, 8 bilbyle is associated with” 4.16.4(C) Enhanced Second-Chance Algorithm
a E E E n n a E a a a maintained in lab]:in memory. 4.16.5“) Not quemly Used or Lou!
_ Frequently Used Page W
interval. This algorithm amides [Dir of when: hit Ind
"Eucaum Rm“! ‘ After regular as is interrupted which" Algorithm (NFU o: LFU)
' UM pig:um”; Sljlfls ”In reference bit for each page into the hi_u_ M modify bit. We gem combinations with twobill as:
"sodium m of its 8-bit byte. . — (0. 0) — ll is the hen ply for ”menu! which is
Other bits are shifted right b neither recently usednotmodified.
.
discarded. _ y l and low mdfl.' -'l'hispollcy‘ m m m m v m ll:
Tins 8 bit ahifi Ingmar shows the ‘ ‘
- M huh:
and - . . — (0. l)—Ilindi wespageii mtgoodfo tnplmnu daemdfumenmbaoffimwiflhew
. ““"Ififlfieemmkerm mumms‘mflnmd- . .
hummer-m ”W3 " Parent-true,
followin valI 1 5 0 f Shlflmgl
- 'sm' m
itisnunfcmnoedbmmcifindllnudwbewnm mm .
_ Tohing mused” sh 8 outbcfommplacemt. - Amismdfornd-pageud
“h at
inammdmh
. W311: .5 PZTEM '1 own below. . _ _ “:Lnfimfid
mm'm5is nplud 00000000- - be medial“! a II shows “mu.“
NolusedforlaslSIimepfl-iod
mm“'UMItleaslonceine ,A. ( l . 0:] - A pug: vnlh ks coltmzzlu 61:33: ”I‘ll”;
used may hm acnpexiod
mm]: men yusc “This Supposemnpum
d mmmapzemi
- "alfiamim _ (l'l)_mspmi.Myu¢dnflM mpgsMwacum I”
— 1' - , mm n “000100-11“,
- . _ page is used Incl-e recently “'1', ‘ ~ inn.
"Tum-s page 1 m mm "mm”? “m'lhlftmynmuueorommu. ‘ W“?’°°‘"“.". “mmmuwflm
1m, _ Sodnhuicugumtislhllhacmmydllbe
”Immenflyu‘edwgeislhelowcslnumbfl'
”bum”: 6}”):t 1::q LRU — mdSkbCfmm‘m ' M nWlomWILSOWZM
hm?
“We: “MM-“WV
- a. WWII in fig. 4". mm, ”mm
“Iii Prom; " M WI! dun
imm- ' register
- value I:- conndexed
. as w :4 MANN“
4.16.403) Clock PageReplica heedwhidlishnvinglmm
.163 “lain; in MI] 11
mainuins all the
used " Clock page replacement Ilgofidun
:5:t I used°f itis seconisd chan
then“'3 mof lclo ck.
Mammal-11‘
ce Wha mm uhw lnrl min unfo
mpgmmenl» '

Scanned by CamScanner
Scanned
—'"—__
+22 7 Examples
wu-som4~com
Al orfl hm oparuflngs tern MU-Sem4-
um.ifinidlllypagef: 4.1 COM
‘ ' ’ anhe algorithm isin no Inference to “us 9 4-8
and than them
_ finanimy ry.
/ p h
“7‘1 mmurormuuo
numo
page. stillit will remain in Em" sum 7 o 1 2 FIFO
(2)
e somepugs reference 9 . ' ' _°. 3'
4.16MB)Mos‘lFMuenllYUsedPag s m 1 2 3 4 2 1 5 6 2 1 1
2. 1. 2. a. 1. 7. o. 1. Calculus mg [3.99
3 7 6 3 2 1 2 3 £
1 1 1 1
ml ) glm OpfimflMLRUand
Algorithm("F"nvin 5 5 5 5 3 3 3 3 1 1
lthbm dondummplionuunpageh ...,.
2 2 2 2 6 6 6 6 7 7 7 7 3
enmlju ulnive dinnnm rymdi lityelm
beused . tor I Memory with films frames. 3 3 3 3 2 2 2 2 6 6 6 6
4 4 4 4 1 l I 1
Solution: WAlgorlIhm 2 2 1
hggfuulhlorm0=14

mmpumm
WV lollnwlngpage Mame Wing
4.3.2.1.4-3-5-‘13-2'1'5
Assumaimlneslza = $.manypwaluulhwouldmnbrfiF0.0pflml.LfiUW7
Solutlon :
magnum (1) FIFO page"pl-mum! uprithm

4 5 2

Total numbflofplg: faults = 9


Tohlhphumfls, a) Opflmflmeflphmummmm
“DAWN: M=7.0.1.2.0.3.0y4.2.3.0.3. 2. 1.2.0.1-7.0.l
4 3 2 1 4 3 5 4 3 2

7 0 1 2 . 0 3 0 A Z 3 0.3.2 1.2 0.1 7.0.1

Total number of page fault = 7


Mann-man
(3) LRU page rephumzm dgurlflim
Emul- 4.17.2

mm:1'2'3"'2'1'5’6'2'1'2'3'7' 3:312.1.2.3.6.Howmanypagefaullswould
mrhxmmwg: 9'"
”mm. ”min four flames? Fl a" a“ W ” mt
"Mmwaswillallcost ans fault am, a “W m “my ”“9”- ” .
(”taunt-cam
mFIFOreplmmem
Salmon:

(DI-RU
“ S u n g 1 2
'
3 4 2 1 5 6 2
1 2 3 7 6 3 2
1 1 1 1 1 1 1 1 6 6
1 2 3 6 .

2 2 2 2 2 2 2 2
2
3 3 5 5 3 3 3 3 Cansiderfnmesiu=3
)
6 6 7 7 1

Scanned by CamScanner
Scanned CamScanner
n

£
l
o

"

\
<

n
N

a
<

o
n
<
<
u

'

"

mu 9 a a B=HII§
u
u

(1) 0 ll am MU _ Sam‘ _ M M
nn LRU
PIE!
Mm:
Number of Illls = 10Ind Ml- : 10
N

Frame 2 0 Ti 4
0 2 2 TT 4
M1"
Nnmhcrofhlu - oI. = '3 1 0 E0— 0
°

Opflmnl
~

(a)
2 3 T 3
6 3-H" 5
W Y Y Y . y
a o Size = 4
<

M “F0 Plan Replacement


Number of “Its = 1 2 and Mlu a 8
I mn 2 0 3 0 4 2 3 0 3 2 7 2 0 7 5 0 7 5 1 0
Number of hillI04. MJuI l0 ‘ 0 2 2 2 2 2 7 7 7 7 7 1 7
a

2 2 2 2 2 7 7 7
(a) FIFO l 0 0 0 0
° ° ° ° ° 0 2 2 2 2 2 2 20 20 20
1 3 3 3 3 3 3 3 3 3 3 0 0 0 0 0
4 4 4 4 4 4 4 4 4 5 5 5 5 5 5
3 4
W Y Y Y - Y ' - - - - v - Y . . . . _
aw Slze - 4
Numberofhlu- 0 l . Miss a l Opllmnl Page Replacement
N

Number ofllluu =14 andMI:- = 6


EnmplOLITJ
li'nmn z 0 3 0 4 2 3 0 3 2 7 1 0 1 5 0 1 5 1 0
Glleulmhi! andmin pmonlauo {or lho lollowlan“ring
using page rapincamonl pollolos FIFO. LRU and 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
‘ 1:hr m- lmmo alto3 and 4. Pogo urlna 2.0.3.0 Opllmal. r
.4
. 2.3.o.az.7.2.o.7.s.o.7.5.7.0
‘ Solullom l 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
aoSlm-J 2 3 3 3 3 3 3 3 3 7 7 7 7 7 7 7 7 7 7
3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5
FIFOPun Replncemcnl
- . . .

PF Y Y Y - Y " " ' Y - - - Y -


Numlnroflllll- 81ndMIMI 12
Fumelllo [31 01 4]: FI‘IIIID SIM = 4
i LRU Page clncemenl.
O N E ) . . .

o
e

" < " U l ° ~ l

2 [2 l2 [2 l4 4
5 Number oflllln =14 and MI]!3 6
o

I o o 010 2 0 7 5 0 7 5 7 0
l

J Frame 2 0 3 0 4 2 3 0 3 2 7 2
~

1 2 1 2 2
3 3 3 3 2 2 2 2 2 2 2 2 2 2 1
N

-‘ 0 2 2 2 2 2
W Y Y Y - 0 0 0
0 0 0 0 0 0 0
<

r, Y Y 0 0 0 0 0 0 0 0
'

2.- Opumnll’naoltep l 0
-

lmmcm
3 3 3 3 3 3 3 3 1 3 3 3 5 5 5 5 5 5
3' Numhrolu: 2
13llld Mlas=7
4 4 4 4 4 4 7 7 7 7 7 7 7 7 7 7
3
Prun e
2 o _ . . y . . . Y . . . . .
a
§

‘1 Y Y - Y
o

PF
2 ’ Hi
N

2
4 0 1 , . “
N

When frame size = 4 then number of hit: am "‘0’" all“'50a M givenW ‘ “.3.

0 r
,
°

MU- Junc 2015.10Mnlks


OFI
fIEO. any www.mwm gww
u
<

<
-

q
u
l
~
o
<

Scanned by CamScanner
Scanned CamScanner
c
q

q
3 . 4 2 3 1
v .3 4 3 2v
I.

CamScanner
1 4
3 4 1

Scanned by CamScanner
4 2 3 1 .

10
4 .4 6 l 2 4 v
V
4 4 1
v2 6 2 3 1 .
.2 3 6 I. 2
v
2 2 1
1 6 u
2 3 1
3 6
I. 5
I.
3 s u
. 1 6 !

OPTIMAL [3
lo
5 I 6 6 2 3 1
I5 6 3 6 I
6 6 1
I5 - 3 6 2 3 1
6
3 6 1

LRU
.3 l 6 l5 v 1 6 2 .1 . ]
1 3 5 v
6 1
3 .S 3 3 23 6 6 2 5 3 v. 5

She
3 6 2
2 6 l5 . 6 6 2 3 5
6 6 2
3 S . 5 l 2 6 5 . 5 6 2 3 5
6 2

Fm
5

Scanned
. 0 2 3 .S 2 2 26
6 5 .I 2 3 5
2
6 .62 l5 v .
6 53v 6 2
2 l3 l5
.
3 5 . 2 I 2 1. 5 .
3
5 Y 5 2 3
l5 v .
Y
-Sun4~oou

2
3 l .
1 | .1 2 2
3 I.
!

v 3 2 .1. IV
Y

3 | ! 3
v z 2 Iv. .
Y

2 | . . .
v Iv. I .
Y

FMS-I
wa
(I) FIFO
Func-

inn:
M 1 I
W L

M W
J
2 l
H
F J
m.

'
;
k K

v
zv l -

r
2v 6 .
3 6 .
- fl fl n n w
J .
x
1 . M
3 C
. 2 ‘
‘ . / .
s ¥ E E M . 7 ?E #
: D fl n fl F J
_ . .. . .
- E n n n~ n
.
l
J Y Z
1”41 AWE!L I
,
t o.I , _ !

fifi ‘ii lai cié aa iai i


z fi g fi

Ila-Sunl-
l

ifiqufifinmfi
hmm-‘dMiHIQ

Pauum-{dlfiu’

FwOpflmlfltIOndMnn‘)
”MON”

MW
(mm

0
m
O
N

u
g

u

\

h
O

n
-

n
F

G
.
'

.
"

,

u
<
. ’a

~
a
u

u

<

4q
"
-
N

\

N
o

g

~3
u
-

w
O

<

Operating
.

$18m(Mu . Sam 4 _ COMP)


.

E
‘ 3
'

Page Hopi-cement
m
N

q
.

are JL
<

M
~
4
.

~
M

Numberofflhs=5 Intl=15

.

V
'

°
N

0 66:::¥§§ifl°3=52°56»5

0
°
K

M a fi a
Fumfle=3
.

<

<

page fink!
i) LRUgives 15 page faults ii) FIFO. 16 page {lulu iii) Oplimnl, 11
<
.

4
\
.

1 “ O O O T T T 4 T % O T % 0 0 0 0 0 6 6 6
We‘rmmommwsdenomthemefmlt
e
' < U - N » _ u .

2 5 5 5 : 7 7 7 7 7 7 2 5 5

°

mum 5 5 5 0 0
w

PF Y Y Y Y - T E T
[rTmeIIIZI’ ‘ 2
r a m — N

3 3 2 2 2 2 2 5
r
" < ’ — N - b u —

<
n

F f l l l f l . _ _ _ Y v Y - . y
n

4 4 v . . v v v
a
N

opflmfll’lgeRapllmmmt
a

IT
a

'

I [2'2 2 2

Numherofflits=123ndMiu=8
m

h
O

l I P 3v -3 m s o s z o a o
lw mm
a

4 z s o s z s z o s s o s
N

o 6 6 6 2 2 2

2 2 2 2 2 2 2 2 2 2 2
q
H

6 6 6
u

(mmo
1 0 0 0 0 0 0 4 4 a o o o o o o o
' a e ' l l z 3,4,2 o o o
u

a
N

z, 5 5 5 3 3 3 3 3 3 3 3 5 5 5 5 5 5 5
IL 1,1 1 4 4
<

<

<

P F Y Y Y Y - - - Y - Y - - Y - - -
D 2 2 Y - -
g

2 2
*

LHUPage Halal-cement
IL

3 3 3
Numberofl-[im = 8 Indl=lZ
o

ll 1! Y Y_,Y ‘-
F m s o s z o s o a z s o a z s z o s e u s

("00d
o 6 6 6 2 2 2 2 4 4 4 0 0 0 5 5 5 5 5 5 5
IE” 1’2’3 4 2 1 6 1 o o o o o o o o s a a a a s o o o o o
IL
N

1]1[1 1 1 1 l 2 5 5 5 3 3 3 2 2 2 2 2 2 2 2 2 6 6 6
u

'L [2'2 2 2 2 l2 m: Y Y Y Y - Y - v Y - - Y - Y - Y - -
N

I; [[3 4 4 4 — Whmuwfieo-fiameflszwuwommlm
I6
o

Syllabus Topic : Alloultlun at Frames ‘ ' wouldbeumdmsehnousof


lY
<

‘ unmmmmrywmbenpmdwimnnu‘.
r

Hhmuhe=5thm 4.18 Allocation of Frames mdsoon.


i)LRUgive|8pagefaults ii)FI — lfflwmomnumheroffilnmdhumdtomm
FO,lO OPfiIIIllJpggefmm
. Bourgenumbqshownhefum Pagefaum iii) I .?.E_Explaln.diflqren_lflsvvatégl_esif§tallocg
page-flimmdmusu. -
.
» (DLRU - Operating system maintains {me frame list. be!u: wk: - Klanuiuwofmnmmdmuchmme
L l l fi l b g g z h 7 an example of single—user system with 512 KB of page-full!rm incmses. slowing pm execution.
(Inmo ”"4314“ mamory consisting of pages 4 K3 in size. — pagefmfltwmnpdmmmamfingimufimis
111:
l!z3;4vzpl,5,fi,z’l’ ' This system has 128 frames each of 4 K5 in size. commas,Ihe insuucfion musthemmdapin.
G1L1,2,3,6 system may occupy 35 {mum and mmining — Asnmflnwemuhnvemfficimhwmholdlll
21357) Opeming
("no
mediffumtpagumnmysingleinmwfio
nm
93 frames are for the wpmcess.
'
293,6 ‘ Ifweconsidumepumdemmdpagingfllmm when“.

wouldntthestmbeputanmefiue-fiuneliit

‘ Once user process begins execution, it wouldPM” a V Equllalleelflcn -
mucus: of page faults. _ magpmhuufm’mdqnmbfilnf
Theinit ial93pa gefaulu wouldn
llge|fiee film from . »
‘ m
lb: free-fume list

Scanned by CamScanner
Scanned CamScanner
”4-00“? m M\ ’ u.
' m In our _ muse of this heguem movement of \ Opflfl‘i Synem MU—Sam4.00MP)
.. “1
Emmempmwfllsfimm mummddflk‘symmmmughm _ Working Set Mom a, hand on this
ww5wflmlgmm3 _ ._ w 1
- mnequemwsinsacfivitycmingthe ' localiltenminemmmmmmm M WW7W=M9IM
m93/5.mlisudlmwmgfl mm mghlmlcalledasflimshing. ‘m =\
mamas-2mm _ Alldwpase‘inmonmmpwmmmm a. Ewammuww-An ':
_ Although many processes are in Mm"! ‘ wakingnimm
“,om'ngseLSnppose inflamed ' Whitm'l’oplumng
C'WIIWV -
Ming CPUutilization goes low. is&Atdmellifflnepapmfcmmlre(z.3,2,3_‘
. " ‘ 1L- 13.4a working ” i s ( 2 3 . 4 ) m d 3 h m u ; <1 _
Whatbmng?(fioform49)(5m
— InmisnllauflonJamuealloawdlomeW ‘
_ When operating system monitors this CPU . ..
swmmmwmm'm Tummy
Io _ ‘ k
mat-mi “mom 5)
3|,m was; _ Mufisfimifdemmdnfuwpxmis
mPlhusiqBmdnhusizalzBKB.
0-
ll“, mh mamrwmmma §
P'Oglmml _ . working set. “Ir-shins willcom.Operating gym will
_ AndifpageliuilB 0/(1M128))x60
m(d1m l ’ l J ’ 2 w i l l g a
. Tmhozc n -
?“ .
Now I! Is mded that the Gusting
mummbmmmmm
4m M 4‘ mnnilm' walking sucflhepm mdlllocunwded
=4l4na)’ flatly minced fonhis new process. {mans “nub. (altars-don4.9m
g E »‘L,
(IWUDHZB)MI a)I = 55.65. that is 55 frames. _ 0'
tmmmm .
a“)
It'slobalpage replacement algorithm is “591‘.it .; n'sufficiuntfra mesIrenoumlnhleitwlll“Wm”.e
-
_ -
0' _.
Glow vsLou I M" mepagcsofoumplmandallocalafi‘mh; . pmcus. In this way Wotfillgulm “DWI”! n Mudouumouum (nae.
51“”! ;
- P's: replacem! algorithm is mgaiud IS global newly inuoduwd process. So other prams“' _“
u"
thrashing. " Topic: 5.9mm
Mlflitmcfimmfmmmm 0-
mmmplacedmdsocm pagefaulu. »’ 4.21 Exam Pack (Unlvenlty and a m Enlahugnamnonm. m
mmuwmdyhilflmwm - Afllhseflulfingpmcessesgoinwailsumm Quesflons) (Return-aimua) ,
Mum. for paging device. In this case again CPU ,. M 0. WM. ll W 4-10) Main ll. wan mnlllli
a- syllnbus Toplc : Mary WM!“ ~. , .
— n m m m m m m m goalow. .'
mm.lxdmplwemmzneedswlqwlacefiameby Rulnmoms
— WhenCPUschedulerobserves lheluw CPU m , m
0- “1 Wh" Q. m u m m y - a h a
moniyfmmitsownmofaflowadfiama. itintmduces newpmcessesaggin in systcmm'w "° “mm m“""““"" '“' m” W(mm4.1m)(sm)
— The «manly with a global npllcemt algorithm is “=9" 0‘ muf‘imnfi This 3'“
”“1“ 4 in, management? (Refersodiontf)
(Duc- 2m
am a process cannot comm!its own page-flu]!me. faults of running W s ‘ 0_ Write short note on Relocation. (Rem section4.1.1) ,. SWIM“ Topic : “mm Mary
- Mulofpagesi nmemotyfma pmcmlkpend snm Again the waiting quzue of paging device become n .
film
causing funhcr dmp in CPU utilization. In this w 0. “MI lilo help of We. W a. wmgmnmonmnIM-mfy-
onlyonlheply'ngacfions oflhalpmoessbmalsoon
the paging nations of other processes. Consequenlly, the page fault me further increases and CPU u-' r w hemenlogical IIt‘dp‘flffl‘fl W W W (mmuzus Mann) mam)
same[locus may perform faifly diffenmly. (Henna-W 4.12) '-
tr syllabus Topic:Memorymummy-find . Wtoplcmudmn-
sum-Mum
KIW
mm
— That: is no actual work getting done and _, n , 2’ Pmlllonlng
Syllabus Toplc : Thmhlng
spendtimeonly in paging. a. wmmnnohan DmundPW-
o. Explaln manly WM! W PM ”u (mmtJalMSMMI)
4.19 Thrashlng — This flushing can be limited by using loal v ‘ 42-”
Variabis Pm‘flfluna. (BMW mama-c.2111»
. algorithm instead of global w "
-) (Juno15) Inplleemenulgoxilhm. -. T
o. m‘hlmwwmm o. mummwhw
— local page replacement algorithm replaces the W“ '3 M W . 1.91.;= (mm ‘ l )p”.
n t fof
Who?
M m “.1,
o-
wmmwm
WWW
(Halal section 4.2.3)
mm”?
mmimwedafotherpmwssfl'hemm
- A [new thou“ have lam: minim ' . P .

fume:lo uuppon Icu've page; which


um number of
are in memory.
affllcothc rpmcesm willnotbe mkcnmd " "
processeswill nonhrash.
“W
hbelpammmmenumbmr ' " m.(Mrm4.14)(1oM)(mc.ao4)
- DW‘ median mmm
P'Sefmflulflhese
number:
n offnmes am notIvailabl
'ld
I“ elothepmomlhen
4
'20 Locality Marking Set Mpdel) 0' (Reler
W M
lasafilkiflfl’fi: .
0'
wlmToplc: Page W W
short note on vllious pug. we!“
W‘
quu: ! h.
- mnsmm
Tommi”? I" Wu: >. 0. Expllln W u in W ' Wm:m
a
paacfmlmmmly. mnplwe
.
me
' can be plevenlnd by providing -‘" " . mxnohmwonumsmunnmq
fitmesloflleprocessuperimnm " Syllabus Topic: Memory M
memory. _ . model _ . '- swimmmfim
- small,“ We
‘9'.

maximitwillalm
Locahty 0fptocess :xecuuon solve uusvmm
I'Yk'fielfinstrlckonnumber o. Explllnammamflm” 'm q_ W
own-I W and are W
M I“ “"m 5 ° my (2m WWW
' Ind .531“.
"PM pig: will cause page “mm, Y “‘"13- .‘3’ is the set of active
. Local: 'und
. P98“. (mmw)
{Ink lgam Macm- ‘: d. .
3"“ Q. Dlgauupmuo‘n M M m m b fl (”mu“)
mm
in flips. mes an mm m min - [hiring mm m mm {mm many]
'fld dusk, thishis an enormous 0mm locality. - 1|
,v

Scanned by CamScanner
Scanned CamScanner
WM“ (10Maria)

*- ampu- FIFO and ““v WMZSUDMMS)


- 5‘ 8W“ mml.’
i. Topic.-Opllnll' W4.17.7(10Mnrle)

' syn.” L mu 9!“ FIFO M" Manama“)

'g a Mmm' “m Wumuomm)


(nu-Imam r syn“; Alla: File Management.
' syn-bun ”-3” pg W 0. WI“ diflarflfllmlegles for
a camper- own-I. mum-:m” (macaw-4w)

u n 9) m a- sylhbuIToplc:Thmhlng
mua
M M a mamashing‘l
i 0. Com FIFO ma LHU mt -
W(mmu&w overview. File Organization and Access. Flla
D[mm file Sharing. Secondary SloaneManw
" sylllbm‘l'oplc:LFU File System. smam,Linux Vlflull

1:" a. Expldncmmfilabudnppmudl
“ (mmuagy
Syllabus Toplc : FlIa Managumnnl- Overfl ‘o cuflpmmmunbeublewmlho
ow

5.1 Overvlew o Inolduwfulfillthelbovenqmm’ w i t h


, In More ‘ on disk: Ind Other
5.1.1 Files and Flle Symems secondary storage in units culled file.
Every application needs to access and store the 0 A m: is a nnmed collection of related infomnfiun
information. During execufiun. process can keep: the that is worded on secondary Stu-an. '11: data
information inils address space. cannot be written dimtly to secondary Image
umessflleyalcwithinafic’mmcmm
This address space to slam information 1: sufficient for
some type of applicatians but not for mhm. which readinformation from the 51:.
requires huge size of infonmtion. ‘ o llalsocanwfitencwinfomafionimoflwfileif
needed. After process lmninlfion. infatuation in
After fimshing the cxncufion, process tnminlm and
file should rennin mlninnd and should not vanish.
infannafion also vanishes.
A file should only vanish whcn its holder clearly
n

For many applications, it is mquhed than infonmtim mmaven‘it. Openflng symm manages the files.
should be retained forever.
a filo-yuemducribuhowfilummuclmd.
Even though computer crashes or process is killed, still mmed, accessed. used. protected andimplement“.
a

information should remain retained. Most of It: time.


" Fllau
the information is shmble among many processes.
Follvwing discussion [bout files from user's point of
If infon-nalion kept in the address spice of one process.
view.lhmis.huwfilumused.nmd.mdwhnmthe
h

mber process-.3 will not benhle to accessit.


different properties they [um

It is necessary to keep infomalion independcm of the


5.1.2 File Naming
A-

masses. .
tg.

Following an the necessitiu for long mm Hawaiian - Pmcusgivesthenmelolhefilewhznilcmlngil, J


storage.
.

— Aflucompkfionoflheemufion.evenflnughpmou
tenninalas, file still exist andollmpmsm
a

0 Itmustbepossibletostmuav nylargenmmnof cmmen


intonation. thalfilebythenmnlme. ‘
f

o The infomfion shouldnot loss afier mmlnlfionof — Thuulesforfilemmingmnotumefonflsyuemm


theplaces:using it. miesfmnsymmtosyélemfiutallcunemopenflng
A

Scanned by CamScanner
Scanned CamScanner
5-2
wanna ’MU- Son-4- cum; 0 slam MU-sem4.c°m
1‘5:1file .. , , . gratin

sysmns allow strings or one to filmkmm‘5 comp for — my


53
_ . . [rimming system based their
fileaylmm 0mm
' m
mum. “I" mamm’
a“ El“ g storage.
,f—mhmnor “
cmigfing of EO-chlncler new
. w mum".
mum-
— If m cpmnn‘5 system diatinguiflles theW '1 mu
Binu'y . w files Mu| . _I cud:wenin“’9' h“!
cm (hen openly on the filein logical ways. “,1l ‘ mm [and input from file mm Emuphfihmmmmwhymm'n
“1‘ s
N “3° m confnlnfinu 0 or in Ill: Imil of 80
— Digit:um special channel“! are also mafia!515m cm! and wmlc in unit: mmfllmilwcfldbehuseinfiu.
fudwlvu. of 132 chanclcn lupi
n
while giving flue file names. UNIX openl-Ifls
For lllppofling
”minin g 52 chancm hunk. 11w, dine-m file mural. Ike
mfnrm non g
("mm belwem upper and Inwer cue letters. manpondingcodcshouuummuinmfins
Panama
‘‘ ‘ 4 3. Tm “mm" symm.
w Ms—DosM M Pd!' pa Its content cannot be
ch doc l _ In this WWW-im' a file
cum in:of the march which -
Window ’s AflWy.itkmmuMmmmu
— Wimbm 95. Mndows 98. Windows NTami 1‘0n ...: m “gm-dud in tree mama.
g
2000 upper!lhe MS-DOS file mm and thus inherit 110s J _ All the mould: not neccsuxily luv: lune Imgth.
wanna; systemluppom form: am»: I‘d:Iypc.
in pmpenlu Each - Efopeming man: does an suppon the m of
mama and maid has Ikey fieldin armedposition. mfonmuo‘nWbyapplie-fitmlhmilmladm
— Fils mm: is divided into two pm: -
extension which Ire wanted by period chatter. User
_ mmwrdsin m e m m m m i n m m m sevenpmblem. I
of my field. to permit quick flicking for I pln'umlar _
Indopmflngsys‘emcmmgniullulypepffilefiom Operating systems like UNIX. Ms-DOS “(one and
nun: only. lacy. wpponfilemmmwhichmhminnumbcm
—— MS-DOS allows the file mints conniving 1 no 8 Following an the three ways in which file. - T h e l m i n n i m i n lhistypeoforgmmu‘ ‘onisloleuch
- mmmhfilealsequenmofmbymmd
m o d on particular key.
chm-nus along with m option-l amnion of l to 3 shunned. openingayuzmdnesmmryoutmeumna'
ohms. . _ The next record also can be searched. Opening system
ohm-chin.
- Onlllaeanlma UNDKumh-snchaicsofdcciding docidn where to addnew record.
Mlmfllnfmixawxmhmximflnihifityht
the in of mansion. In UNIX. file can haw two or _ User is not concern about this opq-atinn. This type or
more amnion. 1. unsuudured sequence a! bytes file is broadly used on the large mainframe comma linlempponisaficled.
1~ '
— Table 5.1.1 shows the some ample; of file extension. andstill used in some commercial dataplowing. - mmmmmmmmewunnfima
- in meaning. and type. 2. Sequence of fixed-length records - Following Figs. 5.1.1 (a). (b) and (C) shows above “In: immune. Ipplinlim should luv: included its own
’hble5.1.1 kinds of files. Fig. 5.1.! (c) shows the me of awards of coda.
3. Tree Stmmure
student file arnngedinmedorder of roll mum — Onthemhgrhmilflopelm gsyswmsmnwpm
>11
{ w‘
"a'g?’ Fig. C5.1: Three ways of file slruclure minmnlm'one structure of III mum; filn.
“s
axial”: _ 9 1. Unstructured sequence of by!“ I
— mmmismmthgaymmwmbemueof
i
gt “mum Image — In this smlcluring. operating system macs contain . . lmdingmdmminglheplogam
imp: the file as sequence of bytes. Any mcaning mun 5 1 4 FlleTypes
World Wide Web imposed by user-level programs. ‘
hm] H t P Web” — Both UNIX and Windows use Ibis approach. TM:
3! gal I “mm v summingprovides more flexibility. '
Complied 'ne - Any types of content can be kept i n the file and as[#1
obj.0 Obj” Convenience of the user, name can be given to the file.
language not linlmd I
-’ 2"
a . affixed-length records '
Ready to execute

“We ’ language
Executable ‘ In this
lengthxlp p file ‘8
mach -
treated as sequence of fixed
7 Fach Irecom has its inwmal structure. Any m‘ a. Gamma!modal flu
M M«mmm Librarian! mm, mm
oration on file realms one record and write‘1m
WI" append or overwrite one record.
m —
_ When Punched cent were in use, record sin WII ”f. l-‘lg,C5.l='lt‘|le'!l|'a
"mm W me. 80 characters and of 132 chmeter! posed 1i”
for ‘
"i“ tamelime printers. Pm

Scanned by CamScanner
Scanned CamScanner
:
.
, ' .
54

:
OperatingSyslammu-Sombm _
E Also 08 should be able to ch: maimed . fl oggmllng SmamsMu — Sam 4 _ Setup)
, -) 1. Reguhrfllu am: at which file was lasuy 5-5
Result! film conflin “5" ”T2: choose the fish! 60111173912 OS must also same for all the syslzm; Ind
“humming
27mm to another.
2 .g
W mm! m m ”' to dewrmille the gym-m

L
Fig. 5.1.2 demolish-ates the UNIX No single existing gym,“ am all

I
explained Ibovcmflle bump!““mg"mm _
V
binary filru auribum, but each on:is M m in mm “I“: "In:

. .
‘I -D 2. Dimmiu
‘ 111359 axe system files for mainllifli
“unmanned Although this file is a- Anrlbuies and Its manlng
the file syslcm. fonnal o] ‘ AMI!!!“-
4 ; Channel-Wm” The fila is divided into five “Slums,
Symbol table.
I’—
mmtion AWGSS-comrol
. inf ,m"
Chm-mgr special files are 1:1d to inW‘louW “d mu, dam, mlocaxion bits,and
WW" magic “'Ffm'm Who can do tuning,
‘ used to model serial no devices such I! The very first field in headm- is ..
file.
v.
wnung , executing, and so an.
-L

”wu'able
winners, and networks. recognius the type of file as an Size
The
current size of 0.: file
-) 4. Blocksneddfilfi — I! facilitates to prevent the unintentional ex Type Infommion is needcd for gym
These Ire used In model disks. file which is not in this fmmal. ““1‘ “‘3‘ 50PM different types of filu.
01'
— All mgular files we normally either A801 files
Cm”
After magic number. the sizes of the djffm . '_ ED 0f “‘5 pemn who cream] the
s Won ‘‘ file
bin-1y filcs. of the file an shown. Afier these variou
same Omen!owner of the file
— ASCII files contain mm 01'm Each Ennis laminated thc address at which execution sums, and “I; ‘ Owner
.

by either fining: Mum charlcleror line feed character. are present. ‘ 3‘I PESIWOI‘d Pasnword needed to access thc file 10.36%)“:
MSDOS us: both types of files. Lines can be of
_.

Following the header are the text and dm at} Identifier This unique number which “Jim
diffeten! length. plugmm ilself. Thue are loaded into mam.” ‘ identifies the file wimin the file
3 — The gun benefit of ASCII files is am they can be ”located using the mlocation bits. The symbol m ‘
system. 17155.3:Commonsymmulkldnflnglnmu

‘ displayed and printed as they m used fur debugging. Hidden flag 0 for name]; 1 far do not display 4 1. Craig
in listing;
.

- Any text editor can edit A80] file. Funnel-mum, if fMaglcNumber‘ - Thuwfileiluemdwiflwmmkisnwdcdlo
large numbers of programs use ASCII filu fur input '~ Read—only flag 0 for mad/write:1 for read only loulelhesplccfurmisctwedfihinfiksynm
if

and output, it is easy to connect the output of one ASCfllbinary flag 0 for ASCII file;1 for binary file - minmfimofmeauislndeclneummefihi.
pmgmm lo the input of another, as in shell pipelinu.
.

madmdsomeohhenm‘hmmmbem
Lock fins: 0 for unlocked:nonzero forlocked
Binary files are no! ASCII files. 9 7. Delete
Key length Number of bytes in the key field
- Lining them on the pn'nlcr gives listing which is Fflcmedwbedcleiedmnleaulhediskspu:
Dan: and time the file was last

beyond the understanding. It gives the random garbage Time of last occupiedbyfilnwhenititmlmgcneqmnd.‘
access accessed 3- 01ml _
if it listed on the printer. Usually, they have some
4
internal structure knuwn to programs that use them. Time of last Dale and time the fil: his last
— Buforemflun'guseoffi lhilismqfi mdloupen mefih
change changed in tum
.

- UNIX binary file is an archive. It consists of a fimby any process. To have quick m m
collection of library procedures compiled but not Maximum sin Number of bytes the file may w ailmelmibmmddiskaddrwmbwgm
im
linked The uscfulness o f file typcs can be 10 minnm noly.
“11¢:d 5“
from (h: TOPS-20 operating system. System flag 0 for normal files;1for system l -D 4. Close
-

llwge}:
The moompilalion of some file will Fig 5.1.2 : An executable file Aficrnscuflhefilecumplma
be cnm'ed out 5.1.6 File Operatlons m m
automatically afler itsmodification. finished. Th: fetchcd attributes and disk
This mompilation is done if user
5.1.5 File Aflrlbutes
o.': explainminusmeamafisjinm‘ . numo tymn nlmg erreq uheis
omefi leslm ldbe
3

spam
obgect film In guarantees that
wants to execute: the
- “firm“:m d closedtnmleaseuninmalubk
the user all the time runs -
are used to store infomauon which s and is wn'mn Ill
an tip-W objcct file. It — Files
al purpose, The disk space is divided in block
saves the waste of time in later on. For storage and remev blocks. Closinsafile comp
el wrifing of mile slut
executing the old object operations. ion
:

file. types
of syswms offer different block.
— To achieVe this auto
matic mcmnpilation of “Imam- Every file has a name and its M ope rati ons like mute. write, mnm‘
;
in 4 5 . 1 w !
F"
mglleomtzomfing modified Operating 53'8m
associate other infonnafion with . ‘ the
em calls. [ma
used for leading I file spec
ific!
system must have ol’el‘mingsystem offer the sym — The sysmm call llIatis
capnh
objm file.
h l,5distinctionbetween
the I" ex8mm,
file,size the date and time of file main-1' of commun symm
calls mining to files
at:
m name of the file.
i

scum: file and


the of the file.
Fig. C53.
Such em information associated by opera“!”mm
is called as attributes. he lists of attributes I“! ’

Scanned by CamScanner
Scanned CamScanner

.WA-conv)

hedfiomdlecmfll rail m U-Sqn4_


Gmnlfly.vbebymsncfem
nuinmdpume'rnflw
pnsitimT‘hesyslemshouldmai Thus. we have read n and Wlil: ,
ismb cgm. Mlmak
n u the
mind lefilz fiomw heten enmd remix/e block umber. m...
fdmd nsixe dmd “‘5‘ °‘
— mull ermu stsm meam oumo me block isdifferent.
mumofl‘cumrwpulmemin. _ beginning of the nllfive block .
1. Sequenlial access
11,;
0- “1|a 1: from {”‘fimvlurmotfikumhmfihm
-D 6. Write , “Winfluuduofuflmmmdinlfisfik
fiwme dmint ofilesp ecifyfi lemm e i the Wammdm
- Symm uflmw Then next-block numberis lmdwm‘m
and information lo be wn'nen m the file.
3. mm“: , "”1“” '3‘k
d"
°f “'5‘ ”Mk is 14045 and - Midahehm
“Maul
.
d’u»Fw “mplylneofle adnmof
om'meexisfingfilc
_ Wfifingisagainatmecunentposifi 777777 ‘
saggndblocklsalm. I
flnmend , , .777, _ The mlalive bIOCk numben W u lhe M !
siuwfllin cmaseifw fidngsm oflhefile . ' mfifimumdh
ntpnsi fionisu themd offilc. Fig.6.“mfl'eremmasmemformuq ”5m to take lhc decision nbnul location of plain; um fimmmficflmlmlmmin
luminous. Ihecum file and facililale the user to slap fmm m g fil:
l . Sequential-cum
_ Onlhcoom ry.ifwrifi ngis donemsomewhminthe .p
Iddifim‘olvflnc.
| s y s w m ponians which at: other than his fil: poniun.
—m m m m u d u y m m m u n k
middaof. flwfilgfli_epzeviou slyexistu ddamfifl be The simplest access method is sequential acc: ‘ , _ Every lead operation D‘Vfis the position in the file m explicitly included a n mhfidd. or Imp“ I
ovuwnm and vanished pennanenfly- opefifing symms provided only this kind o f file m ”ding at. In the second one. a special openfion.
4 7. Append seek. is pmvidcdlo selmecunmt position. afm‘mnmm‘w
_ Inufistypcoffileaccessmmcessmdxmh‘ — Ayikfiledoswhvemymnm‘
_ masaehthcfilecmbemd m“!
— With the help of append sysnem GI": (NI 9973 in a file in order on: record after other, sum“ ' seq y {mute mkmmmnym
now-cumnt position.
Ippended only to flu: and of the file. Systems ofifliflg beginning. 8 - To'ulchmudwimpuficulufiddmmh
lass number of system calls do not generally pmvide — While accessing. skipping of any mom or -) 3. Other access methods mhmwhmdhlhpihufluddnd
_ These accessmevhndscmbelmilwnmpollmdom- mrdislnawdulhemmpmefilnmbemmm
'PP‘WL Lhcm out of Older is not possible.
9 8. Sack access method. “amplmfilemkchedwmmmfi
_ . - access mflhm‘l was convenient for smug: u ‘
— Tlus
-
_ These methods generally invalve the muucfim of an ofm'wlax ficldnndvdne.
a"
‘ The W k system IS "56d ‘0 plwe the WWW" at i such as magnetic tape to a certain extent than dim ‘ index for the file.
pamcular location in the file. " # z. mama-ml:
— The reading of the next portion of the file is mum . — The index has pointers to the van-inn:Mocks.
— Itisnudedfornndomamfilsmspecifyfium by rend operation and automatically file poifik E‘ — The “word in the file is mind by ' Kin
W M uudmdflmel
indexfixstmdxhcnusufhepainlermmlhgfila
whcmlnoblain madamAfierdfiseaflhnscomplewd. llismosloo
moved fonwaxd. . J
Mean bemdfmm, or written lo.thatposit.ion. directly mdtofindmcdmmdmotd. Mm
of file
4 9. Guam-thins — Several factors are important in choice mmmmmummmlmmfim
ntgnnimfiom'l‘hesean equalnumbemrammghfiddsmmuflflm-
Frames frequently and to mad file mibums to advances to (he and of the newly writtcn portion-4‘
complete their designated work. Get attributes system 4 2. Random or Direct access ”‘ °o Mimm mmmhm - AsuaIengmdoa-smotaduMmh-nwn.
Easaofupdatfl .wymmmmrmmmmn d‘ wheat-Ht
4 TilISSetuse-dufglfipmse. — When use of disk started for storing files. it h v The fiald nun: and each 5:c laugh .1: m m of
possible to lead the bytes or records of a file on?
51‘ 0 Economy of storage
Simple maintenance 1h:file m m
0 by
User can change the some altribunes of file afler its order. It is because; disks allow random access hi. - The fin field in and: mm! is m m a field
v’ Reliability
creation. This system call makes flmpossflale. fileblock I 0
mdil is Bed we identify the mom
its- 5.2.2 Flle Organizations
— Aslmfl nlhev llusof keyin eflmm llman!“ 0'
11-
" Rm - It also became possible to access records by
User needs to change the name of an exisliug file. 1111': “5““ °f by POSiIiOII.
Files
whose bytes or room!!! mm“
-
W”
“mm tifiennl. The record:an wed in thelogic-I
system call makes um possible be read in any order are called random a m Fm lumiun-nh' hey.
mmlutlonl oi fill wfi hmmnmbk.
They axe required by many applications 51105 " — Fuhwhappfiuflmd
dwimmmhlemupeu
Syllabus Toplc : File Organizatlon and Access database systems. V Thisfikclnbempnize

— If railway customer calls up and wants to reserve ‘\ : ~


llasdisk. _al
callyc lnbt-. o¢gpn izm'-l
w11:“ eqnem iulfil: physi

Mdmwmmmm
5.2 Flle Organizatlon and Access -
on a _ ' ' train, the reservation program ” M y
5.2.1 Flle Access able to access the record for that train directly instfld‘
tending hundreds of records of other wins first. V ' mem lbm
-) (June 15) — mockondisnnldnpoinmto
For lhe random access method, the file open“ions "I“!
be modified m include the block number as aP '
I file
I‘ “"5 °
Fig.
C5.5 : Flve lundnmenlnl orl;

Scanned by CamScanner
Scanned CamScanner
5-5 l" . .
lfihm-I “K4 mil ”(Mu-M44301“)
! ‘naWW-S’m“ ’ arm to lhat mold.In addition. vmab 50
_ Ifnewrecoll‘liiinseflfld‘l
Poimmedswbe
I _
nd--hm
unbou“um
m mi: Idnds of “f; each
N “w,
hm
,, 5.3.1(A)
Single-Laval
”‘Wrsmam I
“em-g '*
monk Would not occupy on5 enfly I _ .. mfhosmd wdhmmyo tmmmmfi dl
' mmiwlnxed only llldnew flit” ' mde
'
x 1 W .
‘ Single-level
. -
directory is theSimplm di
"a”? ,“film-e. ‘ umbemuTodemaardgunopunins
panic-fluphys-ml block 12:1a. l - - . In nus directory mun, one
dim
1 . . , filnl- cal-um;Ill Illa Whammmlylncaluserdimuy.
n : lf is
l
4 3. Thelnduedseque ma y, the Index Ime
: of — In under trash 1 l, V
“"‘R‘ln.u “M was Iyunn annu {ominously dale:
al file :Iiminale :15k ‘ ti. . . Thil single dimmnry is Ilsa called as a m m m y
The - (and sequenti ' l file. mend! ale
asequm when
the "Mirna“? filn \hlt bu the um: um, FIE. 53.2
”‘. fill”- v.1
— M W"I
illr to
Simmm- sequentia
ornkey field. — A partial mdgx holds names to records fie},
since on early venom! commas. truly an:m . M veldimory symmwilhmmum
of canoem ems. woddIIB- this system was man Sam. was W. Indium“.
file no
m 081ential file contains index no the _ an: of variable—length. some new , fig. 5.3.1 shows uingle-levcl dhecmry
— The indexed sequ ow fit The index
A ; [words will ’
nndom access. ml an 0vexfl have In fields. Afier addition of a new m2 Domining five files. owned by “we different user:1:
“Naked.
ily the “WM main file. all of the index files must he two filmmqqhumfihmdl
3:3: searching ability to much speed Q. dUserPhas
mad. -» 5. TheDiI-ectorflnshed File R in: one file in me dimm.
ermatnmmdinm
- Moverflowfileisusedinmd a._ .Explflln hushed file omnnlzafion.
ing a painmr fmmits
overflow filein wind by follow _ This type of file makes use of the ability
found
on .
mint record. [0 access snaigjn any block of a known mam ‘iIh‘
ng, III: indax is I simpl a Fig.5.3.2: Two-Minimum Syn“
. - In I Iingle lewl of indexi
ns is no idea of sequential ordering like ”quark.1 ‘
file. each recon ! oomi “
I mumlial m In lhe index indexed sequential file. — Above design mulliuscr computer or on I simpl:
key field in the
two fields. A key field idmu'cal (a the — A hashing operation is performed on 0.: hey .; newurk of manual commas that mind [ m m
fila. W Fig. 53.1: Shula-leveldlndm-y gym
min file. and n pointer into the main using hash function. , filemvunmllouluunelwominlhilsym
index is searched lo — Direct files an: frequently used where very f a n t a m fi ‘
— To mull n paniculnr field. the :- Advanugas some sunof lngin will: is nadnd.
locate d1:I m t key value that is equal to or [awed-s necessary. when: there is use of fixed length _ his mum: toimplemcnl. — When a use: mum: to open a fin. um systemBaum
thnlrcy valmmbcsenrchai'l'hcmmhcamiunn
in and what:records are always accessed one by om. whidhuscrilisinudulnknowwhidldimmrym
_ mafingfilcsbeoomefmeruflmiamlympm
‘ memu'n filemhe locan'un dcnomd hymepoimr. Syllabus Toplc: Flle Dlreciorlas to look. search.

" - Th: indexed 1 ' ' file really the lime


"! a- lllntlons - Filcs are symm plug-am: such is loaders. assemblers.
: needed to mecca: a single record. without giving up the compilus. milky uni-tines. libraries. Loader lads these
. 5.3 File Directorles filesmdemwhmlhefifllcmnmndimfim
. j sequential nature of the file. — If single user hns huge number of files kqn in sing):
1 directory. it bewm diflicult lo ten-Amber the n m of to the operating system.
- Fat sequentially processing of complete file. the records 5.3.1 Dlreclory Structures
of the mlin file are visited sequentially unlil a pointer to each file. - Thacmmn kmuuledb ywmnmfli nmm
umamm'nfileinordnrmlmdandumln
the overflow file is located. then accessing goes on in — Ifmomulanoneuserhepslhcfilcsinasingle
directory, then diffemm user: my give the samemums case of two ln'vcl direclnry syslzms. this I'll: mm:
the overflow file until a null pointer is c m across. a!
— Directories hep u‘ack of files. Directories an itselffila wwldbe searchedin Ihe current use!directory.
I] which time accessing of the main fileis remand whet: to Emir files. violating m: rule of nniqumm of nm.
in many system. Systems store huge number of fileson — Ifsystunfilfilmknplinuchmd
mmymen
inleft off.
I large capacity disk. In order to manage all thanM: -9 5.3.1(B) Two-level Directory Systems ymhlem canberesolved.
TheIndexedF": we nwd to organize them. ‘ ions 111i: solution luduowunaeofmemnry nsuchusu'
- Two-level Dimery System overcame: the limitat -
)lndeud,"filebrg-hiz'aflbn; contains the copied system files. lf
theuseof ' system. a speci-l
— This of Single-l evel directory. In this directory W
user. Wham I user systemfilu isdefimdm
— 1h: sequamial file and the induct! sequential file can - 111a most common methods for defining the log“ private dimcmry is given In each mailemrycomirflngnfl
directory is
Ilfers to a paniwlnr file. only his own
.
Search the record based on a single ficld of the file. structure of a directory shown in Fig. C5.6. ‘ _’ above pmhlamcanbe solvad
0'
Apart from using key field. they cannot search word matched. Advnnuges
Asdifimntmdimmdmmdifi
using other attribute of record. mmem every In: his wplnn
- 0'1"“- Solve namecollision pmblm as
— To Immune nun: givcn to I11: files drum '1a "P“
this difficulty and accomplish the dimm.
mnmmm
flmbmly. a strum containing multiple index“. one (A) Single~Level Directory Systems Thueis no p m b l e m i n g i v i n g t h c _ mammrgasischmdfimnachm.
. for each type of fieldismailed. filcs in diffemnt dimorics. I“ 9'
(5) Two-level Directory Syflems ulsion of hnvins llnflons
- Mm.
Inindexedfileuwordsmlcoemdo - Singlc user directory have a comp is. warm: on
y Enoughnl' '
that filfimquenm-Wlemm‘h’fik
mwd" _ 1mm “sets an co-opemive. amdoe snmflw
(C) Hierarchical Direcmry Systems
system mM w m m_m m
camwnmhmcnmsymm
A l u m n a _Ihemis user. the opeming 1 the olhcruscr‘s filu.
. now
. no limit on the plum
’ of n edm. In the lam mg
laconlspmvndmga pommin as uninimum on: ingdcx Fig.C545: Common methods (or defining “'9Md v Whamdim" another file of that nnm existence of f:e or
cto ry
or not . To know dis
sanctumof a directory user's

Scanned by CamScanner
Scanned CamScanner
5-10 , , fl”
9'
Adv-mag-
- In mm system. If ' pen-mined. one user minthive "I: -. ‘
users Way To _ With u hiemchieul dimcwry .ymm' in
ability to name I file in anothe r
- 'Unk 7\\"’
lar file unique ly in I two-lev el duecl oty. their filu. users can access the 51:: of 0th“. u: ; m a d mW
wlwfynmg fikmaium
’ *
nuns A particu
\| wemualy'vaboth the usernm Indfllefila nnme. specifyinsitspnlhnnme. “In; “flats; I 51* 1mm a: mmn'' 3 file In 0:
Mymmnmimn
_ It I: not ulisraclory for use“ with I lira: number 01' 5.3.2 Path Names 3’ 2:;m1nmégfuhimflhmfik
mu. Even on n single-user119mm“l ”'“Wm' n '5 not . . , . \ -, 9 Unlink
B. u m '
”NHL — When fi l e system 1s organized as tree o f ' fl .
by
file is necessod specifying the path n =1» -. m“ dim
“‘inonedn
Wyexin
entry-1r
my' u: file being
4 .5'3-“0’ Hlorarchleal m m “ symms mane:can be of two types. These an : In"
“h. mum
Mfilam
mar m
. u
— I”: quite general and ndvmugeous for users to gmup Typu of path llamas lmplammmlnn
their files together in logic-l wuys. A sludem for ‘3’" ”WW
mmple. might have I collectinn of files related to
different mbjecu orhercuniculum. 1. Absolute Path name
Ewfihmkwurmixamm
— Hm colleclion can be the group of files mlatnd to one
' :hlhmvnj—mImsu‘gfik'
subject, a second collection of files milled to wound _
. . 17133s of thnam fl ,, . ' m " I: is
M :1, me openungsynemum
- m
wlmctmdsoon.flm.somewaylsmquimdlogmup
these files logecher in flexible way. 1): e: a. Unflnk ““1 Path name10 find the dummy unity.
up 1. Absolulepafllmme " * ' -' ~ Afwahwedisclmedinfikmmfimmflu
_ . FlgCSJ:D|rectoryoper-flm “Ema-meow uninfummionneuhdbfini
It consists of the path from the mat dnnctory :0 lhe file. “'9“blocks 0 ( “I:rm.
The meaning of the path Insr/m.’(f'aIdkr/m’flc is M 4 1. Claim — In onmigumu dine-dun, mi: infommion my be the
the mo: directory contains a subdileclory ml: wm Empty directory is mind excluding dm Ind doubt “5“ “MM:0”“ 9min film
i n tum contains a subdirecmry mxfalder, Which (. and ,.), which at: pinned mete nummafinnlly, by the -
0PM“!
1n linked list allot-anon. dimcmy contains an Inning
contains the file myfilc. '
mm and ending block number or a file and in m m
allocation. direclmy comins surfing block number of I
2- 9'1““
4 2. Rehfivepnthnnme -' fila. In an sclwm. the main fimcfiun of the dim
Ifonly single dotand doubledot(.md..)inwun sysmiswmpfluASCfln-meoflhefihmth:
In consisls of the path from the cunent m g . .
file- m
‘y . . infmafionmdedlofindll’ndan
-
dnecwry m the .
A user can assign one a 4_ "y ""31:I l: namediasmam“73,“?n
direct an d
Every file alsohas its mam.13mm!file mm
the current working directory, in which case all m double do! w: n U y we haw:almady discussed.
names not beginning at the root directory are (then -) 3. Opendir — Damon-y any names mm mm” of I ma.
Hg.5.3.3:lflzmchlmlbirectory$yfi¢m relative to the working directory. If the cuncnt wading ‘ Directory can b e m d m l i s x a u x h e fi k u m i n — 1n the simple dzsign. a directory consisls of a list of
— A tree of direcwn‘es is the solulion to stone such group dimctory i s lust/myfalder, then the file whose absolute Directory should be opened befote maingjunapming fixed—size entries. an: per file.containing a fi]: mm: of
Simply
Ind readmg
l-he
file- we disk Imamnfthe
fixedlengm. “P w some mmmnm)eor~ . I
fil: mm.mdun
01' 5138. Pith]usr/mxfalder/myfile can be referenced ' I: '
A (me u- In:most 00mg" directory structure.
nuzfie. a
4'
Cl ' wmuxediskhlacksm.fig,53.4mwmndugn.
m needcd h'mhum mmwas
an “m files can mymm “
to that in — In UNDK upeming system the elements of the path m Afierreading completes. 3 5 1 m ghouldbgclose'dlo , > .'
_ umm be grouped
free up inner table space. - ,
expected ways. 3: separated by I. In Windows the sepamtor is \. The uni 4
31’“ified in .
u" h ”
a “m directory. and every file in the
- Pflth lusr/m alder/m
’f ’fl‘ in UNIX, i s . -D a Rudd“-
m Windows as MMyfaIdeflmyfile.
.systemhas a unique path name. The approach is shown It returns the next entry in an open directory..d
In fig 5.3.3. Root directory contains directory - If the first character of path is separator then will i ‘ always returns on entry in a. standard- {Infill
P, Q. R,
and S which belongs to different users. Users Q absoluu: path. If during working, program always nefli ' irrespective of possible dimetmy m m 1: hem!
have M the subdileclories and S
a particular file, it should use absolute path '0 We“
1 used.
A! user can create find ' . ‘ . that file from any cunent working dimctory.
03‘ ‘ 9 6, Mame “8- 5 M
on number of subdmctoncs. 1t . . like 515, mm:
on a commanding summing tool for users to 5'3'3 33mm simple way mlIininS M
Directory oPmflons Duecmries can b: mauled Jun — Fig. 5'“ mwnfimiflfli
lnnize their work. This is the reason
, near]
y a “ V. . 1
3 mamas thedilecm- ‘ ' mama with
. mfilemwmm
- . W ‘
Wm“.
., ' ‘inlhis .. - I“ W'Mmmu'mwowry V . . 9 7. Link . . . ‘ one
To manage the directories, different system “.1" ~ Due to linking. 8 file “ W “M m .-
dcmonsm more dissimiluity from system to system “’“h ‘ directory.
respect to system calls for files. In order to give an id“ at

Scanned by CamScanner
Scanned CamScanner
512 ”'9Men "M
n-u-Saml-Carn) System MU - Sam 4 - Comp
Emu"
,
Emerafinn _ In mi: emnple two file invenm rym
Fig-53.6
51:
. . - min in
Termination of each file is shown
”Mk Flo
_ Some systems :1 Land: n ‘
uni-nmmmnswe-W‘W - All the 7‘
. "fink ‘ Inna "III-d h Ill. i “Midge
m jun nun: of the file In symbol. Ihlrlng
. {
.m-ibmuofnfilmmmdMi-nm _ A drawback of this melhod is that. amr ”may“ :vi‘mriflmusmmfiMu
_ Fig.5.3.5 showsIhisdGSiE'L hug thedi 5“lg. '.
variable-sized free space is initiatedcome, 1. A m alum.
umeeoffileuflmaliLThemuunnne-I

may happen that, next file to my .n. ‘ “Whmmflm.


no”. " 3-
Email:
in this free space. 2. Simullanaoulm
mammodmd
Amfllmmflmhwflhwm
- Solution on this issue is compacfim of
“J- > C59 : Ifluu related In I'll: ““a “Wuhan-1m
Another problem is that a i f single amt, [.15.
ess HI h‘ls " 4. M
spreads in several pages. page fault Mun “My
‘ A”
“W: i 4 5.4.1 9 - Ammdflufllmuuuuuwhfihfw
reading of a file.
Fl:- usual-awrylnw mfld'mInt

,5,amI , tpumnoIII-1'.rumi- a}; W " dlflemm access dgm‘lo“‘9m..- “YMWMflIcwyingnflMm
d:
"annual-no EM, '5 5. A w
a flexible (”my I.“
awn-cm 4"" W “ _ The file system should offer
_ Above m ‘° ”was Eur-m...“
widespmad filc sharing among mm”: ' “Emu-Immanuummnmm
Schn mand Pmniuin g
9 6. Undue
Withanshon‘filenamuofl— um.
optional:xlmsion of 1-3 chnnmts. ‘ I t i . nlso . responsibility of file sysmm to offer a many - Mamemfimmmhuumnnfify.
dfl’lflfi.Illtlltltlhum-I4)limef'llc'ldlll.
_ m UNIX Vusiall 7. file mm: was 1-14 chm-news.
alternatives in order to control the way of filc amusing.
including-my extensions. ’ _ In gencfllv it important In yam panicular m s Q 7. Chmglngpmenhn
_ “mmmsymmsuppmlonguud ‘ Y 'ssions or rights to users or groups of users In - M m m fl m m m d d m fl w m m
mumm- fiu mules. Following In '11: m mass 3 panicular fila. A bmad empty of we“ unmNonmlltis fimiunon'mdmly with
Wmimplcmtir. ‘n mural-tumor '1 mom: rm.
rights has been used- tn gm mu:
solution is to keep file length ofmximum om isIllnwed m gum mi, m
- '11::l
Flg. 5.3.7 : Lang um hlndling using help _ 111: following are the some of the ex-Implu of was - The
mm
syslgm:
255m. can be gamed w a pnmcuIar user for . 4 I.
fish“ thatfile.
- mmvemnduigmmnmbeusedin which _ The second approach to deal with variable-length m panimlnr

maximmfiichmmsismservedforfilenm is to allow directory enlriu of fixed length and ninth - Theuwisfllwedlodelaelhnfilbfmunfile


- Simitinnnteommanlo havenll 61:5t the file namcs joimly in a heap a: the end of h Win-sperm ‘

mmflmanryspaeewouldbewuwd.
directory as shown in Fig.5.3.7. mammmmmrmnmmy.fim

- hmiswmmfixedsinofnllditeclaryenn'iuis not
The dmwback discussed above is dsfealed hm
an entry is removed, the max: file amend will alwayslit
Win m ugh tigh‘involving theseum pmed: iL
— 'nuls.if'mymisulig\edflumdli5hllul
cansidaed.
in fined space. The management of heap will be 0: parficulnfilhfllmdmuserflsogasfoiminyiw
- M dileaary curry domains a fixed section, which burden here and page faults cannot be avoided as in Widgexecuw.
begins with length of '11: curry, and then followed by previous method.
Mpcmnmspmfiblawcmmfil
ekhymm
dm wilh a fixed femur which are generally file All the dsigns discussed, supports searching of
-
mmfmufileflheownarismndfllufmem
mm his shown in Fig. 53.6. directory sequentially from beginning to and for finding
lighundmyymlriymmum
Humbug!- up the file name. Sequential search would be inefficient mwhichmmbe
if directories are longer. - ‘l'hednfiuml‘categotiaofusus
a-ylu-amnn ' — Solution to Ibis problem is use of hash table in each
gimme:
uu
dimclory as hash search is efficient cumpflfl ‘0 7.Changamuch" o Wm:mdividu\m1havingium
8' Dale“: ID
any sequcnual seamh.
a “mgwp:Ayuupowh°bf-‘Mfi|‘8"
Emybrmmlie
Syllabus Toplc : Flle Sharing Fig. €5.10 :Emma of m fig.“
[mama user w - The mm W M of
1- amhiPOVMWlfi-
5.4J File Sharlng " Nonemess right
(Infle- n All:AtenIicmdmofd|iss-
The user may not still know nbmfiPM.“

this amass limit. the “5.“ 5 ., 5,42 slmuhaneous Access


To put into effect mis file-
3mg, ( from
leading the user directory “‘3‘“mm“ -1tmWt-‘km
Human-mmuomngm nisnwessaryloshareafilcamongmulfipleofusflfii“. mortal-nme w-
mulfiuser sysmn. It needs to deal with two issm: M “ simnluneous updating from
m rights and the of' ' I

Scanned by CamScanner
Scanned CamScanner
w
w ?
r?
m?
gr
ha
m9 MMU-Semd-comp)
r 5-14
When more than one user
granted access to appmd or 5.5.3 'Pofllon Size
update a file,- the opcming
system or file management

gfi
sysm m mus‘ Impl emen The outer issue that needs to be car
t some way t o restrict iL
A brute-fame scheme perm of the ponion allocated to a file.
its a user to lock the hm“ Illwnnn'
complain file when it is to be
updated. 1! is also possible — I m m e n s e . a a i z e o f u u u m r t i o n c a n b e a x 0 mm. m : Alkali-hm: Fun “in”: MN _ Wthmmm cachfll:
that up
I In: of

am
t o lock indiv idua l record necessary to hold the anti]:file.
s durin g update. conugumlt‘rsmup 0 looks or enough m [m I Duk add-u} define . lineu- m n s m w M 1:
— In 0111:: case, space on the secondary WM“
Syllabus Toplc : Secondar ‘5“ ' unused :d'blndknummmam
Ill'ocnm come-um sonakm
y Storage Manuel-nan! allocnled an: block a! a time. While sele¢:fi“:';“"5e i. . a Best m: Allocne the “mum that i. _ 15 um,
size, there i s a trade-off between efficiency °°n:i Mn“ by
5.5 a single file venus overall syslcm
Fouhzw
EffiCiency_ “mm!" Si“
“Wm
MEI- Iofflw at I file in defined a: disk
Secondary Storage Managem a Nara: fit: Allocnle the mum Np of “my. funb luckm lenm mulb hch
ent four itemsneeds to be considered in the “who". Wm! lhalis c l o s e n m m m fi m . hm W-“fl’cfikhmbhchmm
. size hiIMnLlhcnltnknupbloch dmll
mm" il+l.i<-Z._.i+n
A fl]: spans many blocks on second - If blocks are allocated continuously, M g‘ file to inctuse locality,
ary storage. These but.
blocks are allocated to file by operat increases. It is true in particula- when next bl It is vary difficult to decide which policy in WWWMIumhrmmhmm-of
ing system or file Ock i. b y ! Illbltium ‘
management system. be accessed, Ind very much for macfions Thu complexity in modeling om ‘ hmnghlmkmmemuInmtbu-ofh
“Inning i. ' - [won hch
a transaction-oriented operating system. is (he inmfion o f many Such as m3?“ ulmfnmnme.
So first it is impmtqnt to consider the allocati .
on of —' If great numbers of small size portions an Fluent “In pm of file. — DimmyemhfisslhommflhAmu
space on spcondary along: to files, and second.
it is it inmm the size of tables mquimd to may the blockOIndiliflhlocklongouwpyingbhcko.hhck
essential to keep track of the space availabl
e for
55,4 File Allmfion Methods luuhluck zsimiufly jmamuu mksmdim
allocation information.
allocation. 5 block lung and no on.
- If portions ale of fixed size (e.g., blocks) “15“,!k ‘
A

5.5.1 Flle Allocailon easier the reallocation of space. ‘


- If variable-size or small fixed—size portions am PM.
Several concerns at: present in file allocation :
then it reduces waste of unused storage because of avg
— After creation of new file, windm- mnximum 3pm allocation. _ Disks supports for direct access. Due to which we can
“IE
.

nwded for the file should allocate at one time or not. — Ceminly, these items act together and must he » have flexibility in the implemeglalion of files.
— A portion i s n contiguous set of allocated blocks whose considered collectively. It gives two major alternatives; - Them should be optimum and effective ufiliurinn of Ell-El
disk space. The allocation of disk space In files Should
size can range from a single block to the whole file. The
size of portion is another issue to be considered for
0 Variable, large contiguous portions: As a'ilbla
sin: keeps away from wastage of space and due to always allow for the optimum and effective nu'limicn
IIIEI
allocation. large portions. the file allocation tables are small. of disk space so that quick access to the file: will be
summi-
— Thetype ofdata su'ucnneartablcuxedtolmepmkof As‘ a result perfunmnce is betw- but space is hand
— Folluwing methods we used majotly in different
the ponions allocmed to a file. to use again.
operating systems.
0 Blocks: If pom'ons ale of fixed and small size. it
5.5.2 Pre-allocatlon versus Dynamic
offers better flexibility. They may need large tabla Fllo Allocation Ill-mods
Allocation
or complex structures for their allocation. ‘
Flg.55.1:Contiguous Allonflnn oflkkqme
_ In pie-allocation strategy, the maximum: size of a file is Contiguity has been neglected as a major objective: ; (A) Conflgdaus Afloaafion ’
confirmed at the time of the file neation mqmt. blocks are allocated as requimd.
0'
Adv-muses m "on
(a) Llnksd List Album
.
hhlmpkmlmplmlmofly.
. mm‘In
_ In many cases. a reliable estimation of size is possible; — Any option is well-suited with pmflocalion or dynamic d
for example when file need to be transfer to other allocation. If we consider the case of Variable, lamp 1‘ medudmkeegmckonfiluhlockismmblockm
(C) Linked Us!Allocaflm kngmmulnumbu’nfhlocksoocupied
). . the
machine across the communication mtwork contiguous portions, :1 fi l e is preallocmd an: using a Table in Mammy _
cantiguous group of blocks. — mfinmss.mefiksymmmm
_ On the other hand. for many applications, it is not easy :ifkld dmso fmala nhloc kmiac
meda niwhg
I“,
to guess reliably the maximum size ofthe file so as no! - This gets rid of the need for a file allocation tabla: ' requ' uuLzudsmnutMock.
- . A
that is essential is a poinlzr to the first block and ”'5 uchm flup hck
to run out of space. - Tow bloc kko fafil adin ulyfi . ‘
number of blocks allocated. Lweunimmedimflyueessblock
nk. . 7
_ Thus pledlocafion strategy has limitation for secondary
— If we consider the blocks, all of the portions mquimdz‘ 1 Fig.
€5.11: File allocation method
s dmdfflmmuffi
storage allocation. — mmbwsequend
nnon.‘ . _‘ _ .
are allocated at once. mppomdbywnfig‘muuno
- Thus, it is benefidnl to use dynamic allocation, which

'.
5'5-«A)Comig uous Allocation lcfi lcm md fiom fifln
So the file allocation table will have fixed size. sill."e Mo mm ishi ghn who y
flow hm dwfi mb hck
- sing led isko pm fim
aflocateaspaoetoafihinpufiousureqtdmd.
the number of blocks allocated is fixei If 13mm"s 9 “
of variable-, it is nwessary no deal With a " oneseekismedei
fragmentation of free space.

Scanned by CamScanner
Scanned CamScanner
7 File r
5-16
nth urn MUFSBIIM‘
E 5.5.2 shows
_ 111 linked list mlmr‘onfiifor 5': Al“
' Math-m ags file A of five blocks start at block 13 and
allowed “kl
delewd. continuously block 16. then block 21, than block 24 2111131 ., ‘
When Allocated file is
*7 7 , t
-
file Mam e flee - block 29. d 5...“,
blacks to the r‘m‘mitl‘myinnumm‘.
ht n_ot be
cate. m blocks mig Each block holds a pointer to um “ m b] », -l m n ‘ - -m “
— PM new file to allo
m
musly .. “Mh'flmflh n‘fikmmk
cien t. If new file size is small may} pnv pointers an unavailable to theuser_ "k 1m,e j;
' suffi ch we not .
‘ “Emma, “Elude
hol es mai ns whi
“khan-nu. xhymmhfikh . .
mound sin. some _ User can sue the block size excluding the size ’2. h
file.
enough toaflocaw any new "Wind ‘E - Inwdawlm
ately consisis of. fi l m and to state the addmss. ‘ — “Alumna. , and ~n . _ _
A: I mall. the disk ultim
manlatiom _ Accordingly, if each block size is 512 hm 4 ; Index-blockmuyi; lawn“ “Win nie“
holescausing cxlcmal fiag then ‘he use; see]: b 'I£_ .
simple it is simple to find out space mquimd to slam address.
— In some cases. it is 1‘3“!"«5‘.
is needed for a file to be alloc
ated. 503bytes.
.
estimation becomes difficult ' ‘
‘ —— Par cumin file this size nable as all
Advantages
allocation i s reaso
Form -ROM , contiguous — In linked list allocation. every disk block can
file sizes are known in advance. which is not possible in contiguou; allocation he J
w
ation
4 5.541(3) Llnked Llst Alloc — Hence, there is no exwmal fragmentationm‘" . i
'tfant imam:fragmentation in the lastblock. “i ’1
V55w. andlist file-Elia
‘ .unkad _ — " afile ' " , is simple. ‘
limitations of — It i s no! nacmary t o compact disk space.
— Linked list allocation welcomes the 0' Fig. 5.5.3 : Llnked Lin AllocflnnUdng.
contiguous allocalion. In linked allocation, each file Ig
is a Dlsadvantages Table In Memory -
linked list of disk blocks. — It is inefficient to support a random access “Pili‘ 0‘ Advantages
— mmmddiskonzhadiskmbeallocamdtofll
e To retrieve to block i, the operating system has to m
file. The directory contains a pointer In the first and last at the beginning and read lhe i — 1 blockspreviouxlo' Th: entire block is available for data. So all disk space
is utilized for allocafion of filc.
'1'
block:of the Elk one at a time.
- cation ofa new file i s simple. For this. it i s mquixud — In each block pointer :1:c some space, so m]. file — Random access is much easier.
tomaleanewenu'yin the directory. require slightly more disk space lather than its new ‘ msummm-rmw
— The chain used to be {allowed to go! a given uflm in
size.
— nadixecwrye nuyholdsapo intcnomafim dipk the file, but the chain is totally in memory. 30 i! m be - Inifiaflywhmdwfilcisumidlpum' ind:
black of the file. - If pointer is lost or damaged file would become
followed without making any disk Infamous. mblmkminiuhud' ' [uni].
inaccessible.
— The pointer valuc is nil foremply file and file size for - Directory only atoms the starting addmu (integer block - Whmuni‘hmkismmnmckism
— A wrong pointer can be chosen due to bug in m
this file is zero. '
number) of the file and still able to locate all black: hmmefi ae-spac emp.m dilnmi spmin
operating system sofiware or breakdown of d‘uk
- The pointers need to be followed fmm block to block in hmdware. As a result of which, the error could gm ‘ even though file size is very large. meimindex-blockcnuy.
(mint an read a file. result in linking into the free-space list or into 1mm . 0' ‘1' Adv-mags:
Disadvantage
file. '
_ Indexedannwionnwmmdnmm
Whole table mustbeinmemmy allflxefimtonuknil
-) 5.5.4(C)Llnked fiu
— Mmismemnflhmufimmmy
Us! Allocatlon usa I
work
upam nmk x
Table in Memory "9 bloc kmlh edis kmb cfllo mnd
In“
r -b 5.5.4(D)Indexed Allocatlon motespwe-
— In linked list allocation, each block nwds to ,
pointer intonation, therefore entire block is not fully g 0.'‘Eigpléln indexed filé' audéa'iiah 0'
Illsamlllfilfles
oc kismwim
used to stone file content. «a .ldlsadvamagqs. > _ mpommovahudofhmu
— This limitation can be eliminated by keeping pow" - With File Allocation Table (FAT) in M M
. linkod wmwm epoin move flmdo
fflnm mm

information in table which always remains in mm“!- - scum wfiu hum some of_.
the
7inlh eslm ° -': list allocation support mndom am. but "'9 “a“ Edged—allocation
— 1:file A occupies block 5, 9. 1, 12 and table must be in memory all 01:
time.
mwd mmm m“m wmm
4.
order and file B occupies block 3, 8, 14md6in|9|° ‘ e HM”
same order. ‘
1“ indexe d
allocation. all me poinlus am W in M 4 5.5.4(E)
- The File Allocation Table (FAT) is shown in153,512,?» _ location
called as indcx block.
Thm m h fi k l fl d '1'“
‘ is a indcx block assigned to
index block holds the disk block W M“
- ”as” ”
..1m «max.-WW {11 blocks.
the .mibma "“1 “k of w u
Particular file.
Flt-5.5.2:].tedustAnouflonofdiskspaee

Scanned by CamScanner
Scanned CamScanner
5-18 File "
U-Semd-Comp)
fiwspweflnadxpmdumfl
it mp: nick of fim‘f‘fifi:
ii mocimd with ucll file Ind
. \
l—node lgfin gets included in free 5pm
list. a“
whidl block belongs to whic
h file.
in - To implement free space list following Mo “1%“ —\_ s"“"m'ftoliks:LhmxvnmmlFl
1.5,...“
. only its Mode nwds m'be
— If particular file is open compmfnhnkcd used- x5.6 Linux VirtualFlle Sync"!
«5\
smo mbe nefi cinl wifln
memrtisi table mmmmmfiu
enn‘xe file Man mmismflthcdoffieelpm
list dlomlion which requires am together. ' mun-amnesm
‘ A
disk blocks linked _
— The painmr In first flee hlgck in ”I“ in Mum ‘ “Bowmmmmmplesmmmaimm.
”Cajun on disk and cached
it inmm.Mm. - Ithutwomdnlemauordcfiniamummm
dilk fi‘wmmobjecumpmmssaummm'um
’ This first block contains a pointer to a“ next free sofiwmlaynforlhmobjemmmfim.

block, and
so on.
Fig. €5.12 : Methods of free W e - FollowinnnjmohjemypumdefimFS:
mom-bitmap u m p l m m w w m m p l m l u m fi

_
Anhflividud fileisremind by i-Ilndc object.
-9 5.5.5(A) Bl! Map or Bit Vector me block which is block 0. Block 0 would
Wmin
Ihn
Anomfikhmpmmlbyfikobkfl.
pointer to block 1. which would point to man the
O._Explainbflmapmahodothaespaoe An Salim file “m.“ is wanted
block. which is black 2 and so on. In fig.“ 5 5 5
h y n '
Fsaeondarymrago. Iupuhhckobjm
shown, blwk 0 . 1. 2, 4, 6. 8. l l . 12, l3. 14. 16. l7. 19,
. Anindivimdimmryenuyiswmlby
— In this method. every block on disk signified by ; 1 “I 21,22. 24, 26, and 27 are fmblocks. mohjea.
Flee block is represenmd by bit 1 and allowed ”Mi: Much
_ This methodis not efficient because, we mm: '— Ammmmmufimtumho mewof
mpresented by bit 0.
block in order to maven: the list, which Mm
ohmmwjeuofmufuuel ypapaimwn
— Suppose block numbers 3. S, 7. 9, 10. 15, [3, 20_ 3.75. exmnsive IIO time . fimun'able.
and 28 an allocated and ms!of the blocks are flee.
But advantage is XML “warning the' flee [in
_i; not
.. - mmammmofmemmmma
— The fine space map would be as follows. AIM mgular operation. inmncfionuhlc.
Hg. 55.5 : Emple of[mode block an shown in bold space.
Usually, the operating system simp!y med: 9 fine block — mMonsimmlmndtfimdm
ofapemim
_
- The aim offil: allocation table is proportional to the lllOlOlOlOOllllOl lMOllOlOl l0..,. the first formnobjea.
so that it can allocate that Mack to a filenso
number of blocks that disk conlain.If disk has I: blocks Wm. a bitmap. i: is also possible to keep just ongblmk _ — mVFSuiMmhyunadnmmym'
enlist
block in the free list isused. .
file allocation table will have R entries. i n memory, going to disk for mother on only wlum n; into about whukindof object his dealing with.
— The FAT method includn Exec-block woo-mi
In eonlmt. the i-node schem: xequim an my in becom full or :mpty. Since the bitmap is n fixed-d: ltmcmmtmupmfiunmmofhflw
m
thc allocation data 5mm No sepame method is - object's
memory whose size is pmponioml lo the maximum data structure, if the kernel is (panially) paged. Ill objemby invoking theKm! funcfiml {mm an
number of files that may be open at once. needed. -
bitmap can be put in vinual memory and have pig: :1 Mmmle.
lwfimmi-m
- meWSmmainSummnboulw
it paged in as needed. FIBSQIQIIQYIBM a a a
— Fig. 5.5.5 shows example ofi-node.
IW
— The last disk addxtss is reserved for the addmss of a
0'
Advantages EMIWMTMIfiskt-M
onmblemm
Mmatfimwfihmfuncfi
block containing more disk block mm.
— II is relatively simple and requires less space. in: it suinblefumfiunmmdthafi
le.
The mason is. each i-nod: h u space for fixed number uses 1 bit pen-block. llyer will invnk: that Mon
— VFS snfiw am
of block nddlmes. If file grows beyond this limit. this mmwmgmmwwofmding
mm
n is efficient in searching the first free block at!
—mdcmdfilf
last disk addm point to disk block containing
min flee blocks onme disk ' dmfil
yjm embemmwi‘hflwMyofi ‘
Iddifionnldisk addresses.
T Disadvantages fiIftbufllPd
5.5.5 Fm Space Management - AniAnodeobiaaindmmmn
- mwbole vectmis needed tokeepi nmninm em-
4““ mmfis‘kmflmmflfihMBWQ

When file is delved. the disk spwe becomes flee. This Otherwise it would be inefficient. n is wrim to
space should be reused to allocate to new files. System occasionally for recovery net-.ds. flmwm.mum§ummmm
hepxmkoffiwspm usingfiaespacefl fimdisk
blocks which are not allocmd to my file or directory is ‘ Keeping bit map in main memory is promi
smaller disks. 1: is not necessarily possible forW
sinfl W
' Maw-mmwwwww”:
”Wm‘mmwnfl‘mlflm
s

five.Ptacspace list words all such fineblocks. ‘


disk size. uni-noth-
To create a new fila. free space list is marched for
wfihfifltyofneededfiwspmlf found. fieespwe
sunflocmdtothenewfilcanditiswckoutfivmflle

Scanned by CamScanner
Scanned CamScanner
Pu“
n1MU - Sam4 - 520
Th: i-m objects do um balms-l0 single WS- 0. mwnvaflm‘Sflbolwmmhbflef. ' > 7‘ mi : am

Whetuas file objflfl-s WW5 ' ° single ”we” (Refer 5.1-6) l . - 2TH"
MI!
h“ MM
"'5’ 01use In». "WM
554(5)) 0. W. (filter 555“»
111: i-node object is cached by (he VFS Io get helm r Syllabuc Toplc : File Organlzallon Ind 5"
‘ (”9,3,s
5mm
— - r nu:access of the file.mfme. mini" indexed file allucaflnn mm mm m I 0‘ ha W
Momma 1:»: n1! cumnuy using file file: i “ i‘ 'WWMMMWM man-
0' Emu“
“ml m memm mm ) “- dmmnmw- (Refersewon5.549))
VFS-
fife-cw» (Fm, 52.1)(10Marks) ““2015, nawmda'suwm“m“ ‘P‘amav , mmflm»
V
_ Au cached file dam are linked onto a list in the file's i- a. Wlfla shon note File Access (mugmm am“ i 9'
(3619' S m 551(5)) Syn-bu.
Tovlc : Unux VInu-IFun51ml.
node objeCL The i-node also keeps standard WMM randomnew“). (Rafersecflon52,1) i
°' 5% Umvlmu
nu.ma
ghoul each file, for example the owner. sin. And mm 0. Explain diflemnt Iypes of file organizauo" E
(Mm 5.8)
m‘mm ME“
(Helarseca‘on5.2.2) ' . x
— Diminryfik smuefledin adiflmlmyfi omomer
files. 0. Explain pile file organization. I
—- The pmy-nmming interface of UNIX defines seven! (Refersecfion 522(1)) 1
operation: on directories, for example caution. 0_ Explain Sequential file organization. I
dclnion, and ramming of: filein a dimctmy. (Halal m 522(2))
The syn-I calls [or these directory operations do not 0_ Explain indexed file Organization.
have nced of the user open In: fila concerned. Imlike (B h . 522(4))
the cue farming or wnung dam. by VFS 0. . bashed file ization,
— Mime these dimclory openfions are defined .
Helarsecbon 5.2 5
in the i-nodc abject, instead of in the file object o- ":b T Fl: »
- The superblock object 1:m fila of entire file 5y us oplc ' Dll’emfles
:yslzm. 0. Explain afferent directory slrucmras. ' I

-— The upswing-gymn: kernel keeps a single superblock (Hebrsecfion 5.3.1)


object {or each disk device mounted as I file system and 0. Explain d'lflerem directory opemflom.
for each networked file system a! plum! connected (nefgrsawonaas )
'
The main duty of the superblock object is to offer 0‘ Explain the impiemenlafion of dlrectory In dahl :
mmm- (Relarsewbn5.3.4)
— ”I‘m-nodeIncognin: each i-noch by I unique file-
numbflwn , Syllabus Topic .. Flle Sharlng

- h locates the i-node analogous to a particular i-node 0. Emlain 35"“ related‘° “'9 Shimm-
number by mquesu'ng lhc superhlock objecl to Ilhlfl'l (Refer W54}
Ihe i-mxh with mal'number. 0. Explain diflerem access rights to the file.
- A entry object mpresenls a directory entry that my (Re/«sewer:5.4.1)
Include the name of a directory in the path name of
a w- syuabug Toplc : Secondary Storage
file (such aslusr) or the acme! file.
Management
5.7 Exam_Pack(Unlverslty andReview a. What are the different allocation methods vii"
Questions) '_
reference no Flla Systems? . ‘
'- 9/llab
usToplc: Flle Management. Overview (emanation5.54)(10 Marks)
(Mloumgyzoii)
o. Elmlamthedifiemmmd'mlquestoshucmmm a. 3 '‘
wmuguommeauoeafionmetmdwim'” i
files.(R9Iarsedion5.1.3) ammgasanddsadvanmues. ' ‘ I ‘ "*’
Il '17' >
Wmmmm.(mm51.q L. ‘ I I
n. (Raterse wansq)) :
Ewhhv-rbmmeam
°-' mm.
' Mmaw) :
' l

Scanned by CamScanner
Scanned CamScanner
a O mungsfisemMU-SmM-ooulp)

In transfer rate : Dita music; we o f “mm 'W'


Onflumnm,itunuoinmuninblocfingm
devices can be diffemm and can be of several min-of Mmyximmmnmmmnm
‘tudcs
”Wnyymm
Input/Output
Management. Duke application : The applications and use o f the
airfare!“ davices val-ix in the system.
Ammuluhe nmtpmgoesinublockedm

and Disk Schedulin


g Control mmplexity : The complexity Mm In
Wmhmlenmm

3'
Wmemuymmmm
conH‘Ol the devices are also varies. , Theda'Jnansm-betwecnmhmuymdm'llo
K
Dal-I musk! unit : The transferring of data can be in mm]: is oonuullrdbyDMA medulla. '
5mm o f bytes or chamcims or in largerblocks. TheCPUinmlqmformemsh-ohhlnckcf
5- Dim representation : The data encoding methods dammflleDMAmodnlc.
used also varies different devices. In this case CPU cannot be inmlpmd until complain
my“ ), hon :
ling System
095m“
ISSUSS- IIO Buflaring, Disk em of cums Vary chmisumsfemd.
5, Errors : The cham
vo Davie-s.
0%wmim
'oLoMDisk Mmgemeng. Disk Cache. LinuxIIO, one device to anothe
r.
6.2.1 The Evolution 01the IIO Function
Mn: FCFS. -

3. Communication : I! is suitable for coW


syllabus Toplc : Organization of theIIO Functlon
. E ———
OVIMIW
— AsmhlwmnVOismofmem
finm fionsofm
with remote devices.
5 2 Organization of the IIO Function Following an:evolufionary naps.
emfim Examples : Digital line drivers andmodem, ,/’——— -Ar‘,“dcvice ‘; " “ 3 !
opum'ngqmmdiswdmoomlth teclinishéa
W‘lhpmlomdavim. — Then are many types of devim “murky.“ 0. "Emma'dmérem processor.
—eomlled devices use mi:
computer system. shown - Simple' nficmprm
- Blfimlly ilshould havewis suemmm mdstoth
e
Them ale thine ways to perfonn V0. These m lechnique.
_ mastheavim such asdisks,upe s,m infig. C6.1.
mmmhinmnupmmmmem. flsrm flom flnflw
- Aflfli nuod ucflo nofc onm
- nshouldalmpmvidenninmfmbetweenmdevices cards, modems. screen, keyboard. mouse, and my
m use of W IIO with no
Thm ways In perform IIO . New" >
ndmmomnsymmmissimplem dmytouse. more. 'inmnupts.
.'. “‘,...‘._,—I\_T,

' m ”0 We
Emu
a significant fraction of the In under to communicate with a computer xym
1. Programmed IIO '— Asamsflhm cpmc misse pmwd fmmm wfic
{nu'otmemumiceinterfaces.
WWW
device sends signals through wire or signll:but:
MmmfimmYkindsnfdevi/MJSW 2. Inlerrupl-driven IIO Wu introduced. A: u
witches. 4 In above configuration inmmpt
know that it include storage Mm (disks, up”). misnoneedfu
- The device exchange infomafion with the mil 1 ' mukefficiencyisincmaledu
a. Direct memory amass(DMA) fimhed.‘
tnnmimion devices (network tank. modem), and
through a connection point termed a pan (for «unit ’msonowaitunfill/Oopandmis
hum—immduim, canuolmenmybyuing
a mid pun). ' > fig. CM : Ways to perfuml/O i ThéVOmodulecmdimfly ‘
DMA .
Syllabus Topic : IIO Devices — If many devices use a common wired oorlllll'1"i"".“"I
Q 1. Programmed IIO dis km ap m
media, the connection is called a bus. ‘ a — hu mo fm mr erm mw
110module.
disk:9memory is handledby
InmisIIO istheCPU cm-yoma lhlwwork -
6.1 IIODevlces 3: ‘
' When cable of device A plugged into M“ 4'“ 3 . - ntamm cd 1/0 is migmrward hm “.5 ‘1“ i; not engagad in Ihis trans
fer except a: me
until III] the - W
cable of device 13 plugged into device C. and ack
drawb
of tying up the CPU pemamm start mdendoflhemn
sfer.
3'”
Plugged into a port on the oompumr W IIO is done. . 1°
Gumhxwfsysmmv _ m 110 modnl: Is mplvved .
odefifiu; mgemnnt
is called a daisy chain. TtPUissues anIIOcmnumn dwm5‘1“"fllOlmdfllw‘d "Maudie-rad hummimmcmmud‘
mam] ‘ . - ' ed 9mm.
forII0 only.
1.
can mpedimfluu
“Egon“
' : ‘ Itgenel'allyopcmcsasabus.
< ‘“
than that process walls unul operation Ito be
= h i! Wihhl: 01' mm . Dlflerences her""H’IW-fimlins- _ mauymdim'mmflnuommm
" between IIO Devl
tamer. f m. g
" 2-
Interrupt-drivenIIO V m 1,0 W” inmainmen-mom -
. ess m
“3 “ppm atW .. Without involvement of CPU.the V0W
can
‘ When CPU isSues 1/0 ”ma ' ions.
andexecutns these insmm p
.1 WW”! Devices be distinguished with respec‘“’f “"0possibilities exist. 0 07::
EMMW Minutes. 1W0
instruction issuedby process Is“Olfb‘wgi‘ _
I,“
3 result. CPU spemfics I W m
and it is interrupted only aim or. camp , W
"minimum: ' ‘
(2)Dne
. 399lied“
. the
CPU
keeps on executing “Wu“
(I) Data math-mt:
an“ PM! mat issued theIIOMimi W
(4) Data
(3)
Comm]complexity
Elm“
(5)
D“
”plantation (6)

Scanned by CamScanner
Scanned CamScanner
. WIOMM%
s“!
Rwy?) -
momma,,d
luauuu:‘lfl$"“"""gim‘m‘wmb""'i“‘“arul.. me memory address and byte m . is he” '°"",""""'Wuimmtmve.mv
Fl"'w‘lmiflfleJIiS
- Asvommemiummmmry.wmfw bylhe CPU. wanted by it. unitmw'ybhndlulldcvicu
.
mvmummh-vel
otmdevimmbeeomlmwithmuflb" _ Thnse include a memory fiddle“ “38km, a M mom than 0
lgain
is
A1 [his gage. if the byte count It"'wfl‘mmo‘heV'IIYofviewiugllodevilaesby
mpaIficipufimml/Opuwlookflfl“ mister. and one or more comm] regimen,
li flops2mmugh'“IIBWMonus-inunmmm“, W m WI! 0‘
managing In Mice. Ind
the Inks oonoemed in controlling m: temim mmlmgisnenspecifylhe 1/0 m a m m a l W 0.
voi“ "Mum by was ”mm.
— fiomnbovgitisobservedlhuCPUis
notin dim“. of “I: transfer (reading from
the
1/0 device A! thlt mm. the DMA controller
him-mm the CPU to
cfivifiumdilmlievedfiomit. mm .0 mg no device). the transfer unit am:I" lm_ W‘anmrdevieemmmimwmy
let it know that the transfer is now oomp '“Mhlylommmny.
— Mmepufonnmceisimpmved. m or word at a time). and the number of M: t: ummy,
W Amnheopemting system bootsup. “ M Follow ing Tl‘hchimmhinlmodululppmchmthedaimofflu
- Pb: W no memory Innsfer. the manned transfer in one burst. it is m y than.
000m. him m; disk block to memory: ”O‘Neil" Hdumofflzfmofkm’ [loin
wchniquedoesnotmeinlenupt. DMA. let us me how disk read ation.
Fig. 6.2.1 shows DMA oper luwer-levclmufines.
mm

— Whumfwflwummmmfimm
uedw an controller reads the block from the drive sunny,
bit
- Mlmfltmmudupperludaoffl:
wmmmmmmymfermmm W bit. until the complete block is in the “bully,
Idleinnenup t.
operating system mice devices in'tums of gum!
inmmll buffer. '
funofianl. for example read. write. open, clue. lock.
6.2.2 DlmctMemoroem Next. it calcium the checksum to confirm um no m mdunlock.
anon have occurred. Then the controller caulk m
imam.“nau'homnm. >- 6.3.2 Logical Structure of the IIO Functlon
interrupt.
- Whenmy specialoo nmlunitw illbeplwi dedh Anu- this, openling system c m mad the disk block
punfitmfe rofahlock ofdandim cllybelwe enln hummeoonuolkt’sbufferlb yteorawmduafin
— Aswam wopuafi ngsymil orgmiu dinhyas .
mull device and the primary memory. without byexeculingaloopJno nebytcorwocdisludfim
wherewhllyerhasiuspecifiedfimcfion.
intuvmfionbyfllepmonwfledmbimMemry columnar device register and storing it in main Fig. 6.2.1 : DMA transfer openfions - Theup pcrlay erinm clswim usmwh
qumig u.
Ace-55.0340. memory.
Design Issuesmmy mnm fims.
— hmbeusedwidleilherpoflingorinulupuofiwn With DMA, III: pmcess is diffuent. F'Ilst lh: CPU Syllabus Topic : Operating System dsmpufm
— DMAisnflIermmplufiulwd eviceslihdisks, - mlmkyerdaflngwimnudmnee
mm the DMA controller by setting its Ingmar:so ewbfl lionfl noh
whacmmybyuofinfomfionmbeflusfmadin 8.3 Operating System Design Issue
s inva yshm fium foru nmp leinf
itbwomawueaboutwh ummnsferwhauml _
finial/Dalmatians. second.
in fig. 6.2.1). ymm‘'onofIIOf-filiiy.
— Wlmuudalougwimlninmupgthecwis - Follbwingfig.63.lxhnw:u
lulsoinmm to fllediskconu'ollcrto maddmfmn llnly onflw dfliw
infmmedonlyaflcrlhecnmeblockofdamhlsbecn _ mmi kofth corg minfi onwi
Ihediskinloilsinwmal bufferandoonfinnfll
maimed. 6.3.1 Design Objectives :ypemdmnpplicnim.
chechum. DMA can sun only when valid din min lwnl dem mmm ium unm
- firedbnewmmflmuitm mpmvithflu the disk controller's buffer. - IntlledcsignofmeIIOflcilitL‘fimym mlom paiplds.
«mo
nmyaddluslndnllllnbullyflslhucmknllhe
The DMA oonlmller begins the transfer by issuing'l generality are the two major objectifi-
daulmnfu'. “9 _ :wmfollowing u: the layers imlvd
Iuqumoverllle bus to the disk controlled“?2) A!
1’0
operations In slow and nffects W W W
biennial: with I device commun- is min-pi Waugh ik efficiency is very impomm. _ 1's not
udevicedfiver.Devioe¢ivenmpmodeopexm’ The disk manner remains unknown and does not a! W‘M" o W ' .. The b y u] 1/0' W
[/0 _
Mnin
3mm. n5
mmhflhflmquestmme
from the CI’UOI'Wfl memory and the mommpflfm mpuns iblefor cmnmm oh Ems
a DMA onnlmller. " to many I/o dcviws-
compared
mafiwnhmgmdewoenslw
Theopemingsymmpmvidnnimplifiedvhwoffln Mullipmg nmming is solution to W e this “‘3'[I .1“, logical uo module deals with
devinemumrlppficadmstagwhmdevimvs
OWNY.
fl): bus' was; lines contain the H M in aid of m m
Iddms
to be written. Nimitz some processes to be waitingW 1/0 09mm 59"“ yo functions
blockdeviaainUNDK).
Consequentlymnnmmeuiskmmuerwfl' while another procss is executing- Pmfin‘mmdedwimdwdevimwm'

devioeidellfifier'lld‘impk
— hwmemfingxym(¢, ' .vlilille W
. 8-.lanux). devices III EVen
mm'mmwshlhel devfilesysum. next word from its inmal buffer. it mow” "h” than on h min m m 3 .
— Tummfluwm, tomimeit. hot is tithe]: i: not kaepins P!“ “’“h '1” clml'fld-“dwfiw‘
Mbuffmdnlflmua
mwfi‘cmowmfionmmmryisonemw
"
Performance of the pneum- wed o muomco nvmukn dowifmw d“:
mm
immifiseqmoes o r u o m 1“ “d“ m P“
made"i““lldlu sers
hmcycledznmedhympa. To my the processorhlsy. Wm?“
). hmunmmqw mmmdmmUOW°T w commfllds. and oonuolm mum 0‘ W“
- mw lyim pflf mm hlm dmy
s. fiwlefion of Write, the disk controller ’9‘"! inW'V‘ 9m"! mar ufiliuflon. n can m-Im Ins
_ Th: DMA ammun- In:
loom
m “E
"Niofllediskoonuofler, amm ww A: a nun, no any. mull!
htpumcofmm,umhfis mbus efficiency
oftheIIO. '
V ' - . M ’

Scanned
Scanned by CamScanner
CamScanner
‘ >
I ull , ) 66
“flame. T W (MU'Sam4-coMP
w-Somd-OOM” of the
3'5 “E Math“
by users, such as o
specified W
In:butt“:
. ml °m
whim . .’" d'm “m m and "PPM
nu ma M h
m w - A m fl g h u m fl s m m d m ’Seda
m n,"- WI , miW “‘“yo"°9
_ the
Mus m in:mm
1'0 swapped”
will?“ begins ms “Whmuh.'
1nd Mu g ' of
° M fl. m m ' m
. 8
is "quimd to “we. ' III-ibis,
layer. Hence. 3. Physical organization : Itlesm “in,

. _ n
. w mch u _
I .mm‘lu‘mpm .1 mi: logicallefel‘encestofi ”W m P M. , 11“,:. i m m o n l e a
dsmblockingofm
"l m ~ 'wned' unh.islayennd- secmdnryslomge addresm
_ by . "am Mmhlnmmf,
Wl W
.
W " - dyo°"
unu sud one Jus wififls °“ Eh”: afizgm; ‘h;e bloc hng of 1/0
to he _
“I
m m . '
m]: 31m m "7: m
or stru oil'r| Sodeadlockoccun.
W
Physical track and sect
'
imam with the 1/0 ibis m W h ‘ m
mun 3:25:s llyer also takes care of “beating of “k711i; -
-en. ”mud!
dwm- storage space and main storage buff
mundmaefmuudevieehn T0 W away from this deadlock aihlamm, the m WWWMWhhmdMAMB
nary concerned in the I/O operation must be locked landmahflerlfierilismdimmymiti.
Syllabus Toplc : IIO Buflerlng \ ’ in min memory without delay before the 1/0 request is A_W1 inofwm iskqxt mu¢m m' -

mm almou gh me I/o operation is unwed w my dflvq‘.
IIO Buffering \
6.4 not b: execu ted for a moment. 7-
(1mm
' hflVClDdowifll
lnompmwm "
. “Whitening.“
9(N°V-15.Dog
1q , nemmougms nmg-MW ‘ M d
cvleu:
a b l o c k u a n s f eroocursfmm keybouds.
.. H
a ‘Ebumumvowngtechniqm ss is blochd
“night In an 110 module. than 1h: proce - The block (Evin mppon fornndm was. while
theprmmymu
'_ _ I, MU » Nov. 2015. 1 0 Marks. Dec, 2 0 1 5 M glamyxflmuansferand Whimm hmlyw mfly.
0.4 Whalhllo bufi'orlng? Explaln diflerent typ‘“ lwappedolll.
- Acmmu dn'vu‘dnunoullowrndomm
xpens esmhw fiiciem iu,“
Tompnwayfmmthesee wfixedblocksofdm.
ytm linp utm lfen in
_ During the course of executionu user M A iswmetimns suitable tocm _ Emchm-dcvice fimnfis fldmlfi efim
dem dmc mym m
blocks of data from a disk. M Idvm eofm ques ls bein gma m m m'bengiflefingamoffimdm
m
ade.
— This m is read into a data area within the flu: hmfmmnwfimeaflettherequestism implement the file 1/0 opinion: am
the (him an

:pweoflheuserpmcess. _ This memodis cauedasbufieflng- hulk.


wflm w
- ounyouuhisreadopanfion . userpmcmismw w- mtypos ofdevlees mwl does nmd edwi fllfik mdm
' ‘m cnm aem nm anm nym mc wm
commandtodiskandlhenwnilforthzdunonfivein
FIW mew-y. 'mmmmm‘nmdmmmu
hmmwoowm mu — During waiting, the process may constantly am I!» fiymmfu wmindde fim
:hficesm msmlhm canbepm cess suspensiononln I 1' . - ' mallow
- Lflwdwmmmi’
. I _ ‘ “an,“
Chanda Dcvlces _ mum —
‘ mmnimion device. in seem] hya- — :fimWWOfg—"m by
”“23““ autumn 13 mi in Place of - Mmmon'oublesin thissituafion. m m‘lywda'w W ”W I
. _ - Flmdueto slow 1/0. 3mm ets smckinwi'i'l AM“ 0“
~ “I“
Gunman-um
mmfiaofnmnhu-ofhyu: “611/m lets. 1"“ S "
1.
BInc
5'
kDevicu ” W “W
’_ 11m: W "“a“: I MM
J 1: mammalian-mm
such cluuuamde' mnp em't mdo mm” —
cluisuinwmhmmmm“
Itin
am. - Thesecond diflicultyis thanhistype (fl/mm - d1“:
whi
. _ finitely wees
independen a dud blocks of
t, fixed—
““1open-nun;systems swlpping decisions. Wm“ '

nev‘inuallocalions
in main memory azwlfich‘,” ”mm. harddisksmdflowymcp'kom' 5W”
Buffer
—Mnhmm‘. ' H mum:
Tfiwmwm should remain in m m ashlm
Inclflofthe mm'.
blockdevicesismmfil‘mm'
6.41
“Pm
of mu m m' atI'M
I”
“Mummy-wimr‘ m 'l‘"

muse me 110 mm iuthe symm
'-
D'NI: . vuin
"In-am:: This 1.Villfvfl conform ”m"““5“"
cum'Wlse.losssameofdatawouldoecur— ‘
Howw ewckd flimmb edimfl ymwm - For mmamfiu .
_ 1' m ‘,
- v
:fifim mm fle ‘
"systemusupaging
-
then ale-3W": mmmmmmmwm‘m Wmmnuommn-
1‘
black - ”i“ "‘ ”main“ Mam
w
CImigraine
: '
mamm
"m
al! “WW": mm"
“the w”
ism“ bk'fllishy; ilo‘dlng-u'mmlmmm’mmmm
. .bleru, texuum “
1‘ rewind, applications m mo
we"
"W” mien“W“m": will
dlmuy'
a ma;:0. influence the _ :bd ""° “‘3‘“”MY- es .
direclly
~ 3‘“? devic WM ’-" m mW
WiW smm ‘
““I‘
m
l i s”w m d b m h w mmm
' we”. “ d . “mmue mswap thcpm cessmfi ‘dy'w mum W '° .
"mm 'dbytheopemfing system.
’- "9 mun : - by. “"1 the loyal
Amado- m deadlockcanoccur- Q M
Womb-mm“.

4-—

Scanned
Scanned by CamScanner
CamScanner
' . Input/cum ’ ‘ .
V Wmswmmu-. s°m.mmV.. a W
6P7. ‘ 1
" lag

-
l. § = : : 2 m u . s ; n 4 ; m

- miswwm ywx kné’wn u lending M


orfim ‘ ,
°‘
device wwmmh
- t‘hh
' Wmm W
W,” W«m co ,
efnrdlnm ,
. l“flaring,themllectmnofmmeIl'mntwmmffmi‘ -
I
m maimni . In uncircuhrbufferJn
cimmhm.”
Cylinder
linenau‘mc. nxmq-m
fflm IV _ Inlme
mumblockwiuulfimlwlybemu . . .
atanm empu tmtem jw .
u
“divid'l‘l
I
buffer is one unit.
“ W m-'hm
: f"b“""“M
mphon
Wfimmmmislopcd ed e‘cm‘l
memdofalincmndoummtgWilla. ‘zemmmu‘6-41 The UIillty of Buffering
my M a n use as l rule wow “
. onelineatau'me. high, then
bafflin g help; to
mfll fly.
- “demand for [/0 is very WWII-o
Mum-1'
um... -PCPs
Many

eofpmusmswma — The Pommnde ”Minds, ’ fulfill mix demand. ”'k


i‘} Onlyumemmmnsequem smhuwnsmmdmnmummbmm‘m permit: m
hlockbcmdinno
y.
edlesl
MEN-Himm.mebuffuh “W. an the other hand. if buffering is not used. it 6.5.1 FCFS Sehodullng Algomhm
i;- bed aba veg ivea spe edw wflh
_
_ wmwmlchwimapmessdemdf
orm
- ma niq ued mfi
oompmmmhavingflnsy
mhfledng. indefinite period When the avenge demand of an
theIIOdevicecansa-vioe.
- Whanlxuassingofonebl
ockofdmbyuserpmls 5.42 DoubleBuffer Mismtcnmn
buffer:
amfi mmm lhloc kisb eium din. If we consider the mulu'ple buffers, all of the
In this case, instead single bufler as a [I'll. l will hue to waium-
Ramfiusysmunswaplhe
pmoulof '- will finally fill up and Ch: pm Ilgorilhm
- Iwobuflersale usedinsystem mmyfu, chunk of data.
_ 1‘” fi"“*“"|‘9-
fin“fiver! (FEES) . 1: lb:
proces sing each
. M
peningin
mydmmeinpmapmfionishlp By nldled ulingn lyrjmm
doing so. give: improvement avg- . But. in a mulfipmgmmming enviro
nmen t, harm ing Iimpk
mummiymdofummmmy. m a m m u w c m y m m u m m
buffaing. ' "'5 allows to enhance the efficiency
of the wasting syauun _
- mmmm plexflw hgicinfl wopmfi ng Wilmm offerfl umm
meanebufl‘eroutoftwo is uscdbypmmm the perfo nnan ce of every process.
man. Ind
duminboth ways (processlobufl‘erm dmh Cansulu'mediskqmwimnqueuforllouwm
g Alwflhm ,
I ‘ “Wflmmmwmmism plows). Syllabus Toplc : Disk Schedulin on .- ‘ sum-am.
johofopeun'ngsymm. 5.fi
96.135.35.121.15.1N.5
Atflnsamefimelheop emingsysleme mm:‘ orlthms
— IndlinmifflleI/Oopetfimisc-fiedoutondw ‘ (or
the other buffer.'Ihis technique is called 3 in“: 6.5 Dlsk Schedullng Alg Qua: = 96.185.35.122. 16.111.55.5
7
mdkmhuwdrwmlppingmueisnomm
buffering or buffer swappin . -) (Mm/.15) Hud smui l I
quanfikdwswmenmedevicefortwappingdle I Iri-
s I I I .n
mom. - If T; <=T1 than the block-oriented device an be In . . : .

fl
‘r
— Mafimofmlppingmfieeminmemozywfll going at fullspeed.
MMHIIMMUOWanmtomm In contnsL, if T; >T., double buffering gunmlh
‘ owlongitukesmmd
I"hm"‘ifllflwlmlingtheme“;Iodinkmayna
thepmcus need not to wait on 1/0. 'fim ly.w e haveloconsiderm
disdemminedby
bnprbemm orwriteadisk block. The time leqllile
In both cases, an enhmeemmt over single Whisk
mnsideringthreefacmm:
Mud. Due to this improvement complexity imam wmm mem
1-
Seek ume mism ezim mm mm
Iflheinput is steam-oriented, then forlinell‘il
1/0. the userptocessneednot besuspendedfOfiflP‘"1 -
cylinder.
emae_mrb
ma mm al- km
Olllput. Mumauay:mumerorm yflndnflfiwmmm
- [fus ingl ehfi er M l l e . unless the process runs ahead “ W W [fiddlydlediskmdisnc
. ' . bufq. Mundertheheud.
l s m s. I71. 16. 120.5:
fll,Td+T.whuaTillhe;fin:: 3- mm s m m m m
::::ewe:m Amm msm -m l m m fl J o r n mhlhudmmu
f
mmmmhmmmr “W“bfieaut imeopenfion . W W W eekfimiswm und u
mm Pulmoszofthediskhes
“ I “ : M u no benefit over I single buffer 0' M a “ ‘ . cyIin de n. 2n
'finnpgrhléek' 'denbl Wond dclay andac maldm
mmfim
mnmdinmfiuiil.
' length ekmitismbb” Thiucheduleildiag dmblkml
. ‘ ‘6“:km
.mwfi“ . -YMy.
1‘
kn 1-4.3 0 m' m * Hmcebyminimimgmse . . . Thelmswing
M I Z Z w l é i u
_
B mwsignifiWW- mflc.
‘ .
m u...- “me . Wamqom mblemwilhm
Won Mung “1““!d Q skd dfm ml’ l; demonmmmep fim ld he m
Admlble—bufiei
"WM-e 'Wi
r m- u m m ’ m usfi m M
”91;“
_ scheme should mainminflaw‘md‘ Ifth epm llgo fmm byd
WW Um m m fa cy
lin M SS Sm dl
m.
y
itwillbewrinql b WHM’SMNSWMRIS flamexeqmulzz ,
“dalmaanmdeviceandapm togethnbefmeon
. «wily WWW
" MW“! Hm‘ VOW onis capa bleo rhep
ms'
"PM“ “mum. M M W IM R
Plum h w h e n “ dun”: beamieved.
Yet.
mmrapp mwhisp ouib hmfl “ mdpgfmflmfld
belhaeby
"Wed-3W We. InnemuhefllJEI‘fOI'Immcecan ‘ languish
‘ mmmfim . _
moutfastburmofl/OM w
“3:651:
mm
"WnB isnos uffic m ~
whflltheatmisseehng' Wm mm h '
; "“hmwlyofummm “w- _ .
“Whim mmmkycanofienbemdb
yuflfllw

Mobufiem

Scanned
Scanned by CamScanner
CamScanner
6-9 [mm] Outpm Mar-
a.
E 231‘“: MtU‘S'm‘mm S;';f“n‘t‘n-‘w
system (MU —Sam 4‘- COMP) m
memfind -
Ilabus Toplc 55": W’WM
m wsyullnsMW"' -—- ..§—.i : - . : EA!
this moment, 9°u“!
I small number
of ‘ a.
are right away in hunt 0f the head. sinus thug
A ' t been serviced. Dlsk sch“ Within:To“; _ ,
6.5.2 Shummk.nMIm(sSm cyundfls
(may “mus .
omqmtslsmy ham:3:theme“ “Humaarm.m: LOOK.max ' ‘
Schedullng W m Hg.65.2 = SSTFdlsk Scheduling 1?;a disk. 6.5.5 LOOK
0
muesls have also waited for 1h: longer petiod of
Syllabus Tople a m so why not.go there first?That is themime"
Disk Scheduling Algorithm. SCAN
of menext algorithm.
Queue = 96, 185, 35, 122, 16, 120, 55. 57
6.5.3 SCAN Scheduling Algorithm
star! at 5 1
A 13mm
' V 9 m autumn-u!
m , all Ih: Mm near tome 1') “2:1? A'hove two algorithm. SCAN Ind C-SCAN. move
me
mwpusifimbefutmofirgmchcadfrm)’ ~s dsskmummnfinlwidxh omxcdisk.
nmofium Nomafly.“w|rmgmonlynsflruthefinflleqlfii
‘n: syn: w chm the m "m“ a" inuchdixection.
iii-Immfiunlhemulhadpomm — 'I'I~.er|'aovu:1ncmtfi’lhediskm'rninthisalgorithms?“ll
Then. it muses direction straightaway. without going
Asukhinfi‘illhemdcyfindfls amendoflhedlskm'n'lgoesmthedil'ectictnu IllItIymtheeudufthgdisk.
flheomcf
wwwummmmwfim and. Fig. 65.3 : SCAN disk Scheduling Versions of SCAN and CSCANum follow this alum
I mdmuiemhadpua‘fim — Whilcdoingso‘ilservicemqucstsasilaniveum pom are called LOOK and 01001! mung.
cylinhnmfililan-iveanheolhcrendofthedisk. Syllabus Topic
, hummmnfluiginlhed mmcylmforamqmtbcl‘ucmfimingb
_ fimmmgaltheofllflenddhe Dlsk Scheduling Algorithm - OSCAN
pfifilflxq‘hhfi d m ‘onnf hl moveinngivendirecfim.
movement gas mm
mwaacyidafimenmdmmku and servicingcontinues. 6.5.4 G—SCAN Scheduling Algorithm magmas. 122.16.120.55.57
(”Silk-minmtqhhfiis The head repetitively scans backward and fund HudmnuSl ‘
ushhuxmwSSksmdx-m. Nudist an ‘
'ghe
mkmnmmm — 'lhecfiskarmmfiastlikzanelevatorinlhebflm mm {oflawing Disksdredeflns"
mmflf-iylfi. Initially ilmicaallthemquazs while gningnpnd . appmpnale maple-SSW. F0
_. LOOK. MU V‘
1i :1“; and ms in a mu! hm whm tevusetbedimcfion‘owmds dowmitsuviccn:
I‘-
d d:
316 aides way is m
monthisway. C-SCAN
is called as Circular SCAN scheduling and it
F‘mmiflmm Mummmalgmimmisalsoeanedsfl is a variation of SCAN.
m h h u m m h denim-algorithm. mm:LO0Kd
Itoffersamole uniformwaiuimalustlikcltCAN.
— Ia‘somsidulhesameexamplediscumdm C-SCAN moves the head from one end of the disk ‘° Schedullng
hk'm-hm the
olhcr. servicing mums along the: way-
6.6 Examples on Dlsk
- BcfcI'e[xvaceeclingwilhSCAN(oscheclnlcfllemFg
‘ m m Algorithms
Whiznmdngun m cylindas 96. 185. 35. 12116. 120. 51mm.” Whenmehead
anivealmcomumhow f “
Maine-imwmentshotfldbemm 8Wight ' 3251
away Mums In the beginning 0f the disk.
lilhlhehead'smtposifian William
(51). servicing any :equnlsanlhenmmfil’.
— Emmofthediskmismwmdsmmdu Thccscm
Cylindensasacixcum
scheduling alga ‘thmmmy ““5 x M wasnow/finder 125-“ w"
kindfixuwmsenicefiandmenlé. “I usumwnwm‘fm inFlFO m , a s a s . 1 4 7 0 . 9 1 & ‘ $
— Anuwngmcymo¢emwfllmfis°m finalcyfinderzothcfilstona
' mmmmw "
wmgommmemhacndofmediSk-W QIIeue=96. 185,35,122.16.120- 55-57 WNMW‘dE H
‘.
mllllrmsznss,s7.96.120,129. 185-
and HHdshnuSl
Ifdlcincomingmquminqueueisj‘fi infion‘d'“
”33"
mmnwmbemmdmoafim W};
mgmjustatmebackflwmwdm
unfillhemgmtolheendOffl‘e‘flk'
Mmmdoomback.
W sum:m m M I I ‘!
1174.94
143I :6, 1410.913.
_ Whememdbmtofmm
. . dmfi‘ (HEY. 5“ W is10%|.
W I
W
Mmedmsityofmqwmflfl
Wmdand'mmdiwcxiun.

1L

Scanned by CamScanner
Scanned CamScanner
Mum/W WWWM ‘ ‘
w- sonu. cow) H1 ‘
70 b. The SSTF schedule is 143, 130. 86, 9‘3$43,] >_
.9
- 143'
13, '
948. 1022, 14 v 1470.1509,1750.1774. 51 "
V
scm man» I!5“ -m is 02" 0°"
m “'3“'°'
Mm” 10. 22- 20.
a 59+1264+402+M+B7u+1
M w d' m m1see]:distance.is 1745
. M 38 A s m m'"‘°
memflflsecondwmm
09' :»u1714.4999- no.
15091 m 2-
: “=37“?a
’3
1 4 3 . 913, 948,
l ' me Is for close“ cyfindarnw
°- ’11:: SCAN M“ ”,6!“
W’ m
5”“ “WW ‘ Them-pm.
1/
m 1509.17so.1774.4999.'130,86 ”A 14
7°-
[.mcyllnde'm- hm. (155 m) “155-130.“, .Bms uo
‘W “102 2.203.
eismsg .pv/“m ‘ =3. - aas,
m-w-“JW-Sm
w "W Themseekdislane = llaofllhm (948— 50); _ (
Mmmhwwwb': ' SChedule . 948 W _ Com. m . Served 398.0350 948)=402.(15m-1
mem aAu-k““9"“ ”ME
Wind“ next mm? d. The LOOK Is 143, 913'
mm . “W“ TM“
350)-Iso

” «me n for omen . 102;, 86' ”0’ “mwunfimmdmes mmmninmw,


in.

"m. 1509' ”50' 1774’130'


mmhmwm 75+M+36+m,m“50=wcym
mined Wm 20)+(20—2)+(4o—z) a scan:
accept-news
Is 19.
[1:33 143.
= m

:
6- Eegc He 86. 913, 948_ 1470, (22-10)+(72—
«10"0“
WWW 1509,1750, 1774,4999, 130. "’12. mac: 146 “Magnu
m mmscmmhmss.mmso.o.mum
nthnolden +(4 0-6 )+( 38- 6))
' 6
wnafiumdcnfiummi The total seek distance is 9813. Wflmsgekmgorlthms
Tot-Him "sim(155-130)=25.(130-86)=u_m-so)=3g.
(Bonus) The C-LOOK schedule is 143, 913, 943 l ssFShormSeekFimflgofllhmflwayshndlu (50-0)=50.(94I-0)=m.mso—m)=4m,
, (40-2 )
(go—nonm—no)+(22-20)+(20-2)+ 1470, 1509,1750. 1774, 86, 130. ' "22. m cm Muss: first. to minimise leek time, (1500-1350)=150
=876mm
+(40_‘)+(33_5»t5m=l46’6m5ec
Wdyon the mums older;
The total suck distance is 3363. Taulhudmuwum”:
CylncdAlgoflthn-fiSFShom-thkflm 1" mum
25+“+36+50+948+402+150=1655Cyhh:
dun-Ilia Ilmys handles the closest tuquesl firm, to Ex-mplossa
' ' ( 2 2 - 20) + (22 — 10) +(10— 6)+(6— 2)
(go-20)+ 4. 0-SCAN:
www.muymmemqummder, None of the dlsk-schedullng disciplines, exoem FCFs_ a“, c:360mec. .
+(33_2)+(40—38))*6msec=60’6me
Tot-Him fulr(s1awafionmay occur). » .
ainwhytmsassemonlsame. oynnauSeekAlgnI-nhms IMEmmm'M“mmms°‘°'m°'
((20-20)+(22-20)+(22-10)+(10-5)+(5-2) a. Expl Elm”
“Emu“
mm"
m m m Itgivuuss-130)=Zi.(130—86)=u

+(3‘—2+4o— m“
) ( 3sJ)' 6 =60‘6 m =36!)“u“ n .
Dmnbeaw ayto modny' algorithmswdlasm
Musing (decreasing) order until no
we request: on the
(MM Souk Algorithms (59-0):so,(4999—o)=4999.(4999-15M=3499{
to ensure him. my. Afterwards the direction is mend.
Dav-lot algorithm bundles nearest requests in Explainwhyfaimesslsanimpovmgodinlm (1500-1350)=150.(1350-9‘8)=W-
16h]film
inc-wing(deuwing)udermfilnomomtequmonlhe 8—22 + 40-33) +(40-1 0) mmm:
shaflngsystem. (01-20 + _20
+35+so+4 999+m+150+mz
+(lo_6))+(§2_22»*1;:c=5* g)ts(msec=348m 25+u
. mm” mm”
“LAM-mmdimaimismemd G" W”
d °’ mm °' Cy‘
mu... whichitlsimponantmalmeopemmxgsymmh C-woxwkm
-
unfairinservingl/Orequesm.
Bums“
‘ inc
_w o x - m_ _
:?o_M)+m-m)+(38-m+(w_38)+(4o—10) SIMIhm-diakdmehassooocynmmumbemom _ 50.]SM.135°-9‘3
_ 6mc=348mc
_6)+(6 _2)). 6m-sst sauna": 150
‘m-madlj'veiscunenttyservingarequammmflfi‘ hym(155—130)=§
55(’3°"miu'
'- New mquesls for the track over which the W .
hum
cmently resides can thematically arrive as will“ “hummus mqusstwas at cylinder I m m e m 35-50)=36,(150
«02.
0=5°)=!"1°- (mo— mo)-
‘ --
WM-Mdmmsooom ”MGM0 ” "Wmmsisas 1350 948,1 30,15 00.50 W(
mflyserving
ream.
” I
these
2: bei ' d m smetm almwmm . ‘ .
d' plosition'' whati
urmm
l"”"WIBeh (1350-9 48)-
“WWII! ~ should Mmtlmn head allihe “minimum“.
W W M W I E M. M d
M a. “3' 1" mine
MWMold omepmngser
s are
erthans l I
vwe
delemum -
’ my“
+44+36+14so+lso+m=21 °7qw’ - »
W "W.
be
compulsm-ny “I
placed the top of the um- mm for ° ”3"“
of me tollowm-disk W 15
a LoommwoxM-s 'lssx. mflm - 4
ospwfl "W31!- each
F‘ War. Wm
n "W'- "‘ is 86. mo, 91
3'1""
“5-1509
1022.1
hummus“
associated
bitforeach couldbe0””sett 4 c'scIN 1350,1500 —so)=36.'
mfihhm‘” could
be moved ahead M, LFCFS 2 ss
"5W ”quest m ’°’
mmmmmWBJMu-om F“ W“
"m

' 00K
Look6-<‘r|-
3’
SCAN _50)s-xao)=
navaas =masso—zs.(l3°-
948) =m'“.5°°‘“
"’=“‘m
Mumsmm,
bro-mama
5511‘. 'he ms! of the qe Mm -
Wad with Inspect m the last of W 0“
Toulhfldmm:
:5c Wm
tom
requests. 1. aFs 5w
130150050 25+u+36+898+m+150=l55
0.0m “can nook Imusuallylongmsponsefimfls pill”
The

G Toavoid -
Sou...“
md’ h_
Fm‘slettll-Ileis 155.315.1350” '
d'
U” W should have lower prim“? ”a
"
n"
m M -I
41mm,“ b‘
.. M
“in”
Orv“
a?_ _ = 402. ””3’amuw
. mm
. n
m1“;
- - - "W5 “ “‘3'
Wmmbmmlm

""’-'°2’~"5M; "74,948. "'d 1/0, such as the wrmng


can!!!” a Misha;(13so_ss)=1264.(l3505w94_8)m=lw
30 =818,(1500-130)=1370.(1 M
‘ mm
. mwmmhml man.
no lake priority over used1’0 /0 at .
' ,' » Ital-lime
i. ' “Wm process priorifies. the "q 4‘
.
\Wi

Scanned Scan npr


CamScanner
Scan ned by Cam
6'13 Input/Wm”

WW(W'5°'""°°MP) S. C—SCAN : me C3 W
msymmmu-Semu—coup, 6-14 "I
I
125. The queue at
and cmW
mm was .1
_ FIFO .5 m as so.1410. 913. 177/, 1022. 1470, 1750,1777. 4999 oedule ;,
80,
130.
143,
9
13. 9Q.
W head
movem ents
m:
R ” ( “l )3= s s _ u ) 57.
l
= m,
It givw _ 143) = 770. (9‘48: '1‘ l043514.34.115+l+20+18+15tH-ll)+ 2‘4,=734 (“7‘9 (117 = (M1 - g,
Mm’lg- WM! 3 W W W M me diSR (913

~913) =35, . -91 = ("7 _9 ‘ ) -_3 3 .


(1022 — 948): 74, ' (150'94)=56.(lso-1(m)=4§6'
(:ylindfl‘s
“Jamaican
4. SCAN 503cm (1470—1022)=448'
("5°‘147m-
x z Th eLOOK schedule.. (175—102)=73.(115—1
3m 2_sSTF :1m 34
L [00 90, 52. 55. 39.as. 18.150,150,1
280. 30)=45
(1777 — 1750)= 2-,,(4999 _1777 ‘ Tuhlhudmvmnumi

)=3' '
solution: (499 9"0) =499 9.(S O—(
”=30
)=3 Sgyf6 l+56+ 86+n +56+ 4a+1 3+45
) = 132,(5
3 9 — 3 8ss)= 3_55 38'13)=20_ =56§
I. FCFS = m w “W is
'(
(I30~“Ohm “Wa, 3co-9 0h10( ,(90—
1470. 913, 1717,948. 1022. 1750.130-
Tom]headmawmum: (55 9 ) : 16,
10,084— ]60) = M-
143. so, (150 _18) = 132' (160 - 1 5 0 ) = 2. smum smm nnm . 141. 150.1 30.102.
139o. . 770+35+74+448+280+ V 94.91.86.175. m
Mm (143—00)=63,(147a-m)= 2 are:
+5°=9985Cy1ind=rs 7+3222+4999+In Tomm dmove mems
(1410-913) =551. +132+10+24=743 1: gives (:41 — 143) = 4. (150 — 141) = 3'-
10+32+3+16+1+20
, (1m—913 )=364.(17 77-948)= 829. (150—1 ao)=m, (1ao— 102)=7 3.(101-
cylindcxs 94)=3-
(1750— 1012) =728, is (94—9n=3.(91-m=s.(175-W=”-
(1022-948)=74. Suppose that a disk drive has 200 cylin
ders c.5cA NzTh eC-S CAN sche duln
([750—so)=1670 199. The initial head position is a:100'n“Q""JW" 100, 150. 160, 184, 199. 0, 18. 33.
39. 55,58.90
(177-175)=2
Tmmmflmflum:
Tnulheulmovcmm:are: paneling requeslsin FIFO i 5 5 5 . 58. 39. —150) = 10,
1890.152.1 It gives (150 - 1 0 0 ) = 50. (160 4+3+20 +28+8+ 3+5+I9+ 2=162c y|im
63+1390+557+864+829+74+728+ 1670 134. Calculate average seek time for each
oi Ihe MEm — 134) = 15, (199 —o)=199,
(134 — 160)= 24, (199
, .
3-
mutanmemmmi‘
=6125Cylinders Mm. (18-0) = 13, (38- 18) =20. (39-38):1. 143. 141. 150.175.m. 199, no.102.94,91,“
1. FCFS 2_ 5511: 3- SCAN ,(90—58)=32
1. SS’l'F:The SSTF schedule is (55—39)=16.(58—55)=3
v 1‘
Kim 25.—
(“7 143)
= 4. (150 — m) =‘3_.
- [43,130. so. 913, 948. 1022, 1470.1750.1717. 4. LOOK 5. GSCAN 6. C-LOOK Total hand mov emen ts are:
-111): 12.
(177 - $75) 2=82.. ((199
+l6+ 31+3 2 (175 —150)= m-9o)=s_,
kgivu (143—130)=13.(uo—ao)=so, Solution : 50+ 10+2 4+15 +199 +18+ m+l (199-130)=69.(
ISO-Im=
(913-80)= 833. .
(948-913)=3s.(1022-94a)=74,1. FCFS : The FCFS schedule is =388 Cylinders (94-91)=3-(9|-36)=5
(1470—M)=448.(17so — 1470) = 2m, N schednl:is : . _
100.
55, 58, 39. 18. 90, 160. 150. 38, 184. 6. C-IJOOK : The C - SCA Toulhudmuvemenum
(1m — 1750) = 27 58, 90 9 + 2 | + 3 + 3 + 5 § 1 69
100, 150, 160, 184, 18. 38. 39, 55. 4+3+25+2+22+ 6
TMMWCMB m: It gives (100 — 55) = 4s, (58 — 55) = 3, (say—391:1;
(39 -
18) .
= 2 1 (90 — 18) = 72, (160-150)=lfl.(150- It gives (150 - 100) = so, (160 —150) = 10.
gm+m+as+74+m+2so+z7= mo (184 — 160): 24, (184 — 18) =
166, (38— 18)=20.
38)=112,(184 — 38) = 145
—55) =3.
3- W K : (39 — 38) = l , (55 — 39) = 16, (58
mwoxscweis Toml head movements are :
(90 — 58) = 3 2
:43.913.948.1022.1470.1150.1777.130, 3Q 4 5 + 3 + 1 9 + 2 1 + 7 2 + 1 0 + 112+ 146
Total head movements an :
Hive-(913— 14 = _ _35' = 428 Cylinders 2 A + 1 6 6 + 2 0 +
1 f 1 6 + 3 + 3 2:322
5 0 + 1 0 +
, (lm—m)=7:?(133ififilfl; 7-
(1750- 1470)= 7m.(1711 - 1750)= 2'; SS'I'F : The SSTF schedule i s
(1777—130)=1M7'( 130_8°)= 41 .
100. 9o, 58, 55, 39. 38, 18, 150, 160, 184 U
E‘lml’le uflon:
. 119.141. 136. 6‘.
mum mnm m“ 8.3.9 le is: 100.110. 120
It gives (100—90)=10,(90—58)=32- g dusk vnih 3°“ M 5d 581? Schedu
suppose that the head ol a mu
110
Gy m”
+3 5+ 74+ 448+2
80+ 27+ 164 7+5 0=3 33L (58—55)= 3, (55—39 ) = 16, (39—38)=
1'
numbered 0 to 199, is currenfiy aaMllg are;
Thequfiua 4 ! . 2 7 , 1 0
10) + (129-1
20) + (141-129) +'
_1a)=1azuso—150)=1‘* 100) + (120-1 n + (27-10).
(41—?!)
(38-1s)= 20, (150 min d” - 0 -
‘43 has lust finlshed a requ
3"I! est ([1 !) +
4. :A NW M -64) + (63H+ u +
SC AN M E : 86 —147) + 1(1s 86 +m+2
=W=
n :913.9¢8.lm
(184- 160) = 24 °1mm is kep!In the FIFO order gm+1o
+9+ + 3 9

91 171 94 150 102,115,130


.1470,l750.l777 56-147
.499913080 Total head movements as: : l
m
29'“ . 41.21, 10. m.141‘
ave-(913—143 ' ' l l

Head mug: AW - m. 64.


Ham-943»
)=7o.(943—91‘
74 (”7° ~10 22= m I I . 10+32+3+15+1+2o+132+10+w "‘3‘ ls Ihe ma! number ofthe 36"d ‘ 05“]! saw!!!“ b.
following
(1750-14 )_
3)-”,
Cylindns “M y these requests for .10) + (us-w) '+
+ (120-110)‘=
-1 A 33;,3“
4!
119,129,110 (4147 (g) =
(4999—1777»: W; . 64) + (644“ + (1 29
3-
SCAN : The SCAN schedule is (1“)
29 ) +
100. 160- 1 “
g 1. FCFS 2. SSTF 3. Eleni“ 4 vfl +aw(1m47m-1mwm 1:1
9o. ss, 55. 39. 38, 18, o.150. s"‘l-Iflnn
:
(MAE-run
u :u o. m ,m
, , ,
u le
It
'ves _ =1o.(90‘ ,1: V L oo xw

(55— 590303, (5590: 39) = 16, (39‘ :3), [5a L


Fens
=mmmhdulcil W c-
1m. l75r13° 10,17,419“
(38 - 18) = 20,“; _ o) = 18, (15°‘
143.86.
147,91,111.94.150.
(160-150):
10,(184—- 160) =Z‘
\ ,
4 —

Scanned CamScanner
Scanned by CamScan ner
8-15 Input / Oulpm svs‘gMMU-Smnbcom’)
Cr A smM-W"°°MF) n
wtchwcmilindimmmflummah
‘7‘
; ‘
m" (874-123)
(no 100) + (120110) + (129120) + (147-129)
_ + m“
+ (en-M
47S)+ (475 m -105 + (376-105+) = 2013 +(
" )(345-123) "4% 1”“ has become complfld and khat 111: a!“ W ml“? M u m
for naught)
14 + (186-10) + (27.10) + (41-21) + (64-41) . ’ 569‘“ ad. - h‘“ . “M““Wwwm
= 316/9 — Average (u) 55-" :
76+l7+l4+23 nfi'u b conlflins
92310729+lfl+39+l infomfion.if few m, of
123 “d sufficiem
g5 The SS'l'l7 schedulels 345376475. 6923“. «Enhflwmgm°fhlymtruncru
memorymflthe m m m m fl m
11 : TON Mad movement = (376-341 5) + (475-376) 1 1119 been con-“pied, it facilim: ‘he council“:0 “Mum
,, u +(123' 05)=1298.
r
and nmnwwnp
IV“ ellmhte whn
5"“
m, on!!!MOW“ are 54,- 57: 40- .. + (874-69 2) 41374 .13)
+ (692475) “I: which hits have changed
.3}. P“, I!“
ognl
values should be. It then m I ‘ W Wmmmmmmmm
mdaln
who. as; (m) SCAN
cone“
I W dishlmd smmkmnlimomm_mmnn
2: an. 126.1150.4s. we. my me
wait _. inififlddlmmmulm
fllcmflm‘ .
90" - '1 345.
123. 105,
0.376.475.692 and874 "one, “gummy «10:3: BCC pronouns _ The M my Memory (mm m m
" P“ I I W mm: . wmflflflwon snadorwn . inifilliufiunandimufimmeuimmndupmm
WW(W”'W‘°’* 2)++
(345-123) (123—105) + (105
4)=1219 - 0)
6% m:
Salim )+movemm
Tom mu
' +(M76 (376475)+=(475-69 (692.37
. mewufacnniflSW-‘kelfml can W e m fi n g m m w m m
— ”d disk is carried om. Mmbmmis nondinROM.
(I) FCFS Syllabus Topic : Dlsk Managemem ‘
mmumufimnmn 120,150.45.180 ”f“ muffin,“ m initialize the mapping frun — m of mud mly (m at non;inmu1:
‘ . ll h-e‘psblllk
to “fauna sectors on th:disk.
numbels infecmdby I wmpmvims.
1.3a“: (”54) + (57-54) + (57-40) + (4020) + (80-10) + 6.7 Dlsk Management
(12080)+(l50-120)+(15045)+(lw45) m disk ‘ fl ‘1: “he dem‘ hard disks. the disk conuollcr is insulated — Th:difficuhyismlmd “I'm?“
mmgemen ac v1 es 0 Wu - Fofl:w many byies of data space to luv: Ween tha tequileichmyngmekOMhndwmchip.
Totalhead “10:35 _ 343 include dusk uuuahuuon, boonng fmm disk. m u bad-hm [of
the in: when it — Mmmoflsyflmmumfllbwmhdu
36+3+l7+20+60i40+ - MOM‘ and trailer of all seems at
love ] formaning. Wmmmmnmmmmmm
(mm gaf orm
low
1,025 bytes.
ss’rmmnso,so.s7.s4.4s.4o,2o.m150.130 6'7'1 ms"
“mam“ For example, we size s can be 256. 512. 'and
ton - mandifiodmsionoffilllwmmmmbe
laxgcrseclurmfewersec
I:gives (9030) +mm + (57.54) + (5445) +(4540) + q'.‘ Emmi: disk fomnfling activity of disk main:" — lfdiakis toxin-mod with .m on simplywflmmmdwdisk.
.
«awamzonosmzonamsm 099mm. canI'llon cash track
' ‘ and mien are wad “ _ m mmlmofmmmil
Toulhgadmwemcnum As a mul l fewer headers ' 'boothlom‘.
V — If the magnetic disk is new then it is a plum: of a ore spaceiso ' blef oru m n.
lo+n+3+9+5 +20+100+3 0+30=730 magnetic molding mute-in].
enchmkmdm
le a secto r we of 512 _ immunmwmaHIwfifu
can hand
(WC-SCAN - Some operating systems
Dimclly on such surface, we cannot stone dam.
W _ 8 510mm m tomullet fit
C-SCAN wlwdule is 90, 80, 57. 54. 45. 40. 20. 0. its own dam Manama-5k — M R$nbmm(mm‘glw
120. - The surface needs to be divided in sectors so that disk
150,180 m"Tainted:nhinaoun)mm!”"""""““""‘
It wive- (mm + (80-57) + (57-54) + (5445) + (4540)
controlleris able to performread and write ope-dial. - befoniudisktostom
‘ mefilesltpu‘fmwm as
M - Thepmoedunofdoing this iscalledlawlevelor followingm o steps 1 of code- m
*(‘0'2")+m0)+(120-0)+(lso-120)+(180-150)
physiculformming, 01*“n
The gun mm 9‘“:”mm 110M:it5 m
Imdmovemennm l. I! pamuons the duskffllo by 08 u I
- mahrmnfingfillseachmmmmum cylinders. Each pamuon IS . load:t . IIW .
10+n+3+9+s+2o+2o+1zo+ : W
3o+3o=27 1- sepamcdisk. . file ll" m M W“
finder cmnpiale.m

2' 2 Lopml' frmtfing:mmu‘m“°f l ”Mmdmwimu


mmz—
fa MHHOOOcyindeqs M ‘ W ’3‘“ Amm‘mymwinm I system o Mnfionxfiamm b
m.m m u'a m m diskan
nu '
0m
nmmu mvm
a saflsiy‘ ' ‘ In
order m increase due efficiency- file S W 6.13 384 Bl“
the mq ua sts mh
ds kq ue ua .ks su — 3'
Them“
headerIndmailer hold the information usedbyW Mbinchunkscalledlsdusm
.
W and M
:mwmmmam
hhfidhmh
mm e:s tm
~81] ‘ll 1]: mmfim‘diskwlbe
‘_ okamaweuotnnF Inward
conkoller such as error meeting codes ECG Operating 5‘"
Mombflamn.
om erc
475.105
onmns 9‘‘ seem-number. ‘ Sm systems ”w “mum! 1. Conn:m' .skwupomm'fl
Eamon. W 1 0 : 392 mmmme ECCisupdatedwithavaJuccalculaxedfiDmdlm “mumadiskpanifiwaslw Mi , V ‘
m m d (Ii k-
"1, “ 8 7 3 ' ‘ ‘ lagical . filfly‘mn IE?
5 mm!
.
.
.-
'"9‘1'"'7'" ,_ , . _> ”"9 bytesinmedm. °f blocks. wnhoul any Manna
W- m”
D/HPO. ID-SSTFMSCAN , . m 0mm unifi
- Thisis done during the controller w fl m l m o f w 7"
m “I hmm
3‘ om
This
(0m. ~ . myxswmeumbs ' ' cfllgdthefl‘w ‘1'“d AM mufmmfifll-
. mfififl‘w‘m
mumyiscanedamwllo-
H10
IttinnofnmmalI/Oflwml
TheECCismcalculmedatfllefimcsecw'ismdm‘
W” - mm.
Them ‘ 5-7-2
acheduleiu36.18.814.692“s Ind376 W with the stated value. BootBlack
Ifflnnomdmdcflculanednumbflswmwn

AL

Scanned by CamScanner
Scanned CamScanner
W
I ' .sgnt-OOMP)
a
5'17

ne w ”.
Input/omM

0%
Mlnmqm‘m

Y 0*“ .1“Placing
W-sw
‘ least fiequ-uy used (”“0 '_
“‘m“ b l w k m. m m fl m h l s m i m m “hell
onflwdisk. my my“: 3"": W and u .9,
hm“mfiwmfiemd
- “9:11!“t - Tofulfi llanl/t-mamm" ’ W
ne -
- (LFUunbedo”“3““: “HIM“. “mm
mmmwmmegtfifimn
Wismx W °"°k. . taruwdthm
V. mMS-DOSWWM“.
mm. “in. , mm (c) “ h i s . «diam
_ EmmMIsgpflofflleptw-m
“wimeachbloc
mined
an a block is mmsfened m memory, i n . Mummmwmh
(a) “W ~ .
- “WW-1e
. " “n'sl’mmm'm mmquestisfialfiu
Vin ed ofl.
. ,.wyno°uflt . . wfi r m h m m
mmammbdbloch —- fl n mngmmmwmrk “beak in! this each time It Is refinanced . own:
m g ,is a. “Wuhm
"mm-Humnwfiauspemlnlne
Wimhfi
yLAblockwith“1e
mmmrArauywmfie-“Mw
whammdisk
impmvg
. flf.‘.h..;m1fl1tedb “I“
D" II
. - The disk cache me em.
mummimxblodr- for rcplacem - mjm .
leqwissnfiaficdfmmk “ m . . . “ filmed Immnmvnymmflwmm‘
- "mywmmmflmflmlwfl Syllabus Toplc : Llnux
IIO —
m(mnchmk)mustbenmmuaflymlook
The property of locality of reference is “led _ ’ _ LWWmm-nwmm
y.
fulhehdblocbmdmockmumm _ When a b l o c k o f f h f a i s Pmnn mchet OU'PU‘ Window. ' " '
- mMfiMmdadhhcbm-Iflymlofl. “gel/o request, It IS expecledflmumhlo
omfln
6.9 mm In!»m Mmmmlminmmm
most
ckm . ‘
- n: 561 dim I: media high-end K3 at! needed In future.
k - y, k _
mmmmhMIhmyMMm

Ind sums. :1: mole intelligent about a- .


$11:t
M DeslgnIssues > . . . be - md.I'm.
- . very umilat RV-t whachwe “Wyvpd
mend-block. _ minpulloutpuns
- mummamorwuochmm

ltfingfllehw—levelfi .
“fl“‘d‘fmmfi “mule Il0 quantum
fiom.the d:s_k cache. that: arc two ways to
delivmh
dllamthedlskcac hetolheruqmgm
”W ' socinlesa
31”“
'alfilewi thmhllo
'
- m :m‘Hwy “
0"
09 I1
— Mammm mflamm inmmh
. . ,m

_ mnnir‘T It —mungmda innumm


ifioneduflhcque ma.n.m.
mmmnmmmmmmum. mamm' mmposgthche-d u.
Infixuapproach.me block o f d a m m b e m m l - n .150 mognizes Block. chum. Ind netwuk wilthein
mmmmmmm-He fmmthedisk cachetomcmory allocatedtoum (“at - Hamm ofmm dbhd m
mmmmmm num
"Mandamm
Thummunbemldmmplmachbldm
Dim
em Disk Scheduling _ mmu mm mm mm m “I m
— - Inseeondappmach,ashmednmmoryisusedmdn ' h
_ , w m udwr
— buweyenmd ilemqum
mmfisw
WWBPISedmthex-ightslotinthediskmhe. 2:31: ' '
schedulerlnux ' ' cdbdthcllnux
2 . 4 ls
wymmofflwmemm 'flfiskmfledu '
Wmflffmwmfing.
- Theseoondappmachsavethcu‘nwoflmy-w- ' 1a
' 7.6, the elevator algntilhm hn been — mmwfimfif‘m,
-
— Amhfiugmbdmislbfonm: may transfer and also permits shared mushy - In Linux _ . m a m ‘ lfwfi
n. m m m h w w m fl ' album Wbytwofimhflalgmiflmwfichmm
H0
mm?
mmumm.
In mmmu flmmm eeocmm m deadline IIO scheduler and the unfinipmty “mung;
_ in
Afmdm gnim‘m mmwm mwwd thunder.
allm . findings
Mme mu bad. TheW mull is "POM lo unsung block from disk cache. Awhmm 'y
- ”m"
OS. I: is required to create space for a newly M W °s-‘WThe Elevator Scheduler _
W“:
I m f m m y mA
dmm'”; D
sector into the disk cache. This is analogues '0 P" . hwmrfiufllt he
mminfomdnscsxmm
‘ _ “unusual
replacement in memory management.
”Plumb!!!
mm.“ Wm
~ “*GIEVator schedulers k e e p a s i n s l e w m m
replacement
After ward , ‘ A Page algorithm is required no mm”
d. . at whatevertun
loy al block 67. the
' : the "em m m least recently used ( 1 3 1 3 ) “ d M End
write mqucsts. .
request is “glued commonly. Imsa accomplishes both sorting and magi“!”6::
mad-huskythem mu“.1mg: Tins pohcy suggufi the: replace the block m m 0|: Hume. Usually, the elevator “hauler mm
- .
WTopicmhkcm he litt of Muesls gonad by block “W'
‘- leudes'inrornonmpedodorume wimI‘dcum“and
V Amckoftheblocks
6.8 9|.“t * ‘ Itlopofmck.
is maintained wil'I My
When a block is brought in from did" “"
me block's“ M
bottom of the stack is 1391”“ When a new Inquest is added to “W qua
onto the top ofthesnck. inco min g bloc“ Minions an considmed in ode! 1 My
- wfl' (I) Ifmemqu mismdw samedis‘ f_ 9016‘“.
“"‘fikof
Meal».
pointennomemmksmhelm-"'3'“ed “shinning sector to a mum
”mun

/
_

Scanned by CamScanner
Scanned CamScanner
.
6-19 Inpul I Uumut Mara ,
1 " ; mu-aemq-ugu
. . '(MU-M"OOMP) em '
_ Ifso. that request win he “Wicca V 77 Toplc : Operltlng WM'
mm"!
of mice mum “n ”wk
‘ ”"1
“”3m
such read request occurs. the sch My."
: m n m m Ww_
al the deadline scheduling algolflhm "sum.‘‘5: WW" oparaflng systems $.39" Issue ”Med to Q use».
W to ra su bm nfi .
nduler Page Cache a we. (ne'er section6.3)
bhckaprw.
eadhneI/Osd 6.9.1(B) Llnux
eploblmmcd
Totdwuhflns . ”plain logical stnmure of IIO lum‘
ekmqmubefom .. In Linux 2.2 and former versions, fol. .Loox mmmm-F0FS.scm'
mus Wm aaz)
qwkeepnlisto
fmqucsumnw from regular file system files and ref?“ ° Wm"
Bothmlmdwrite wm . Cache. 0's“
‘ . (Dogma)
hlheymi pages, kamcl had maintained a Page ' syllabus Topic: IIO Buflorlng ‘ LOOMTm
seqmnwinwhic Kc‘MWflr-wm:
qwtlsdafmlthlt ._ 1/0
formdandwfinem
block
A disfinct buffer cache for
— Expinfionflme 3pm various I/o bufferlngmy.“
und Sse oondsf orwme maintained by kernel. Wu .1,“ “Wilma.
isswondsformquu 6.4) (10/5 Marks)
endsoutmquutfinm _ 0' (mhrsg cfian
WWI-SSE, FCPS.
304".
mhmrflJcmwdulets 0n the contrary. in Linux 2.4 and in mm . ("W-
2015. Damn) 5mm“
mm.
unmedqwuc. single joint page cache is
intmdum which
E mm“ MWMMW
ubnawnyfiomflu
diflerem
”New What is IIO buffering? Explain typas of [/0
Omaleqneuisafisfieiitis in all traffic between disk and main “my. “I mam)
lbofiomflwappmpfiam buffering. (Refer
section a4)
Moflhcsofledqmumd — The page cache provides two benefits. 1mm M
mflmfiw
0.
diflyl’agesmneededtowritcbackmdkhi' Algorithm .
1‘q a- syllabus Topic : Dlsk Scheduling Maugham
ofmofunmo
Buninmifmeiwmndnhud thesepagescan becrdemdappmpflmlymm Explain techniques of disk scheduling. mam (10ms) Maui
esolfle rmm itsexpinflmfirngumnug 0.
quwfibeoom out efficiently.
Ma mm nw ndm fiom mn mm e' (Refarseatlon 6.5) (10Marks) (Nov. 315)
Emmmw (10um) MM.)
wimmmnm gem — Mud, because of the principle pmpeny oflmflty of uling Algamfim.
Wfimflmmumm c- sylahus Toplc : Dlsk Sched gums
reference. pages in the page cache axe mm]: m b: Ext-muses.“ (10Menu)
mummlhequeua. ' FCFS
referenced in mother time prior to they are fiushedfim (Items)
_ Aswhlequutissemomitiukomm‘m hm Exfllueefidz (10m)
the cache, thus saving a disk IIO operation. 0. Compare the folbwlng Dlsk scheduling algorit 0'
Wm a” -SSW, FCFS. SCAN. SyllabusToplcmMW
using appmpriaie example
_ Th: I II‘ [/0 Dirty pug“ are written back to disk in twosiumiom:
O-SOAN. LOOK. (Refer salon 65.1) (10 Marks )
0. mammuum
pmhlem and duo me and W Wm: — When free memory available goes below the specified (Du-2016‘)
man dmmmmmam
problem. dueshold. the kernel decreases the size of the pup hm -
" Syllabus Toplc : Disk Scheduling Algorit wmmmuamd
cachetofieeme mory to be admdtodwfie emem a.
~
' Wmam mu pool.
SSTF mmmmwfi
hposibhmmnmfimfln gambling
_ Sandmfl algonlh'ms 0 Syllamophmlsa ..
m — When dirty pages grow older than a specified W 1 fl. Gunman the foikmlng Disk
mmvfiflbemdkkbwmmmm using appropriate example-SSTF. FCFS.
SCAN.
anumberofdiny pages are wrinmbacktodisk- a; mafimmmfiw
_ “fibulbdpfinciplgofwwofnfm-
C-SCAN, LOOK. (Refer $8060" 6.5.2) (10
Math)
(Dec. 2016)
M1013
6.10 Exam Pack (Unlverslty and Review V ,. .,
_ 01‘3“;m Gouldbe
Questions) 0' SyllabulTOPh:u“"‘v°
ss11= disk schedulingmam
.G'""“!.Mmm Exphin
Q .. .
.p'“MKRWuwmm
mmpam in:
' a. www.mmw
3'
syllabus Topic : ID Devices (Relarsectianssz)
mm'°mihmcm
To c : Disk Schedullng AlsOflfl‘!"
I
rmmw-m.‘w O
Syllabus muumw"
ELEM
Wide-hug“ .. . 0-
Explain different types of V0 devices- SCAN pl 0. Wm 541W)

“Emu. ml "’Mmplemenbd (Herersecabn6.1) 0' following Disk whodufinfl 690$
. W °°mpare hepriate
[nu-"1,“. l' . 9-
Explain different palametavs to W IPPrO S- '
ample-55TH FCFMN”
Iald fllsplaudoVeru

“"9 )
W W devices. (Hefarsecfian 6.1) “CAN.LOOK. (Refarsedlon_6.58)(10(nu-JMC) M
whifldlflqlfllildimh __ °' Syllabus Topic : Organlznllon of “19IIO
mmcschedulings Function
mamdependin mm
gmmeocnfigm 0-
.. Dm ngfhxsqellyflm
fim “ W m “ ? Explaindifferent techniquesnoperm“"0'
eingoodchmce
m whhnumue flmlbe (Refersewbn6.2)
m nwin' W'
qmum EXPlfiin
0'
lhcnmelegiono
ffiecilkm evolutionary slaps of IIO
(Rehrucfionsm) all}
‘_
Businsbpslnomnnsfeunebrw
°'

Scanned
Scanned by CamScanner
CamScanner
commands 01‘
‘31““6 the Internal linux |ike IS,chdir, mkdlr, chown chmodI Chan!I P5 etc .
I
1Momma“ about the FIL
ES (the current direct ory by default)

Séfieifii’"
‘mficxfip
.j
: synapais'.l'og v
‘ .r synopsmdex
HATGm 7‘
‘ ‘texputagsgf -, “
itfiifl‘fipp“

Vldeos

changes the cur rent folderf


of the current directory or
(b) chdir: Displays the name

' . . esh—opuplex-3020 .,
Y6 ’
9”EM“. It create the DI RE CT OR ra'eSh
,
” @ m “h- ti'plev ~, diI J ,:
{@mlesh-optIplex—3020

grpA'lsppp- -- .;-
gr'pAZ-cpp-
' ' $94553???
' .‘GSmPP'..~=

Scanned by CamScanner
Scanned CamScanner
.sm4-COMP) ' I -, 1
Sysm“ H - -~ '7 ’ubu-m-IW ' '
Mann a
N“: IV top 10 Processes In dasundlngorder
I ,
'L./ A A
’1.” panes” inEmail“!

h-zfipin
1693070”.3 '5 expl
, Wnding older Is:
1° Winn
.10?
v' ppm PEI "I .VSZ" 5~
: 0 3 ) ?1 0 : 2 00 '5' _ (mo
: 0 . ‘ . v. .

31 °, 2 2 20 ,0' ' S
mmjdapfipmm' ‘
If 0 5 2 0—20 0 '1 <
m@njall-°P“Pl“‘302°:— ‘ 2
1- 2°
(em—n report-smsholomwm‘PM ‘3 1 v 2 ° :
rips " i 0 8 2 20 0 5
“@njgh—opfiplu-SOZO:
. :1. 0 9 2 400: Z S ,
‘ mm TIME. CM:
_;5366pul5 00:00.00 bl! j 0 10 2 400
snow/5 woo-no ps . ' 2 '1°° '
Imoi@mjelh-opupl:x~3020:
—S
links. (2)
(f) chm command is used to change the ownerInd group of files, directories Ind program
The group is a set of “Sets um sham the time ""D la m d
By durum. the owner of a file system object'IS the user um stated it. “ P Y Pmceeseuv nlhhl
1m:-
(i.2.. lead. wfileandexecule) formuobject.
mpmuiwons
x}‘ The basic syntax for usingchown no change owner:is
, . . >
f ’1 =chnwn [nptinns] neu_ownerofijéélb mal@fljesh-0P‘i91°x'3ow
is the name of thgmum-11¢.
m_nwmr is the user rum or the numeric user ID (011)) of flu mw owner. and object
lm@niesh<oPUP‘“'3mo'
f V ' 4 mm“!
with mm‘ éh3112.2.“
simultaneously. Display Pm g
dimmry or link. The ownership of any number of objects canbechanged
. [=l PHD mb/fifloxlfimbx
For example. the following would mater the ownership of a file namnd filel and a directory dirl to a ncw awn: Z22,27 1581 lust/“bl“ V
named slice: (vi-unu-
, 572;;
:05: ,urmws @l . ,
IE»:- dice m an ;'
:9 2:11:d lsusedtoclnngelhe gmup ownership oftheflle 2041 1581 Kit/13M” lusrlbin/‘I
or m a ' 1581
293:3 4
. 872 MW?"
;- Lamm: m . 1973 1816 -
clung“ lhe owning gmup of flu:file alum to the group xyL 1939 1816 7'

u. Write shgll sums to do the following : 20141581 l9 ‘ 4020.“ , ‘ - um
,_- h-opLiP I n ll
1- Display M P 10 .
process In descending order ‘> , Ml@nju “man! loss!““5“ and m
2. DIIpIIy processes with hlghut memory usage I v
3- Display current lagged
user and loginname ‘-'i
4« Display
current shell home d “9’-
currunt working direc'tofv [mm operating m type, “mm 935‘ “a
5' number,
”sway OS name, ”a“ kernel version
a. “Inmate the use of sort, grep '
, Ink, etc

Scanned by CamScanner
Scanned CamScanner
.a-spnmmu -80m4--COMP) I.-«

106:21
not ny_'l 2011090909:5 RE
INWBBR 0?106650020INUSEBSA
M”. cum MI! setting,
(4) Display current shell, hom
o dmrv. opening w w
dlncmy
."t
Winn“

. » Mflsmmmmddmnmmnflychmgeminwfib'mI If
’“wm”"%emmmm
W mdirectflleoutputlikndis
um
will m m fi k m m u m m m m
1
mwhi ch
will not display any oulput. but J
xhe output. use 1h:cal

immummw
ern , grep munamdinpmmmmim
wpri nt lines matching apan minivanPA‘HERN.
en-m inus (-) is give n as file nlme) fat linesMinimum
Hinge hyph
flammumh words only
ummdn
hw w w . m m m m m m
ch for boo, gap will matc m'
When you sear
tmm whnbwudlibmmhonlym
Wallyfllose lines conminingmmchesm
3m
-w "boo" file
“*Mlotdiflu-entwords
u""‘Pefi'l’cotmrmndIsfollmili
ii
'mdnwoxaz'lpnwwm'e
Mk

m m m
l”:
5m
‘2' I "
- , " . 1 ; , NZ: ,1», 31:,
3 ”www.mm
nmmmmh‘
.mmhh’h
Mm

momm- mul—
,
_:wmaM
.I’Mhlnlflle‘m “'m‘-“finml =r
' .

.mu'
“”5550!”
'

Scanned by CamScanner
Scanned CamScanner
Open“ W
(MU - sem4--00
child mum" ! In
MP)
unu x uslna the fork mu
using getpld an
L-6
m call. Fm... the
d germ,“ “s
Child

tamp “bobbin
Y Egg .munn System (MU-Se
m4.'COMP)
L-7
um

1
!
I3. (3) can a ID of dichlld and pannt by all.
an process .. open,
read, wrlu, ch“, “talc, , atFlu Mm. froma file dam-1pmM d h u m
mad
sy stem ca lls
mgm
0:) £1t
the follwllng
m
w... mount is zero. rudo rem «hum

mid, gang“. galliu


. mm .-
An!- ksymdl write to a file dam-Elm
wfi'fl'w
Mlnflnuxuslnlhf ym; wnm m Maud
(I) Mall]!!! 0n succes s. the num ber ofh
(mimm"mmnm-mmud
Wd“m wmmly
Gla!
Close- close a file (13c
doseOclosesafileducI-ipmr'
whinging. pm
ism aw my ”mmfltMMIuI-uuumm
on”: -1is mm me d.a nde nm
gap“
tion
Getpid - get process identifica

I
:wgqa) W0
returns
thepm Inof themm!PM
Sdlpld
Timon-mm»: epmwdwflum
A‘Einflfh'l‘ltemchfldmmawedbyfuk fifiéflm‘,mido); Se‘vid—
”Mowmmmmofm
Geipld
SIM Gemid- get user identity.
umDofthecmnpmm
1mm:Monfork'), Wdomtumnhenal
gatouId
Edi.“ *d " WPMOL ' erlD om : mntpmcela.
mmw‘l‘m Mum: the cfiecflvom
W “MM-fl;
1mm" P“ Belulid - gem-lac
wild
j; _‘ W d - gel groupide
ntity
fflwcmmpmeu.
ms themalyoupmo
W 0 muent . ndoulmuflum
ma
lm
flew-'9; Implem lndl of mm:Ilka Is.up
bask:comm
“-
'
52.1, ; Ans. -
Implement "cp" uslnggym all: m mmewmmd line
1mm“
(I) m, It mm
9"" 1- Fm: somemdaleuthe
check If bothche
min-ri
nlp"
mm
Win
m . “an! M
mime ' ma-raw:
”Wm" nholmimm
ckm .
WM~3M ‘_
counterisma
onl yfl- gse t.
” mom > m a g
Op efll hes oum
file wim md

e mauve m s! a m om In fl]:
e mm m
Open me wanna”“ fil :mini )_was?
-
Jam“ 3- mm; w to"m
w”
1mm Midi”:-

fill],
401° -> Tm
s
00"“ f“m m film—
”oM
.MWm o TRSRUNCwe file pemission('X
SJ XU
' cfn
sio ns for the
Math-k mdaorwm)
('X’ canbeRfm
rfiommwfile“ad
1h amant-I
mchildm ” d: cb ’ m m w m 4. Smdammsfe
'- Ma.’

09 -0 m calls- cm,Mm.
(5) Syste M - . ‘ ul‘d
tegld, gete
W"
”Md “Md. untold. ge
W open Ind .
mhly um; I file
WW0
. .- "“""“'=new fileand” -1if anm Occumd
(in which cm, mm is m mmpflam
ly).

Scanned CamScanner
Scanned by CamScanner
symmu -s«m4-O°MP) W
W / . Sam
a opafaafafll’l“ syswm (MU' 4-‘CDMP) Lg

out!)In , ‘ mm
‘{ fl V.. lcpcmd 5m.ktdeauixl
“FDA“ED'HWbV/filfl:
MOWUFF SIZEJ'
0P9“ in; file smut!:11a = 2 . .
amt
dmmwal
' iibahmdtdeufllumrweivedor—helpumeive I!“
MP“) fish an:
m!=3llwlll==
desfinalion_file\n"); call" “This program is I Iimumion ofthe Linux mild/0
pdnfl'flnUnpc cpcmdmagma bake a copy of your 513 and flinch-in.hulhmwfry
nand “P
, . Vamjmm; {tom one file in anotheris bundled ' > mm ' ., I "“mdmmmmmmh
' . }.
' " ' .-
Jcpcmdsmtxtdestm '
‘ rammfilc‘l
'I'
uFD-OPGI(IISV[1L0_RDONLY): madam: ‘ ' .H __
V‘
1'“.m inanimulnunnnflhghnuxmpymmmudep '
4)
WEED“—-= copy of your file: Ind (menial-i but here In
fileman ulhcris handlu i.‘ '_,_ , ,

WmmeWumo= «sawW W W ) ; (b) Implement “Is" command uslng systemnulls


qXI'L FAWN-Z]; . V ., ‘ .
#include<sldio.h>
#include<fcntl.h> 3 . =~ "1"
.#im:lude<sys/sm.h>
POpudatimtiouEleni!!!respective flay & modes 0_CREAT & O_TRUNCis to Emma #include<dimnl.h>
‘ In file S_[XXXX an:file minions for lb: unensmups & olhers‘l in!nuinGm “50,011"*ugvfl) .

hum wwmjkouu|o_cm’r10_muuqs_musnl s_1wusn l S__IRGRP|s_1wcnr|=r DIR ‘dp;


s_mam|s_(mnm 'mucl
dirent ‘sd:
dr=°9=ndir(nrsv{1]): '
.-‘ ifldufi'l) = = .1) whfle((sd=readdir(dp))l=Nm-L)
(
mmwm- s _
—‘H" . ' pnnll‘("%s\z",sd-->d;nanlfl)
dmfiflunmg ”I m llvmo): } .
closediddp):

)
'I‘Smdmuqm mfilom ' Output:
den file h'll V
) “WW=mm mm £3,113?” mm mot@]ilmus:/Iwm=# get:In
mat@liunus:Ihome#./mm dmnmfl', ,,
[.mfl.c . . calls
L; V, .m'flu.(m’l?“fi.nbmd) !.—. nbmd) V"¢° “"“‘" d"5m g_
hwfi'yflnf ,
. , PM" “Eliot,. in writing dun to ('3 Implement"
#include<fcnll.h>
‘ #include<ayslsm.11>w
r.
#include<dimnl.h> _
:‘int mainfim WI!” “Wm
'{ ',.
'
mm“
“Em m clam; file *‘wfilvfln §'_inn.rd1ad2; _
. ch-r ‘fllel,'file2.buf[2. '
Wok-«m; ==_1)
closingfileqawmm)‘.
.. a, l “3"" III
'aim —SUCCES)‘; ',

Scanned by CamScanner
Scanned CamScanner
L-1
0
09mm system (MU- Sam4 - OOMP) 1mm. erallnfl System (MU- 39m 4
COMP)
'L-11
._
‘ VA
>,,'|‘u.(;=md(ldl.bufil)>0) mn i [ fi ] = b l [ i ] + w l [ i ] ;
.-
;‘fiu(fd2,buf.l); . ,t+=wl[i]; Vv
* -
'
Mflél): nvm+=mlilz
22.1mm: pfinlfWPIWNVMWmum
-Jflhm 'Mfilnqm-
)
Mm):, '
:,_
DWI/:1;
“may:
mm-o mv.o|ll - ' lll/=I;
>H V Wm llnn mrm n1|m).
MW:M Primfc‘mmAvemge
nd
Tim:-
19d'fill-I),
hallo wadd- . a fl "\nAvernge Turnarou
, ,
iool@ldh5 lmmul fl [2 . . "‘ 0;
humus-m ‘ mum
V I L-
at“ No such file ar dilulory )
mm: SenI2 .
Schedu fing a'QOrithms “k F , output
helloworld M3020~ 8 9613M“ . --
lement any two CPU m1@njelh—oplipl£x—
l5. Write a program to imp e cps, SJF, MUM
ml@njesh-opuplex-3020:~ 8 Juan
_
20):5
Robin etc. Enter laud numbe'r of muscl(maximum
Ans.:
Enter Process Burst Time ,
(I) FCFS ‘ ~ ’
Plllzlo
Fromm '
' a
H215
MMudinh> PIS]:6
P[4]:8
limbo P[5]:'l
'l'mumdTm:

' fl m fi' "u(m


Bun!Time Wniling'l'lme

Pmcas
20m; P[1] 10 10
15
“Imam; Hi] 5
6
10
15 21
TB]
Bum-um; 21 29
$+T . PM]
PIS]
‘ a
7 29 36
Avera ge
Waiting Time:15

“WW
WWUH);

.3
Auras : Turnaround Tina: 22
Ml@mjesh—oplip1u—3020:~
$ ' . '

W1! 0
“M=o i ”Ililing “m3 Elfin;

”alum “ V #include<sldio.h>
TG=I;<93+:‘)" m
void amino
var-Hr.
[“6=0',j<i§+
'
+)
in:mach[20],;n1201.ml2°15\i-“'““=°""" '
float avulnl; .
“FH- =hm;
printEnler number ofM”;
WCM‘.&n):

mw‘l‘lfi. - _ ‘
'1;
m'ifi's'rmw primmni‘mer BuISITusk-
numb; eme') for(i=o;i<n;i++)
05§<nai++)

Scanned by CamScanner
Scanned CamScanner
L-12
EM Wmu-m4-oour)

otp
{Amp Waiting Tim=1aeoo
Mange Turnaround 'fime=18.
ml@rajeah-opuplex-3020:~8
;: }
V. A . (1:) Round fiobln
y will bem voidno
‘ l “101%; IIVIIiIing lime far5mma
I §-_,‘/Ig1amwdflngam
golfi=lfi<nfi++)
».
‘ mm ~ 91'):
:1 M=<ni<izi++r ENTER Ho wm mo mm
:«Jiintfc'v-WGil-m
mm
» ,-
I "mf'hlfily. 5 “”0“"
m);
' ‘ .
.,i {Wi‘1;i<=mnxpmc:i++).-
‘ , “+"iffl:
ENTE
&Pmc_m[i].m_fi-iw).~ , :7
I»; Mil-=o;mmwn' ”lw'llfillgfilu “m- ’
lime+=P_mc_Inm-hll

. . ,
f" \z n j;
Mi=o;i<hu++) m‘l’img “YW TWW WM

m["1=|fl[il~t- '
[/m
. "
W+amnm

mm, M“ M“W‘vhfilmm,hm
'v
IL.‘ .1“=(fl ¢ll)m l/n; ”-
“WW -Ma m

Scanned
Scanned by CamScanner
CamScanner
L44
99"
Law
_‘_ “by-hm
,
,' {
51-h
lantgwflhjo’
,
' I _, ,
, ‘fi_llfl“_fli&fi , , - M lmane . V ,2

9 5 ". . mmzolp. lzou


PM m» _> . .1 J 5
‘ ‘ : / _ ~ ‘5:
|’ en
3:5:buny[201.P-n'-y[201: _ . __
a: I l 2 . WWW-”"
Hr
»
.,_ ,;
W !
. . u,
V' “\mMemm-y
..
. ' flflnmm.”mummy; _ '0‘ .7
‘db“ I> _
. M",&nb); . ' ' v .
. . .1. .
1 .J' . flfEnm the umberofpmuuv');
gig! I - v- . . 'q
r:— -
_- ‘ W'kdmp);
' ' ' I .

g
.
_
-
7
. V ‘ «(,3

1 'Fhmm nu:siuoflhamy;
m-lfi‘ni‘-n<n-gdflk

Jifiafl. Jug a;
k
E'-' - - - :,. ( =1;i<=nb;i++)
'W ' ' ~-
Pn_ztflm__-r=h=_¢l:
‘ no.%d:'. i); , . ‘- -
, I V marcw".&b
prinfl'f'Black [fl);
‘ Wx
,
J.
. . .. ,
hw_nqq.hu_m—=m_m ,- 'fi
pfinfimnterflwsigohhepmwfl;
V I‘
. ’:=1;i<=np;i++) _ _.‘ ,I V . , ‘ T
im’mc_lrr[il.bu_lima<=0) ‘
k++:
AA
pdntPmceu no.%d:",i);l- .. '. ' ..
“ yfl ) ‘ _);m@
' %d".&p[fl . . fli-QH
‘, WW=4WW .
i‘(i==mlxpmr:) ' . I ‘
i=0:
Mi=1;i<=np;i+.+) f" .
"Mile V
,
W=1fi<=mpmcj++) mg=15<=nbd+fl :‘
VFianna Wailingtime[%d]=%d".j,Pmc_lflU]-M_lifl¢);
I l); I
., {. mmymb '
minmmwmocmwmcmw):
IvLIima=0; ( ~
"(mfi=l;i<=m'lxpmc;i++) if(lemp>=0) V
map)
'{ . V4
wimmwwmymm; _
‘ NWh'.P-oc_uqn.m_mne); mil-31"]?
' "m—"Wnd_linw+=|’mc_m[i]m_tim
‘. )llim+=Pmc_ur[i].wt-Iime;

.lrLfim="‘-fimd ' - , .,
- . , .

mammflvsmcswmonum= s as
11aqua;
’Pflnfl'MAVERAGETUflNAROUNDTIM ' ‘;
BIS-fi nun)“ mud WW)“
a )Imn
u. w u u a m n m u m “ ’ / '
Pint-Flt, wont-Hum Whamlc Plrflflonmg placement algorithms i

Scanned by CamScanner
Scanned
lab“,
.‘ mungSys MU-S em4-coM 1'17.

E
r,
‘ Systommu--Sem4-4:01.19) “‘6 \ H M‘M'vm);
.. 1,2,
:
3?”
' ‘Whoa ,
- -DJ» mmmunhrkmvwflj 2 , .‘ .
.
’ M=IJ<FWWMT=°¥+H ' ' 3 . {Mwmofmmm
WWWWW m : 0;i<p no;i+
award +)).
,‘ - 2 ‘
MM"
= Mi=0: i<_PM _o--i++) ”Man ama-am
‘M mix-spins“. ‘ [ Wm fl . pt m =hm;'
] <—= 0 J&& )
+ +ham > = mm

WW”: ~ 3 .II. on!


:" (
7‘ i.
‘ Ileana!W I M - -But fit :3: allocationb']_-
ism ='’ [1333]]! = 1;
up War m ‘
break;
: mnM’JW4 _‘ '
PM“. ' " }
. > _,
Em: Ibo sin of I]: Hahn-
‘moek no.1:10 ,‘ :.//aisplny allocluon dehill .
pfinlfC'hBlockmALsiutmm
mum'),
mud:no.2:ls
1“
MAE V , ‘ ‘ f m fi = 0 ; I < hm; i + + ) , ‘
‘ _ 4‘
no.4:12 c:{
'M
prim.“"\n%d\l\l%d\l\l",i+1, hum); . , _
Blink m5:12 .
mfln35[i]== 1 ) . " "
‘ F 4
llmfimlim
Emu-Minimum:- 5' a . pfintff‘%d\l\l\l%d .ulloulinnli]+l,pm{n
Pace- no.1:12 d" 2

‘ . '- print'Nol anaemia}

.
_

_
W ,A. A
4.
.
' 001.puinellol.hno,
21v..hswu
pm.WHOLMNM],u;
‘:5‘W=0;i<10;‘i++)
4i -
thy-Elf
' 0 A:
Wm='1= '
'-
1
" printfl'Emarno.ofblmks:'3; I
WM. Mm»);

V primfNEmmimrmwmm;
¥-M=0;i<bno;i++) '
~ . MM',&baiuli]):
< 1mm no. dm: ’9;

Scanned by CamScanner
Scanned CamScanner
- COMP) L49 “bM.
E] %mu§ 5mm 5w - som4 N
(0) mm at
Proumn
#mamacaiafléi‘- *I ‘ 1'’
In!III-ho j ,
gem-ram!Number om g,h:
op
. ='
‘ in!
{mm-[10]. black-r101. rule-[lo];
. nwn bcr_n(_filu. map.lop = 0: flaw-Ml plummetin
in!m,n. numbct_uf_bloch
file_nn'[10];
1min inl block_nn(10],
ber of Blochfll");
prinlIflnEnlzrIlla Total Num
of_blnch);
mnf("%d'.&numlnr_
ber»!FilmW:
prinlffflnlcr Ihe Told Num , .
al‘_files);
. mm!(‘%d".&numb¢r_ .
fflnE nler the Site ofth: Bloc kuh"):
‘ ,prilll ' ‘
o{_blnch;m++) , '
Mm = 0; m < number_
N°-[M=\|': 1);
Pfiflflflm III +
scuff”. filochlml):
}.
.‘ Marksman» mam");
)
Mm =0: m < nmnber_af_file|:m++
‘ .
Finfl'ffile No.[%d]:\l'.II + l);
tariff”, Elisha”;
)
Mm = Dun< unmber_of_files:m++)
‘ .(
HI! =
0;
n < unmher_of_b)och;n + + )

W_fll‘[fl]
Write a programN "Mme”
I: l )
.( .
9.. ,
W = bluish] -fih[lll]; Ans.:
‘ 0)
imam> = (a) FIFO

V “I"? < Imp)


{
Els_m[m]=.; _

)
mp=mm
laqolmmu omm-HW: 7‘
'- frfii;
mamm
V7 ' _)
I: 1 TflifiACfiWMma
-‘
- ..filM{-]=m for(i=l;i<=n:i++) - ' " ‘f '
M—“fflullfmn=l;
scnnf 96d",&alfl)i . »'
W=°; win“ WWW
.5 }
, V" ' '
WNUWGSEW
“Wmmfi;
(h!- = 0;: < “RULE“: m++§W

.
baslme_¢n1mn,menu[mm ‘"
‘Wfiaflu‘w
adm
”r u

“‘ A

Scanned by CamScanner
Scanned CamScanner
_

Q Opemfin Systemmu- Ssm4- COMP)


usnwnumWW
"‘ *
._”“..a‘""l;fdw"#m_ P911"
u&n0_oLP“5‘s): :
I?“
[w=0;k<mk++) Winn.“ 9““ reference strinw


‘ ( I ”£51: ‘ <nu_ W “M
rif(gn§l==ol
:?(u;,d" apngum);

Man;
j=(i+l)%lw:
fw-‘o‘k‘WHH i _ o'i < no_of_Imm a;++i)(
ovum-PH E.
I‘ 7. pineal!) ’ '1'

Euai 5 m i < 11031318895; 'H'M,


0‘
11-51 = ““32:
_ _ 0 ; j < nu_0L fflfllel; ++J)(
_ {adj-‘-
‘é' ml'rumcsfi]:~11—nselm)(
“1:51; “'9: 1
break;
)
)
“01,51 = = 0){
‘ 0 ‘ “ : o_'J < no_of_Iranian. ++j)(
“(Immcslil = = '1“
[nulls++; V ‘ ,
l‘rnmeafi] = Wm; ' '
1;
":52 = > ‘I J '
break;

“(mg = = 0)(
[15,33 =0:
{are = 0;} < motif-m” ”5“}’ .
lempfil"““ ' 1 ' ‘ 'I

m<k=.+i.k<-'° ”F’Hm
at(fnmesfil= WWW
‘ ”mm 7—4;: . _

Scanned by CamScanner
Scanned CamScanner
\\~
———w 313mm (MU -Sem4- COMP)
Winn

ungarstem(Mu-Sem4-00MP)

I o , [50}.c=0.cl,d.f.iJ.k=0
h-
W==o){
no of PBS“")'
firstCM" 8m); . ’nn’bmlflm
5,1,: m=hmrl01=
p 6 = 0; Enlfl' the reference firing"); 7 .
.m = o ~ i < m i + + ) . I
M=l si<m_nf_ fiams;++fl{ ..
sanf("%d"
81PM):
iftmpfil m“
>
mp5];
max =
pc- =1}

c l =0;
forfi=0;j <fi+t)
{
“(PIT=qfil)
0-6
= 0;j < m_of_fi:mu; +“*'.i){-V c1++-
mm):
. mm". ~

c++;‘
ir(k<o

'nlkl=l=[fl; :
k++; - -
rorG=¢h3<kJ++)
,_p.inu_r_('\iu'_.qfil).

c2[r]=°i
'L V ' (“6.11—1.1‘3-1‘)

“(q[.-]l=plil)
mate-'4’.'

Scanned by CamScanner
Scanned CamScanner
— —

z ’ WtU -Su M-o ow) ”5


5 s' mu fl
I;
MP)
L-24
V . , “sin! the cPu-orea dmo“ ““1 ‘L . ..
. tm
i EWW(W-san4-OO ’ 7 :
Iv"
awnflflllfli.
h'l'h “z"
sylmlm'nw
bId=:2[-t W'MM
‘ ‘
. “(pom-I») hmfl wlin k:
. , . Ans-5
1 the YASS simulator
( Dow nloa d

, m=m<tg++) ' hmdmww‘wh—simxom


theammo, the f llmwi
mm<b|m “an the simulmar . when yourun °
ngmn ppem :

Eb“;
Md=bfik
Hus); i=3
=
. *7
_ ) Ill

‘ A }
F
'} a
W0:<f;r++) 3 -
3.
if(e2 Ir]== bIOD
2'.
u-r'
n u-
f qlr1=pm= nm
u n- \
= wwmd'gw: D In ‘
} um
. I? II
_.

l'ng.
(I) Process schadullng ngpxmgdwdm
ms-Invetdgafi
Dr‘fi'aéé camIOpefllingsysk
s as giv en inth elink I/wwwxeachsim mg ‘m -
m9§~81mm Foll ow the slap
illnmmuhkp
flmdcompiling
einflflmmpil molof
Enteringmm ecod PUfimflmmdflfla
,

Sup 1 = nbenmbymeC
mdesoflul ilca ispmofm qm
it mmmum!” a y w n w d m m fl w w m fi l u w h k h
'

(a) You need to em tomanc o ' simple high -lev el some mama":i n ilmo‘fi
snl Bub
r. InW
g

um OS sim ulm dw. You


50t
mpilnr is Ible to 17mmin the cum“. win
ting the 00
u

ec
window by sel
the «mile!
To do this,open
n


shouldnow b51005
b
MNmuH‘HH

*

“Warsaw-s ,

Scanned by CamScanner
Scanned CamScanner
j‘ "’ *' ~
m m. : ‘ "
click“ m e m n o n S H O W . . . m B m A R y C o m m n m m
wm
7,, ,
mom . ”w."— ......... ‘ n . “u_\:\mflw
L; ‘ |
”meninuy CodefoeYrESrwindw
“"h'tnYuum...
. mmmn , 9)
-——
nus-0"
Dmcadelfulowmf
~
“—0 ‘3‘“ i
Mil man e-c f‘
W“-

"'0010301010000000001
‘0400010101020000002l010430010101
w

} z022fl0200440001010103110000010103
.1 ‘00010301050001050101!10000010102
1D03001C3F
a . . . . . . .. . . . w . . .~»

odnmismlinkonIMCOMPmflyhm
(I) Mmmdtonnmpikdfisiumduwmathemblemde.T
.“ 4 . 5 ; ” w.

~ .m-
oursomeoode.’l’hc
MCODEview.Makeahabitofsavingy
YmdmfldleelheoodequledmlhefigminPROGRA
nodeiuhownhelaw.
u“ — a x
.....
manna".
m w w w w zm m w
:- ‘ fizm
PUflmfllWE‘flamumiLTobuisfimw
nu—
g... ." ' ‘-: ' m:;
Stein:Loadingth:programinmmeCIn
m-fi -' ‘ Wmmgmm ‘1d “Fly-[gnu
WW
m

.1- uncheCklhflW
Wmm‘m"
‘ 0 ’ " " ' ° ”1:131 . mGnASSEMB om! mini! Iva-dill

H > I Mailbox. Now ,clic kon


inmymldytobemmd-
.
YW
w'
th:I DA D
Efmkinwww‘w
wm
discdfiwm"
WW”
HWMnmmflymd

000101010)
. 1,.5 .. V ,. ' ‘ 1‘97".
I made: “in“...
"MOMS !
cu. mus
“mum mam ”105101
Iii-play ”In“. ..
M m :
mammumumig

Scanned
Scanned by CamScanner
CamScanner
L'“ figflyfl
My». (MU. Sem4- cow)
ma hum-tar- mwmau—x uni-1s: w.

- 0 torn-0w“

mam
oumom
couple/cud... "mum an MI: 51.,
kph]
tum-n5 om cw“...
tum: aldumhmtnl: ummu an :15...“
nun-m..m no:
_. m x - x,-. ‘ Hg. M
n o uad- my o z can a . . . l : ; ,‘ .........
=odn
mm
winmnnydcvi-Iimjl‘ynudmmm
uploading
w.‘“_”
eimmmbelow
Now. it is very impomnuhnwollwnh mulu.
my follnw-upInflow)my gin nu: wmng
’ mm _
cf' . '
9": the exerci se from“I: beginning a
"“3-
1”; m 3 m. “ D mo.
polici esInd run theW inan:os imam.
um—mlmlm'h sup 4 : Select diffm m sched
uling lbs
"at - m'r,
6-3 : '- W “*4 w fl 7-
Make sure um Fulomb-fimw
(FCFS) option is selectedin d1:SCHE
DULE/Policie- vizvl. ANNA point
sun the OS mm; the lumen.
.‘~*“"" 7. III! wow! STAR T butto n. This shoul d
-
9m in. then click on 1h: PROCESSES
am 08 is inactive. To activate. window. F on the M ? views: RUNNING
‘ in Ihe CPU ' '
Observe the ' '
d You on View thep m list as shown In fig,L1.
SES during this perio
Hg.“ and the READY PROCES AE
3‘3
(57¢ 9- 207-7!!!59:?IIA'A'
or. 2'75" ' l CVJLi 5 ’ u m Yam"
Shaken-tepmcmfiumpmgnminmeOSsimma inlhe
. To qua-me OS simulator. click on the OS 0... button
We are now going to me the OS simulator lomn miscode
. The OS window opens as shown Fig. L5.
ml window

Inn-mnmdmnm

"I‘D—Inlay.”
unwind-mun
‘umm—nmmmqo‘

lump-M
«mum-M—Muah‘
‘1] I n "- v
I] Ill. 0 _
" 1
. . -~ a ‘ . » _ .
2 . 2 F.
.m,
it: Lu.

w m_— mm -mmr_u' -
~,
5 "‘ ' : ’ I fi w.,_‘
: ., ,, “ i v - I
‘U‘flh m.
nun— z
”E ,m ”_ , , ‘

Hg. L5
in lhc PROGRAM LIST View. Now that lhispmgmm is available
wlheos
You should so:In entry. tilled [£0m
i33- on the CREATENE W
fimumor. m:can male as man)’
im-
W of it IS we like. Yon do this by clicking
qwh‘h
Observe lhepmgn mheinnndinmemd
PROCESS bulton. Rnpcu this four Kim me four inmncu of
uwmdbymeREADYPROCESSEs View.

Scanned
Scanned by CamScanner
CamScanner




.
.
.
.
_ _ > H1
3' , mung system(MU-Sem4-coMp)

.
‘ .. ,

@MWW the usedThread:
fibfiat‘aflng System (MU- Sam 4 - COMP) '-'3° E'In . . c . _ . , .‘
lmkllwwwxeacmim'
Una/Opennngsm , , . ». . .

'
1( '- Iowmesxephsm . ..
humane mmmhfmnfl WWI- WLMflMl
3 rfnlwfiwgsourcecodemnummm
mmlflwiwwmwmem . Mi ,
CPU/OSsimulator.mmm

_
m gm:
_ M:&Fm§lfi
' ' »' V .7 “ W P . ‘ .
nmwfi: , mead'l‘esll

.
.
9 2
.1.d ‘ - .
- wrileln('lnlhzead2")'
I whilemie , '
5
:

Fig.”
#

log can be viewed from View


01: th: same lines select oiher scheduler policies and check for the output. The activity Sflpz :
lab. The activity log forRR scheduling with three processes is as shownin Fig.L9. wan-ins;
gnaw-um}: ......
Wmmmmn
nah-q
‘ ‘
uh mad! an m
. uglmlnPXn [maul-l :
uhll- tn- .1
mu =
m Lhnadfl :- undid
call. thfla‘l
malnvln W') =
s um. um wand .-
: ...u nub _ ., a!
BLU‘L'I
a n an.” urn-In! I n “in I"
oousmuo: 707) [ 3 5 0 : 09000000): Pllli' leldtl saw a: mo! 5:23: (Mfr-l SARI.
PIS-G“:
: a. loop will
0 0 : 1 9 : 1 2 “ . 93] [ 0 5 0 : 09000900]: P: : 1 lane: 3:“ ‘72: 5235! a n : [m:3‘l pure»
a n 1050: 000000001- r a m lung: 3:. a: READ! one“ [xenon-1 ”cu. 92:0“:
: use: 55000000 25:12:: a m a: ma! queue (xenon—z ylveh nun-
(”0: 00000500
ten: GGOODOOD n:- xmvmz szssscsz 51mm
[050: common mung ache: 3.: Six menu-Serra: N n o sun-In!
(050: #:0960060 Haazr luau: : puuc‘.‘ -.s nu: -: m xuwexdW
[050: 05050000 m ) moved um! 50 m 3:“: m: cm 0 0 ma xeyuuza m -
(050: 0900004: rq. pneu- i a n an - 9 4 : sec ...
[050: 00900000 900' qnnunion mm
[350: ODOODOOD III 5mm $5351”! mm» Inn “in. gen-rand
~ _' A . .
(650: OODDUDOO unsung sates: u n:s=—Cfle-hu=-Stm ‘
toso: waomoc Hazy Luann“ poker :5 h a : n: i
[ 0 5 0 : 09900353 in! “mud “any
... m: and an M 1.15140
'
“150: 06-011033 SETS Eek m 5 Pill} "'
31-31465) [ 0 5 0 : 50000293 In": 1'18: I 00:L‘.\‘ 3 | 0 : . 1 § 5 l m'Y-.
‘ mmM W 99"?“ v
3034950
”93-105)
[530: 0 0 9 '
[056: 066': w “a” “Singmmokmonlh‘
mfl'lomm“. W
, ‘ > _ .fl-' (guingb
4"?
JIOJ-SOS) [ 5 5 : 6650:):
- the ‘ .- clic '. " - an ace bum“
3193.59“ WP 55““w
(030! 09500:
p 34:I W window
consolemi) "5'”:by a: “Wk” - me CPU PROCESS
“nun-:2! mam
flap Make Why!“ by checking!” as... Milo“;mis“5‘ m.
1'“
.
) [ 0 3 0 : 0090062 9}: " ‘ SST-IS 1'03 m s fit; Window 5 ' “ 5 1 View.
[050: 0000099): unwed In. "'
- 00:00:05!

Hg.”

Scanned by CamScanner
Scanned CamScanner
umumuunl
we no
MW-Smpm
Hi1
Mmmmgmumwnmmmmumwhnn '
lb:STARTWMMHWWfimMMMfiWWMWHMImFug.L".
,,
SEW '31-.
n-nm hawker.—u
.“kcmamamwhichmnwmdmumommfuimlfimmmmmnmu
Asa—o.
'~—;.r..».:, 5“.“ é '
mflmm
m‘mi;“mmfilmmmfinuynmufiwlwmmaudm
I-‘h'w \«TN 12;"
nhh n...
O S - In. 0.... _
H as Mi"!
’ ”.
5: “"5““ “ mm
C...—
". u . _ C >... mwflmyouhmlw uloffowpimdmmm
‘ ”I: mvccodcandpamilinmnemedilwinda
: a g mme
mcmscNanumwogmmwlm
l.wmm 4.ww fuechnflheXn-nd‘
x.
é. us
u.
I: ' 1 "‘ yourgmph youcmsuu ctedin(l)m mdnfinuh lmfmmfifl
mflw
a
‘‘ ritwqm ccsof wmcm dc-
boy-.3 {our
, ‘
W“ ”a. one of [M mouth.
— , h“ D
_ n ‘
I : madinmcnwrylklw‘l’iaud‘mw
“ a
,
_ ”Gnu—nn-I-Imw
(wanna-twill

" Jun-Anna
F

—~
n; I . “
'

(6) Wk: PrIvcmlon


P

Fowpmummmnninglbynald?! hN.Tiur-:aholwmsmlfik(mlycmmd
each).1bcylmnumed R 0 m D . M m p fl d h m m p m - m w u t fl m m f w m d

Milforimlffmvcr.Wfldkmm-flfldklflmmhmflm
M'onfourpmcm Mathew
F

Rename Allocation M ”W

canal-0""
F

ae- q-n-uuoo
HQXOYHW r u ' “ “ ‘7'.
Non" “can“...
,
-

cud-gull." . .
"- m -
o w fi w fl m - u'; i
r

Now-witchlo “MW.“
g.

Cmmndnpkim
(I

memzocrt-ISTfume
lntltsClimULEE‘Lhm; MR5"
moscmomb- . me _ ”a
clICko“ . mM' W
umv emw utwm m fl
NI. .
mwmm
.

”I: hmm'kwhdw.mmafoflawingmaodchms kmwm(wnoow


-

”51'
maniac; °°""'
-
w

Scanned by CamScanner
Scanned CamScanner
F
P
-
F

'. E Nnasyslammu-Sembcomp)
has
F

W4 ~ . , “Mam
aWfiWS/s‘lmMU-Semf-OOMP) check
ed in (1) above? Ifyou hue“ then and N I}
m. Haveyougolndudloc k condition same as you construct have ‘
I
If.“
ock .. 4
(n) or (3) below til you 3:: I deadlock
“I! . condition. II. If you
to

d» above. Do not pmwed 00mm“


SSES" button In the System Resom
thcnclick on the SHOW DEADLOCKED PROCE

Fig. L14
1
Step 3 : Now thax you created a deadlock condition let us try getting out of [his condition :
they are both
I. 1 In the System Resources window. then should be four msoume shapes that are in red colour indicating -, ”_
”x/—
by another; ..... M‘ . . __,_,__. ,g - -
' allowed 00 one process and requested

' Select one of these resources and click on the Rnlcase button next no it. -#”"‘g V" _ “Muhaw-v " " .-

. Observewmishappeningmm pmcesm in was Simulator window. . ..—~’-‘“ , , ~ — " .. . . ,. - "”" —


___,..—-——‘
E the daldlock situation resolved? Explain briefly why this hclpedmolve the deadlock. 7-“
k ‘1‘...- .....
Rn—cmm the same deadlock condition (steps in 2 above should help). . /,_..’—/

i“ F ~ > _- . ,4 " .
_’ Once 1h: deadlock condition is obtained again do ch: following: In the OS Simulator window, select 3 l)loccss “is -_,/
',J/"'
«—
waking qucue in the WAITING PROCESSES frame. , _
Click on the REMOVE button and observe thepmcesses. - ' '
(P

,_ _..~’-—“/ - ,——' _..—<—‘


IL.
Hisdliammdmmlveupdeadlock. ’ VVVV , flag—’4
» _,,,,-— " ‘ , M _—__ , .r ~

- r“
" ” ,....
J/"’;
_,.4."/' ’_,—""

mum/I/ . ~ . / ' "”-

/—"' "r
..._.._-/
.zvmjfll. ,, , . '-

Scanned by CamScanner
Scanned CamScanner

You might also like