You are on page 1of 8
NAME: ID.NO.: BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE PILANT K K BIRLA GOA CAMPUS First Semester 2016-2017 Course No, : CS F372 Course Title : Operating Systems Component; Test 1 (Regular) (CB) MM. 240 marks (20%) Duration:1 hour Date : 19-9-2016 Note: Answers for descriptive questions are to be given i sentences. the form of a Numbered List of short Ql. Explain in brief (9 marks} a) Which type of processes (CPU bound or IO) does Multilevel Feedback Queue Scheduling favor? Why? b) Does Multi-threading solution always improve performance? Q.2. For the given set of processes and their details given in table below (a) Draw a Gantt chart illustrating the execution of these processes using the Shortest Remaining Time First scheduling. (b) Find the waiting period of all the processes (©) List the time units when the process is preempted and find the number of preemptions. (a) Find the waiting period of all the processes if scheduling was done using FCFS scheduling (© Assuming this data is for the any 10 seconds and is likely to repeat, Give arguments for choosing either FCFS or SRTF scheduling algorithm, [14 marks] Process A ae | Arrival time 0 on 7 Burst time 3 2 5 3 . NAME: 7 ID.NO.: Q.3. Answer the questions given below for the code snippet given below _ [7 marks] int main (int arge, char *arg/])} fork 05 if (fork () { fork 0s } fork 05 } a) How many total processes are created (including the first process running the program)? b) Draw a tree diagram showing the hierarchy of processes created when the program executes. (Label the processes PO, Pl,...etc. ). Q.4. Give code for a Shared Memory solution for the multi-process system in Q3.,(on the back of this page). It should satisfy the following requirements [10 marks} a) Every process that is created needs to write its Process Details = Process ID and its Parent Process ID, Assume that for writing the Process Details a block of 10 * sizeof (int) is needed. b) You keep track of the number of Process Details written by using the first location block to store the number of Processes which have written its data in the Shared Memory ©) All Shared Memory operations which can cause race condition should be made mutually exclusive using TestandSet. 4) Ensure that minimum number of lines of code are kept in the Critical Section. Give a brief explanation how you have implemented this. 4d) NAME: 1D.NO.: BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE PILANI KK BIRLA GOA CAMPUS First Semester 2016-2017 Course No. CS F372 Course Title: Operating Systems Component _: Test 2 (Regular) (CB) MM 240 marks (20%) Duration:1 hour Date : 24-10-2016 Note: Answers for descriptive questions are to be given in the form of a Numbered List of short sentences. Q.1. Explain in brief one Advantage and one Disadvantage of using [6 marks} a) Deadlock prevention technique of ordering resources b) Paging using large page size ©) Binding of a process addresses to memory at execution time Q.2. Consider the Dining Philosophers problem with 3 Philosophers (a) Draw a Resource Allocation Graph showing an unsafe state. () Give solution in the form of an Activity Diagram which will prevent Hold and Wait requirement of Deadlock from occurring. (Ensure that the solution is complete and incorporates mutual exclusion conditions). [14 marks} 2(a) NAME: ID.NO.: Consider four processes which need multiple instances of three resources A, B and C for completion. Consider a snapshot of the system below which gives the number of resources Allocated and the number of resources Needed by each process for completion. There are no resources available. [10 marks} a) Check whether the system is safe or not. If the system is safe write a safe sequence. If not, name all the processes in unsafe state b) Is there an alternate sequence which will allow Deadlock to be avoided? If yes list it. ©) If now P2 requests for (0,0,3) and Ps requests (1,0,0). Is any process in the system Deadlocked? Explain briefly how you can determine this. @) Allocation Need ABC ABC Pp | 010 000 Ps 200 202 Pa 303 oo1 Ps 211 100 P, 002 002 Q4. Consider a system in which the virtual address space is 64 bits, the page size is 4KB, and the amount of physical memory is 512MB. [10 marks} a) How much space would a simple single-level page table take? (Take the space required for each page table entry as 4 bytes). b) How many levels of paging would be required to ensure that each page table requires only a single page? ©) Give the size of the inverted page table? (Take the space required for each entry as 16 bytes) ‘Name: ID No: [at a2] a Qa as | as Q7 Total] Marks | | Recheck | | | | | | I | BIRLA INSTITUTE OF TECHNOLOGY & SCIENCE PILANI K K BIRLA GOA CAMPUS First Semester 2016-2017 Course No. S F372 Course Title Operating systems ‘Component Comprehensive Exam (Regular) (CB) MM +80 marks (40%) Duration:3 hours Date : 1-12-2016(AN) Note: Answers for deseriptive questions are (o be given in the form of a Numbered List. Answer should be precise and to the point. 1. Assume there are four threads (TI, T2, T3 and T4) as shown in the below diagram. An arrow from one thread (A) to another thread (B) means (A) must finish its computation before (B) starts its computation, Assume that threads can arrive in any order. Use minimum number of semaphores to solve the following problem. You will need to indicate the activities: Computation(Ti), up(Si) and down(Si) . (Time increases downwards) [10 Marks] T1 T2 73 4 > | So | | Declaration and i Initialization: i 2. Write answers for the blanks in the box below [27 Marks] a) b) O} d) e) Given that the memory access time is 100ns, TLB access time is 20ns, hit rate is 80%, the Effective Access Time is___. The Effective Access Time with 40% slowdown in memory access time due to paging with 98% hit rate is Given m frames, p references, n distinct page numbers. The lower bound on the number of page faults is The upper bound on the number of page faults is . Give brief explanation. The best way to solve “thrashing” is to increase the overlap between V/O and computation time, by increasing the number of threads in the system. True / False? Justify your answer. How can we minimize Seek Time? Explain in brief. How can we minimize Rotational Latency? Explain in brief. Write two ways through which processes on the same processor can comm with each other, Write their advantages and disadvantages of each technique. a) b) Q) qd) e) f) 3. Design an inode for a file system where file size is generally large and access pattern is mostly random, Write your assumptions and justify your answer. [3 marks] 4. Given page reference string: 1,2,3,4,2,1,5,6,2,1.2,3,7.6,3,2.1,2. Consider four frames. ‘Compare the number of page faults for LRU and Optimal page replacement algorithm. [10 Marks] 2 [2 [5 [6 [2 [2 [2 [3 [7 [6 [3 [2 [a [2 5. Consider a non-preemptive CPU scheduling algorithm called Highest Response Ratio Next. A process with highest Ratio is picked to execute. Ratio = (Time spent waiting + CPU burst times)/( CPU burst times) a) Explain which type of processes does it favour. b) Does any process starve in this algorithm? Explain. ©) Consider five processes and their CPU burst times P1(2). P2(1), P3(8), P4(4) and P5(5). These processes require i/o time of 1 after each CPU burst. All processes need 2 CPU bursts to complete execution. i, Draw a Gantt chart for these processes. ii, Calculate the turnaround time for these processes. [10 Marks] 6. Consider a computer with a 64MB of RAM and a 32-bit virtual address space. The offset within a page is 12 bits. Process P is running on this computer. The virtual memory layout of process P is indicated in the diagram below. P's stack size is 6048 Kbytes, its heap size is 1600 Kbytes, and its code size 400 Kbytes. [10 marks} Pay Suk | —. Fee a) b) °) da) What is the page size of this computer? Each page table entry is 4 bytes. What is the size of P's page table, assuming a single-level page table? Assume the memory architecture uses a 2-level page table scheme. Each level is represented by 10 bits and each page table entry is 4 bytes for both levels. How big is P's page table if Segmentation with paging is used for Code, Heap and Stack? Assume the memory architecture uses inverted page tables, and that each page table entry is 4 bytes. How big is the inverted page table? Is this page table private to process P? o 7. When we modify any block in main memory there are two ways to make the change persistent 1. Flush the complete block on disk. 2. Write the change / modified data to a log and flush the log. [10 marks] a) Draw separate activity diagrams to implement the above methods. b) Which method will you choose from above for read intensive workload and write intensive workload. Justify your answer.

You might also like