0% found this document useful (0 votes)
77 views35 pages

Operating Systems (Ask)

Uploaded by

Tarun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
77 views35 pages

Operating Systems (Ask)

Uploaded by

Tarun
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 35
QUANTUM Series + Topic-wise coverage of entire syllabus — in Question-Answer form. « Short Questions (2 Marks) I I www.askbooks.net A.S.|K. Always.Seek.Knowledge All AKTU QUANTUMS are available * An initiative to provide free ebooks to students. * Hub of educational books. Ul CR UCU em COE} on this website are submitted by readers you can also donate ebooks/study materials. 2. We don't intend to infringe any copyrighted material. PCa una cr ek air DR ee Ar ee ORR RLS Loe PWN ehh inane A. Concept Outline: Part-1 20 B. Long and Medium Answer Type Questions 128 (1-98 to 1-208) (Computer System Pele eyes me hee re nae rai ae oe ee 2g ee CONCEPT OUTLINE : PART-1 + An operating system ea program that acts an intermediary hetween user of computer andthe computer hardware Function of operating nystom iL Procstor management ed + Thefeatur fateh system isthe ack iteration between. the ser an the ob wie tat pbs eceuting Ami procezor ina computer sate with wo or mow etal frosesung units, with each one sharing the common main A. Concept Outline :Part2 1-98 B Long and Medium Answer Type Questions 1-108 11 B(CSITSem-4) ——=— s | ‘Long Annwer Type and Medium Answer Type Questions QeeTT | What i operating system ? Write the major functions eer] 1. -Anopriing sytem aceon an intermeayIneven he wer of 2 carpi ee onopsar bare 2. An operating pom sofware that manage the compute hardware, 4 The hardware must provide aproprnt mechanisms to ensure the tarecopersuonaf ie compete tem anda prevent sr progratcs ‘from interfering with the proper operation of the system. a neti of an operating system “Tom opertng em perform he ing uetons Operating Systems TSB(CSIT-Sem.g 1. Booting iL Uses diagnostic routines to test system for equipment failure 1A Copies BIOS (Basie Input System) programs from ROM chige tp ‘main memory fi Loads operating system int computer's main memory. 2 Formatting : Formats (ntalizs) diskettes so they can store data and programs, 8. Managing computer resources {._ Keepatrack flection in main memory where programs and data sre sored (memory management) |i Moves data and programs back and forth between main memory snd secondary storage wapping via partitioning using foreground snd background ares, and using bufers and queues. 4 Managing files Copies es/programs from one disk to another ii Backup flesprograms 1 Brass (delete) filesprograms. ie Renames files 5 Managing tasks : May beable to perform multitasking, nul-programming time sharing cormult- processing QUETRT | Describe the classification of operating rystem. on Write down the different types of operat ing system areas follows ‘This type of operating system was used inthe earlier axe To speedup processing, jobs with similar needs were batched together and were run through the computer asa group. ‘The definitive feature ofa batch ayetem ithe lack of interaction ‘between the user and the job while that job is executing. 4. Inthis execution enviroment the CPU is often ile 2 Mult-programming rystem 4 Inhis typeof operating system, mre than oe program il resdeintoraia aemry The operatingaytem ick and begins to excste ne ae eb inthe menos, Computer System 1AB(CstT Sem ay ava walle tak operating © Eectaa yaiaher to another band exeetes it * ‘a. Atime shared operating system allows the many wsersto hare SA tinea epee coh arith saline 4 Real ine operating sem —e aout rem aspc pre persing ie [STR wn svat ine operating wt Haare eet non rel ime snd rf ra time period ‘pier =a peers sito sats Sees gem a “a Pate ton Di pean nd of el ine operating 0: TiNol| Characteristic | Hard realtime 1 [Reaposstime | Hardvequired | Sotdesied | 2 [Peakload ——_) Preditable Desraded performance eh [Teenie ops | Bavironment aml satay] OReneritieal | Noweitial 5] Smet atafies | Smailindium | Lange 1 | Redundaney type Active 1 Ghecoint recovery 7 [Dasioteriy | Short term Long-term 3 [Errerdetedion | Astonomour | User esisted ee ot) a _ ae ee Properties of time-sharing operating system 1. Uses CPU scheduling and multi programming to provide economies] interactive use of a system. . 2 The CPU switches rapidly from one user to another ie. the CPU shared between a numberof interactive users, ad 3. Instead ofhaving a jb defined by spooled card images, each program reads its next contrl instructions from the terminal and sutfar n ‘ormally printed immediately on the sereen, Properties of real ime operating system Leal time systems are usually dedicated, embedded systems. 2. They typically read from and reset to sensor data 38. The system must guarantee response to events within fixed periods of time to ensure correct performance. Properties of distributed operating system: 1. Distributes computation among several physical processors, 2 The processors donot share memory or clock, instead, each procesor has its own local memory. 8 They communicate with each other through various communication me a i. Multi-programming system 4i,_Malti-processor system i. Multi-programming system : Refer Q. 12, Page 1-98, Unit iL Multi-processor system 1. Multi-procestor systems have more than one processor in close ‘communication. They share Uhe computer bus, system and input ‘pat devices and sometimes memory ‘2 Immulti-processing system, iis posible for two processes torus it paral 3. Multi-procemor systems are of two types :aymmetric ut-processié fndasymmeteic mult procesing. ec L-GBICSIT Sem) Computer Sytem ‘Ingymmetric mul procesting. ach processor runsidentical copy te operating sprtem and they communicate with one another {needed All he CPU shared the common memory 'b In asymmetric mult-processing, each processor is axsgaed a secifictuck Itunes marter alae relationship, GaeLe | Explain the following terms clearly i. Malti-programming. tL Multithreading = i Multiprogramming Refer @.12, Page 1-8B, Unit-L H Maltthreading 1. Mul-hreading extends the idea of mul tasking into spplistions to wecan sub-vide specif operation within ingle appiaion Into tadiidl threads 2 Eachof the threads ean run in parallel 4. The OS divides processing time not only among different “pplication, but slo among each Unread within an appieation, 4 Tami headed program. an example application might be divided into four threads aur interfce thread, data isin thread, tetwork communication, and a logging thread ‘eran prioritize cach ofthese, stat they operate independently. ‘Thus n multi-threaded pplication, multiple tasks can progress in parallel withother application that arerensing onthe stem, WaEET] Write down the difference between mult-processing ‘and mult-programming operating system. Taswer | SNe] Multiprocessing Multi-programming 7 [Multiprocessing refers to} Mult programming keeps several of taultple| programs in main memory atthe t same time ty| same time and execute them coacarreatly wtlng single CPU. Tse single CPU. 3. [te permite parallel processing | Context switching take place Operating Systems HADC8I Som Less time taken to proces the] More time taken to ob, ae recess te] It facilitates much effcient| Loss efficient than muir] utilization of devices ofthe | processing. : ‘compater system, 6. [Usually more expensive. | Such systema are less expensive] PIB ese tks cacerences eiwoen aymmetsts ant symmetric mal (ARO ADT a] Tower] Basia ‘Symmetric processing. “Aaymametrie multiprocessing | _ multiprocessing T | Architecture | Allprocessorin Allprocestorin symmetric symmetric tulti-processing has | multi-processing may thesame architecture. | have same or diferent architecture. 2 [Communication| Allprocessors Procators nec nto] communicate with | commoniate a they fanother processor by a | are controlled by the Shared memory. master proceso Failure | Ua procnor fal the | Ia master proenor computing capacity of | ful slave earned ‘Beupatem retune, | tothe maner ocean ty enntinue The exeeation. It « Ave procera fan tn awitshed f@ ther proctor. © | Bese | Symmetric “Anymmetre multiprecesiorie | multi-procear is fompiex Simple BRRTR Wont soating? on ‘What is spooling 7 What are the advantage of spooling oveT battering’ mai Computer Systom L-amicstTsem-) ewe | se POOLING ie acronym for Simultaneous Peripheral Operations Online Spoon refers opting jbe in buf, a peal are in memory oF SpeniN ehore a devi tan acces Unem when ti ready cote) desteces ‘Fg. 1.94, Print aootng pooling useful bocause device access ata diferent rates, ‘The butler provides awaiting statin whore data can rest while the lnwer vie eatchee uP ‘Themis common spooling application sprint spooling. Ta print spooling, dacuments are loaded into a buffer and then the printer ple them off the ble at ts own rate, 11 Spooingsalso used for processing data at remote sites, The CPU sends the daa via communications path toa remote printer, Advantages of spooling over buffering: 1. The spoling operation des dik as avery large ble. 2 Simin chi forying/O operation rom hit os WaTAOT itverentiate between batch procesing rstem and sli programming este wil example ra] [Hi iateenioee | eer ee| Oe ES eae tele ee er Fe cA paciandar |eemecenncageeeenees Sst to the computer | programming operating system Snertrin the formoft,|Fequire more” rophiaieated| pndlngngsthn Operating Systems execution at time, any time critical device management is not required, which simplifis the 10 management % [Only one program ie io __ 9B C81T Sem. Multi-programming system allow sha deve anne mali ue more “sophistieated ‘management is required. "| ‘Since files ar also accessed in ‘serial manner, a concurrency | fontrol mechinism for fle’ sccess isnt required, making fle management also a very simple matter in a bateh| operating system, File management in mull programming operating aysten ‘must provide advanced protection land concurrency contrl methean Program exceution | wee renee eae | The users are not allowed to interact with the computer system, ‘The programs shouldbe shed jin such a way that the CPU Femaine busy for meximun| amount of time 5. | Example: Execution oftsh files such a5 autoexec bat by the computer. Example: Interleaved excuton of two or more different and] Independent programs by the ame computer PART-2 Operating System Structure, Layered Structure, System Components, Operating System, Services Reventrant Kernels, ‘Monolithic und Miero-kernel System. CONCEPT GUTLINE : PART-2 + Structure of 08: i Simplestracture | Layered approach | ii. Mikerels | fy, Modules + System components + 1. Memory management 4 Processor management Sk Device management jv Flemanagement ‘GaeTT] What is an operating system ? Discuss the operating system structure, a Explain layered structure of an operating system. Also explain Exfuntages and disadvantager ofthe layered approach to system design. = Operating system : Refer Q.1.1, Page 1-28, Unit Structure of 08: 1. Simple structure :MS-DOS written to provide the most functionality 1 Niedivided nto modules, 1 Although MS-DOS has some structure its intrtuces and levels of ‘inctinality arena well cparated aby sera eee lent rem progam 2 Layered approach The opersting system is divided into a nu Sie rete amie teeny hardware the highest (ayer N) isthe user inset Oy With modularity layers are selected such th (operations) and services ofonly lower level layers layers < ning 8. Micro-kernel |& Moves as much from the kernel into “user” space communication takes place between user modules using message passing. 4 Modutes : Here the kernel has ast of ore components and Knksin ditions! services either during boottime or during runtime, b, Such astratogy uses dynamically loadable modules ands common in modern implementations of UNIX, uch as Solaris, Linux, and Mac OSX. ‘© Such a design allows the kernel to provide core services yt als? allows certain featuresto be implemented dynamiealy 4 ‘The overall roslt resembles a layered system in that each kerel section has defined, protected interfaces; but it ix more Hexble ‘than layered system int any module can call any oer module ‘The approach i ike the micokernel approach n that the prima"y ‘module has only coe functions and knowledge of how to load a (CST Sem) Compter System ner Ee communieate with other modules; bu iti more ficiont, because formar do ot need te invoke taesage passing in order Advantages 1 Thomaia advantage of the layered epproachis simplicity constroction td debasing 2 The layers are selected so that each wsosfantions (operations) and ferviees of nly lower level layers, 3 Thisapproach simpliSes debugging and sytem verification. 4L The is layer ean be debugged without any concorn forthe resto the TRiiees because, itusee only the basie hardware to implement its fines. 15 Once the ist layers debogged, ts corret functioning canbe assumed Swe the second layers debugged, and 0 on 6 fanerror is found during the dobugrng of particular layer the error ‘ast be on tha layer, beause the apes below taro already debugged 11 Ths the design and implementation ofthe ystam is simplified Disadvantages 1. The major difficulty with the layered approach involves appropriately defining the various layers, Becaune a layer can use only lower level layers earful plantings necessary 2 Aina! problem wit ayred implementations that they tnd tobe ess ‘iicent than thee types Ar each ayer the parameters maybe modified, data may need tobe paseed, anon on Each layer ads overhead to the ‘tem call the net real isaystem call that takeslanger than ne on ‘non layered aystem. ‘These imitations have caused a small backlash again layering, Fewer layers with more fnctionality are being designed, providing most ofthe ‘sdvantage of modulariaed code whl avoiding the diclt problems of layer definition and interaction TR oan cpernting stem 7 Deine thncomponents of operating stem, RTT Ma] o ile cance tes Operating system: Refer Q.1.1, Page 1-28, Unit. eeearene Components of an operating system are : 1, Memory management [An operating system does the following activities for m parating, mer ‘management 4 Keeptrack of primary memory, What par ofitae nay whom, what pat are notin use, In multi-programming, the OS decides whieh process memory when and bow much ¢Allocates the memory when a process requests it todo so 4 Deallocates the memory when proces no longer need i er hay been terminated, 2 Processor management : [An operating system does the following activities for processor ‘management ‘a Keops tracks of processor and status of process. The program responsible for this task is known as trae controller Allocate the processor (CPU) to process. & Deallocates processor when a process is no longer requited 3 Device management : An operating system manages device communieation via their respective drivers, It does the following activities for dev ‘management ‘Keeps tracks of all devices, Program responsible for this tasks ‘known as the UO controller 1b. Decides which process gets the device when and for how much Allocate the device inthe efficient way. @ Deallocates devices 4 File management : Anoperating eystem does te following activities for fle management |. Keeps track information, location, wes, status ete. The collect facilites are often known as file system. bh Decides who gets the resources. © Allocates the resources, 4 De-allocates the resources. TRGTIBT] Detine the services provided by the operating system (are aorea ark) —$—<— ne vl ge Computer System B(CSTT-Sem-) Explain the services provided by operating system, rea Some ofthe services provide hy operating system are as follows 1. Program execution ‘a. The purpose of computer aystem isto allow the users to execute programe in an efficient manner. The operating system provides an environment where the wser ‘an conveniently ran these programs ‘Torun a program, the program is required to be loaded into the © RAM fist and thea to asign CPU te fr its execution. 2 WOoperations Bach program roqires an inpst and after processing the input fubmited by usr i produces output 1 Thisinvolves the ue of UO devies. The UO service cannot be provide by wsevel programe and ust be provided ty the operating sytem Filesystem manipulation : ‘While working onthe computer, generally a user it required Inenipulate various peso files ike opening fle saving Ed deleting «le from he storage disk 1 This animportan task that lo performed by the operatin A. Communication ‘Operating system performs the communication among vario. types of processes in the form of shared memory. 1 Communications may benplemned va shared memory: in whi moor mor processes ead and write ashared ection of memo tr macoage passing, n which packets oration in predfin {rma are moved between proses by the operating eystem & Brrordetection: 4 Themain function of operating system iso detect the error i trad sectors on ard dink, memory overflow and errors elated DO derces. 1 After detecting the erors, operating system takes an appropri tin fr conmntent computing Operating Systems inl “ 6 Resource allocation | Inthe multitasking environment, when maltiplejobe are rag, raat isthe responsiblity of an operating system tog She required resources (ike CPU, main memory, tape dr tee rile Strageete to ach process for its better utaatnt® Protection and security : Protection involves ensuring that all access to system resourc cantroled 5 Sarena i pc ti GaeTAa]Wnst is kernel? Describe various operations perforne Dyer == 11 Kernels the main component of most computer operating systems, 2. Itprordes an interface between applictions and actual data preening st the hardware level 2 Keroeis onsidered asthe heart of an operating system Kernel provides the lowest-evel abstraction layer forthe resus (cepecialy proceors and UO devies) that pplication software m8 conta to perform ite unetion ‘The various types of operations performed by the kernel are 1. teantrlsthe stat ofthe proces that is it checks whether he ros {srnning or process is wating forthe request ofthe usr. 2 It provides the memory forthe processes those are running 08 system that skernel uns the allocation and de-allcation of FO 4. The kernel also maintains atime table for ll the processes those ‘running that isthe kernel also prepare the schedule time rove the time to various proces of the CPU. 4 Thekerelputsthe wating ane suspended bint the eet 5 ener terns thatthe la mommy doses estate oa enon Thegropes hen'tans the ene oe psc me will store the programs into temporary manner. Therefore, phys tenor othe en canbe ches come ean? BERTIE esse reentrant kernel, 6B (CST Sem Computer System Taawer LL Are-nteant kernel is one where many processes or threads can exseute ‘AkStame kernel program concurrent withos fleetigone anther. Innon-reentrant kernel a protss doesnot modily kernel programs, ‘pet modify global Kernel dat ‘4 Mproceanis executing operating system programs, no other processes nay bealowed tocnccua the programs, norimay System start another [ornel path execution when the kerael acess he global dat, 44. Aninterrupts rom VO devices ay not be handled immediatly by the peratingeysem. ‘5. Normally the operating system is composed of re-entrant and non Nutra functions. The re-entrant functions may mudi les! data, Tt they donot modify any global data 5 Concurrent execution of entrant funcion® do mat ae the bebaviour Stone another The dperstingeystem makes sure that noa-reentrat {foncions are executed mutaly exclusively by the kerel path 0 that ‘etfineion executions do net modify lob data at the same ime. We TAG] Dirterentiate between the following: i. Shell and kernel fi, Monolithic kernel and micro-kernel on are the differences between shell and kernel? ARTO 201415, Marke 08 Taawer ‘Shell and kernel ea a |G Interface tothe Kernel. | operating system that intersrte wrth the hardware. SNe] 1.) When user lgrin te | Thokernel isthe hub the | Town programchecks the | opertingsystem, allocates Serums and pssword, | Ee and memor to programs Shdthenstarsansther’ | sndhandles the Me storage and {foram calledtheshell | communications in response ta ‘Suemeaila E] Sheligvesinerice Kernel gives the hardware betmeen user and kernel. interactionwith user, __ The shellistbe GUL or | The Kernel ithe prt of the Operating Systems i, Monolithic kernel and micro-kernel = No| Monolithic kernel | _ Microskernel 1. | Kemel sie is large Z[OSisconpextdesign OSes to desis. inpiog and instal, 7 [Alte mtingsem eres eae [hero services, Request may be serviced faster Kernel provides only 1 Request may be serviced slomey than monolith kernel pee eae [eases Microkerel requires mexag] Posing andcontentrwtcng BD ere secic etc ae aan Scan rae yee es ‘table xml or explanation. System cals 1L” Sytem calls provide an interface othe services made avilable by 8 a ering yen. ‘These calle are genorally available as routines written in C and Ce although certain low-level tasks (for example, task where hardware rust bo accessed directly), may need to be writen using assembly System ale made ESS Sez atom maken ie cl ate le fit szamioilusratchow sree seed wring asin ro to read data from one fle and copy them to another 8 ‘Theft input thatthe progr wl need isthe names of the two le ‘heinput lean the opt fe ‘Onc approach forthe program to ask tho usr fer the namesof se Inan interactive system this approach wl require a sequen Of ae Once the tw le names are obtained, the ‘land ereate the ott file, Hach ofthe operations requires 00°" eS thew operations requires not ‘When the program tries to pen the input il, t may find that here ‘ofa ofthat name or that the files protected agninat acct, spies Compute Sytem a Ifthe input file exists, then we must create anew output fil, 8 Airman find that there is already an output file with the same name, A ee eat acta myer oars nit edhe leaner ated Cee eee oe egunerseh oe 2 Pay elie ler nay miata oral 2 Deal ania erac Ar Ln ee ay reheat sem a canton eae eee ema Erato cso a ele oe een ert epee APL ee lrilelin accmeineasee Tape stains abl nde acorn t ese nmbers ase : 5 ee ningathne there calsinlemes Hone sine and anda what te onerating a atten fin ncn ten a 1 RE nena paar en othe Pedometer pt. ‘QaeTAw] What do you understand by eynem call Enumerate ‘ve system calls used in process sanagement. on ‘What do you understand hy system call? List and explain three system calls ured for process management. ‘Syrtem call: Refer 1.1, Page 1-17B, Unit —— System calls used for process management fork) To eeate a new process net); Toexecute anew program in a process (ral) ‘To wait untilacrested proces completes its execution {ail To ext rom a proces exceution fete prs ier ofthe cureet proce fetppe To gt parent process identifier ri): Toincrensldecrease the data segment size ofa process WETAIT] What are the advantages of the layered approach oihy design of operating system (ART 20123, Marisa 1. Thomain advantage of the layered approachis simplicity of onsines sad debugeing 2. The layers ar slcted so that each uses functions (operations) an services afoul lower-level layers, 3. Thisapproach simplifies debugging and system verification, 4 Thetirt layer canbe debugged without any concern forthe rest ofthe system, because, it uses only the basic hardware to implonest functions, 5. Onc the first layers debugged, ts correct functioning ean be assumed hil the second layer i debugged, and soon Ianerroris found during the debugging of particular layer the emer ‘mont on that layer, beeause the lagers below tar already deg ‘Thus the design and implementation ofthe sytem is sump ‘TEETIOT] wnat is the reason behind dual mode operation of processors? (ARRTO BOTT, Marks on ‘Whether itis posible to construct a secure operating system without ‘having dual mode of operation in the system ? Gi favour of your answer. Jn dual mode operation, two separate modes are used for working of operating system, These modes are user tude and monitor mode For indicating modo ofthe sytem, node bit is used inthe como are The mode bit is for monitor and 1 for wer, ‘With the made bit, we are able to distinguish between a task that ‘ecu ine eo onion ot feature help tothe operating system in many ways ‘© Atte booting ime the hardware stars the nntor mode, el ‘petting sysemisoaded. The hardware swithos foe {monitor mode when interrupt cece, When th opera. ip fnsconta ofthe system, tis a monitor made ARR ey L208 (CST Sem-4) "The pvioged instructions ar exscoted onlin th monitor made ‘eetompecrardare st lovato eating tbe pies a Mier towide greater protection for the operating system. Fp 2h. sesh dale tee % |fR"pecoer niches om] ofa prover ben ere oe pocens tomate) nese eer ie oder i a rear | ti pe ins Feb nss| eerie om] the saved contest of neve| state tokerne mode prose thedled trun Exar? he natn nds] eda ees ne, seach en cnet of cotaledby erp ie | [Bxampie : 1 en interrupt] Example: Ia user process | Fanning process on CPU, 20| necessary to perform mode ‘ht it eam restore the saved | itching entext when processing of Interrupt is over, i proces itching. iz useful for ‘opening ad resoming of | pce nes ——— Soncurrent. Pre (wait for available barbers i else (1 do nothing leave) whe vrtingfeutting 1 set siren et hai et for sometime; Signaleutting) VERY IMPORTANT QUESTIONS. ‘Following questions are very important. These question ‘may be asked in your SESSIONALS as well as UNIVERSITY EXAMINATION, @.1. Discuss process model and principle of concurrency. Ans, Refer Q. 2.1 and Q. 23, Q.2, Write short note on producer consumer problem along 8 its solution using semaphore ‘awe, Relor Q.24 and Q-216. Q.8, What is mutual exclusion ? What are the four ond! ‘mutual exelusion ? we, Refer Q.25. Q.4. Write and explain Peterson solution tothe ert sae, Refer @.2.11 @.5. Giveasolution toreadesswriter problem using sem ‘wom Refer Q. 2.19, Q.6. Discuss classical problem of concurrency. ‘ams Refer Q. 2.22. Qt. ped oa eal ect art |. Write short note on interprocess communication: Refer Q. 2.23. es Tine mov lent rrecevng preferential teat wil bith Bh Theretagy ofthe iame iat eigen coc eee ar calegeec cae cal re hedaler a jranag ofthis chees tht he shorter oh il sr case [Ebene joe rilleecte wih mor tine, There wil be oerhcodfor managing peters, Iemay also nerease overhead same process uns tack totack. ‘GEEBAE | Consider the net of the processes given in the table and the following scheduling algorithms 1 Round Robin (Quantum = 1) 4S. Round Robin (Quantum =2) fil, Shortest Remaining Job Fist [ Process d | Arrival Time | Execution Time | Ae ° 4 @ aka ses D a5 3 cae ia 5 there ie within the processes the eis broken in the favour of th lest proce: Dra the Gant that and find the average Waiting time, responce time nnd turnaround time for the ‘leoritinsConument on our rent Which ae inbetterand why 7 = Round Robin (Quantum = 1) =e] [>] — Se ‘Waiting time for process, Aq0s4s4u8 B=2+404e3+1414 1016 Ca3+4+4=n1 Datsdes=v2 Babs4saelede 8416411412416 Average mitng ine » #416°11112-16 _ 1p ‘Turnaround time for process, A-2 Bex c-u D=15 E=18 Average turnaround time, + ar ‘Response time for process, +Az0 B=0 c=0 D=4-35=05 B=5- ‘Average response time, oss4 09 |i Round Robin (Quantum = 2) ayayepoyeyayaT eToys ayels) bs IW isd 1516 oat Weling tins proven, : as Bezve+6+2-18 Cravecis Dosrenis Basrerzeis Average waiting time, 8418412416438 - 44 S.25R(CRTTSem- ovrentonebp ent bon " 12+ 20+11+ 12.5617 = Meme MeTBBSIT gy Reponce time for proces, iting ime or proces, very Average waiting ime 016467610 4p ‘rmaround time fr process, mooe> ‘Average turnaround tan, 41200456506 9, ————— ‘Average responce time ‘SUF gives the minimum average waiting time as com, : Sint bet chedlingslgorthn. Are toRRagg —_Tunmnd tie TAT, Wao SIE.] Consider the processes, 2 Bea) P ‘CPU burst time and arsine, siven belo pin6-2=26 pz10-3=7 B Draw the Gantt chart and calculate the following hi = alate he Following By wsing ST CPU scheduling algorithm, a Average waiting time BERR] various pertrmance eter or wehedaling 1. Average turnaround time RTT ETE MGT slorithms, Five processes A, B,C,D, E require CPU burst of 85 nd unite respectively. Their arrival times in the system are Ob ‘and 12 respectively, Draw Gante Chart and compute the average {emaround time and average waiting tne of these processes for the Shortest lob Furst (SUF) and Shortest Remaining Time Fist (SHUT scheduling algorit Rewer] Performance eriteria for scheduling algorithm : Refer Q. 3.1 Ratan iinericl: Sir Tenarond Tine nea oe Su; Bas ¥ 3 Averagetumaroundtime —(3+9+2+6 gy5_, ‘Average waiting time Wr4s0er 555 58m Sim Bp mal Seep A Waiting Time ° ° 1 3 Average turnaround time (+94266+895, Average wating time (rasonrs aye BaeGRT] What is deadlock ? What are the necessary condi for deadlock? se! on ‘What are the necessary conditions to hold a deadlock in ase ‘What is a deadlock ? Discuss the necessary conditions fr dest ithe. ‘Adesilockis itoaton wher a group of proces ar perme ‘Bocked aba rerult of each process having enue sae fewsurer need for is completion and waiting frees Terminng resource ld by othe nthe sare 20, + ™ ipounil for ny ofthe proenre to proceed. : 2 Resource managers an ether operating system, Prose eee atest ‘deadlock situation can aris ifthe following fut Sinultancouly in ayset fe 1" Matual exclusions Atleast one resource ust ‘habe mash onlyone proces at tine Pe Bes Py RP " he SS jection. Write a 2 aor “ey a roc ect Setering fests and Sentiing the process and resources ety fades = 2 The deadlock detection algorithm is invoked when the alc ing Systeme aR (CST Sem) te granted immediately and this condition occurs frequen = ® 4. Thebaiciden sto chek locaton aginst resource vay ee eciceian nn ae ate i Deadlock detection algorithm e Step: Let work and finish be vector ofengthm and n respecting ro " 3.38.1. Resource-allocation graph with corresponding era Initialize ree Work Available it The remptions made nthe aio graph are slo allocation, #0, then Finis i) = false Otherwise, inish{ i] = true Fori= 1,2, ‘Step2: Findan index such that both Finish{]= false Request, « Work a Step: Hino such exists, go to step 4 Step: Work = Work «Allocation, Finish} = trae t Go tostep 2 , ‘Step: Il =falee for some i, 1 8 ale sequence for the {eigen and ogee ge sllocation state Wf for och Pte reources that , ean still ‘request can be satisfied by the current; 4. Asafe state is not a deadlock state. Conversely, a 7 Jead to adeadlock. asa 4. Aslongas the state is safe, an operating system can avoidyg. PS spersinceen conn Sa a eens ae 1. Deadlock prevention :Refor Q.3.28, Page 3-298, Units 2 Deadlock avoidance :Refer Q.3.29, Page 3-208, Units, Deadlock detection : Refer Q. 3.31, Page 3-828, Unit, GueGSA] Define deadlock. List four necessary conditions ‘occurrence of deadlock. A system contains 6 units of resoury processes that use the resouree. What is the maximum wake for which the system will be deadlock free if the mata requirement of each process is 37 (ARTO BOIzI8, Maa ‘Answer Deadlock and its four necessary conditions: Refer @. 27, Pur h= Unita Maximum value of: ‘The maximum value of for which he sstom in guaranteed oi {roc is 2, Two processes ean never lead to deadiock asthe Peak of) +3 = 6) resources can be satisfied. But3 processes can Ie AWeach proces hols 2 resources and then demand on 2" a ia Guo 35, | Write an algorithm for detection of dendlon™ ‘having several instances of multiple resource YP axe 01 ‘Anewer ‘Trealrithm ussscvera time-varying data serosa ol 1. Available : A vector of length m indicat tbe PUES ‘eanucen ofeach type, cot % Allocation :Anin xm matrix defines the number f=" type currently allocated wo each process. TRequeot: An” narixindieates the coment equa ofeach rosea Rea equetll equals, then proce trenource Pe, ‘gorithm erp Work ond Finish be vectors oflengthm and, respective Tntnize Work = Available, ort =0,1,.-.n— Ini Allocation, 0, then Fins terse, Pill = tue ‘2, Find wnindex such that both Finisl == false ues, = Work Tro such exists got step Work = Work + Allocation, nil = true Gotoep(2) “4 thie = «fale fr some ,0<< thenthe satem nina deadlock Morcovo i Finish = fase then proces Ps deadlock ‘Tusalerthm requires an order ofm «operations to detect whether ‘he apotem sin dendloc state ERIGE] Write the Hanke’ algorithm and how it canbe used to sold ean be used to avoid deadlock. ‘OR Describe Banker's algorithm fo fe allocation. on Write and explain Banker's algorithm for avoidance of dendlock. Answer ‘Banker's algorithm : ener ai i eorex and lock vidance rin tar ey sting salar pre dterie im pune noo al eure tn kes estate” check a Seton mn arn bern oe sorta TEs strtreare wed ioe the Banke alot ‘Sottero procs nthe tom adn’ be the nar of —— —— XL Available: Iisa 1Darray ‘Tesources ofeach type. sts inating the nate ogg, ‘Availablel j= means there are'¥ instances of resource type Max :ttisa 2D array ofsize'n"m' that de ‘each process in «system. es the maximum dmgy Mast i,j} = means process P, may request at most ¥ instanca y resource type 8, 3 Allocation : 1s 9 2D array of size’ that defines the number y resources ofeach ype currently allocated to each proces, Allocationt i, ‘of resource type means process P,is curently allocated itn 4 Need=Itis2D array ofsize'n*n’ that indicates the remaining resoure sed ofeach proces Need i,j} = resouree type R Need (i, ‘means process P, currently allocated instances Maxi, j] Allocation i, Allocation, specifies the resources currenly allocated to process Ps [Need pecfiesthe additonal esoures tha roceasP may sill et tocompleteits task ‘Banker's algorithm s used to avoid deadlock by fellowing algorithms ‘& Safety algorithm ; 1. Let work apd finish be vector of length m and n respect Initialize Work » Availabe and Pinish it~ False for = 2S ton 2 Find an such that both Finch f= False Need = Work rao such eit gato step 4 SRE Siete ane ena 4 _2fMiaish ~Trae forall then the system isin asa sta % Resource request algorithm Let Request, be the reques 779% | aparece nates heme eti actions are taken antelensnal, Oo! | a af a | ‘nas exceeded ta maxon aim “tition ine | 2H Requests Available | 3-97 B (CS/T-Sem-4) operating Systems Goto step; otherwise, P, must wat, since the re valle 7 Have the system pretend to have allocated the requested resou! Taprocess P, by modifying the state as follows Available Available Request, Allocation, = Allocation, + Request, Nod, = Need, Request, GHEAT | Describe Banker's algorithm for deadlock avoidance. rider a system ‘SSipnhot of system at time ts given below a ‘aaa, three processes and three resouret (eae eae alele| alejc|alsle R 22[s|slele| 7] 7| 2 [alels[«isla? |] 4 | Xie carrot allocation in safe ato? oul he atowingrequets be granted inthe current stae Speer) 1s Process, requests (1,0, 0) Available = ‘77 10) (5410) hres = (280) coe ee 3-39 B (CSAT-Sem-4) Content ofneed — ] wing snapshot of the system Ned | ‘Gast Comin he fatowing snaps of the yn: 2, eens [allocation Max ‘Available | , ae lets: c[p|alplc[p | als jc|p] 7 aay 7 ra fofefaya [xfs [2 [oe] F ofofa{z/sfo Safe sequence z s|4|2is|sle | ‘The system nin sae state, Fes oe Slee SL a. Proc equ ,0, 0 this rquet lot than ed Nal |Z te felets}e|_{t 1s Do hh Oswalt rescurceis(2,2,0)androqmati, —jaayer the following questions using the banker's algorithm {What ithe content of the matrix need ? Roquet < Availabe (1,0,0)< (23,0) {i Inthenystem ina cafe cate? Ifyes then find the safe sequence, After allocating, 0,0) to process P the need becomes as fllws 3k. iareqocst from process P, arrives for (0,4, 2,0) can the request Tar te pranted immediately? (ART 2016-16, Marin 10) 2 a Taower \Theneed matrix can be calculated according to Bankers algorithm, Eien ieAlisen|eno Need Max "Alot, a eee esate Nesdiatn e a ‘And aval resources (3, 0) We se tat sytem isin safe st AL can a tafe sequence Hence requet of (10,0) wll bean aeons ato | ‘b Process P, request (1, 0 0, this request is lees than need: Need rcees Pi 23,0) Available rence at, and rust 100" oe rie ite Request cAvalsle, (4, 0,0.<¢1 8,0) dine a ‘Afwr allocating, 0,0) o proce , the need becomes fl? co | cas ee x iil | otal aa irs Pree Ned Stein sate tne Ts can bse blow Sa ey etal (6,2, 0 which canbe allocated to Por, Walaa [ecac|) 0 Aconlng orate nee, aire ae aa hicce faery aes oe 5 2 0 Uvaiable, scare, 0) New sue 3 i Satiegtae rege Fay pcan ove nati coe p Rate oO Serta tem wl shed Oo bc 18 2 Othraila) ted, allocated resource. lence Alcea oD" aac D Po40oLe eb " 22 Sarath: . CPU, This can satiy the request of process P, Since = HaMIwANDUO Di” AB: Cp, 1002<1532 3-41 B (CSAT-Sem-4) ‘Avi 642 ‘this source units that 2 8 8 6 (Available) TeRRDET nn ptem,mprocener share m revource units eh "This Available ean satisfy the request process ote ee Tee eed Is Hence, resources willbe allocated to it can reverved and relma oly one masta need Work = Work +Alloation ‘teach pe see gai. Show that a deadlock cannot occ¥- ABCD AB feos than = m2s6 6 +06 ABCD ee = 2 1 8 (available Taner ‘Tis Available) resource, an be allocated to Pros, Since Be Spee, cen ABCD anep ame NeiiPJ= 0642 <2 us bilge a atin Hence, after completion processes P, will lao release the resource. svar Nese Mes Allon sf Work = Work + Allocation — ABCD ABCD Sea Pune coors % Abe D Mas, Sust = cometaa be Py<21,0> ARTE ety “Answer Banker's algorithm for safe allocation ; Whena new proces ntrs the ye, mt declare he mai ofinstancs ofeach resource type that it may need. Tig exceed the total numberof resources inthe system. Whey te a Aesttreurcee wiles the sytem ina atest twine are allocated; otherwise, the process must wait uni we se feleases enough resources a Safety algorithm : Refer Q. 8.36, Page 3-a8B, Univ ‘Numerical: Total resource = total alloated (Sum of columnsof allocation wi = (8571 +13 10)=11167), 4 Need=Maximum Allocation Ot Using Bankers, Wench Abc set 40 ti. s22 wile ae 902 60 tes a) os 0 ae nea 112 - 4 Neisompredvith Arable Het aval, ens allocated otha process and process will release th ne XE Nec i rete than Available, neat process 2% compan Ned far proces Pi) a val Need> Available -+ Fale Sovaystem will move ta next process Nea for Fis (110) and avallale i (810) Need s Available> ‘True Request for Pi erased Available Available + Allocation = 810212 = 522 ‘Nes Proses Fenda 01 and available is 52 = 522+ 401 = 925 eration Systems S438 CAITSem-4) ‘So, equerteeranted S01 £622 > rue Next process, needs 7 and availabe 2 ‘ow Available = 923 +020 = 949 Next process P, eed (1, 1, 1)and avalale in 43, Need > Avalale Need» Avallable 21 ¢ 10 ‘ase, reruns wil net be granted. bPe24.0> Need < Avail + Troe Hence, the request wil bo erante, TSA] pitterentiae between deadlock and starvation, Ti fo Deal Baraca Eomparon Bane ——_| Deadlock te where wo | Stavain o where low | | pecs pce and et | pearityproscics et | Eas Shh gh iy ese rows pre Aog [Bi scurne ofa | afremen fpr cathe ‘clusion, bod snd wait Sireulte wait Unconteolled "resource 1h deadlocked, requested | resourees are blosked by the ther proeases Tnstarvation therequeted resources are continuously sured by igh priority ‘Aging ‘Aiding mutual ‘clusion, bold and wat, fed circular wait and preemption —— Stheg —— QaeTAT] Discuss the techniques to recover from deadtogy, ‘Answer "There are two options for recovering from a deadlock 1. Process termination: Tocininate deadlocks by aborting dre ue oe of two methods. mm ‘Abort all deadlocked processes: This method clear ving the dedckeye bt th ealockedproceece may hae eee for slong tine, and the revltsaf these partial computations te disered and probablywil have tobe recomputed ater 1 Abort one process ata time until the deadlock eye ‘Miminated The method incurs considerable overhead eet uch proces in aerted, a deadocicdetection alge wea invoked to deter whether any prconts are stl dead 4 Resoures preemption :Tocliminste deadlocks using remirame taptin, we vcenielyprecngt wre resources from prone {ve thr resources ier proceso until the deadlock crtesbe 4 Seleetinga victim: i. Which resources and which processes are to be preempted? [Ain precen torminatio, we must termine the or reanpion tominimize cot , 4 Cont factors may include such parameters a he muh ‘ecourees adeno process x holding and SHES time the process has th far conmimed during © Rollback: j {vepreempt resus rom proses thence vithitnermal excetion Winminsing some nonded resource, i! wa ‘8. Wemus rollback the process to some safe state an ‘om that state, anit Sins n genera itis dct to determine what ‘he simplest solution is a total olhack, abot sodthen restart. sae -ANthough tis more fective to rollback the POS se neescary to break the deadlock, tie th tlt ‘amen a keep more information about thestate 5 Killthe process, -alsng qucstions are very important. These quertions at a 2 RE o perfor the Non f Nee SAE wii be asked in your SESSIONALS as well as UNIVERSITY EXAMINATION. Explain performance criteria of CPU scheduling. Refer @. 3.1 What is CPU scheduling? Writethe difference between pre- uptive and noa pre-emptive scheduling. Refer 3.1 anda. Explain process transition diagram. Refer @ 3.5, Discuss Process Control Block (PCB). Refer @ 3.7, Write short notes on process identification information. Refer Q 3:10, Write short notes on followin FCPS scheduling SUP scheduling Round robin scheduling ReerQ 217. ii, RoferQ 8:18, ii, Refer Q. 9.20, Write the difference between following: ‘Thread and process User level thrend and kernel level thread. ‘Long term, short term and mid term scheduler Refer Q.9.15. 2. Refer Q 218. 9, Refer Q. 28. ma Banker's algorithm for avoidance of deadlock, Ben tere coarser Refor Q. 3.28, 9.3.29, Refer @: 3.1, 00

You might also like