May-2010 Question Paper Subject:- OSCD 1. What are the various real-time CPU scheduling algorithms. Explain each one in brief. Ans: Explain P= D= T= Types of Real Time CPU Scheduling:1. RATE –MONOTONIC Scheduling 2. Earliest Deadline First Scheduling 3. Priority Inversion May-2010 Question Paper Subject:- OSCD 2. What are requirements of mutual exclusion? Explain Peterson's algorithm for mutual exclusion. Ans: • No two processes simultaneously in critical region • No assumptions made about speeds or numbers of CPUs • No process running outside its critical region may block another process • No process must wait forever to enter its critical region void P0() { while (true) { flag [0] = true; turn = 1; while (flag [1] && turn == 1) /* do nothing */; /* critical section */; flag [0] = false; /* remainder */; } } May-2010 Question Paper Subject:- OSCD 3. What are two differences between user-level threads and Kernel-level threads? Under what circumstances is one type better than the other? Ans: Differences between user-level threads and kernel-level threads (Any two): • Operating system has the knowledge of existence of kernel level threads while it does not know about the existence of user-level threads. • Suppose a process P1 has 2 kernel level threads and P2 has 2 user-level threads. If one thread in P1 gets blocked, its second thread is not affected. But in case of P2 if one thread is blocked (say for I/O), the whole process P2 along with the 2nd thread gets blocked. • Kernel level threads are slower to create compared to user-level threads. • Switching in Kernel level thread involves OS scheduler while in user-level threads OS scheduler is not involved. • Context switching between kernel level threads has high overhead, almost the same as a process. • Context switching between user-level threads has almost no overhead as compared to kernel level threads. • Kernel level threads can run on different processors simultaneously while user-level threads of a process will run on one processor only even if multiple processors are available. May-2010 Question Paper Subject:- OSCD 4. Consider the following page reference string :1,2,3,4,2,1,5,6,2,1,2,3,7,6,3,2,1,2,3,6 How many page faults would occur for the following replacement algorithms assuming one, two, three, four, five, six or seven frames? - LRU Replacement - FIFO Replacement -Optimal Replacement. Ans: May-2010 Question Paper Subject:- OSCD 5. How does DMA increase system concurrency? How does it complicate hardware design? Ans: DMA increases system concurrency by allowing the CPU to perform tasks while the DMA system transfers data via the system and memory busses. Hardware design is complicated because the DMA controller must be integrated into the system, and the system must allow the DMA controller to be a bus master. Cycle stealing may also be necessary to allow the CPU and DMA controller to share use of the memory bus. May-2010 Question Paper Subject:- OSCD 6. How do caches help improve performance? Why do systems not use more or larger caches if they are so useful? May-2010 Question Paper Subject:- OSCD 7. What are the various disk-scheduling algorithms. Explain each one in brief. Ans: FCFS SSTF SCAN C-SCAN May-2010 Question Paper Subject:- OSCD Consider the following segment table: Segment Base Length 0 219 600 1 2300 14 2 90 100 3 1327 580 4 1952 96 What are the physical addresses for the following logical addresses? a. 0,430 b. 1,10 c. 2,500 d. 3,400 e. 4,112 Ans: a. b. c. d. e. 219 + 430 = 649 2300 + 10 = 2310 illegal reference, trap to operating system 1327 + 400 = 1727 illegal reference, trap to operating system May-2010 Question Paper Subject:- OSCD 9 What are the four conditions that create deadlock? Explain deadlock prevention and avoidance techniques Ans: Conditions for Deadlock Mutual exclusion: resources cannot be shared. Hold and wait: processes request resources incrementally, and hold on to what they've got. No preemption: resources cannot be forcibly taken from processes. Circular wait: circular chain of waiting, in which each process is waiting for a resource held by the next process in the chain. Deadlock Prevention Attacking all the above condition for not occuring Deadlock Avoidance Banker Algo (Both Safety and Resource Allocation) May-2010 Question Paper Subject:- OSCD 10. Given memory partitions of 100K, 500K, 200K, 300K, and 600K (in order), how would each of the First-fit, Best-fit, and Worst-fit algorithms place processes of 212K, 417K, 112K, and 426K (in order)? Which algorithm makes the most efficient use of memory? Ans: First-fit Best-fit Worst-fit 212K is put in 500K 212K is put in 300K 212K is put in 600K 417K is put in 600K 417K is put in 500K 417K is put in 500K 112K is put in 288K 112K is put in 200K 112K is put in 388K 426K must wait 426K is put in 600K 426K must wait In this example, Best-fit turns out to be the best May-2010 Question Paper Subject:- OSCD 11. What are the various buffering techniques? Explain each one in detail May-2010 Question Paper Subject:- OSCD 12. Explain file allocation methods in details Ans: Contiguous Allocation Chained list Allocation Indexed allocation May-2010 Question Paper Subject:- OSCD Write a short notes on any four of the following :(a) Monolithic Vs. Micro Kernels (b) Comparison of any two RTOS (c) V Works 5.X (d) NOS Vs. DOS (e) Race Condition (f) Inodes. Ans: Race Condition : Two or more threads read/write a shared variable, and final result depends on the order of the execution of those threads. May-2010 Question Paper Subject:- OSCD 1. What are the various real-time CPU scheduling algorithms. Explain each one in brief. Ans: Explain P= D= T= Types of Real Time CPU Scheduling:1. RATE –MONOTONIC Scheduling 2. Earliest Deadline First Scheduling 3. Priority Inversion