Operating systems miscellaneous


Operating systems miscellaneous

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









  1. View Hint View Answer Discuss in Forum

    A process executes the code and works as follows:
    The number of child processes created = 2n – 1 = 23 – 1 = 8 – 1 = 7 where, n = 3 ∵ 3 fork () are executing.

    Correct Option: C

    A process executes the code and works as follows:
    The number of child processes created = 2n – 1 = 23 – 1 = 8 – 1 = 7 where, n = 3 ∵ 3 fork () are executing.


  1. Which one of the following is FALSE ?









  1. View Hint View Answer Discuss in Forum

    (a) is correct as user Perel threads are managed without kernel support.
    (b) In many one model, it one thread makes a blocking system call, the entire process is blocked so all its threads are also blocked.
    (c) User Level threads are faster to create & manage than kernel threads as no intervention from kernel is required, so the context switch in them is also faster.
    (d) As all threads share code & data including kernel level threads, so this option is ‘FALSE’.

    Correct Option: D

    (a) is correct as user Perel threads are managed without kernel support.
    (b) In many one model, it one thread makes a blocking system call, the entire process is blocked so all its threads are also blocked.
    (c) User Level threads are faster to create & manage than kernel threads as no intervention from kernel is required, so the context switch in them is also faster.
    (d) As all threads share code & data including kernel level threads, so this option is ‘FALSE’.



  1. The maximum number of processes that can be in Ready state for a computer system with n CPUs is









  1. View Hint View Answer Discuss in Forum

    Number of processes which are in running processes will be atmost n as there are n processors. Maximum number of processes that will be in ready state is independent of number of processors.

    Correct Option: D

    Number of processes which are in running processes will be atmost n as there are n processors. Maximum number of processes that will be in ready state is independent of number of processors.


  1. Which of the following is/are shared by all the threads in a process?
    I. Program counter
    II. Stack
    III. Address space
    IV. Registers









  1. View Hint View Answer Discuss in Forum

    The thread is a light weight process and all the threads in a process has share address space but other entities like, stack, PC, registers are not shared and every thread will have its own.
    So, option (b) is correct.

    Correct Option: B

    The thread is a light weight process and all the threads in a process has share address space but other entities like, stack, PC, registers are not shared and every thread will have its own.
    So, option (b) is correct.



  1. A multithreaded program P executes with x number of threads and uses y number of locks for ensuring mutual exclusion while operating on shared memory locations. All locks in the program are non-reentrant, i.e, if a thread holds a lock l, then it cannot re-acquire lock l without releasing it. If a thread is unable to acquire a lock, it blocks until the lock becomes available. The minimum value of x and the minimum value of y together for which execution of P can result in a deadlock are :









  1. View Hint View Answer Discuss in Forum

    In an multithreaded program P executes with X number of threads and Y number of locks for ensuring mutual exclustion while operating on shared memory location. Now consider each option.
    (a) X = 1, Y = 2.
    If there is one thread and two locks then there is not situation of deadlock.
    (b) X = 2, Y = 1.
    Similarly if there is only 1 lock and 2 thread, then there will be no deadlock situation.
    (c) X = 2, Y = 2
    If there is 2 thread and 2 locks then the Deadlock situation can arise because both threads can holds one lock and can wait for release of another lock, which arises deadlock.
    (d) X = 1, Y = 1
    If there is one thread and one locks, then one thread can hold one lock, then there will be no deadlock situation.
    So, option (c) is correct.

    Correct Option: C

    In an multithreaded program P executes with X number of threads and Y number of locks for ensuring mutual exclustion while operating on shared memory location. Now consider each option.
    (a) X = 1, Y = 2.
    If there is one thread and two locks then there is not situation of deadlock.
    (b) X = 2, Y = 1.
    Similarly if there is only 1 lock and 2 thread, then there will be no deadlock situation.
    (c) X = 2, Y = 2
    If there is 2 thread and 2 locks then the Deadlock situation can arise because both threads can holds one lock and can wait for release of another lock, which arises deadlock.
    (d) X = 1, Y = 1
    If there is one thread and one locks, then one thread can hold one lock, then there will be no deadlock situation.
    So, option (c) is correct.