Process Management - process scheduling, inter-process communication, client-server communication, process synchronization, critical-section problem, Peterson's solution, semaphores - Question Bank

1. Which of the following is a method to recover from deadlock?
A) Preempting resources from one or more processes
B) Increasing CPU speed
C) Terminating all processes
D) Disabling I/O operations
2. Monitors are higher-level synchronization constructs that encapsulate:
A) Only shared data
B) Shared data and the procedures that operate on it, ensuring mutual exclusion
C) Process scheduling policies
D) Network communication protocols
3. In client-server communication, Remote Procedure Call (RPC) allows a client to:
A) Send raw network packets
B) Execute a procedure on a remote server as if it were local
C) Directly access the server's memory
D) Manage the server's operating system
4. Which scheduling algorithm is optimal in terms of minimizing average waiting time but is not practical to implement in most real-time systems?
A) Round Robin
B) Priority Scheduling
C) Shortest Remaining Time First (SRTF)
D) First-Come, First-Served
5. A semaphore initialized to 0 can be used to:
A) Allow multiple processes to access a resource
B) Block processes until a certain event occurs
C) Grant exclusive access to a resource
D) Signal the completion of an I/O operation
6. What is the main advantage of using shared memory for IPC?
A) It is inherently secure
B) It is very fast because data does not need to be copied between processes
C) It requires no synchronization
D) It is easy to implement
7. Which mechanism is often used to prevent deadlock by ensuring that a process requests all its required resources at once?
A) Resource preemption
B) Request all resources upfront
C) Process termination
D) Timeout waits
8. A deadlock can occur if four conditions are met simultaneously: Mutual Exclusion, Hold and Wait, No Preemption, and:
A) Progress
B) Bounded Waiting
C) Circular Wait
D) Starvation
9. In process scheduling, the concept of 'context switching' refers to:
A) The act of a process changing its own priority
B) The process of saving the state of the currently running process and loading the state of the next process to run
C) The communication between two processes
D) The termination of a process
10. Which of the following synchronization tools is generally considered more primitive and lower-level?
A) Mutex
B) Semaphores
C) Monitors
D) Message Queues
11. An atomic operation is one that:
A) Can be interrupted midway
B) Is executed as a single, indivisible unit
C) Takes a long time to complete
D) Requires multiple CPU cycles
12. What is a common use case for the client-server communication model?
A) Running multiple applications on a single desktop
B) Web browsing (e.g., HTTP requests to a web server)
C) Managing local files
D) Controlling hardware devices directly
13. In the context of IPC, sockets provide:
A) A mechanism for processes on the same machine to communicate
B) A network endpoint for communication between processes on different machines
C) A way to manage shared memory segments
D) A method for inter-process synchronization
14. Which scheduling algorithm is most susceptible to starvation if not implemented carefully?
A) Round Robin
B) First-Come, First-Served
C) Priority Scheduling (with low-priority processes)
D) Shortest Job Next
15. Starvation in process scheduling occurs when:
A) A process is denied CPU time indefinitely
B) A process terminates successfully
C) A process enters an infinite loop
D) The system crashes
16. Deadlock is a situation where:
A) Multiple processes are waiting for each other to release resources
B) A process is terminated unexpectedly
C) The CPU is overloaded
D) Memory is exhausted
17. What is the primary purpose of a mutex (mutual exclusion lock)?
A) To signal events between processes
B) To provide an atomic way to acquire and release exclusive access to a shared resource
C) To manage process priorities
D) To implement message queues
18. Using semaphores to solve the producer-consumer problem requires:
A) A binary semaphore for buffer access, and counting semaphores for empty and full buffer slots
B) Only one binary semaphore
C) Three counting semaphores, each initialized to 1
D) No semaphores, only shared memory
19. A counting semaphore initialized to 1 and used with `wait()` and `signal()` operations behaves like a:
A) Mutex
B) Queue
C) Stack
D) Buffer
20. A counting semaphore is initialized to a non-negative integer. Its value can range from:
A) 0 to 1
B) 0 to N (where N is the number of resources)
C) 1 to N
D) -N to N
21. The `signal()` operation on a semaphore (also known as V operation) performs which of the following?
A) Decrements the semaphore value and blocks the process if the value becomes negative
B) Increments the semaphore value and potentially wakes up a blocked process
C) Checks if the semaphore value is zero
D) Sets the semaphore value to its initial value
22. The `wait()` operation on a semaphore (also known as P operation) performs which of the following?
A) Increments the semaphore value and potentially wakes up a blocked process
B) Decrements the semaphore value and blocks the process if the value becomes negative
C) Resets the semaphore value to zero
D) Sets the semaphore value to one
23. A binary semaphore can have only two values:
A) 0 and 1
B) 0 and infinity
C) 1 and 2
D) -1 and 1
24. Semaphores are synchronization primitives that are used to control access to shared resources. A semaphore is essentially:
A) A variable with associated procedures
B) A hardware register
C) A network socket
D) A file descriptor
25. Which condition in Peterson's solution ensures mutual exclusion?
A) while (turn == j) ;
B) while (flag[i] && turn == j) ;
C) flag[i] = true;
D) turn = j;
26. Peterson's solution uses two shared variables: an array `flag[2]` and a variable `turn`. `flag[i]` is true if process `i` is ready to enter its critical section. What does `turn` indicate?
A) The total number of processes waiting
B) The process that is currently in its critical section
C) The process whose turn it is to enter the critical section
D) The time remaining for the current process
27. Peterson's solution is a software-based solution for the critical-section problem that works for:
A) Any number of processes
B) Two processes
C) Three processes
D) Exactly four processes
28. Bounded Waiting is a requirement for a critical-section solution, meaning:
A) A process can only enter its critical section once
B) The number of times other processes are allowed to enter their critical sections after a process has made a request to enter its critical section and before that request is granted must be finite
C) A process must wait for a maximum of 10 seconds
D) Processes must wait for I/O completion
29. Progress is a requirement for a critical-section solution, meaning:
A) If a process is in its critical section, it must eventually exit
B) If no process is in its critical section and some processes wish to enter, then only those not in their remainder section can participate in deciding which will enter next, and this selection cannot be postponed indefinitely
C) No process should be kept waiting forever to enter its critical section
D) Processes should execute as quickly as possible
30. Mutual Exclusion ensures that:
A) If one process is executing in its critical section, no other process can be executing in their critical sections
B) All processes eventually get to enter their critical sections
C) Processes do not indefinitely delay other processes
D) Processes do not get stuck in a waiting loop
31. Which of the following is a requirement for a solution to the critical-section problem?
A) Mutual Exclusion
B) Deadlock
C) Starvation
D) Livelock
32. The critical section is a segment of code where a process:
A) Performs I/O operations
B) Accesses shared resources
C) Waits for a signal
D) Executes system calls
33. A race condition occurs when:
A) Multiple processes are running simultaneously
B) The outcome of concurrent operations depends on the particular order in which they are executed
C) A process accesses shared data
D) A process waits for an I/O event
34. Process synchronization is necessary to:
A) Speed up process execution
B) Ensure orderly execution of cooperating processes and prevent race conditions
C) Reduce memory consumption
D) Increase the number of processes running concurrently
35. What is a potential issue with client-server communication over a network?
A) Lack of data consistency
B) Network latency and reliability
C) CPU overload on the client
D) Excessive memory usage on the server
36. The server in the client-server model typically:
A) Requests services
B) Provides services to clients
C) Initiates all communication
D) Has no persistent state
37. In the client-server model, the client typically:
A) Provides a service
B) Requests a service from the server
C) Manages all network resources
D) Acts as a central database
38. Message passing is another IPC mechanism. It involves:
A) Directly accessing another process's memory
B) Exchanging messages between processes
C) Sharing CPU registers
D) Using hardware interrupts for communication
39. Which of the following is a common method for IPC?
A) File deletion
B) Shared memory
C) Process termination
D) Disk formatting
40. Inter-Process Communication (IPC) refers to:
A) The process of shutting down a system
B) A mechanism for processes to communicate and synchronize their actions
C) The allocation of CPU time to processes
D) The creation of new processes
41. Priority scheduling can be preemptive or non-preemptive. In preemptive priority scheduling:
A) A lower-priority process can interrupt a higher-priority process
B) A higher-priority process can interrupt a lower-priority process
C) Processes are executed strictly in arrival order
D) Processes are executed based on their CPU burst time
42. Which scheduling algorithm is non-preemptive and executes processes in the order they arrive?
A) Shortest Job Next
B) Round Robin
C) First-Come, First-Served (FCFS)
D) Priority Scheduling
43. In Round Robin scheduling, each process gets a small unit of CPU time called a:
A) Time slice
B) Quantum
C) Time limit
D) Burst time
44. Which scheduling algorithm aims to minimize the average waiting time by executing the process with the shortest burst time first?
A) First-Come, First-Served (FCFS)
B) Shortest Job Next (SJN) / Shortest-Process Next (SPN)
C) Round Robin
D) Priority Scheduling
45. What is the primary role of process scheduling?
A) To manage memory allocation
B) To decide which process in the ready queue should be allocated to the CPU
C) To handle file system operations
D) To manage user accounts
46. A process enters the waiting state when it:
A) Needs to wait for an I/O operation to complete
B) Is about to be terminated
C) Has finished its execution
D) Is ready to run
47. When a process is currently executing on the CPU, its state is:
A) Ready
B) Running
C) Blocked
D) Suspended
48. The state where a process is ready to be executed by the CPU is called:
A) Running
B) Waiting
C) Ready
D) Terminated
49. Which of the following is NOT a typical state of a process?
A) New
B) Ready
C) Running
D) Sleeping
50. What is a process in the context of operating systems?
A) A program in execution
B) A file stored on disk
C) A hardware component
D) A network connection