• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

OS Process Management

Question 11

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?
  • t1 > t2
  • t1 = t2
  • t1 < t2
  • nothing can be said about the relation between t1 and t2

Question 12

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 following is TRUE?
  • On per-thread basis, the OS maintains only CPU register state
  • The OS does not maintain a separate stack for each thread
  • On per-thread basis, the OS does not maintain virtual memory state
  • On per-thread basis, the OS maintains only scheduling and accounting information

Question 13

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) ;
Critica1 Section
S1 = S2;

Method Used by P2
while (S1 != S2) ;
Critica1 Section
S2 = not (S1);
Which one of the following statements describes the properties achieved?
  • Mutual exclusion but not progress
  • Progress but not mutual exclusion
  • Neither mutual exclusion nor progress
  • Both mutual exclusion and progress

Question 14

The following program consists of 3 concurrent processes and 3 binary semaphores.The semaphores are initialized as S0 = 1, S1 = 0, S2 = 0. gatecs201042 How many times will process P0 print \'0\'?
  • At least twice
  • Exactly twice
  • Exactly thrice
  • Exactly once

Question 15

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?
  • I only
  • I and II
  • II and III
  • IV only

Question 16

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
  • 0 and 0
  • 0 and 1
  • 1 and 0
  • 1 and 1

Question 17

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

Question 18

Consider the following statements about user level threads and kernel level threads. Which one of the following statement is FALSE?
  • Context switch time is longer for kernel level threads than for user level threads.
  • User level threads do not need any hardware support.
  • Related kernel level threads can be scheduled on different processors in a multi-processor system.
  • Blocking one kernel level thread blocks all related threads.

Question 19

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?v
  /* P1 */
while (true) {
  wants1 = true;
  while (wants2 == true);
  /* Critical
    Section */
  wants1=false;
}
/* Remainder section */       


/* P2 */
while (true) {
  wants2 = true;
  while (wants1==true);
  /* Critical
    Section */
  wants2 = false;
}
/* Remainder section */
  • It does not ensure mutual exclusion.
  • It does not ensure bounded waiting.
  • It requires that processes enter the critical section in strict alternation.
  • It does not prevent deadlocks, but ensures mutual exclusion.

Question 20

Which one of the following is FALSE?
  • User level threads are not scheduled by the kernel.
  • When a user level thread is blocked, all other threads of its process are blocked.
  • Context switching between user level threads is faster than context switching between kernel level threads.
  • Kernel level threads cannot share the code segment

There are 115 questions to complete.

Last Updated :
Take a part in the ongoing discussion