You are on page 1of 14
Deer sc) Mutual Exclusion Questions & Tea nae o Start Complete Exam Preparation RR Reet Daily Live a owes bg MasterClasses tesa Download App MCQ Question 1 View this Que: online Consider the following policies for preventing deadlock in a system with mutually exclusive resources. |. Processes should acquire all their resources at the beginning of execution. If any resource Is not available, all resources acquired so far are released Il. The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbers Ill. The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbers IV. The resources are numbered uniquely. A process Is allowed to request only for a resource with resource number larger than its currently held resources Which of the above policies can be used for preventing deadlock? 1, Anyone of | and Ill but not Il or lV 2. Anyone of|, Ill, and IV but not Il 3. Any one of Il and ill but not | or IV 4, Anyone of|, Il, Ill andIV Answer ((o!ailed Solution Below) Option 4: Any one of |, I, ll and IV Mutual Exclusion MCQ Question 1 Detailed Solution Concept A deadlock will not occur if one of the following four conditions doesn't occur: + Mutual exclusion: it prevents simultaneous access to a shared resource. * Hold and wait: Process is holding resource that may be required by other processes. + Circular wait: It means there are processes which are waiting for other processes to finish. + No preemption: If a process that is holding some resources requests another resource end that resource cannot be allocated to it. then it must release all resources that are currently allocated tot Explanation: Option 1 Processes should acquire all their resources at the beginning of execution. If any resource is not available, all resources acquired so far are released, If this is allowed , then hold and wait will never occur. So, deadiock will not occur. Option 2: The resources are numbered uniquely, and processes are allowed to request for tesaurces only in increasing resource numbers. It violates circular wait . Option 3: The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbers. It also violates circular wait. Option 4: The resources are numbered uniquely. A process is allowed to request only for a resource with resource number larger than its currently held resources. It also violates circular wait. So, all options are needed to prevent deadlock, Ee se ee cai ene Cer eon Start Complete Exam Preparation eed es Pressing ett Download App MCQ Question 2 View this Question Online Mutual exclusion problem occurs 1. Between two disjoint processes that do not interact 2. Among processes that share resources 3. Among processes that do not use the same resource 4. Between two processes that uses different resources of different machine Answer (Detailed Solution Below) Option 2: Among processes that share resources Mutual Exclusion MCQ Question 2 Detailed Solution Concept: Mutual exclusion happens when two or more processes share the same resources but can not access the same resource at the same time. Explanation: Mutual exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions. It is the requirement that one thread of execution never enters its critical section at the same time that another concurrent thread of execution enters its own critical section. This problem is resolved using different tools, e.g. semaphores. Pa eal cn Oa Sela merle cee hol) RRs Pray faraicd Mock Tests DO cie Cresta Download App MCQ Question 3: View this Question Online > To overcome difficulties in Readers-Writers problem, which of the following statement/s is/are true? 1) Writers are given exclusive access to shared objects 2) Readers are given exclusive access to shared objects 3) Both readers and writers are given exclusive access to shared objects. Choose the correct answer from the code given below: 1. 1 only 2 Both 2and3, 3. 2only 4. Zonly Answer (Detailed Solution Below) Option 1: 1 only Mutual Exclusion MCQ Question 3 Detailed Solution In Readers-Writers problem, more than one Reader is allowed to read simultaneously but if'a Writer is writing then no other writer or any reader can have simultaneous access to that shared object. So, Writers ere given exclusive access to shared objects. Hence option 1 is correct Pg ear cn Sela merle) (cM ec deh) CURR Rca Peers fared Dor cia Que: Download App MCQ Question 4: View this Question Online > Which of the following is/are true about Peterson's synchronization mechanism? 1. Progress is guaranteed 2. busy waiting solution 3. uses semaphore variable 4, Mutual exclusion is cuaranteed Answer (Detailed Solution Below) Option : Mutual Exclusion MCQ Question 4 Detailed Solution Peterson's synchronization mechanism: + Its a busy waiting solution. + Mutual exclusion and progress are guaranteed + It doesn't use semaphore variable, but it uses to integer variables (tum and interest) to achieve synchronization. & eal cn aero Sela merle cee hol) Pray faraicd Mock Tests Dor cree Cresta Download App MCQ Question 5: View this Question Online > Suppose P, Q and R are co-operating processes satisfying Mutual Exclusion condition. Then if the process Q is executing in its critical section then executes in critical section 2. 'R’ executes in critical section 3. Neither 'P’ nor'R’ executes in their critical section 4. Both 'P’ and'R’ executes in critical section Answer (Detailed Solution Below) Option 3: Neither ‘P’ nor ‘R’ executes in their critical section Mutual Exclusion MCQ Question 5 Detailed Solution Concepts: A mutual exclusion (mutex) is a program object that prevents simultaneous access to a shared resource, Acritical section is a code segment that accesses shared variables and has to be executed as an atomic action, Thecritical section problem refers to the problem of how to ensure that at most one process is executing its critical section at a given time. PROCESS: ENTRY SECTION Process Q CRITICAL SECTION EXIT SECTION REMAINDER SECTION Since process ‘Q' is in the critical section then other processes P and R cannot be inthe critical section. Therefore neither ‘P’ nor ‘R’ executes in their critical section. oe India’s #1 Learning Platform eRe errs Start Complete Exam Preparation Pas ried Reser (reser Download App ray (z=) i) ea ia eet MCQ Question 6: View this Question Online> Let each process Pj, i = 1 to 7 executes the following code. repeat P(mutex); cs ‘V(mutex); forever The process Px executes the following code: repeat ‘V(mutex); cs V(mutex); forever What is the maximum number of processes that can be present in the critical section at any point of time? Given that the initial value of binary semaphore variable “mutex” is 1. Answer (Detailed Solution Below’) Option 2:8 Mutual Exclusion MCQ Question 6 Detailed Solution Here mutex = 1 first, take Process 1, that Is, P1 P(mutex); cs ‘vimutex); This code will run. mutex = 0 and P, will move into the critical section After this, try to enter the Ps in the critical section, it will run the code vimutex); cs V(mutex); In this case, it will changes mutex into 1, and Pg will enter into the critical section. After this, exit the Pg from the critical section, it will change mutex to 2. Then again enter Pg. In this way, It increases the mutex value always In this way, if Mutex becomes 8 then all the 8 processes can simultaneously enter the critical section. SO, the maximum number of processes that can be present in the critical section at any point in time = 8. Pg eee tact Recaro et ots Sela merle cee hol) Pray faraicd was Dor cree Cresta eri Download App MCQ Question 7: View this Question Online > Suppose P, Q and R are co-operating processes satisfying Mutual Exclusion condition. Then if the process Q is executing in its critical section then P’ executes in critical section 2. 'P' does not executes in critical section 3. ‘R’ executes in-critical section 4. 'R' does not executes in critical section Answer (Detailed Solution Below) Option : Mutual Exclusion MCQ Question 7 Detailed Solution Concepts: A mutual exclusion (mutex) is a program object that prevents simultaneous access to a shared resource, Acritical section is a code segment that accesses shared variables and has to be executed as an atomic action, Thecritical section problem refers to the problem of how to ensure that at most one process is executing its critical section at a given time. PROCESS: ENTRY SECTION Process Q CRITICAL SECTION EXIT SECTION REMAINDER SECTION Since process ‘Q’ is in critical section then other processes P and R cannot be in the critical section. ‘Therefore neither ‘P' nor'R’ executes in their critical section. a eee aM iol ria) Ce Dan eco Start Complete Exam Preparation Pee Practice aoa ee Crestor etc Download App MCQ Question 8: View this Question Online > Consider the following policies for preventing deadlock in a system with mutually exclusive resources. |. Processes should acquire all their resources at the beginning of execution. If any resource is not available, all resources acquired so far are released Il. The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbers Ill. The resources are numbered uniquely, and processes are allowed to request for resources only in decreasing resource numbers IV. The resources are numbered uniquely. A process Is allowed to request only for a resource with resource number larger than its currently held resources Which of the above policies can be used for preventing deadlock? 1. Any one of | and lil but not Il or lV 2. Anyone of|, Ill, and IV but not Ii 3. Anyone of Il and Ill but not | or IV 4. Anyone of, II, Ill and IV Answer (Detailed Solution Below) Option 4: Any one of Il, Ill and IV Mutual Exclusion MCQ Question 8 Detailed Solution Concept: Adeadlock will not occur if one of the following four conditions doesnt occur + Mutual exclusion: it prevents simultaneous access to a shared resource. + Hold and wait: Process is holding a resource that may be required by other processes + Circular wait: It means there are processes which are waiting for other processes to finish. + No pre-emption: If a process that is holding some resources requests another resource end that resource cannot be allocated to it, then it must release all resources that are currently allocated to it. Explanation: Option 1 Processes should acquire all their resources at the beginning of execution. If any resource is not available, all resources acquired so far are released. If this is allowed , then hold and weit will never occur. So, deadiock will not occur. Option 2 The resources are numbered uniquely, and processes are allowed to request for resources only in increasing resource numbers. It violates circular wait . Option 3: The resources are numbered uniquely, and processes are allowed to request for resaurces only in decreasing resource numbers. It also violates circular wait. Option 4: The resources are numbered uniquely. A process |s allowed to request only for a resource with resource number larger than its currently held resources. It also violates citcular wait. So, all options are needed to prevent deadlock, & eal cn aero Sela merle cee hol) Pray faraicd Mock Tests Dor cree Cresta Download App MCQ Question 9: View this Question Online > Only the process executing the critical section is allowed to access the shared variable and all other processes should be prevented from doing so until the completion of the critical section. This is known as 1. Interprocess communication 2. Semaphore 3. Deadlock 4. Mutual Exclusion Answer (Detailed Solution Below) Option 4: Mutual Exclusion Mutual Exclusion MCQ Question 9 Detailed Solution The correct answer is option 4 Concept: Mutual Exclusion: + Mutual exclusion is a property of concurrency control and + itis used for preventing race condition. + No two process can exist in a critical section ata given time So only the process executing the critical section is allowed to access the shared variable andall other should be prevented from doing so until the completion of the critical section. This is known as Critical section. ©; Additional Information Critical section: Shared variables can be accessed through the code segment is called critical section. ‘Syntax: dot Entry section Critical section Exit section Remainder section }while(TRUE); Interprocess communication: Interprocess communication is the mechanism that allows processes to communicate with each other, which is provided by the operating system. ‘Semaphore: semaphore is a technique that is used a simple integer value to manage concurrent processes. Deadlock: Deadlocks are a set of blocked processes in which all are holding a resource and waiting to acquite another resource which is held by another process. Reet tec) SS ETa merle ee eT RS Dan caste ors eee RSet Cormeen Download App MCQ Question 10: View this Question Online > Mutual exclusion problem occurs 1. Between two disjgint processes that do not Interact 2. Among processes that share resources 3. Among processes that do not use the same resource 4, Between two processes that uses different resources of different machine Answer (Detailed Solution Below) Option 2: Among processes that share resources Mutual Exclusion MCQ Question 10 Detailed Solution Concept: Mutual exclusion happens when two of more processes share the same resources but can not access the same resource at the same time. Explanation: Mutual exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions. itis the requirement that one thread of execution never enters its critical section at the same time that another concurrent thread of execution enters its own critical section. This problem is resolved using different tools, e.g. semaphores,

You might also like