Operating System

1. Time taken to switch between user and Kernel modes is ______ the time taken to switch between two processes.
User mode और Kernel mode के बीच switch होने में लगने वाला समय, दो processes के बीच switch होने में लगने वाले समय से ______ होता है।
(KVS PGT C.S. 2018)
A. More than
B. Independent of
C. Less than
D. Equal to

Correct Answer: C

Explanation (EN): Time taken to switch between user and kernel modes is less than the time taken to switch between two processes.

Explanation (HI): User mode और Kernel mode के बीच switch होने में लगने वाला समय, दो processes के बीच switch होने में लगने वाले समय से कम होता है।

2. A semaphore is an integer variable that, apart from initialization, is accessed only through which of the following standard atomic operation?
A semaphore एक integer variable है जिसे initialization के अलावा केवल निम्न में से किस standard atomic operation के द्वारा access किया जाता है?
(DSSSB TGT C.S. 07.02.2024 (Shift-II))
A. release()
B. lock()
C. acquire()
D. signal()

Correct Answer: D

Explanation (EN): A semaphore is a synchronization tool used in operating systems to control access to shared resources by multiple processes. It is an integer variable that can only be modified using atomic operations to prevent race conditions. signal() increases the semaphore value. If the result is non-positive, a waiting process is unblocked.

Explanation (HI): Semaphore operating system में shared resources के access को control करने के लिए उपयोग किया जाता है। इसे केवल atomic operations द्वारा modify किया जाता है ताकि race condition न हो। signal() semaphore की value बढ़ाता है। यदि परिणाम non-positive हो, तो waiting process unblock हो जाता है।

3. In which of the following condition of Deadlock Prevention, at least one resource must be non-sharable?
Deadlock Prevention की निम्न में से किस condition में कम-से-कम एक resource non-sharable होना चाहिए?
(DSSSB TGT C.S. 07.02.2024 (Shift-II))
A. Circular wait
B. Hold and wait
C. Mutual Exclusion
D. No preemption

Correct Answer: C

Explanation (EN): Mutual Exclusion means at least one resource must be non-sharable, that is, only one process can use it at a time. Example: a printer. If all resources were sharable, deadlock could not occur.

Explanation (HI): Mutual Exclusion condition में कम-से-कम एक resource non-sharable होना चाहिए, अर्थात एक समय में केवल एक process ही उसका उपयोग कर सकता है। उदाहरण: printer। यदि सभी resources sharable होते, तो deadlock नहीं होता।

4. In ______, one thread immediately terminate the target thread.
______ में, एक thread तुरंत target thread को terminate कर देता है।
(DSSSB PGT C.S. (Male) 27.07.2018 (Shift-II))
A. Asynchronous cancellation
B. Synchronous cancellation
C. Deferred cancellation
D. Both deferred and asynchronous cancellation

Correct Answer: A

Explanation (EN): Thread cancellation is the process of terminating a thread before it finishes execution. In asynchronous cancellation, one thread immediately terminates the target thread without waiting for it to reach a safe point.

Explanation (HI): Thread cancellation का अर्थ है किसी thread को उसके execution पूरा होने से पहले समाप्त करना। Asynchronous cancellation में एक thread target thread को तुरंत terminate कर देता है, बिना safe point का इंतजार किए।

5. Consider a system with ten units of resource R and three processes: X, Y, and Z. The maximum resource requirement and current allocation to these processes are as follows. Now, consider the following resource requests: (i) X makes a request for 2 resource units (ii) Y makes a request for 2 resource units (iii) Z makes a request for 2 resource units. For the system to be in safe state, which of the following must be granted?
मान लीजिए किसी system में resource R की 10 units हैं और तीन processes X, Y और Z हैं। इनके maximum resource requirement और current allocation दिए गए हैं। अब निम्न resource requests पर विचार कीजिए: (i) X 2 units माँगता है (ii) Y 2 units माँगता है (iii) Z 2 units माँगता है। System को safe state में रखने के लिए इनमें से किस request को grant करना चाहिए?
(DSSSB PGT C.S. (Male) 27.07.2018 (Shift-II))
A. Only request (i) must be granted
B. Only requests (i) and (ii) must be granted
C. Only request (iii) must be granted
D. Only request (i) and (iii) must be granted

Correct Answer: C

Explanation (EN): Initial need is X=4, Y=6, Z=2 and available resources are 2. If X or Y is granted 2 units, available becomes 0 and no process can finish, so the state becomes unsafe. If Z is granted 2 units, Z's need becomes 0, so it can finish and release 5 units. Then X and Y can also finish. Hence only request (iii) keeps the system safe.

Explanation (HI): प्रारम्भिक need X=4, Y=6, Z=2 है और available resources 2 हैं। यदि X या Y को 2 units दे दी जाएँ, तो available 0 हो जाएगा और कोई process finish नहीं कर पाएगा, इसलिए state unsafe हो जाएगी। यदि Z को 2 units दी जाएँ, तो उसकी need 0 हो जाएगी और वह finish करके 5 units release कर देगा। उसके बाद X और Y भी finish कर सकते हैं। इसलिए केवल request (iii) सुरक्षित है।

