Operating systems miscellaneous


Operating systems miscellaneous

  1. Consider the following two phase locking protocol. Suppose a transaction T accesses (for read or write operations), a certain set of objects {O1; ...,Ok}. This is done in the following manner:
    Step 1. T acquires exclusive locks to O1,..., Ok in increasing order of their addresses.
    Step 2. The required operations are performed.
    Step 3. All locks are released. This protocol will









  1. View Hint View Answer Discuss in Forum

    Two phase locking protocol ensures serializability and due to following linear order in acquiring the locks, there will be no deadlock.

    Correct Option: A

    Two phase locking protocol ensures serializability and due to following linear order in acquiring the locks, there will be no deadlock.


  1. A unix-style I-node has 10 direct pointers and one single, one double and one triple indirect pointers. Disk block size is 1 kbyte, disk block address is 32 bit, and 48-bit integers are used. What is the maximum possible file size?









  1. View Hint View Answer Discuss in Forum

    Size of 1 block = 1 kB
    Block addresses size 1 pointer size = 32 bit = 4 bytes.

    So , no. of pointers in =
    210
    B
    22

    1 block = 256
    So direct pointer will have = 10 × 1kB = 10kB
    Double will have = 256 × 256 × 1 kB
    Triple will have = 256 × 256 × 256 × 1 kB = 28 × 28 × 28 × 210 B = 234 B
    Hence (c) is correct option.

    Correct Option: C

    Size of 1 block = 1 kB
    Block addresses size 1 pointer size = 32 bit = 4 bytes.

    So , no. of pointers in =
    210
    B
    22

    1 block = 256
    So direct pointer will have = 10 × 1kB = 10kB
    Double will have = 256 × 256 × 1 kB
    Triple will have = 256 × 256 × 256 × 1 kB = 28 × 28 × 28 × 210 B = 234 B
    Hence (c) is correct option.



  1. Using a larger block size in a fixed block size file system leads to









  1. View Hint View Answer Discuss in Forum

    Using larger block size in a fixed block size system lead to poor disk space utilization due to data items which are very small comparable to block size cause fragmentation. But it leads to better disk through put since no. of blocks needs to fetch & replace become less.

    Correct Option: A

    Using larger block size in a fixed block size system lead to poor disk space utilization due to data items which are very small comparable to block size cause fragmentation. But it leads to better disk through put since no. of blocks needs to fetch & replace become less.


  1. Consider the following proposed solution for the critical section problem. There are n processes: P0 ...Pn - 1. In the code, function pmax returns an integer not smaller than any of its arguments. For all i, t[i] is initialized to zero.
    Code for Pi:
    do {
    c[i] = 1; t[i] = pmax (t[0],..., t[n – 1]) + 1; c[i] = 0;
    for every j ≠ i in{0,..., n–1} {
    while(c[j]);
    while(t[j] != 0 && t[j] <= t[i]);
    }
    Critical Section;
    t[i] = 0;
    Remainder Section;
    } while (true);
    Which one of the following is TRUE about the above solution?









  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    NA



  1. The following two functions P1 and P2 that share a variable B with an initial value of 2 execute concurrently.

    The number of district values that can possibly take after the ececution is ...............









  1. View Hint View Answer Discuss in Forum

    If we execute P2 process after P1 process, then we get B = 3
    If we execute P1 process after P2 process, then we get B = 4
    If we did preemption between P1 and P2 processes, then we get B = 2 (Preemption have done from P1 to P2) or B = 3 (Preemption have done from P2 to P1). So, among 2 and 3 values, only one value will be saved in B. So, total no. of different values that B can possibly take after the execution is 3.

    Correct Option: C

    If we execute P2 process after P1 process, then we get B = 3
    If we execute P1 process after P2 process, then we get B = 4
    If we did preemption between P1 and P2 processes, then we get B = 2 (Preemption have done from P1 to P2) or B = 3 (Preemption have done from P2 to P1). So, among 2 and 3 values, only one value will be saved in B. So, total no. of different values that B can possibly take after the execution is 3.