Time Left - 20:00 mins

GATE CS : Operating Systems Champion Quiz 3

Attempt now to get your rank among 656 students!

Question 1

Which of the following scheduling algorithms is non-preemptive?

Question 2

Let m[0]…m[4] be mutexes (binary semaphores) and P[0] …. P[4] be processes. Suppose each process P[i] executes the following:
wait (m[i];wait (m[(i+1) mode 4]);
………
release (m[i]); release (m[(i+1)mod 4]);
This could cause

Question 3

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

Question 4

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

Question 5

A system contains three programs and each requires three tape units for its operation. The minimum number of tape units which the system must have such that deadlocks never arise is a _________.

Question 6

Consider a system with 4 types of resources R1 (3 units), R2 (2 units), R3 (3 units), R4 (2 units). A non-preemptive resource allocation policy is used. At any given instance, a request is not entertained if it cannot be completely satisfied. Three processes P1, P2, P3 request the resources as follows if executed independently.

Process P1:

t=0: requests 2 units of R2

t=1: requests 1 unit of R3

t=3: requests 2 units of R1

t=5: releases 1 unit of R2 and 1 unit of R1.

t=7: releases 1 unit of R3

t=8: requests 2 units of R4

t=10: Finishes

Process P2:

t=0: requests 2 units of R3

t=2: requests 1 unit of R4

t=4: requests 1 unit of R1

t=6: releases 1 unit of R3

t=8: Finishes

Process P3:

t=0: requests 1 unit of R4

t=2: requests 2 units of R1

t=5: releases 2 units of R1

t=7: requests 1 unit of R2

t=8: requests 1 unit of R3

t=9: Finishes

Which one of the following statements is TRUE if all three processes run concurrently starting at time t = 0?

Question 7

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?

Question 8

Suppose n processes, P1, …. Pn share m identical resource units, which can be reserved and released one at a time. The maximum resource requirement of process Pi is Si, where Si > 0. Which one of the following is a sufficient condition for ensuring that deadlock does not occur?

Question 9

A system has n resources R0,…, Rn-1, and k processes P0,….. Pk–1. The implementation of the resource request logic of each process Pi. is as follows:
if ( i% 2 = = 0) {
if (i < n) request Ri;
if (i + 2 < n) request Ri+2;
}
else {
if (i < n) request Rn–i ;
if (i + 2 < n)request Rn–i–2;
}
In which one of the following situations is a deadlock possible?

Question 10

The atomic fetch-and-set x, y instruction unconditionally sets the memory location x to 1 and fetches the old value of x n y without allowing any intervening access to the memory location x. consider the following implementation of P and V functions on a binary semaphore S.
void P (binary_semaphore *s) {
unsigned y;
unsigned *x = &(s->value);
do {
fetch-and-set x, y;
} while (y);
}
void V (binary_semaphore *s) {
S->value = 0;
}
Which one of the following is true?
  • 656 attempts
  • 4 upvotes
  • 51 comments
Jun 25GATE & PSU CS