DSSSB TGT CS Mock 03 – Question 116

Question:

In Peterson’s algorithm for mutual exclusion between two processes, which shared variables are used to prevent race conditions?
दो प्रक्रियाओं के बीच पारस्परिक अपवर्जन (mutual exclusion) के लिए पीटरसन के कलनविधि में किन साझा चरों का उपयोग किया जाता है?

Options:

  • An array flag[2] of booleans and an integer variable turn
  • A single binary semaphore mutex
  • A counting semaphore and a condition variable
  • A hardware test-and-set register only
  • बूलियन का एक ऐरे flag[2] और एक पूर्णांक चर turn
  • केवल एक बाइनरी सेमाफोर mutex
  • एक काउंटिंग सेमाफोर और कंडीशन वेरिएबल
  • केवल हार्डवेयर टेस्ट-एंड-सेट रजिस्टर

Correct Answer: a)

Explanation:

Peterson’s algorithm strictly relies on two shared variables: boolean flag[2] indicating intent to enter critical section, and int turn determining whose turn it is in case of conflict.
पीटरसन एल्गोरिदम दो साझा चरों का उपयोग करता है: flag[2] (प्रवेश की इच्छा दर्शाने हेतु) और turn (विवाद की स्थिति में प्राथमिकता तय करने हेतु)।

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top