Partial preview of the text
Download Operating Systems : Process Management and more Study notes Computer science in PDF only on Docsity!
RANKA U2-] Process Monagement Dae / me aN " = X| Process: _____1-[ 8 running inatance of a pxegrcin is called & proce veld cantons Hoe program cde cu rent activity and awenourtes required for execution. “max stack heap fe) text | Process In Memory {1A process state shows what a process is doing ato gven time. oe S) \ the OS users there states +o Manage and control proces execution. (New) len nated) Admitted But Tnterrupted og (Ready (Rurnina) ee AK Schedul | a er / dispatch lo oy event t z/o oy event let completion wat (waiting The jarocess if bering created: “ TE Pa ing yet fn dhe ready Quiet e— ( . Readu' re) { -lThe process is in natin nemorny and wating forthe CPu- to \ Tk_is ready Ap wun lurk not executing yet { 2. wunning: 7 i} The prrocess_is currently using Pe CPU - 4: Only one precess perc CPU core can be. To thts stake. : 4. Waiting * { i-|The process _} waiting far an event like T/0 completion. 4 ie T+ cannot win even i, tne. CPL ta feo: i 4 sl Terminatied. Ihe process has finished execution ox has heen killed: ts resources COU memo) are velearsed and the pacer ; contro) lock (PCR) ts deleted. hx | Process Comin) Block Cac): ' Pointer | Process Hate { Process Number 4 Program Counter ( CPU Registers { Memovy Allocations ’ Event Informahon ‘ Lust of Open Files f r : f —___6:|Memoru Allocations —______1] fontatins fnformation ahort the memory assigned iL Tncludes> x |to the process ma) —_——|Page tables |Seqmernt tables CE paging ox seqrnertal “on -|Baae and limit n rm evs (for _m emorys prot echon) td Lided)- tLevent tnformatian: SPRRRRRRKARKF Stoves cletails about the events the process Ls waiting for, like I/O completion or respuxce cvvailalally. ha = iL Helps the. O03 wake. +he_process when the event’ OCCU - List of Dpen Filer: Fee? Le if -| Maintains a Link of all files Wie Process has openad i ———}}He_teto\ a Includes tile clescriptors and pointers “tp system-wide e [Scheduling Queues: J | ae Te dato - — Tob Queue} ———pReady Queue f}—P(C PU Ext > Queue Inpur/oulpuy fe —__1 Lo Wasting! 1 1 | 1 I | I i i 1 1 I 1 i] | eas *Prereezwreneeit® fi 1Sdneduling queues are daka struckures ped by the Os to manage process en waiting For CPU or other resources. . They aes processes ih “diPlerent State, cond hele tn process chedult ng and exeustton contro). winen a_procesa Os created ,ibk is placed ing queue bared on_its re -1 The OS correan ges rYoces er tin no quiets fou oviothy or q ¢g 4 axxival time - d Ihe CPU scheduler selects a process from the. bead, Queue Sov execution, and i, ibs intermupted, cysea hack | bo ne Quewe . | Mi- Processes, keen myo fing beturcon Oe es nt} they Finish execution. VAG Scheduling Queues halt dine OS dectde which paces should run ide 2 wily ats Supports coultiprogramming ‘uy handing multiple pracesses ak once- Schedules : lSchedutlers cure components that decide which procera SNould yw at a Sven: Hme.- iiTheu manage prrcace ss exe cubioyn by Selecting procores From queues dna osianing CPL or other TODO COA: ite Inere are three -yjpea~ long term scheduler, median ern sche aluler and shorter Scheduler. Tupes of Schedulers : a Long Term Schedutey (Joh 2 Sth edu ler) a Process ul Medfarn stem Scheduley (Swapping Scheduler) roo Shorb Texan Scheduler ( COU Schedulew) hyi* , ee ee eee. Se Medium “Term Scheduler | Suspend, ed and | Swapped out queue Long Term ScKed lev Batch Toks - Lye Batch \y Ready Short term scheduber queue a queue “Interactive Suspended Programs Medium term Queue Scheduler OifPerences betve D Liypen of Schod bers: Long Term Med? um Term Short Term é Picks Lap joh from pool and \oads into main Remaves proces: from Imain memory and Selecks the Jobsfprnceses which are ready + memoru foy_execurtion! reloads When vequived. execute from the read Auewe fe allocates CPU ‘Ben. {Tk (s Job scheduler. Scheduler Tina process Wapping. Tk is Cpu scheduler: oo Wis Frequen cu of execution Frequency} of execution Frequenus of Px eruhim Rs low is Medium - is_high- dg WV. Tt oleale with main memo Te deals with main memo For Yemoving processed Te deale with CPu- land reloadin| wheneney required. fox loading process. Tk peducea the clegree of Provider ‘len conbol over Tk controls the Clearer of multiprogveunm fing. t U 0 multiprogra mming Vi Minimal 1a time sheting Phsert/mininul in me Mainly usted fn time. hates SUptem- g chaving _sustem. (rr Sytem. 0 ~Tintewapt or System Call | + Save stale Mato PCBo idle — [Reload Stee From PCBA errr; :T idle Intewupt or System Call S Save Slate nto PCBs Reload State Hom PCB. Fxeusting LO Context Switch Le the < process of saving the dlale of g Hu ing _prncen> and leading the. ae. anothey (rocens - LAY Lithia allows CPU_-+to switch between mulbiple psn endl su 4 omuiltitarking - if-\alhen a proceas is int. exaupted or spl ting the OS Eaivo the Context into tts PCB. [The 0S thon locds the context of the | hect_process selected by tne CPU scheduler: : This mavichren updating CPU registers Memory sori and the program Cou ntey of the. neuo proces [Biter the susttch tne C “ process from where tt left off - i 4 Vit: Forbetk. auddehtng enabler multitasking & mus ogra 4 vit! Helps the OS manage process enecition Ulead. & 4 Shared Memon, Si Yate cn: Sinatred Memory Qyolenn i an TPC meted where ulittple. processes “niteeten a_commmen memory wegion . Alou Airect data_shoarxing lbetuesn prncessea J without needing to Pass message. ant IOne races are a_shared memory segment. Ww:1 Other mrocessea can attach to Uta seqmenk Lina Se Ba a @& &@ a a using. s\ysiemn_ calls. J¢@ a_shared memory LD prowicle od oy Ling as. -lPfter catrachment processes Can read From and 4 write to +Hhe Shared menacny Aiyectta using | pointes © ‘Ihe shared memons remains bieatada unl ih € ta explicitely remove re Eh alien Rae data shaving. ti{Lsed TM real-+ime. systemc and pecalld Procuting Message Passing System: TA A an Pc metnod where. processe communicate TTX oloes At eq titre shared memory. uy sending and arecoiving messages through the Qs. wi One process eerie omerdoge using the send C) eis se call , and ne other received tt using e hecoivel)* call. , Message passina works LWidhnout shared memory eT PrP riiee ce using ribsthors to tvansfer dala Wbelweor pracedies ‘ Ne Tn ot eck communication, processes Must 15) each : vi other's process ADs fo exchange. TOCAIAD 04, - Tn treliver’ communication messages are sent Vit: Hthrough a mailbox or a Queue. . when “processes cannot shere memory. Vili 4 g 4 Messages comtaiin_clerta_ or signals, and are used 8 4 _ Used tia _clfent-sexver models and distributed systens. RANKA. X | Diflerence. between (frances and thread: Porameters Process Thread ‘| Definition [Bin executing instance | A subset of g of Oo Program. Process Te IMemory. [Has Separate smemoxy Shares memory with. 0 Spare other Yhreads. Ui. lCreation time! Slower Eber “We Contox + Sho wer ashen Sutthing Ve Security. More Searme Leys Seume vi-lOuerhead | Move Less Vil: Dependence Inclependent De pendent iit Example Running tuo different [Tabs fa browses Qypps like Chrome and lala) ‘cunning aA +hveads J under one cele ae ia S } copa : ne &) ©) &}) | CcPu) ge (cru) &] Multithreading Models: © lMulthread trig ita dive abit, ofa CPU de exeriube, moultiple Haveacka within a single procixs at tne Same tme - lA miltitareadiag. woocdel obefines how murer thn eacdksa cure capped do kernel Hireadn for executes, by ane OS- ‘Ok There. cro roe sy pea of mulihrencling models: : | One —to - One More! ¢ Manito ~one Minalol “(nA cunt bo. —NAcuny Moscod x o * | One-tr-One Model « Whreca, i [Thirecral Management rs hanalled oa +ho. OS. ! ibe Advantages : Cop" vein tre abs ih paral on multi pple CPU: Has fast weapon - ve [Dadvevebzaes: How high overhead. OS can handle limited tivend- vig. Une in kindows, Linux ote: PAGE yp |} User thread 2 S («K) () (Kk) Ck) <— Kernel Head - *Many= to- One Madel : Here, manu User torendls are 00.2 pped to a Singte kerne) thread - J Th kead management is handed tn userspace. i S exalt ‘H| Bava ntoges: Simple to manage Tread ral and gw¥- hing tds “Yaad « Ve Disadvantages’ & blocking thread Atops all ; otner Mnread sy oloean'e Aupport_f paral elism- Se uel Liked tn older thread -Itbraxies dike Coreen Threacls On Solaris - ae ow ow ye (kK) <— Kernel Thaead CePeSRiaegaegeaana- ; < User threaal * | Many —to-Man iy naods hl’, [Here many UStic Yheeads are mapped to Oo P malley or caual number af kernel Mnveads. (The thread Horan moananes‘ user level threads, and the kernel manages ermed ~ level Ipveaols - iii.| Advantages > Flex§ ble. aval efficient 7 A_blocked thread te doar Sop all_other thrveads- * (| Disadvantage: Mone complex to implement Has iat performance iksuss os Ellelelmeaemaerbe a | Bt 4 g | 22) | Dean: Dela s_ execution fora Apeci}ied eunourd a] ‘inne JE": Lised 40 pause belweon commands- tl Sumtoy* sleep umsBer Csurerxs | (2. cope: ss seconds, m=minittes,, h= hours) ‘wv Eq. sloop 2M q P edt EY: Crd» erxeention anol returns a uat+a tian Def”: Terminatea a sholl Serdion ox sc xipt- Crocle Ato tne calbing igyo cont. Ti Qimdn + exit th] le Pie lele toe &@ & : ane exis O Z#Ends Sesrion ufith slotua code O(Succespre & 6-Ito & 1 peph: Displays vealtime. info. about canning © processes and system Waéouyee Usage. £ WIE Montes CPU memow, usage, process priovicfy,th. i a) g 7X eG ve Syntax’ “Lop : © We Ea. to tf Opens We prcen Monto - é FA-| nice e “1 Deym. Sta cosa With a apediied monty: bs (HHE" Contvels scheduling paorihy’ lower nicanea= higher pie ike Suytorc: hice _—h Lavciten el chhavhnind ; WwW fq _ nice -n 10 Muproaram ; be ke li