You are on page 1of 8
BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI~ K. K. BIRLA GOA CAMPUS First Semester 2014-2015 Course Title : OPERATING SYSTEMS Course No CS C372 , IS C362, CS F 372 and IS F 372 Component: Test I (Regular) Closed Book Component Weightage =: 20% Max Marks: 40 Duration ; |Hour Date: 13-09-2014 TD No.: Name: "Part A (10 Marks) Question No. 1 Fill in the banks: i. Interval between the time of submission and completion of the job is called ii, A program in execution is called iii, scheduler contr the degree of multiprogramming iv. is a technique of improving the priority of process waiting in Queue for CPU allocation v. Switching the CPU to another Process requires to save state of the old process and loading new process state is called as vie program is loaded at power-up or re-boot vii, . The ability to continue providing service proportional to the level of surviving processor is called is a hardware entity that prevents infinite loops and processes monopolizing the CPU. ix. If the actual length of CPU burst for exponential averaging SJF is 10 at t = 6 with alpha = then predicted CPU burst at t= 7 is x. Three CPU intensive processes require 10, 20, 30 CPU bursts and arrives at times 0, 2, and 6 respectively. The number of context switches required is if OS implements SRT (Ignore context switches at t= 0 and at the end) xi. Given below is the information about 3 processes, their arrival time and their CPU Burst time. Process | Arrival | CPU Burst Time Time -The average turnaround time for FCFS is - The average turnaround time for SJF is \ BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI— K. K. BIRLA GOA CAMPUS First Semester 2014-2015 Course Title: OPERATING SYSTEMS Course No CS C372 , IS C362, CS F372 and IS F 372 Component: Test I (Regular) Closed Book Component Weightage =: 20% Max Marks: 40 Duration : [Hour Date: 13-09-2014 PART B ( 30 Marks) Question No. 2 a) Draw the process state diagram of an OS in which only non-preemptive scheduling is used. Label the transitions appropriately. [3 marks] dive one benefit of a small time quantum and one benefit of a large time quantum in Round Robin Scheduling. [2 marks] Consider an operating system that uses a preemptive, priority based scheduling algorithm. The priorities, arrival times, and CPU and I/O burst times (CPU burst time is underlined) for four processes are given below. Lower numbers denote higher priorities. Assume that all 1/O requests are for different devices. (Order of preference for insertion at ready queue in case of tie: job queue process, process that completed 1/O, preempted process) b) ©) {Process | Arrival Priority | CPU-1/0 Turnaround — - \ time ee Burst time ja | 0 44241 ] BO [3 34244 fo — r 15 1 243 34242 | TT - = fe ‘8 Draw the Gantt chart for the processes Compute finish time, turnaround time and Waiting time Compute average turnaround time and waiting time [10 Marks} Question No. 3 a) Compare the performance of selfish round robin scheduler with virtual round robin scheduler using the following example, Assume q = 3. For selfish round robin, active queue can hold at most two processes. ( Order of preference for insertion at ready queue in case of tie: job queue process, process that completed I/O, preempted process) Arrival Total cPpu-10 time CPU burst 5 Burst [13 Marks] b) State true or false with justification. “ With HRRN scheduling, short processes are always scheduled before long ones” (2 Marks] BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI—K. K. BIRLA GOA CAMPUS First Semester 2014-2015 Course Title : OPERATING SYSTEMS Course No:CS'€372,, IS C362, CS F372 and IS F 372 Component: Test II (Regular) Closed Book Component Weightage —: 20% Max Marks: 40 Date: 18-10-2014 ‘Question No. 1 a) Consider the following code fragment: main() { fork(); forkQ; forkQ); printf(“X”); } i) How many child processes are created? ii) What is the output? b) Define the following terms: (Race Condition (ii)Mutual Exclusion (iii) Zombie Process (iv) Busy Waiting (v) Spin Lock c) List the six versions of exec() system call. d) Draw precedence graph for pseudo code given below: Sl; L2: S86; Li: $3; JOIN COUNT; L3: S87; Question No. 2 [11+4 = 15Marks] a) Consider 4 processes A, B, C and D. Processes A and B belongs to group Glwith weight of 0.5 and Process C and D belongs to G2 with weight of 0.5. Assume that all processes are processor bound and time quantum of execution is 20 units. Following table shows the base priority and total CPU time requirement of four processes: Process A_ |B [c [D CPU requirement [30 [60 [50 | 30 Base Priority 120 [116 [118 | 119 Draw Gantt Chart and present your answer in the following table format. GI I G2 A B GICPU ¢c D G2CPU Time Pr | CPU| Pr | CPU Pr [CPU | Pr | CPU 7 4 | | b) Consider two processes P1 and P2 which shares common critical section and swap is employed to provide mutual exclusion. Shared variable “occupied” is used to indicate whether any of the process is in its critical section or not. If occupied = true if either process is in its critical section. Process P1 decides to enter its critical section based on its local \ Boolean variable plMustWait whereas process P2 based on its local Boolean variable p2MustWait. Initially occupied = false. Replace Qi, Q2....Q8 with suitable values or variables. Process PL: Process P2: pIMustWait = true; p2MustWait = true; while (1){ while (1){ do { do { swap (QI ); swap (Q5 ); } while (Q2); } while (Q6); // critical section code // critical section code p1MustWait = Q3; p2MustWait = Q7; occupied = Q4; occupied = Q8; } Question No. 3 [142 +4+3=10 Marks] ‘A Computer system uses the Banker's Algorithm to deal with deadlocks. Its current state is shown in the tables below, where PO, P1, P2 are processes and RO, R1, R2 are resources types. Maximum Current allocation Available RO Ri R2 RO RI R2 RO RI R2 PO 4 1 2 PO 1 0 2 22 0 wi. 4 Plo 3 1 p21 2 3 P21 0 2 (] How many instances of resource type RI, R2 and R3 are actually exist in the system? (i) What is the contents of matrix Need? (ii) _Is the system in a safe state? (iv) If a request from process PI arrives for (2.1.0), can the request be granted immediately? BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI- K. K. BIRLA GOA CAMPUS First Semester 2014-2015 Course Title: OPERATING SYSTEMS Course No CS C372, IS C362, CS F 372 and IS F 372 Component: Comprehensive Exam (Regular) Closed Book Component Weightage _: 35% ID No: Question No. 1; Fill in the blanks [20*0.5 = 10Marks] a) is a circular platter constructed of non-magnetic material. 'b) Multiple Zone Recording is also known as : c) Using hamming code, we can detect bit errors. d) A memory page containing a heavily used variable that was initialized very early and is in constant use, is removed when replacement policy is used. e) is a technique to overcome external fragmentation . f) The set of all the tracks in the same relative position on the platter is known as g) InTLB, is used to uniquely identify each process and to provide protection. __a) There are 4 processes trying to access to critical section of the code. To avoid the race condition, the number of processes that may be simultaneously inside their critical section is i) system call returns the process identifier of a terminated child j) On successfal thread creation value is returned. k) Consider a logical address space of 32 pages with 1024 bytes per page, mapped onto a physical memory of 16 frames. The number of bits needed for addressing physical memory is 1)_A process is selected from the queue by the term scheduler, to be executed. m) is the concept in which a process is copied inio main memory from the secondary memory, according to the requirement. n) A system program that combines the separately compiled modules of a program into a form suitable for execution is Consider a system with “m” frames, which are empty initially and “n” pages. is the minimum number of page faults in case of a reference string of length “p” made up of “n” pages. p) The time taken by the head to locate the specific track on the disk for getting the information is known as 2 @) In second chance LRU policy, ‘page with a reference bit of, value is replaced. ) replacement policy is impossible to implement because the OS needs to have perfect knowledge of future events. s) function call is used to get the id of a thread. ) In semaphore, the semaphore can have more than two values a) b) ©) d) e) f 2) b) i) DD i) ) m) n) o) P) @) » ly » Question No. 2: State True or False. Incorrect answers will fetch -1 marks [6*1 = 6Marks] Note : Indicate “T” or “F” only a) Shortest remaining time first scheduling may cause starvation b) Round robin is better than FCFS in terms of response time ©) Semaphore is a special program used to solve the critical section problem. 4) Translation look aside (lookahead) buffer is part of Virtual memory that is used to hold recently referenced page table entries. ) A segmentation fault occurs when a program tries to access a page that is mapped in address space but not loaded in physical memory. £) File Control Block contains the information about process such as program counter, process state etc. a | b+ | 9 a | © D Correct Wrong Marks Question No. 3: Answer the following questions [4*2= 8Marks] a) There are 15 data disks in RAID 2. What is the total number of redundant (Parity) ©) Listthree file access methods disks are needed? b) List any four memory management requirements. d) List the four dynamic memory allocation schemes available. Question No. 4: Answer the following Questions [3+4+4= 11Marks] a) The following program consists of 3 concurrent processes and 3 binary semaphores. The semaphores ate initialized as $0 = 1, $1 = 0, S2 = 0. The time quantum is set to the execution time of 5 statements. Find out how many times Process PO will print “0”. Assume the order of execution as PO, P1, P2 and so on. Process PO: Process PO: Process PI: Process P2: while(true){ wait(S1); wait(S2); wait(S0); signal(S0); signal(S0); print "0"; | signal(S1); signal(S2);} Ans: 'b) A process refers to 5 pages, A, B, C, D, E in the order : A, B, C, D, A, B, E, A, B, C, D, E. Find ont number of page faults if the FIFO page replacement algorithm is used. Assume 3 frames. Also write final contents of the physical memory Page Fault: FO: Fl: F2: ©) Consider a system with 10-bit virtual address, 12-bit physical address and each page of 128 bytes. i, How many virtual pages? ii. How many physical frames? ii. Given page table contents = (2, 5, 1, 8, 3, 0, 4, 6], what is the physical address for virtual address 24E (represented in hexadecimal)? i ii. iii, BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE, PILANI— K. K. BIRLA GOA CAMPUS First Semester 2014-2015 Course Title: OPERATING SYSTEMS Course No CS C372 , IS C362, CS F 372 and 1S F 372 Component: Comprehensive Exam (Regular) Closed Book Component Weightage —: 35% Max Marks: 70 Date: 03-12-2014 IDN ‘Name: Marks Score: 35 Marks Question No. 1: [3+6+2=11Marks] Consider the following sequence of addresses(represented in decimal): 0500, 1001, 1632, 2400, 0900, 1000, 2873, 0894, 1325, 2300, 1672, 0750 Assume 500 byte page. Find out the reference string representing page numbers(Write reference string in boxes indicated by Ref). Assume four frames and initially all frames are empty. A second chance LRU algorithm is used to replac> the pages. Find out page fault. [Ref> FIRIF/R/FIR/FI(R|IFIR|FIR/F|R/FI(RIFIR/F(R/FIRIF(R FO [FL | 2 | HS { Page fault Total number of page faults = Note: F stands for frames and R stands for reference bit. Mark “X” in the last row in case of page faults. Question No. 2: [7Marks} Consider the following reference string:1 20 4 2 4 1 2 Assume three frames (initially empty). Find out page fault for hardware matrix LRU implementation. Note: F0-F2 are frames and RO-R2 are row values (in decimal) obtained from the matrix. The first two columns are filled for you. Reference string > Ital 7) ]>]olal2l4a)lilo2 Value FO = 1 1 Fi =a mike ate F2 bea fs ale Page Faults(Indicate with X) x |x RO 0 = lt RL 0 o [5s | R2 0 0 0 | Total number of page faults: Question No. 3: [7Marks] Consider 5 processes A, B, C, D and E which are to be scheduled using HRRN scheduling technique. Process | Arrival Time | CPU Burst | Finish time | Wait time Tum around time A 0 3 B z 6 c 4 4 D 6 3 | E 8 2 | A Gantt Chart O42 4 5 6 7 8 9 10 11 12 13 14 16 46 17 18 19 20 Question No. [242+6=10 Marks] Consider a system with Multi Level Feedback Queue scheduling. At t=0 there are three CPU bound = processes PI, P2 and P3 in the system (Assume initial order of execution P1, P2 and P3), The CPU burst lengths are: 10 units for Pl, 7 units for P2, and 8 units for P3. Case 1: The system has three RR queues with the following time slices: 1 for queuel, 2 for queue 2, and 4 for queue3. Draw a Gantt chart. Case 2: The system has two RR queues with the following time slices: 1 for queue! and 2 for queue 2. Queue 3 is FCES. Draw a Gantt chart. CASE 1: 012 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1819 20 21 22 23 24 25 26 CASE 2: 012 3 45 6 7 8 9 10 11 12 13 14 15 16 17 1819 20 21 22 23 24 25 26 Compare Multi Level Feedback Queue scheduling with RR scheduling (time slice = 1) in terms of Average Wait Time and finish time. Average wait Time Average Finish time Case 1: Multi Level Feedback Queue Case 2: Multi Level Feedback Queue Round Robin

You might also like