Operating System

11. The resource matrix is a data structure used in deadlock detection algorithms to:
Resource matrix deadlock detection algorithms में किसको represent करने के लिए उपयोग की जाने वाली data structure है?
(Bihar STET C.S. 12.09.2023 (Shift-II))
A. Represent resource allocation
B. Represent the execution order of processes
C. Represent the execution history of processes
D. Represent the priority of processes

Correct Answer: A

Explanation (EN): A resource matrix is used in deadlock detection algorithms to represent which resources are allocated to which processes.

Explanation (HI): Resource matrix का उपयोग यह दिखाने के लिए किया जाता है कि कौन-से resources किस process को allocate किए गए हैं।

12. 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?
एक computer में 6 tape drives हैं और n processes उनके लिए compete कर रही हैं। प्रत्येक process को 2 drives की आवश्यकता हो सकती है। System deadlock free रहे, इसके लिए n का maximum value क्या होगा?
(UGC NET C.S. Exam-24 June-2019 (Paper-II))
A. 5
B. 4
C. 3
D. 6

Correct Answer: A

Explanation (EN): If 6 processes each hold 1 tape drive and wait for another, deadlock can occur. To guarantee deadlock freedom, the maximum number of processes is 5.

Explanation (HI): यदि 6 processes में से प्रत्येक 1 tape drive ले ले और दूसरी का इंतजार करे, तो deadlock हो सकता है। Deadlock freedom सुनिश्चित करने के लिए n का अधिकतम मान 5 होगा।

13. The Banker's algorithm is an example of a deadlock:
Banker's algorithm deadlock के किस प्रकार का उदाहरण है?
(Bihar STET C.S. 12.09.2023 (Shift-II))
A. Avoidance algorithm
B. Detection algorithm
C. Prevention algorithm
D. Termination algorithm

Correct Answer: A

Explanation (EN): Banker's Algorithm checks whether the system remains in a safe state before allocating resources. Thus it avoids deadlock.

Explanation (HI): Banker's Algorithm resources allocate करने से पहले जाँचता है कि system safe state में रहेगा या नहीं। इसलिए यह deadlock avoidance algorithm है।

14. A thread is also called:
Thread को और किस नाम से जाना जाता है?
(KVS PGT C.S. 2017)
A. A scheduler
B. A virtual process
C. A heavyweight process
D. A lightweight process

Correct Answer: D

Explanation (EN): A thread is also known as a lightweight process. It is a path of execution within a process.

Explanation (HI): Thread को lightweight process भी कहा जाता है। यह किसी process के अंदर execution का एक path होता है।

15. Which one of the following statements are CORRECT? (A) Granularity is the size of data item in a database. (B) Two operations in a schedule are said to be conflict if they belong to same transaction. (C) Two schedulers are said to be conflict equivalent if the order of any two conflicting operations is the same in both schedules. (D) Write operations which are performed without performing the write operation are known as Blind Writes. Choose the correct answer from the options given below.
निम्न में से कौन-से statements सही हैं? (A) Granularity database में data item के size को दर्शाता है। (B) किसी schedule में दो operations conflict कहलाते हैं यदि वे same transaction से संबंधित हों। (C) दो schedulers conflict equivalent कहलाते हैं यदि किसी भी दो conflicting operations का क्रम दोनों schedules में समान हो। (D) जो write operations बिना write operation किए किए जाते हैं उन्हें Blind Writes कहते हैं। सही उत्तर चुनिए।
(UGC NET C.S. December-2023)
A. (A) and (B) Only
B. (A), (B) and (C) Only
C. (A), (B) and (D) Only
D. (B) and (C) Only

Correct Answer: B

Explanation (EN): As per the given key, statements (A), (B), and (C) are correct and statement (D) is incorrect.

Explanation (HI): दिए गए उत्तर के अनुसार statements (A), (B) और (C) सही हैं तथा statement (D) गलत है।

16. Which one of these is not a condition for Resource Deadlock?
निम्न में से कौन-सी Resource Deadlock की condition नहीं है?
(DSSSB PGT C.S. M/F 11.07.2021)
A. Non-sharable resources
B. Hold-and-wait
C. Preemption
D. Circular waits

Correct Answer: C

