Loading

SET 5


  Question 1

Group 1 contains some CPU scheduling algorithms and Group 2 contains some applications. Match entries in Group 1 to entries in Group 2.



A : P – 3 Q – 2 R – 1
B : P – 1 Q – 2 R – 3
C : P – 2 Q – 3 R – 1
D : P – 1 Q – 3 R – 2


  •  
    .

     Correct answer is :A

     Solution :
      Gang scheduling for parallel systems that schedules related threads or processes to run simultaneously on different processors.
    Rate monotonic scheduling is used in real-time operating systems with a static-priority scheduling class. The static priorities are assigned on the basis of the cycle duration of the job: the shorter the cycle duration is, the higher is the job’s priority.
    Fair Share Scheduling is a scheduling strategy in which the CPU usage is equally distributed among system

  •   Question 2

    Consider the following statements about user level threads and kernel level threads. Which one of the following statement is FALSE?

    A : Context switch time is longer for kernel level threads than for user level threads.
    B : User level threads do not need any hardware support.
    C : Related kernel level threads can be scheduled on different processors in a multi-processor system.
    D : Blocking one kernel level thread blocks all related threads.


  •  
    .

     Correct answer is :D

     Solution :
      Since kernel level threads are managed by kernel, blocking one thread doesn’t cause all related threads to block. It’s a problem with user level threads.

    Kernel Threads:
    Advantages: Because kernel has full knowledge of all threads, Scheduler may decide to give more time to a process having large number of threads than process having small number of threads.
    Kernel-level threads are especially good for applications that frequently block.
    Disadvantages: The kernel-level threads are slow and inefficient. For instance, threads operations are hundreds of times slower than that of user-level threads.
    Since kernel must manage and schedule threads as well as processes. It require a full thread control block (TCB) for each thread to maintain information about threads. As a result there is significant overhead and increased in kernel complexity.

    User Threads:
    Advantages:
    The most obvious advantage of this technique is that a user-level threads package can be implemented on an Operating System that does not support threads.
    User-level threads does not require modification to operating systems. Simple Representation: Each thread is represented simply by a PC, registers, stack and a small control block, all stored in the user process address space.
    Simple Management: This simply means that creating a thread, switching between threads and synchronization between threads can all be done without intervention of the kernel.
    Fast and Efficient: Thread switching is not much more expensive than a procedure call.

    Disadvantages:
    User-Level threads are not a perfect solution as with everything else, they are a trade off. Since, User-Level threads are invisible to the OS they are not well integrated with the OS. As a result, Os can make poor decisions like scheduling a process with idle threads, blocking a process whose thread initiated an I/O even though the process has other threads that can run and unscheduling a process with a thread holding a lock. Solving this requires communication between between kernel and user-level thread manager.
    There is a lack of coordination between threads and operating system kernel. Therefore, process as whole gets one time slice irrespect of whether process has one thread or 1000 threads within. It is up to each thread to relinquish control to other threads.
    User-level threads requires non-blocking systems call i.e., a multithreaded kernel. Otherwise, entire process will blocked in the kernel, even if there are runable threads left in the processes. For example, if one thread causes a page fault, the process blocks.

  •   Question 3

    An operating system uses Shortest Remaining Time first (SRT) process scheduling algorithm. Consider the arrival times and execution times for the following processes:
    What is the total waiting time for process P2?




    A : 5
    B : 15
    C : 40
    D : 55


  •  
    .

     Correct answer is :C

     Solution :
      At time 0, P1 is the only process, P1 runs for 15 time units.
    At time 15, P2 arrives, but P1 has the shortest remaining time. So P1 continues for 5 more time units.
    At time 20, P2 is the only process. So it runs for 10 time units
    At time 30, P3 is the shortest remaining time process. So it runs for 10 time units
    At time 40, P2 runs as it is the only process. P2 runs for 5 time units.
    At time 45, P3 arrives, but P2 has the shortest remaining time. So P2 continues for 10 m

  •   Question 4

    A virtual memory system uses First In First Out (FIFO) page replacement policy and allocates a fixed number of frames to a process. Consider the following statements:
    P: Increasing the number of page frames allocated to a process sometimes increases the page fault rate.
    Q:Some programs do not exhibit locality of reference.
    Which one of the following is TRUE?


    A : Both P and Q are true, and Q is the reason for P
    B : Both P and Q are true, but Q is not the reason for P.
    C : P is false, but Q is true
    D : Both P and Q are false


  •  
    .

     Correct answer is :B

     Solution :
      P is true. Increasing the number of page frames allocated to process may increases the no. of page faults .
    Q is also true, but Q is not the reason for-P as Belady’s Anomaly occurs for some specific patterns of page references.

  •   Question 5

    A single processor system has three resource types X, Y and Z, which are shared by three processes. There are 5 units of each resource type. Consider the following scenario, where the column alloc denotes the number of units of each resource type allocated to each process, and the column request denotes the number of units of each resource type requested by a process in order to complete execution. Which of these processes will finish LAST?



    A : P0
    B : P1
    C : P2
    D : None of the above, since the system is in a deadlock


  •  
    .

     Correct answer is :C

     Solution :
      Once all resources (5, 4 and 3 instances of X, Y and Z respectively) are allocated, 0, 1 and 2 instances of X, Y and Z are left. Only needs of P1 can be satisfied. So P1 can finish its execution first. Once P1 is done, it releases 2, 1 and 3 units of X, Y and Z respectively. Among P0 and P2, needs of P0 can only be satisfied. So P0 finishes its execution. Finally, P2 finishes its execution.

  •   Question 6

    Two processes, P1 and P2, need to access a critical section of code. Consider the following synchronization construct used by the processes:Here, wants1 and wants2 are shared variables, which are initialized to false. Which one of the following statements is TRUE about the above construct?



    A : It does not ensure mutual exclusion
    B : It does not ensure bounded waiting
    C : It requires that processes enter the critical section in strict alternation.
    D : It does not prevent deadlocks, but ensures mutual exclusion.


  •  
    .

     Correct answer is :D

     Solution :
      The above synchronization constructs don’t prevent deadlock. When both wants1 and wants2 become true, both P1 and P2 stuck forever in their while loops waiting for each other to finish.

  •   Question 7

    A process has been allocated 3 page frames. Assume that none of the pages of the process are available in the memory initially. The process makes the following sequence of page references (reference string): 1, 2, 1, 3, 7, 4, 5, 6, 3, 1 If optimal page replacement policy is used, how many page faults occur for the above reference string?

    A : 7
    B : 8
    C : 9
    D : 10


  •  
    .

     Correct answer is :A


  •   Question 8

    A process has been allocated 3 page frames. Assume that none of the pages of the process are available in the memory initially. The process makes the following sequence of page references (reference string): 1, 2, 1, 3, 7, 4, 5, 6, 3, 1. how many more page faults occur with LRU than with the optimal page replacement policy? (Least Recently Used (LRU) page replacement policy is a practical approximation to optimal page replacement.)

    A : 0
    B : 1
    C : 2
    D : 3


  •  
    .

     Correct answer is :C


  •   Question 9

    For a magnetic disk with concentric circular tracks, the seek latency is not linearly proportional to the seek distance due to

    A : non-uniform distribution of requests
    B : arm starting and stopping inertia
    C : higher capacity of tracks on the periphery of the platter
    D : use of unfair arm scheduling policies


  •  
    .

     Correct answer is :B


  •   Question 10

    The P and V operations on counting semaphores, where s is a counting semaphore, are defined as follows:
    
    
    P(s) : s =  s - 1;
      if (s  < 0) then wait;
    V(s) : s = s + 1;
    
      if (s <= 0) then wakeup a process waiting on s;
    Assume that Pb and Vb the wait and signal operations on binary semaphores are provided. Two binary semaphores Xb and Yb are used to implement the semaphore operations P(s) and V(s) as follows:
    
    P(s) : Pb(Xb);
      s = s - 1;
      if (s < 0) {
       Vb(Xb) ;
       Pb(Yb) ;
      }
      else Vb(Xb); 
    
    V(s) : Pb(Xb) ;
      s = s + 1;
      if (s <= 0) Vb(Yb) ;
      Vb(Xb) ;
    
    The initial values of Xb and Yb are respectively
    
    
    
    


    A : 0 and 0
    B : 0 and 1
    C : 1 and 0
    D : 1 and 1


  •  
    .

     Correct answer is :C

     Solution :
      Both P(s) and V(s) operations are perform Pb(xb) as first step. If Xb is 0, then all processes executing these operations will be blocked. Therefore, Xb must be 1.
    If Yb is 1, it may become possible that two processes can execute P(s) one after other (implying 2 processes in critical section). Consider the case when s = 1, y = 1. So Yb must be 0.

  •   Question 11

    Which of the following statements about synchronous and asynchronous I/O is NOT true?

    A : An ISR is invoked on completion of I/O in synchronous I/O but not in asynchronous I/O
    B : In both synchronous and asynchronous I/O, an ISR (Interrupt Service Routine) is invoked after completion of the I/O
    C : A process making a synchronous I/O call waits until I/O is complete, but a process making an asynchronous I/O call does not wait for completion of the I/O
    D : In the case of synchronous I/O, the process waiting for the completion of I/O is woken up by the ISR that is invoked after the completion of I/O


  •  
    .

     Correct answer is :A

     Solution :
      In both Synchronous and Asynchronous, an interrupt is generated on completion of I/O. In Synchronous, interrupt is generated to wake up the process waiting for I/O. In Asynchronous, interrupt is generated to inform the process that the I/O is complete and it can process the data from the I/O operation.

  •   Question 12

    Which of the following is NOT true of deadlock prevention and deadlock avoidance schemes?

    A : In deadlock prevention, the request for resources is always granted if the resulting state is safe
    B : In deadlock avoidance, the request for resources is always granted if the result state is safe
    C : Deadlock avoidance is less restrictive than deadlock prevention
    D : Deadlock avoidance requires knowledge of resource requirements a priori


  •  
    .

     Correct answer is :A

     Solution :
      Deadlock prevention scheme handles deadlock by making sure that one of the four necessary conditions don't occur. In deadlock prevention, the request for a resource may not be granted even if the resulting state is safe.

  •   Question 13

    A process executes the following code
    for (i = 0; i < n; i++) fork();
    The total number of child processes created is


    A : n
    B : 2^n-1
    C : 2^n
    D : 2^(n+1) -1


  •  
    .

     Correct answer is :B

     Solution :
     
             F0       // There will be 1 child process created by first fork
          /     
        F1      F1    // There will be 2 child processes created by second fork
       /      /  
     F2   F2  F2   F2  // There will be 4 child processes created by third fork
    /    /  /   / 
     ...............   // and so on
    If we sum all levels of above tree for i = 0 to n-1, we get 2^n - 1. So there will be 2^n – 1 child processes.

  •   Question 14

    A processor uses 36 bit physical addresses and 32 bit virtual addresses, with a page frame size of 4 Kbytes. Each page table entry is of size 4 bytes. A three level page table is used for virtual to physical address translation, where the virtual address is used as follows • Bits 30-31 are used to index into the first level page table • Bits 21-29 are used to index into the second level page table • Bits 12-20 are used to index into the third level page table, and • Bits 0-11 are used as offset within the page The number of bits required for addressing the next level page table (or page frame) in the page table entry of the first, second and third level page tables are respectively.

    A : 20, 20 and 20
    B : 24, 24 and 24
    C : 24, 24 and 20
    D : 25, 25 and 24


  •  
    .

     Correct answer is :D

     Solution :
      Virtual address size = 32 bits
    Physical address size = 36 bits
    Physical memory size = 2^36 bytes
    Page frame size = 4K bytes = 2^12 bytes
    No. of bits required to access physical memory frame = 36 - 12 = 24
    So in third level of page table, 24 bits are required to access an entry.

    9 bits of virtual address are used to access second level page table entry and size of pages in second level is 4 bytes. So size of second level page table is (2^9)*4 = 2^11 bytes.
    It means there are (2^36)/(2^11) possible locations to store this page table. Therefore the second page table requires 25 bits to address it. Similarly, the third page table needs 25 bits to address it.

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