Unit II: CPU Scheduling
What is the primary purpose of CPU scheduling in an operating system?
A. Allocating memory to processes
B. Managing input/output operations
C. Distributing CPU time among multiple processes
D. Providing a user interface
Answer: C. Distributing CPU time among multiple processes
Explanation: CPU scheduling ensures efficient CPU utilization by allocating CPU time to processes waiting in the ready queue.Which scheduling algorithm assigns the CPU to the process that arrives first in the ready queue?
A. Shortest Job First (SJF)
B. Round Robin (RR)
C. First-Come, First-Served (FCFS)
D. Priority Scheduling
Answer: C. First-Come, First-Served (FCFS)
Explanation: FCFS scheduling processes in the order they arrive, providing simplicity but may lead to inefficiencies like the convoy effect.What is the main disadvantage of the First-Come, First-Served (FCFS) scheduling algorithm?
A. It is difficult to implement
B. It may lead to a phenomenon known as "convoy effect"
C. It favors short processes over long processes
D. It requires a large amount of memory
Answer: B. It may lead to a phenomenon known as "convoy effect"
Explanation: The convoy effect occurs when a long process delays the execution of shorter processes in the queue.Which scheduling algorithm aims to minimize the total time a process spends waiting in the ready queue?
A. First-Come, First-Served (FCFS)
B. Shortest Job First (SJF)
C. Priority Scheduling
D. Round Robin (RR)
Answer: B. Shortest Job First (SJF)
Explanation: SJF prioritizes processes with shorter burst times, reducing the average waiting and turnaround time.In Round Robin scheduling, what is the significance of the time quantum or time slice?
A. It is the maximum burst time allowed for a process
B. It is the time a process is allowed to run before being preempted
C. It is the total time a process spends in the ready queue
D. It is the time required to switch between processes
Answer: B. It is the time a process is allowed to run before being preempted
Explanation: The time quantum ensures fairness in CPU allocation, allowing each process a fixed duration of execution before preemption.What is the key characteristic of a preemptive scheduling algorithm?
A. Processes cannot be interrupted once they start executing
B. Processes can be interrupted and moved back to the ready queue
C. Processes are assigned a fixed time slice for execution
D. Processes are executed in the order they arrive in the ready queue
Answer: B. Processes can be interrupted and moved back to the ready queue
Explanation: Preemptive scheduling allows the operating system to interrupt a running process to prioritize higher-priority tasks.What is the role of a Dispatcher in the context of CPU scheduling?
A. Allocates memory to processes
B. Manages input/output operations
C. Selects a process from the ready queue for execution
D. Provides a user interface
Answer: C. Selects a process from the ready queue for execution
Explanation: The dispatcher is responsible for transferring control of the CPU to the selected process from the ready queue.In Priority Scheduling, how is priority assigned to processes?
A. By the order in which processes arrive
B. By the total time a process has spent in the ready queue
C. By the burst time of a process
D. By a predefined priority value associated with each process
Answer: D. By a predefined priority value associated with each process
Explanation: Priority Scheduling assigns CPU time based on a priority value, where higher-priority processes are executed first.What is the primary advantage of Round Robin (RR) scheduling over First-Come, First-Served (FCFS)?
A. Lower average waiting time
B. Fairness in CPU allocation
C. Simplicity of implementation
D. Improved throughput
Answer: B. Fairness in CPU allocation
Explanation: Round Robin scheduling ensures that all processes get an equal share of CPU time, preventing starvation.What scheduling algorithm allows a process to be executed only if its priority is higher than the priority of the currently executing process?
A. Round Robin (RR)
B. Priority Scheduling
C. Shortest Job First (SJF)
D. First-Come, First-Served (FCFS)
Answer: B. Priority Scheduling
Explanation: Preemptive Priority Scheduling interrupts the currently running process if a higher-priority process arrives.
What is the primary disadvantage of Priority Scheduling?
A. It may lead to starvation of low-priority processes
B. It favors short processes over long processes
C. It requires a large amount of memory
D. It is difficult to implement
Answer: A. It may lead to starvation of low-priority processes
Explanation: Priority Scheduling can cause starvation, where low-priority processes may never get CPU time if higher-priority processes continuously arrive.Which scheduling algorithm is designed to handle both real-time and non-real-time processes?
A. Priority Scheduling
B. Round Robin (RR)
C. Multi-level Feedback Queue
D. First-Come, First-Served (FCFS)
Answer: C. Multi-level Feedback Queue
Explanation: Multi-level Feedback Queue scheduling dynamically adjusts process priorities and can handle both real-time and non-real-time processes.What is the purpose of a multiprocessor scheduling algorithm in an operating system?
A. Distributing CPU time among multiple processes
B. Managing input/output operations
C. Allocating memory to processes
D. Coordinating the execution of processes on multiple CPUs
Answer: D. Coordinating the execution of processes on multiple CPUs
Explanation: Multiprocessor scheduling ensures efficient load balancing and CPU utilization across multiple processors.Which scheduling criterion aims to achieve maximum CPU utilization and throughput?
A. CPU Burst Time
B. Turnaround Time
C. Response Time
D. Fairness
Answer: A. CPU Burst Time
Explanation: Minimizing CPU burst time directly contributes to improved CPU utilization and increased throughput.In real-time scheduling, what is the primary concern?
A. Maximum CPU utilization
B. Fairness in CPU allocation
C. Meeting deadlines
D. Minimizing turnaround time
Answer: C. Meeting deadlines
Explanation: Real-time scheduling ensures tasks meet their deadlines, which is critical in systems like embedded and industrial controls.What is the primary goal of the Shortest Job First (SJF) scheduling algorithm?
A. Minimizing turnaround time
B. Maximizing CPU utilization
C. Fairness in CPU allocation
D. Minimizing waiting time
Answer: A. Minimizing turnaround time
Explanation: SJF reduces the average turnaround time by prioritizing processes with the shortest execution time.In multiprocessor scheduling, what is load balancing?
A. Allocating memory to processes
B. Distributing processes among multiple CPUs to ensure equal workload
C. Selecting processes based on their priority
D. Coordinating the execution of processes on multiple CPUs
Answer: B. Distributing processes among multiple CPUs to ensure equal workload
Explanation: Load balancing aims to evenly distribute the computational workload across multiple processors.What is the primary characteristic of a non-preemptive scheduling algorithm?
A. Processes can be interrupted and moved back to the ready queue
B. Once a process starts executing, it cannot be interrupted
C. Processes are assigned a fixed time slice for execution
D. Processes are executed in the order they arrive in the ready queue
Answer: B. Once a process starts executing, it cannot be interrupted
Explanation: Non-preemptive scheduling ensures a process completes its execution without interruption once it starts.What is the purpose of a Multi-level Feedback Queue in CPU scheduling?
A. Assigning priorities to processes
B. Distributing CPU time among multiple processes
C. Handling both real-time and non-real-time processes
D. Adapting to the behavior of processes by adjusting priority levels
Answer: D. Adapting to the behavior of processes by adjusting priority levels
Explanation: Multi-level Feedback Queues dynamically adjust process priorities based on their execution history and behavior.Which thread scheduling algorithm allows a thread to run until it voluntarily releases the CPU?
A. Preemptive Scheduling
B. Non-preemptive Scheduling
C. Round Robin Scheduling
D. Priority Scheduling
Answer: B. Non-preemptive Scheduling
Explanation: In non-preemptive thread scheduling, the thread voluntarily relinquishes the CPU only when it completes or requires waiting.