0% found this document useful (0 votes)
2K views55 pages

OS WB Madeeasy

Made easy operating system workbook

Uploaded by

gkushagra76
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)
2K views55 pages

OS WB Madeeasy

Made easy operating system workbook

Uploaded by

gkushagra76
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/ 55
POSTAL Study Course 2018 Computer Science & IT Objective Practice Sets fey chur eye) Sl. Topic Page No. 4. Basic Concepts of OS 2 2, Process and Threads 4 3. CPUScheduling 7 4, Process Synchornization 2 18 5. Concurrency and Deadlock a 6. Memory Management 3% 7. Virtual Memory a 8. File System 50 | 9, Input-Output System 52 MADE ERSY Inte Best tite for ES, GATE 6 PSUS et of Boot MADE EASY Wot Ths book conta apt bjt mater 1 MADE EASY We By any meas FOr Smnony | een ae att it CTriT) aa a2 a3 a4 as a6 Which of the following should be allowed only in kernel mode? 1. Changing mapping from virtual to physical address. 2. Mask and unmask interrupts 3, Disabling all intertups 4, Reading status of processor 5. Reading time of day (@) 1,2and3 (b) 1,2,4and5 (©) 2,3and5 (d) allof these An interrupt handler is a (@) location in memory that keeps track of recently generated interrupts (©) peripheral device (©) utility program (d) special numeric code that indicates the priority of a request Executing more than one program concurrently byone user on ene computer is known as (@) muttiprogramming(o) time-sharing (©) multitasking (d)__ multiprocessing The simultaneous processing of two or more programs by multiple processors is (@) multitasking (©) muttiprogramming (©) time-sharing (2) muttiprocessing Which of the following does not interrupt a running process? (a) timer interrupts (©) power failure (b) device (8) scheduling process System call is used to access (@) V0 functionality (b) operating system functionality Basic Concepts of OS (6) application functionality (6) None of the above Q.7 Swapping is performed by (@) longterm scheduler (b) midterm scheduler (©) short term scheduler (@) dispatcher Q.8 Choose the false statement (a) static inking requires no support of OS (b) dynamic linking requires no support of OS (©) dynamic loading requires no support of OS (@) none of the above Q.9._ Assume that the kere! mode is non-preemptive What happens when an I/O interrupt comes while @ process 'P, is running in the kernel mode on the CPU? (@) CPUis given to the process for which the iY Ohas completed (0) CPUis given to some other process based ‘onthe scheduling policy (©) P, continues to execute on the CPU (d) None of the above .10 Overlayis (2) apartof an operating system (0) a specitic memory location (©) single contiguous memory that was used inthe olden days for running large programs by swapping @) overloading the system with many user files urs, an operating system terrupt 198 the stage of the 88 atter processing the inte G3 MADE ERS! (0) always resumes execution of the interrupted process after processing the interrupt (d) may change the state of the interrupted process to “blocked! and schedule another process Q.12 Consider the following statements: $1: The OSis designed tomaximize the resource utilization. $2: The control pragram manages the system programs. Which of the above statements is/are true? (a) St is true $2 is false (©) S2is true and St is false () both $1 and $2 are true (@) both $1 and $2 are false PEEIIEEN 22s1c concepts of 05 1 @2 © 3 © 4 @ 5. 10. (@) 11. (@) 12 (@ 13. () 14, Basic Concepts of OS 1. (a) Only critical services must reside in the kernel All services mentioned except reading status of processors and reading time of the day are crilical Hence option (a) is correct, 9. (c) ‘When the kernel is non-preemptive and any process's running ina kernel mode, then process Continues torun until either it completes oritwalts for some input/output. 1. @) When a interrupt occurs operating system decides the request on the fact thatthe interrupt is higher priority or less priority. If less, the rupted process is resumed and only after in www.madeeasy.in ease) 2078] mRoE EASY Operating System 0.13 Bootstrap loader is always stored in (@) cache (©) ROM (c) RAM (d) disk Q.14 Which of the following is true? (a) Overlays are used to increase the size of physical memory. (0) Overlays are used to increase the logical address space, (©) When overlays are used, the size of a process is not limited to the size of physical memory. (d) Overlays are used whenever the physical address space is smaller than the logical address space. (e) the execution of process, the interruptis handle. However if interrupt has higher priority the processis blocked and interruptis entertainod Hence an operating system may or may not change the state of the interrupted process to tblocked” and schedule another process. 14. (c) By using the overlays we can execute much greater processes simulianeously which cannot bbe execute and reside inthe memory at the samo time. In this the process to be executed process brought to memory only when itis needed at the time of execution. Objective Prater Sts CorCia) Which of the following statements comparing the context of a thread with that of a process is true? (@) two processes will not share any context; two threads ofa same process will only share the data and the code (tex!) areas of the context (©) two processes will not share any context; two threads of a same process will share the data, code (text) and the stack areas of the context (©) two processes will share the data and the code (tex!) areas of the user context; tivo threads of a same process will only share the register context (d) the overhead invalved in context switching for threads is much higher than that for processes Which of the following information is not part of process control block 1, Process state 2, List of open files, 3. Processpagetable 4, Stack pointer @ only3 (b) 3and4 (©) 2and4 (6) None of these Convoy effect is a result of (@) onelong CPU bound process and many other CPU bound processes are waiting (b) many CPU bound processes and less YO bound processes (6) many CPU and /O bound processes (@) proper mix of CPU and /O bound processes in a time-sharing operating system, when the ime slot given to a process is completed, the process goes from the RUNNING state to the (@) BLOCKED state (b) READY stat (©) SUSPENDED state (d) TERMINATED state ota ated Process and Threads as a6 a7 as Inamuttiorogramming environment (@) the processor executes more than one process at atime (b) the programs are developed by more than one person (©) more than one process resides in the memory (@) asingle user can execute many programs at the same time It @ system contains n processors and n processes then what will be maximum and minimum processes in running state respectively. @ an (b) 7,0 © m0 (0) Pn? Match List-Iwith List-II select the correct answer using the codes given below the lists: List-1 A. run ready B, run—>blocked ©. blocked > run D. run—terminated List-tl 1, notpossible 2. when a process terminates itself 3. when a process time quantum expires 4. when a process issues an input / output request Codes: A B Cc D @m 1 4 3 2 ® 2 1 3 4 @ 3 4 1 2 @® 1 4 2 3 While designing a kernel, an operating system designer must decide whether to support kemel- levelor user-level threading, Which ofthe following statements is/are true? G3 MBE EASY 1. Kemel-level threading may be preferable to user-level threading because storing information about user-level threads in the process controlblock would create a security risk 2. User-level threading may be preferable to kernet-level treading because in user-ievel threading, if one thread blacks on 1/0, the process can continue. (@) tonly (e) (©) 1and2ony — (@) 2only None of these ag Postal Study Course EOEE Q.10 Consider the folowing statements with respect to user-level threads and kernel-supported threads (Context switching is faster with kemnel- O17 supported threads (i) For user-level threads, a system call can block the entire process (ii) Keme!-supported threads can be scheduled independently (iv) Userlevel threads are transparent to the kernel Which of the above statements are true? (@) (ii, (it) and (is) only (©) (i and Git) only (©) (and (a) only (©) (and (i) only www.madeeasy.in Gg made ERsy Operating System | Assume process A has 8 user level threads and process B has 4 kernel-level threads. Consider while process A is running in CPU, process B is waiting in ready queue. If one of the thread in A is blocked then find status of A threads and B threads? (@) AIA threads are blocked and all B threads are blocked AIA threads are blocked and B threads are not blocked (©) AIlB threads are blocked and A threads are not blocked None of these (b) @ Assume T, and T, are two threads of the same process, Consider the folowing information 4. Datasection 2. Stack section 3. Code section 4, 1/0 files Find which of the above information can be shared by T, and T,, @ 1.2.3 (o) 1.24 © 1.34 @) 2.34 Objective Practice Sets | Computer Science & IT PEEIIIEN Process and threads 1 @ 2 @ 3 @ 4 © 5 ©) 10. (o) 11, () PEIEIE #rocess and threads 3. (a) 9. CPU bound processes requires lat of processor time, resulting in long wait for © bound processes for the processor. This ettectis called convey effect, It results in lower CPU and VO devices utilization 6. (b) men system contains ‘n' processor and ‘ni processes, then maximum number of processes in running state can be 'n’ with each processor containing maximum of one process inthe running state. The minimum number is zero with no processor having a processin running state hence correct option (b). 7. (c) When a process issues an input/output request then it goes from running state to blocked state. When a process terminates itself it goes from running state to terminate state. A process cannot go to running state after completing its 1/0, it most go to ready state. Hence option (c) is correct 10. 11 Postal Study Course PLXE]} Damade Easy 6. ) 7 © & @ % bb) (b) Kernel level threads can be scheduled independently, For user level threads a system cail can block the entire process and are not transparent to kernel, () Process Ahas user-level threads. Whole process. has single control block instead of maintaining control block for each thread. So blocking one thread cause all processes to block. Here process A and process 6 are independent, henceno relation between Aand 8, + Option (b) is correct. (c) Each thread needs a program counter and stack section to keep the local variables of procedures. ‘So stack section can not be shared by threads. option (0) iscorrect. Qt a2 a3 as 3 CTT a In round-robin scheduling there are ‘rn’ no. of processes in ready queue and time slice is ‘q! units in worst case, the interrupted process will getthe CPU again after (@) (n= 1)gunits —(b)_nqunits (©) (q-1)nunits — ()_ (q+ 1)nunits Consider 'n’ processes sharing the CPU in a round-robin fashion. Assume that the context switch takes “S seconds. What must be the Quantum ‘q’ such that the overhead of context switching is minimized and at the same time each process is guaranteed to execute on the CPU atleast once in every t seconds? @) qs(t—nsy(n—1) (©) qs(t~ns(a-1) (©) qs (tryin + 1) @) qsit-nsyn +1) ‘The process state transition diagram in the figure isrepresentative of a feinated) New. a (@) abatch operating system (b) an operating system with a preemptive scheduler (€) an operating system with anon-preemotive scheduier (@) auni-programmed operating system Consider the following set of processes that arrive at time 0, with the length of the CPU-burst time given in milliseconds: Qs as CPU Scheduling ‘Whats the average waiting time in milliseconds when we use the FCFS, and SJF scheduling algorithms? (@) 9.33, 4.33 (b) 50,433 © 50,26 (6) 26,26 A uniprocessor computer system only has two processes, both of which alternate 10ms CPU bursts with 90ms /0 bursts. Both the processes wore created at neatly the same time, The /O of both processes can proceed in parallel. Which of the folowing scheduling strategies will result in the least CPU utilization (over along period of time) for this system? (@) first come first serve scheduling (b) shortest remaining time first scheduling (©) static priority scheduling with different priors for the two processes (@) round robin scheduling with a time quantum of Sms Consider.the following set of processes that need to be scheduled on a single CPU. All the times are given in msec. Process Name | Arrival Time | Burst Time a ° 3 B 3 4 © 7 3 D 9 5 E 12 7 Which of the following will give minimum average. waiting time for all five processes? (@) FOFSoniy (b) RR(T.Q.=3) only (©) SRIF only (6) Both (a) and (c) a7 as ag ‘Computer Science & IT Starvation can be avoided by which of the following statements. 1. Byusing shortest job first resource allocation policy. 2. By using first-come, first serve resource allocation policy. (@) J only (©) 1 and 2 only (©) 2only (@) None ofthese ‘Suppose a system contains n processes and system uses the round robin algorithm for CPU scheduing then wnich data sttucture 's Gest suited ready queue ofthe processes. f@) stack (b) que (c) circularqueue (d) ‘tree If asystem contains CPU bound processes then which of the following scheduling algorithm produces maximum efficiency of he CPU. (@) FIFO (0) round robin (© SuF (@) priority Q.10 The jobs are assumed to have arrived at time 0 an and in the order p, 4, /. 8, t Caloulate the Geparture time for job pit scheduling is round- robin with time slice of 1 (@ 16 () 10 1 (@) 12 Below process arrive in the order P,, P,, P, and are served in CFS order The average turn around time is_and average waiting time is, Process [CPU Burst time] Arrive time Pi 5 0 Pe 3 1 By “a Pe a (2) 45miliseo, 6.25 milisec (0) 85milisec, 4.75 milisec (©) 8milisoc, 4.75 milisec (4) 475 milisec, 8 milisec GeTRDE EASY MADE EASY Q.12 Consider the following performance table for FCFS scheduling. For this batch of processes, the throughout will be Postion | Jab arrival | Job completion inbatch | time (ai | _ time (Ci) 7 3 3 2 8 10 3 10 6 4 | 2 8 5 15 2 (@) 0.184 (o) 0192 (c) 0.269 (@) 0.238 Q.13 Consider we have four processes P,, P,, P, and and consider the following table, Consider the a

You might also like