Skip to main content

MOOCS MCQ GATE QUESTIONS ON DEADLOCK PREVENTION, DETECTION AND AVOIDANCE

MOOC MCQ QUESTIONS WITH ANSWERS  1. A system has 6 identical resources and N processes competing for them. Each process can request atmost 2 resources. Which one of the following values of N could lead to a deadlock? a) 1 b) 2 c) 3 d) 4 Answer: d 2.  Consider a system having m resources of the same type. These resources are shared by 3 processes A, B and C, which have peak demands of 3, 4 and 6 respectively. For what value of m deadlock will not occur? a) 7 b) 9 c) 10 d) 13 Answer: d 3.  A computer system has 6 tape drives, with n process completing for them. Each process may need 3 tape drives. The maximum value of n for which the system is guaranteed to be deadlock free is: a) 2 b) 3 c) 4 d) 1 Answer: a 4.  Which of the following is NOT true of deadlock prevention and deadlock avoidance schemes? a) In deadlock prevention, the request for resources is always granted if the resulting state is safe b) In deadlock avoidance, the request for resources is always grant...

MOOCS MCQ GATE QUESTIONS ON DEADLOCK PREVENTION, DETECTION AND AVOIDANCE

MOOC MCQ QUESTIONS WITH ANSWERS 



1. A system has 6 identical resources and N processes competing for them. Each process can request atmost 2 resources. Which one of the following values of N could lead to a deadlock?

a) 1
b) 2
c) 3
d) 4

Answer: d


2. Consider a system having m resources of the same type. These resources are shared by 3 processes A, B and C, which have peak demands of 3, 4 and 6 respectively. For what value of m deadlock will not occur?

a) 7
b) 9
c) 10
d) 13

Answer: d


3. A computer system has 6 tape drives, with n process completing for them. Each process may need 3 tape drives. The maximum value of n for which the system is guaranteed to be deadlock free is:

a) 2
b) 3
c) 4
d) 1

Answer: a


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

a) In deadlock prevention, the request for resources is always granted if the resulting state is safe
b) In deadlock avoidance, the request for resources is always granted if the result state is safe
c) Deadlock avoidance is less restrictive than deadlock prevention
d) Deadlock avoidance requires knowledge of resource requirements a priori

Answer: a

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) 6
b) 7
c) 8
9) 9

Answer: b


6. Consider the following snapshot of a system running n processes. Process i is holding Xi instances of a resource R, 1 <= i <= n. currently, all instances of R are occupied. Further, for all i, process i has placed a request for an additional Yi instances while holding the Xi instances it already has. There are exactly two processes p and q such that Yp = Yq = 0. Which one of the following can serve as a necessary condition to guarantee that the system is not approaching a deadlock?

a) min(Xp, Xq) < max(Yk) where k!=p and k!=q
b) Xp+Xq >= min(Yk) where k!=p and k!=q
c) max(Xp,Xq) > 1
d) min(Xp, Xq) > 1

Answer: b


7. 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:

a) Thrashing
b) Deadlock
c) Starvation, but not deadlock
d) None of the above

Answer: b


8. Which of the following is NOT a valid deadlock prevention scheme? 

a) Release all resources before requesting a new resource
b) Number the resources uniquely and never request a lower numbered resource than the last one requested.
c) Never request a resource after releasing any resource
d) Request and all required resources be allocated before execution.

Answer: c


9. A counting semaphore was initialized to 10. Then 6 P (wait) operations and 4 V (signal) operations were completed on this semaphore. The resulting value of the semaphore is

a) 0
b) 8
c) 10
d) 12

Answer: b


10. A computer has six tape drives, with n processes competing for them. Each process may need two drives. What is the maximum value of n for the system to be deadlock free?

a) 6
b) 5
c) 4
d) 3

Answer: b


11. An operating system contains 3 user processes each requiring 2 units of resource R. The minimum number of units of R such that no deadlocks will ever arise is

a) 3
b) 5
c) 4
d) 6

Answer: c


12. Each Process Pi, i= 1.......9 is coded as follows
 repeat 
    P(mutex)
    {Critical section}
    V(mutex)
 forever
The code for P10 is identical except it uses V(mutex) in place of P(mutex). What is the largest number of processes that can be inside the critical section at any moment?

a) 1
b) 2
c) 3
d) None of the above

Answer: d


13.A critical section is a program segment

a) which should run in a certain specified amount of time
b) which avoids deadlocks
c) where shared resources are accessed
d) which must be enclosed by a pair of semaphore operations, P and V

Answer: c


14. A system shares 9 tape drives. The current allocation and maximum requirement of tape drives for 4 processes are shown below:
1Which of the following best describes the current state of the system?

a) Safe, Deadlocked
b) Safe, Not Deadlocked
c) Not Safe, Deadlocked
d) Not Safe, Not Deadlocked

Answer: c


15. Consider a system with 3 processes that share 4 instances of the same resource type. Each process can request a maximum of K instances. Resource instances can be requested and released only one at a time. The largest value of K that will always avoid deadlock is _______ . 

a) 1
b) 2
c) 3
d) 4

Answer: b


16. What problem is solved by Dijkstra banker’s algorithm?

a) Cache coherence
b) Mutual exclusion
c) Deadlock recovery
d) Deadlock avoidance

Answer: d


17. A total of 9 units of a resource type available, and given the safe state shown below, which of the following sequence will be a safe state?
Process   Used    Max
  P1        2      7
  P2        1      6
  P3        2      5
  P4        1      4

a) (P4, P1, P3, P2)
b) (P4, P2, P1, P3)
c) (P4, P2, P3, P1)
d) (P3, P1, P2, P4)

Answer: d


18. Consider a system having m resources of the same type. These resources are shared by 3 processes A, B, C which have peak time demands of 3, 4, 6 respectively. The minimum value of m that ensures deadlock will never occur is

a) 11
b) 12
c) 13
d) 14

Answer: a


19. Which of the following is not true with respect to deadlock prevention and deadlock avoidance schemes?

a) In deadlock prevention, the request for resources is always granted if resulting state is safe
b) In deadlock avoidance, the request for resources is always granted, if the resulting state is safe
c) Deadlock avoidance requires knowledge of resource requirements a priori
d) Deadlock prevention is more restrictive than deadlock avoidance

Answer: a


20. Which of the following is not a necessary condition for deadlock?

a) Mutual exclusion
b) Reentrancy
c) Hold and wait
d) No pre-emption

Answer: b

Comments

Popular posts from this blog

DEADLOCK PREVENTION, DETECTION AND AVOIDANCE

INTRODUCTION            In a multiprogramming environment, several processes may compete for a finite number of resources. A process requests resources; if the resources are not available at that time, the process enters a waiting state. Sometimes, a waiting process is never again able to change state, because the resources it has requested are held by other waiting processes. This situation is called a deadlock.             Deadlock is a critical concept in the field of operating systems, particularly in the context of concurrent and multi-threaded environments. It occurs when two or more processes (or threads) are unable to proceed because each is waiting for the other to release a resource or complete a task, resulting in a standstill where none of the processes can make progress.             To understand deadlock better, let's look at the four necessary conditions for dead...