CPA CPA Operating Systems & Process Management 1 — Questions and Answers
Question 1: What is the primary role of an operating system's process scheduler?
- Manage CPU time allocation among processes (Correct answer)
- Store data to disk
- Encrypt user files
- Compile source code
Correct answer: Manage CPU time allocation among processes
The process scheduler allocates CPU time among competing processes to maximize efficiency and responsiveness.
Question 2: Which scheduling algorithm gives the shortest average waiting time when all job lengths are known in advance?
- First-Come First-Served
- Round Robin
- Shortest Job First (Correct answer)
- Priority Scheduling
Correct answer: Shortest Job First
Shortest Job First (SJF) minimizes average waiting time by always executing the process with the smallest CPU burst next.
Question 3: In operating systems, what is a 'race condition'?
- A CPU benchmark test
- A situation where output depends on unpredictable timing of concurrent operations (Correct answer)
- A memory leak in multi-threaded programs
- A scheduling algorithm for real-time systems
Correct answer: A situation where output depends on unpredictable timing of concurrent operations
A race condition occurs when multiple threads access shared data concurrently and the result depends on the order of execution.
Question 4: What mechanism prevents two processes from simultaneously entering their critical sections?
- Paging
- Mutex lock (Correct answer)
- Virtual memory
- Context switching
Correct answer: Mutex lock
A mutex (mutual exclusion) lock ensures that only one process can enter a critical section at a time.
Question 5: Which state transition occurs when a process's time slice expires in a preemptive scheduler?
- Running → Terminated
- Waiting → Ready
- Running → Ready (Correct answer)
- Ready → Waiting
Correct answer: Running → Ready
When a time slice expires the scheduler preempts the process and moves it from Running back to Ready, so another process can run.
Question 6: What is 'deadlock' in operating systems?
- A program that loops forever without using CPU
- A condition where two or more processes wait indefinitely for resources held by each other (Correct answer)
- Memory that cannot be freed by garbage collection
- A file-system corruption state
Correct answer: A condition where two or more processes wait indefinitely for resources held by each other
Deadlock is a state where a set of processes are permanently blocked because each is waiting for a resource held by another process in the set.
What is the primary role of an operating system's process scheduler?