Operating System

21. Which of the following is not a valid deadlock prevention scheme?
निम्न में से कौन-सी valid deadlock prevention scheme नहीं है?
(HTET PGT C.S. 2020)
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.

Correct Answer: C

Explanation (EN): Options (a), (b), and (d) are valid deadlock prevention methods because they break necessary deadlock conditions. Option (c) is not a standard deadlock prevention scheme.

Explanation (HI): Options (a), (b) और (d) deadlock prevention की valid methods हैं क्योंकि ये deadlock की आवश्यक conditions को तोड़ती हैं। Option (c) कोई standard deadlock prevention scheme नहीं है।

22. Which of the following is not related to synchronization in Operating System?
निम्न में से कौन-सा Operating System में synchronization से संबंधित नहीं है?
(HTET PGT C.S. 2019)
A. Bounded Buffer problem
B. Readers-Writers problem
C. Dining Philosophers problem
D. Belady's Anomaly

Correct Answer: D

Explanation (EN): Bounded Buffer, Readers-Writers, and Dining Philosophers are classic synchronization problems. Belady's Anomaly is related to page replacement, not synchronization.

Explanation (HI): Bounded Buffer, Readers-Writers और Dining Philosophers classic synchronization problems हैं। Belady's Anomaly page replacement से संबंधित है, synchronization से नहीं।

23. Which of the following is not required condition for a deadlock?
निम्न में से कौन-सी deadlock के लिए आवश्यक condition नहीं है?
(HTET PGT C.S. 2018)
A. Hold and Wait
B. Preemptive
C. Mutual Exclusion
D. Cycle

Correct Answer: B

Explanation (EN): The required conditions for deadlock are mutual exclusion, hold and wait, no preemption, and circular wait. Therefore preemptive is not required.

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

24. For each thread of a multi-threaded process, there is a separate:
Multi-threaded process के प्रत्येक thread के लिए अलग क्या होता है?
(CGPSC C.S. 2020 Set-A)
A. Process control block
B. User address space
C. User and kernel stack
D. Kernel space only

Correct Answer: C

Explanation (EN): All threads of a process share code, data, files, and address space, but each thread has its own user and kernel stack.

Explanation (HI): किसी process के सभी threads code, data, files और address space share करते हैं, लेकिन प्रत्येक thread का अपना अलग user और kernel stack होता है।

25. Semaphore are used to solve the problem of:
Semaphores का उपयोग किस problem को solve करने के लिए किया जाता है?
(CGPSC C.S. 2020 Set-A)
A. Race condition
B. Multi-tasking
C. Mutual exclusion
D. Both (A) and (C)

Correct Answer: C

Explanation (EN): As per the given answer key, semaphores are used for mutual exclusion, i.e. ensuring that only one process/thread accesses the critical section at a time.

Explanation (HI): दिए गए answer key के अनुसार semaphores का उपयोग mutual exclusion के लिए किया जाता है, अर्थात एक समय में केवल एक process/thread critical section में प्रवेश करे।

26. The advantage of having multiple threads over multiple processes is: (i) Less time for creation (ii) Less time for termination (iii) Less time for switching (iv) Kernel not involved in communication among threads
Multiple processes की तुलना में multiple threads के advantages क्या हैं? (i) Creation में कम समय (ii) Termination में कम समय (iii) Switching में कम समय (iv) Threads के बीच communication में kernel शामिल नहीं होता
(CGPSC C.S. 2020 Set-A)
A. (i), (ii), (iii)
B. (i), (ii), (iv)
C. (ii), (iii), (iv)
D. (i), (ii), (iii), (iv)

Correct Answer: D

Explanation (EN): Threads are lighter than processes. They require less time for creation, termination, and switching, and communication among threads is more efficient as they share the same address space.

Explanation (HI): Threads, processes की तुलना में हल्के होते हैं। इन्हें बनाने, समाप्त करने और switch करने में कम समय लगता है, तथा threads के बीच communication अधिक efficient होता है क्योंकि वे same address space share करते हैं।

27. A processor while executing the instruction sequence of user mode process, received n interrupts. If no other activity is reported to processor during the execution of instruction sequence, what is the number of mode switches and process switches experienced?
एक processor user mode process की instruction sequence execute करते समय n interrupts प्राप्त करता है। यदि execution के दौरान processor को कोई अन्य activity report नहीं होती, तो mode switches और process switches की संख्या क्या होगी?
(CGPSC C.S. 2020 Set-A)
A. 2n, 2n
B. n, n
C. 2n, 0
D. n, 0

Correct Answer: C

Explanation (EN): Each interrupt causes two mode switches: user to kernel and kernel back to user. Since the same process continues execution, there are no process switches. Hence the answer is 2n mode switches and 0 process switches.

Explanation (HI): प्रत्येक interrupt पर दो mode switches होते हैं: user से kernel और फिर kernel से user। क्योंकि वही process execution जारी रखती है, इसलिए process switch नहीं होता। अतः उत्तर 2n mode switches और 0 process switches है।

28. In the case of parallelization, Amdahl's law states that if P is the proportion of a program that can be made parallel and (1–P) is the proportion that cannot be parallelized, then the maximum speed-up that can be achieved by using N processors is:
Parallelization के संदर्भ में Amdahl's law के अनुसार यदि P program का वह भाग है जिसे parallel बनाया जा सकता है और (1–P) वह भाग है जिसे parallel नहीं बनाया जा सकता, तो N processors का उपयोग करके अधिकतम speed-up क्या होगा?
(UGC NET C.S. June-2015 (Paper-II))
A. 1 / ((1 - P) + N.P)
B. 1 / (N(1 - P) + P)
C. 1 / ((1 - P) + P/N)
D. 1 / ((1 - P) + P.N)

Correct Answer: C

Explanation (EN): According to Amdahl's law, maximum speed-up is 1 / ((1 - P) + P/N).

Explanation (HI): Amdahl's law के अनुसार अधिकतम speed-up 1 / ((1 - P) + P/N) होता है।

29. Peterson's solution is a classic software-based solution to the critical-section problem. What is the maximum number of processes to which it is restricted?
Peterson's solution critical-section problem का एक classic software-based solution है। यह अधिकतम कितने processes के लिए restricted है?
(Haryana PGT C.S. Asstt. Prof. 2024)
A. 2
B. 3
C. 4
D. 5

Correct Answer: A

Explanation (EN): Peterson's solution is restricted to two processes. It uses two shared variables: flag[] and turn.

Explanation (HI): Peterson's solution केवल दो processes के लिए लागू होता है। इसमें दो shared variables उपयोग होते हैं: flag[] और turn।

30. Which of the following scheduling algorithms gives minimum average waiting time?
निम्न में से कौन-सा scheduling algorithm minimum average waiting time देता है?
(UKPSC PGT C.S. Asstt. Prof. 2017)
A. FCFS
B. SJF
C. Round Robin
D. Priority

Correct Answer: B

Explanation (EN): Shortest Job First (SJF) selects the process with the smallest CPU burst time next, which gives the minimum average waiting time.

Explanation (HI): Shortest Job First (SJF) वह process पहले चुनता है जिसकी CPU burst time सबसे कम होती है, इसलिए यह minimum average waiting time देता है।