Explanation (EN): The necessary conditions for deadlock are mutual exclusion, hold and wait, no preemption, and circular wait. Therefore preemption itself is not a deadlock condition.

Explanation (HI): Deadlock की आवश्यक conditions हैं: mutual exclusion, hold and wait, no preemption, और circular wait। इसलिए preemption स्वयं deadlock condition नहीं है।

17. Which of the following statement(s) is/are true regarding threads in operating system? I. The threads in a process are visible to other processes. II. A thread is strictly private resource of a process.
Operating system में threads के संबंध में निम्न कथनों में से कौन-सा/से सही है/हैं? I. किसी process के threads अन्य processes को दिखाई देते हैं। II. Thread किसी process का strictly private resource होता है।
(DSSSB TGT C.S. 08.08.2021 (Shift-I))
A. Only I
B. Only II
C. Both I and II
D. Neither I nor II

Correct Answer: B

Explanation (EN): Statement I is false because threads of one process are not directly visible or accessible to other independent processes. Statement II is true because threads belong exclusively to the process that created them.

Explanation (HI): Statement I गलत है क्योंकि एक process के threads दूसरे independent processes को सीधे दिखाई नहीं देते या उनके द्वारा नियंत्रित नहीं किए जा सकते। Statement II सही है क्योंकि thread उसी process का private resource होता है जिसने उसे बनाया है।

18. Which of the following statement(s) is/are true regarding processes and threads in operating system? I. Threads encapsulates concurrency within a process. II. Process encapsulates protection within the system.
Operating system में processes और threads के संबंध में निम्न कथनों में से कौन-सा/से सही है/हैं? I. Threads किसी process के भीतर concurrency को encapsulate करते हैं। II. Process system के भीतर protection को encapsulate करता है।
(DSSSB TGT C.S. 08.08.2021 (Shift-I))
A. Only I
B. Only II
C. Both I and II
D. Neither I nor II

Correct Answer: C

Explanation (EN): Threads enable concurrency within a process, and processes provide protection through isolated address spaces. Therefore both statements are true.

Explanation (HI): Threads किसी process के भीतर concurrency उपलब्ध कराते हैं, और process अलग address space देकर protection प्रदान करता है। इसलिए दोनों statements सही हैं।

19. A computer system has 7 tape drives. There 'n' processes competing for them. Each process may need 2 tape drives. What is the maximum value of 'n' for which the system is guaranteed to be deadlock free?
एक computer system में 7 tape drives हैं। उनके लिए 'n' processes compete कर रही हैं। प्रत्येक process को 2 tape drives की आवश्यकता हो सकती है। 'n' का अधिकतम मान क्या होगा ताकि system guaranteed deadlock free रहे?
(DSSSB TGT C.S. 07.08.2021 (Shift-I))
A. 2
B. 3
C. 4
D. 1

Correct Answer: B

Explanation (EN): Each process may need at most 2 drives. To guarantee deadlock freedom, the system must always be able to satisfy at least one process completely. Thus 2n ≤ 7, so n ≤ 3.

Explanation (HI): प्रत्येक process को अधिकतम 2 drives चाहिए। Deadlock freedom की guarantee के लिए system को कम-से-कम एक process की पूरी आवश्यकता हमेशा पूरी करने योग्य होना चाहिए। इसलिए 2n ≤ 7, अतः n ≤ 3।

20. In context of semaphores choose the option with valid codes for wait() and signal() functions:
Semaphores के संदर्भ में wait() और signal() functions के valid code वाला विकल्प चुनिए।
(HTET PGT C.S. 2022)
A. Wait (s) { while (s) <= 0; s++; } and signal (s) { s--; }
B. Wait (s) { while (s) <= 0; s--; } and signal (s) { s++; }
C. Wait (s) { s--; } and signal (s) { while (s) <= 0; s++; }
D. Wait (s) { s++; } and signal (s) { while (s) <= 0; s--; }

Correct Answer: B

Explanation (EN): In semaphore operations, wait() decrements the semaphore after checking availability, and signal() increments the semaphore. Therefore option (b) gives the valid code.

Explanation (HI): Semaphore operations में wait() उपलब्धता जाँचने के बाद semaphore की value घटाता है और signal() उसकी value बढ़ाता है। इसलिए option (b) सही code देता है।