Loading

SET 3


  Question 1

A thread is usually defined as a ‘light weight process’ because an operating system (OS) maintains smaller data structures for a thread than for a process. In relation to this, which of the followings is TRUE?

A : On per-thread basis, the OS maintains only CPU register state
B : The OS does not maintain a separate stack for each thread
C : On per-thread basis, the OS does not maintain virtual memory state
D : On per thread basis, the OS maintains only scheduling and accounting information


  •  
    .

     Correct answer is :C

     Solution :
      Virtually memory is concerned with processes not with Threads.

  •   Question 2

    Let the page fault service time be 10ms in a computer with average memory access time being 20ns. If one page fault is generated for every 106 memory accesses, what is the effective access time for the memory?

    A : 21ns
    B : 30ns
    C : 23ns
    D : 35ns


  •  
    .

     Correct answer is :B

     Solution :
      P = page fault rate EA = p × page fault service time + (1-p)* Memory access time = (1/106)*10*106+ (1-(1/106)) * 20 == 29.9ns

  •   Question 3

    Let the time taken to switch between user and kernel modes of execution be t1 while the time taken to switch between two processes be t2. Which of the following is TRUE?

    A : t1 > t2
    B : t1 = t2
    C : t1 < t2
    D : Nothing can be said about the relation between t1 and t2


  •  
    .

     Correct answer is :C

     Solution :
      Process switching also involves mode changing.

  •   Question 4

    An application loads 100 libraries at startup. Loading each library requires exactly one disk access. The seek time of the disk to a random location is given as 10ms. Rotational speed of disk is 6000rpm. If all 100 libraries are loaded from random locations on the disk, how long does it take to load all libraries? (The time to transfer data from the disk block once the head has been positioned at the start of the block may be neglected)

    A : 0.50 s
    B : 1.50 s
    C : 1.25 s
    D : 1.00 s


  •  
    .

     Correct answer is :B

     Solution :
      6000 rotation = 60 sec & 1 rotation = 10 ms Rotational latency = 5ms Time for one disk access = 15 ms Time to load all libraries = 15 ×100 = 1500ms = 1.5sec

  •   Question 5

    Consider the following table of arrival time and burst time for three processes P0, P1 and P2.
    Process   Arrival time   Burst Time
    P0            0 ms          9 ms
    P1            1 ms          4 ms
    P2            2 ms          9 ms
    
    
    
    The pre-emptive shortest job first scheduling algorithm is used. Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three processes?


    A : 5.0 ms
    B : 4.33 ms
    C : 6.33 ms
    D : 7.33 ms


  •  
    .

     Correct answer is :A


  •   Question 6

    A process executes the code
    fork ();
    fork ();
    fork ();
    The total number of child processes created is


    A : 3
    B : 4
    C : 7
    D : 8


  •  
    .

     Correct answer is :C

     Solution :
      If fork is called n times, there will be total 2n running processes including the parent process. So, there will be 2n-1 child processes.

  •   Question 7

    Consider the virtual page reference string
    1,2,3,2,4,1,3,2,4,1
    on a demand paged virtual memory system running on a computer system that has main memory size of 3 page frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacement policy. Then


    A : OPTIMAL < LRU < FIFO
    B : OPTIMAL < FIFO < LRU
    C : OPTIMAL = LRU
    D : OPTIMAL = FIFO


  •  
    .

     Correct answer is :B

     Solution :
      FIFO = 6 fautls
    Optimal = 5 faults
    LRU = 9 faults

  •   Question 8

    A file system with 300 GByte disk uses a file descriptor with 8 direct block addresses, 1 indirect block address and 1 doubly indirect block address. The size of each disk block is 128 Bytes and the size of each disk block address is 8 Bytes. The maximum possible file size in this file system is

    A : 3 KBytes
    B : 35 KBytes
    C : 280 KBytes
    D : dependent on the size of the disk


  •  
    .

     Correct answer is :B

     Solution :
      Each block size = 128
    Bytes Disk block address = 8 Bytes
    Each disk can contain = 128 /8 =16 addresses
    Size due to 8 direct block addresses: 8 x 128
    Size due to 1 indirect block address: 16 x 128
    Size due to 1 doubly indirect block address: 16 x 16 x 128
    Size due to 1 doubly indirect block address: 16 x 16 x 128
    So, maximum possible file size:
    8 *128+ 16 *128 +16 *16 *128= 1024 +2048+ 32768=35840 Bytes= 35KByte

  •   Question 9

    Fetch_And_Add (X, i) is an atomic Read-Modify-Write instruction that reads the value of memory location X, increments it by the value i, and returns the old value of X. It is used in the pseudocode shown below to implement a busy-wait lock. L is an unsigned integer shared variable initialized to 0. The value of 0 corresponds to lock being available, while any nonzero value corresponds to the lock being not available.
    AcquireLock(L){
    While (Fetch_And_Add(L,1))
    L = 1;
    }
    Release Lock(L){
    L = 0;
    }
    This implementation


    A : fails as L can overflow
    B : fails as L can take on a non-zero value when the lock is actually available
    C : works correctly but may starve some processes
    D : works correctly without starvation


  •  
    .

     Correct answer is :B

     Solution :
      1. Acquire lock (L) {
    2. While (Fetch_And_Add(L, 1))
    3. L = 1. }
    4. Release Lock (L) {
    5. L = 0;
    6. }
    Let P and Q be two concurrent processes in the system currently executing as follows
    P executes 1,2,3 then Q executes 1 and 2 then P executes 4,5,6 then L=0 now Q executes 3 by which L will be set to 1 and thereafter no process can set
    L to zero, by which all the processes could starve.

  •   Question 10

    Consider the 3 process, P1, P2 and P3 shown in the table.
    The completion order of the 3 processes under the policies FCFS and RR2 (round robin scheduling with CPU quantum of 2 time units) are




    A : FCFS: P1, P2, P3
    RR2: P1, P2, P3

    B : FCFS: P1, P3, P2
    RR2: P1, P3, P2

    C : FCFS: P1, P2, P3
    RR2: P1, P3, P2

    D : FCFS: P1, P3, P2
    RR2: P1, P2, P3



  •  
    .

     Correct answer is :C

     Solution :
      For FCFS Execution order will be order of Arrival time so it is P1,P2,P3
    Next For RR with time quantum=2,the arrangement of Ready Queue will be as follows:
    RQ: P1,P2,P1,P3,P2,P1,P3,P2
    This RQ itself shows the order of execution on CPU(Using Gantt Chart) and here it gives the completion order as P1,P3,P2 in Round Robin algorithm.

  •   Question 11

    A computer has a 256 KByte, 4-way set associative, write back data cache with block size of 32 Bytes. The processor sends 32 bit addresses to the cache controller. Each cache tag directory entry contains, in addition to address tag, 2 valid bits, 1 modified bit and 1 replacement bit.
    The number of bits in the tag field of an address is


    A : 11
    B : 14
    C : 16
    D : 27


  •  
    .

     Correct answer is :C

     Solution :
      Number of blocks == 256KB/32Byte = 213blocks
    As it is 4–way set associative, number of sets = 2^13 / 2^2 = 211


  •   Question 12

    A computer has a 256 KByte, 4-way set associative, write back data cache with block size of 32 Bytes. The processor sends 32 bit addresses to the cache controller. Each cache tag directory entry contains, in addition to address tag, 2 valid bits, 1 modified bit and 1 replacement bit.
    The size of the cache tag directory is


    A : 160 Kbits
    B : 136 Kbits
    C : 40 Kbits
    D : 32 Kbits


  •  
    .

     Correct answer is :A

     Solution :
      TAG controller maintains 16 + 4 = 20 bits for every block
    Hence, size of cache tag directory = 20 × 213 bits =160 Kbits

  •   Question 13

    In a k-way set associative cache, the cache is divided into v sets, each of which consists of k lines. The lines of a set are placed in sequence one after another. The lines in set s are sequenced before the lines in set (s+1). The main memory blocks are numbered 0 onwards. The main memory block numbered j must be mapped to any one of the cache lines from

    A : ( j mod v)*k to ( j mod v)*k + (k-1)
    B : ( j mod v) to ( j mod v) + (k-1)
    C : ( j mod k) to ( j mod k) + (v-1)
    D : ( j mod k)* v to ( j mod k)* v + (v-1)


  •  
    .

     Correct answer is :A

     Solution :
      Position of main memory block in the cache (set) = (main memory block number) MOD (number of sets in the cache).
    As the lines in the set are placed in sequence, we can have the lines from 0 to (K – 1) in each set.
    Number of sets = v, main memory block number = j
    First line of cache = (j mod v)*k; last line of cache = (j mod v)*k + (k – 1)

  •   Question 14

    Three concurrent processes X, Y, and Z execute three different code segments that access and update certain shared variables. Process X executes the P operation (i.e., wait) on semaphores a, b and c; process Y executes the P operation on semaphores b, c and d; process Z executes the P operation on semaphores c, d, and a before entering the respective code segments. After completing the execution of its code segment, each process invokes the V operation (i.e., signal) on its three semaphores. All semaphores are binary semaphores initialized to one. Which one of the following represents a deadlock-free order of invoking the P operations by the processes?

    A : X:P(a )P(b)P(c) Y:P(b )P(c)P(d) Z: P(c )P(d)P(a)
    B : X:P(b )P(a)P(c) Y:P(b )P(c)P(d) Z: P(a )P(c)P(d)
    C : X:P(b )P(a)P(c) Y:P(c )P(b)P(d) Z: P(a )P(c)P(d)
    D : X:P(a )P(b)P(c) Y:P(c )P(b)P(d) Z: P(c )P(d)P(a)


  •  
    .

     Correct answer is :B

     Solution :
      Suppose X performs P(b) and preempts, Y gets chance, but cannot do its first wait i.e., P(b), so waits for X, now Z gets the chance and performs P(a) and preempts, next X gets chance. X cannot continue as wait on ‘a’ is done by Z already, so X waits for Z. At this time Z can continue its operations as down on c and d. Once Z finishes, X can do its operations and so Y. In any of execution order of X, Y, Z one process can continue and finish, such that waiting is not circular. In options (A),(C) and (D) we can easily find circular wait, thus deadlock

  •   Question 15

    A certain computation generates two arrays a and b such that a[i] = f (i) for 0 £ i < n and b[i] = g (a [i]) for 0 £ i < n . Suppose this computation is decomposed into two concurrent processes X and Y such that X computes the array a and Y computes the array b. The processes employ two binary semaphores R and S, both initialized to zero. The array a is shared by the two processes. The structures of the processes are shown below.
    Which one of the following represents the CORRECT implementations of ExitX and EntryY?




    A : B :
    C : D :


  •  
    .

     Correct answer is :C

     Solution :
      For computing both the array a[] and b[], first element a[i] should be computed using which b[i] can be computed. So process X and Y should run in strict alteration manner, starting with X. This requirement meets with implementation of ExitX and EntryY given in option C.

  •   Question 16

    A shared variable x, initialized to zero, is operated on by four concurrent processes W, X, Y, Z as follows. Each of the processes W and X reads x from memory, increments by one, stores it to memory, and then terminates. Each of the processes Y and Z reads x from memory, decrements by two, stores it to memory, and then terminates. Each process before reading x invokes the P operation (i.e., wait) on a counting semaphore S and invokes the V operation (i.e., signal) on the semaphore S after storing x to memory. Semaphore S is initialized to two. What is the maximum possible value of x after all processes complete execution?

    A : -2
    B : -1
    C : 1
    D : 2


  •  
    .

     Correct answer is :D


  •   Question 17

    Consider a hard disk with 16 recording surfaces (0-15) having 16384 cylinders (0-16383) and each cylinder contains 64 sectors (0 - 63) . Data storage capacity in each sector is 512 bytes. Data are organized cylinder–wise and the addressing format is . A file of size 42797 KB is stored in the disk and the starting disk location of the file is <1200, 9, 40>. What is the cylinder number of the last sector of the file, if it is stored in a contiguous manner?

    A : 1281
    B : 1282
    C : 1283
    D : 1284


  •  
    .

     Correct answer is :D

     Solution :
      42797 KB = 42797 *1024/512 = 85594sectors
    Starting is <1200,9,40> contains total 24 + (6×64) = 408 sectors
    Next, 1201, --------, 1283 cylinders contains total 1024×83 = 84992 sectors
    Total =408 +84992= 85400 sectors
    The required cylinder number is 1284 which will contain the last sector of the file

  •   Question 18

    A computer uses 46–bit virtual address, 32–bit physical address, and a three–level paged page table organization. The page table base register stores the base address of the first–level table (T1) ,which occupies exactly one page. Each entry of T1 stores the base address of a page of the second–level table ( T2) . Each entry of T2 stores the base address of a page of the third–level table (T3) Each entry of T3 stores a page table entry (PTE). The PTE is 32 bits in size. The processor used in the computer has a 1 MB 16 way set associative virtually indexed physically tagged cache. The cache block size is 64 bytes.
    What is the size of a page in KB in this computer?


    A : 2
    B : 4
    C : 8
    D : 16


  •  
    .

     Correct answer is :C


  •   Question 19

    A computer uses 46–bit virtual address, 32–bit physical address, and a three–level paged page table organization. The page table base register stores the base address of the first–level table (T1) ,which occupies exactly one page. Each entry of T1 stores the base address of a page of the second–level table ( T2) . Each entry of T2 stores the base address of a page of the third–level table (T3) Each entry of T3 stores a page table entry (PTE). The PTE is 32 bits in size. The processor used in the computer has a 1 MB 16 way set associative virtually indexed physically tagged cache. The cache block size is 64 bytes.
    What is the minimum number of page colours needed to guarantee that no two synonyms map to different sets in the processor cache of this computer?


    A : 2
    B : 4
    C : 8
    D : 16


  •  
    .

     Correct answer is :C

     Solution :
      As the page size is 213 Bytes and page coloring is asked so we divide cache size by page size and group 16 pages in one set.Number of pages in cache=1MB/8KB=128 pages
    Number of set in cache=128/16=8 sets
    Take any page of LAS, it will be mapped with cache on any one of these 8 sets (set association mapping).For any two synonym to map with same set they should be colored with same color of that respective set. So minimum we need 8 colors for this mapping.

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