Loading

SET 4


  Question 1

In which one of the following page replacement policies, Belady’s anomaly may occur?

A : FIFO
B : Optimal
C : LRU
D : MRU


  •  
    .

     Correct answer is :A

     Solution :
      Belady’s anomaly proves that it is possible to have more page faults when increasing the number of page frames while using the First in First Out (FIFO) page replacement algorithm.

  •   Question 2

    The essential content(s) in each entry of a page table is / are

    A : Virtual page number
    B : Page frame number
    C : Both virtual page number and page frame number
    D : Access right information


  •  
    .

     Correct answer is :B

     Solution :
      A page table entry must contain Page frame number. Virtual page number is typically used as index in page table to get the corresponding page frame number.

  •   Question 3

    Consider a system with 4 types of resources R1 (3 units), R2 (2 units), R3 (3 units), R4 (2 units). A non-preemptive resource allocation policy is used. At any given instance, a request is not entertained if it cannot be completely satisfied. Three processes P1, P2, P3 request the sources as follows if executed independently.
    
    
    Process P1: 
    t=0: requests 2 units of R2 
    t=1: requests 1 unit of R3 
    t=3: requests 2 units of R1 
    t=5: releases 1 unit of R2    
            and 1 unit of R1. 
    t=7: releases 1 unit of R3 
    t=8: requests 2 units of R4 
    t=10: Finishes
    
    Process P2: 
    t=0: requests 2 units of R3 
    t=2: requests 1 unit of R4 
    t=4: requests 1 unit of R1 
    t=6: releases 1 unit of R3 
    t=8: Finishes
    
    Process P3: 
    t=0: requests 1 unit of R4 
    t=2: requests 2 units of R1 
    t=5: releases 2 units of R1 
    t=7: requests 1 unit of R2 
    t=8: requests 1 unit of R3 
    t=9: Finishes
    
    
    
    

    Which one of the following statements is TRUE if all three processes run concurrently starting at time t=0?


    A : All processes will finish without any deadlock
    B : Only P1 and P2 will be in deadlock.
    C : Only P1 and P3 will be in a deadlock.
    D : All three processes will be in deadlock


  •  
    .

     Correct answer is :A

     Solution :
      We can apply the following Deadlock Detection algorithm and see that there is no process waiting indefinitely for a resource. See this for deadlock detection algorithm.

  •   Question 4

    Consider a disk system with 100 cylinders. The requests to access the cylinders occur in following sequence: 4, 34, 10, 7, 19, 73, 2, 15, 6, 20 Assuming that the head is currently at cylinder 50, what is the time taken to satisfy all requests if it takes 1ms to move from one cylinder to adjacent one and shortest seek time first policy is used?

    A : 95ms
    B : 119ms
    C : 233ms
    D : 276ms


  •  
    .

     Correct answer is :B

     Solution :
      4, 34, 10, 7, 19, 73, 2, 15, 6, 20 Since shortest seek time first policy is used, head will first move to 34. This move will cause 16*1 ms. After 34, head will move to 20 which will cause 14*1 ms. And so on. So cylinders are accessed in following order 34, 20, 19, 15, 10, 7, 6, 4, 2, 73 and total time will be (16 + 14 + 1 + 4 + 5 + 3 + 1 + 2 + 2 + 71)*1 = 119 ms.

  •   Question 5

    In the following process state transition diagram for a uniprocessor system, assume that there are always some processes in the ready state: Now consider the following statements.
    
    I. If a process makes a transition D, it would result in 
       another process making transition A immediately.
    II. A process P2 in blocked state can make transition E 
        while another process P1 is in running state.
    III. The OS uses preemptive scheduling.
    IV. The OS uses non-preemptive scheduling.
    Which of the above statements are TRUE?
    
    
    




    A : I and II
    B : I and III
    C : II and III
    D : II and IV


  •  
    .

     Correct answer is :C

     Solution :
      I is false. If a process makes a transition D, it would result in another process making transition B, not A. II is true. A process can move to ready state when I/O completes irrespective of other process being in running state or not. III is true because there is a transition from running to ready state. IV is false as the OS uses preemptive scheduling.

  •   Question 6

    The enter_CS() and leave_CS() functions to implement critical section of a process are realized using test-and-set instruction as follows:
    void enter_CS(X)
    {
        while test-and-set(X) ;
    }
    void leave_CS(X)
    {
       X = 0;
    }

    In the above solution, X is a memory location associated with the CS and is initialized to 0. Now consider the following statements: I. The above solution to CS problem is deadlock-free II. The solution is starvation free. III. The processes enter CS in FIFO order. IV More than one process can enter CS at the same time. Which of the above statements is TRUE?


    A : I only
    B : I and II
    C : II and III
    D : IV only


  •  
    .

     Correct answer is :A

     Solution :
      The above solution is a simple test-and-set solution that makes sure that deadlock doesn’t occur, but it doesn’t use any queue to avoid starvation or to have FIFO order.

  •   Question 7

    A multilevel page table is preferred in comparison to a single level page table for translating virtual address to physical address because

    A : It reduces the memory access time to read or write a memory location.
    B : It helps to reduce the size of page table needed to implement the virtual address space of a process
    C : It is required by the translation lookaside buffer
    D : It helps to reduce the number of page faults in page replacement algorithms


  •  
    .

     Correct answer is :B

     Solution :
      The size of page table may become too big to fit in contiguous space. That is why page tables are typically divided in levels

  •   Question 8

    A hard disk has 63 sectors per track, 10 platters each with 2 recording surfaces and 1000 cylinders. The address of a sector is given as a triple (c, h, s), where c is the cylinder number, h is the surface number and s is the sector number. Thus, the 0th sector is addressed as (0, 0, 0), the 1st sector as (0, 0, 1), and so on The address <400,16,29> corresponds to sector number:

    A : 505035
    B : 505036
    C : 505037
    D : 505038


  •  
    .

     Correct answer is :C

     Solution :
      Total surfaces are 20 There are 1000 cylinders each cylinder contains 20 tracks in all the surfaces together. Each track contains 63 sectors So the address is 400x20x63 + 16x63 + 29 = 505037

  •   Question 9

    A hard disk has 63 sectors per track, 10 platters each with 2 recording surfaces and 1000 cylinders. The address of a sector is given as a triple (c, h, s), where c is the cylinder number, h is the surface number and s is the sector number. Thus, the 0th sector is addressed as (0, 0, 0), the 1st sector as (0, 0, 1), and so on The address of the 1039th sector is

    A : (0, 15, 31)
    B : (0, 16, 30)
    C : (0, 16, 31)
    D : (0, 17, 31)


  •  
    .

     Correct answer is :C

     Solution :
      16*31 + 31 = 1039

  •   Question 10

    Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.

    Method Used by P1
    while (S1 == S2) ;
    Critical Section
    S1 = S2;

    Method Used by P2
    while (S1 != S2) ;
    Critical Section
    S2 = not (S1);
    Which one of the following statements describes the properties achieved?


    A : Mutual exclusion but not progress
    B : Progress but not mutual exclusion
    C : Neither mutual exclusion nor progress
    D : Both mutual exclusion and progress


  •  
    .

     Correct answer is :A


  •   Question 11

    A system uses FIFO policy for page replacement. It has 4 page frames with no pages loaded to begin with. The system first accesses 100 distinct pages in some order and then accesses the same 100 pages but now in the reverse order. How many page faults will occur?

    A : 196
    B : 195
    C : 192
    D : 197


  •  
    .

     Correct answer is :A

     Solution :
      100 Page faults then we are left with 97,98,99,100 in memory.
    These 4 will not have PF rest 96 will again have page faults so total 196

  •   Question 12

    Which of the following statements are true?
    I. Shortest remaining time first scheduling may cause starvation
    II. Preemptive scheduling may cause starvation
    III. Round robin is better than FCFS in terms of response time


    A : I only
    B : I and III only
    C : II and III only
    D : I, II and III


  •  
    .

     Correct answer is :D


  •   Question 13

    The following program consists of 3 concurrent processes and 3 binary semaphores. The semaphores are initialized as S0=1, S1=0, S2=0.
    How many times will process P0 print ‘0’?




    A : At least twice
    B : Exactly twice
    C : Exactly thrice
    D : Exactly once


  •  
    .

     Correct answer is :A


  •   Question 14

    A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pi is as follows:
    if (i % 2 == 0) {
    if (i < n) request Ri if (i+2 < n) request Ri+2
    }
    else {
    if (i < n) request Rn-i
    if (i+2 < n) request Rn-i-2
    }
    In which one of the following situations is a deadlock possible?


    A : n=40, k=26
    B : n=21, k=12
    C : n=20, k=10
    D : n=41, k=19


  •  
    .

     Correct answer is :B


  • MY REPORT
    TOTAL = 14
    ANSWERED =
    CORRECT / TOTAL = /14
    POSITIVE SCORE =
    NEGATIVE SCORE =
    FINAL SCORE =