6. Let Pi and Pj be two processes, R be the set of variables read from memory, and W be the set of variables written to memory. For the concurrent execution of two processes Pi and Pj which of the following conditions is not true?
मान लें Pi और Pj दो processes हैं, R memory से read किए गए variables का set है और W memory में written variables का set है। Pi और Pj के concurrent execution के लिए निम्न में से कौन-सी condition true नहीं है?
(UGC NET C.S. June-2015 (Paper-II))
A. R(Pi) ∩ W(Pj) = Φ
B. W(Pi) ∩ R(Pj) = Φ
C. R(Pi) ∩ R(Pj) = Φ
D. W(Pi) ∩ W(Pj) = Φ

Correct Answer: C

Explanation (EN): Reading by two processes does not create any conflict. Therefore R(Pi) ∩ R(Pj) need not be empty, so this condition is not true.

Explanation (HI): दो processes द्वारा केवल reading करने से कोई conflict नहीं होता। इसलिए R(Pi) ∩ R(Pj) का खाली होना आवश्यक नहीं है। अतः यही condition true नहीं है।

7. Which of the following conditions does not hold good for a solution to a critical section problem?
Critical section problem के समाधान के लिए निम्न में से कौन-सी condition आवश्यक नहीं है?
(UGC NET C.S. December-2014 (Paper-II))
A. No assumptions may be made about speeds or the number of CPUs.
B. No two processes may be simultaneously inside their critical sections.
C. Processes running outside its critical section may block other processes.
D. Processes do not wait forever to enter its critical section.

Correct Answer: C

Explanation (EN): In a correct solution to the critical section problem, processes outside the critical section should not block other processes. Hence this condition does not hold good.

Explanation (HI): Critical section problem के सही समाधान में जो process critical section के बाहर है, उसे अन्य processes को block नहीं करना चाहिए। इसलिए यह condition मान्य नहीं है।

8. Given a set of four processes, two resources with two units each, the following resource allocation graph exists at point in time. The graph indicates:
चार processes और दो resources (प्रत्येक की दो units) के लिए दिया गया resource allocation graph क्या दर्शाता है?
(KVS PGT C.S. 2018)
A. cycle and deadlock
B. no cycle but deadlock
C. neither cycle nor deadlock
D. cycle but no deadlock

Correct Answer: D

Explanation (EN): In the given resource-allocation graph there is a cycle P1 → R1 → P3 → R2 → P1. Since each resource type has multiple instances, the presence of a cycle does not necessarily imply deadlock. Hence it indicates a cycle but no deadlock.

Explanation (HI): दिए गए resource-allocation graph में cycle P1 → R1 → P3 → R2 → P1 उपस्थित है। क्योंकि resource types की multiple instances हैं, इसलिए cycle होने से deadlock आवश्यक नहीं है। अतः यह cycle but no deadlock दर्शाता है।

9. Consider the following statements about deadlock: A. Existence of a cycle in resource-allocation graph indicates deadlock. B. Existence of a cycle in wait-for graph indicates deadlock. C. Mutual-exclusion, hold and wait, no preemption and circular wait conditions, if occur simultaneously, may lead to deadlock. Mark the correct option:
Deadlock के बारे में निम्न statements पर विचार कीजिए: A. Resource-allocation graph में cycle होना deadlock को दर्शाता है। B. Wait-for graph में cycle होना deadlock को दर्शाता है। C. Mutual exclusion, hold and wait, no preemption और circular wait यदि एक साथ हों, तो deadlock हो सकता है। सही विकल्प चुनिए।
(NVS PGT C.S. 15.12.2022 (Shift-II))
A. Only (B) is correct
B. Only (C) is correct
C. Only (A) and (C) are correct
D. Only (B) and (C) are correct

Correct Answer: D

Explanation (EN): A cycle in a wait-for graph indicates deadlock. Also, if mutual exclusion, hold and wait, no preemption, and circular wait occur simultaneously, deadlock may occur. A cycle in a resource-allocation graph does not always indicate deadlock when there are multiple instances of resources.

Explanation (HI): Wait-for graph में cycle होना deadlock को दर्शाता है। साथ ही mutual exclusion, hold and wait, no preemption और circular wait एक साथ होने पर deadlock हो सकता है। Resource-allocation graph में cycle हमेशा deadlock नहीं दर्शाता, विशेषकर जब resources की multiple instances हों।

10. Degree of concurrency in thread can be arranged in the manner.
Threads में degree of concurrency को किस क्रम में व्यवस्थित किया जा सकता है?
(UGC NET C.S. December-2022)
A. One-to-one > many-to-one > many-to-many
B. One-to-one > many-to-many > many-to-one
C. many-to-many > many-to-one > one-to-one
D. None of the above

Correct Answer: B

Explanation (EN): The correct arrangement of degree of concurrency from highest to lowest is One-to-one > many-to-many > many-to-one.

Explanation (HI): Concurrency की degree का सही क्रम highest से lowest तक One-to-one > many-to-many > many-to-one है।