OS Sem4 - CS
OS Sem4 - CS
___—
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
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.
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
Scanned by CamScanner
Scanned CamScanner
MW 2 Table(i Crumb
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
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
: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,
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
/
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.
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
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 “
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.
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
Kn-neleanslmnlunwusl‘yschednlemumple‘ mud:
fiomlhenmepmongflflplepw.
0‘
mm. massof kernelumimm
is
E
§
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.
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
¢
21 Turnamllndlim efmn = ( 6 - l ) = 5
“— ‘mncrorm = (3—o)=3 'I‘In'nuulndtimaforPS = (l4—2)=12
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:
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.
Scanned by CamScanner
Scanned CamScanner
27:“
2'”
.5.“- Opening (MU---Sllll4 -OOMP) PM In!
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
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)
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 -
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.
(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
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 ‘
Scanned by CamScanner
Scanned CamScanner
mun (’40- :
E Mn! slam“ gMU - Sam 4 - COMP) 2-25 Pm Em andSdndulhl
‘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}
Scanned by CamScanner
Scanned CamScanner
H:
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
(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‘}
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.
——-‘
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
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
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
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
-
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! _|
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
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
Pm: 4 2 v ‘
b
SyllabusTopic m5 5 I I No.5
-
me a I ' 0
o
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
,_____—
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
Scanned by CamScanner
Scanned CamScanner
w '
. . 1 . ‘2
m
Vfimmmfmmnmm
w:
7
mnwm'ms'”mww
.
m' w a "MTM
#20
0' Implunentltlon of LRU
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
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
<
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
o
e
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
,
°
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 , _ !
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
.
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
fi
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
‘ unmmmmrywmbenpmdwimnnu‘.
r
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 .
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)
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
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
masses. .
tg.
— Aflucompkfionoflheemufion.evenflnughpmou
tenninalas, file still exist andollmpmsm
a
Scanned by CamScanner
Scanned CamScanner
5-2
wanna ’MU- Son-4- cum; 0 slam MU-sem4.c°m
1‘5:1file .. , , . gratin
“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
Scanned by CamScanner
Scanned CamScanner
—
.WA-conv)
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.
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
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.“
‘
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
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
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
- 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)
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. -
' 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
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
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
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
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
)=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
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
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
/
_
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
' . . 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
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.‘ '_,_ , ,
)
'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:
“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
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
.
_
‘
_
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
)
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
_
‘
‘ ( 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'
“(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
— —
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
ec
window by sel
the «mile!
To do this,open
n
“
shouldnow b51005
b
MNmuH‘HH
fi
*
“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
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.”
#
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 . “
'
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
.
”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
”
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 " " .-
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
- r“
" ” ,....
J/"’;
_,.4."/' ’_,—""
/—"' "r
..._.._-/
.zvmjfll. ,, , . '-
Scanned by CamScanner
Scanned CamScanner