Week 5 - Operating System Fundamentals (Part 4) Flashcards
Process Scheduling (68 cards)
What is the objective of multi-programming in an operating system?
The objective of multi-programming is to have some process running at all times, maximizing CPU utilization. This ensures that while one process is waiting (e.g., for I/O), another process can use the CPU.
What is the main purpose of CPU scheduling in an operating system?
The main purpose of CPU scheduling is to decide which process to execute next by selecting the next process in the Ready queue for execution on a processor.
What is the objective of multi-programming in an operating system?
The objective of multi-programming is to have some process running at all times to maximize CPU utilisation.
What happens during a scheduling decision in an operating system?
A scheduling decision takes place when an event interrupts the execution of a process, selecting the next process from the Ready queue for execution.
What are the possible events that trigger a scheduling decision?
- Clock Interrupts (process running → ready state)
- I/O Interrupts (process waiting → ready state)
- Operating System Calls (e.g., read, write, process ready → waiting)
- Signals (e.g., semaphores)
What is the purpose of the Ready queue in the context of scheduling?
The Ready queue holds processes that are ready to execute but are waiting for CPU time. The scheduler selects a process from this queue to run on the CPU.
What is the characteristic of process execution in batch processing?
In batch processing, processes are typically CPU-bound, meaning they spend more time performing computations than waiting for I/O operations.
What is the characteristic of process execution in interactive systems?
In interactive systems, processes are typically I/O-bound, meaning they spend more time waiting for I/O operations than performing computations.
What are the two main phases in the CPU-I/O burst cycle of a process?
The two main phases in the CPU-I/O burst cycle are:
- CPU Burst – Process executes instructions using the CPU.
- I/O Burst – Process waits for I/O operations to complete.
How does the scheduler use the CPU-I/O burst cycle?
The scheduler can schedule another process to execute during the I/O burst of a process, optimizing CPU usage while the process is waiting for I/O operations to complete.
What happens at the end of the final CPU burst in a process?
At the end of the final CPU burst, the process typically makes a system request to terminate execution.
What does the histogram of CPU bursts typically show about most processes?
The histogram shows that most processes have many very short CPU bursts, especially in interactive systems.
What type of systems are characterized by many short CPU bursts?
Interactive systems are characterized by many short CPU bursts as processes frequently alternate between CPU and I/O operations.
When the CPU becomes idle, what must the OS do?
When the CPU becomes idle, the OS must select one of the processes in the ready queue to be executed next.
Is the ready queue necessarily a first-in, first-out (FIFO) queue?
No, the ready queue may not be FIFO. It could be a priority queue, tree, or an unordered linked list.
Who is responsible for selecting a process to execute when the CPU becomes idle?
The short-term scheduler is responsible for selecting the process to execute from the ready queue when the CPU becomes idle.
Conceptually, what are all processes waiting for?
Conceptually, all processes are waiting for a chance to run on the CPU.
What is the role of the dispatcher in an operating system?
The dispatcher is the module that gives control of the CPU to the process selected by the short-term scheduler. It involves switching context, switching to user mode, and jumping to the proper location in the user program to restart it.
What are the tasks involved when the dispatcher gives control to the next process?
The dispatcher performs three tasks:
- Switching context
- Switching to user mode
- Jumping to the proper location in the user program to restart it
Why should the dispatcher be as fast as possible?
The dispatcher should be as fast as possible because it is invoked during every process switch, and the time it takes to stop one process and start another is called dispatch latency.
What is non-preemptive scheduling in operating systems?
In non-preemptive scheduling, once a process is scheduled, it continues to execute on the CPU until:
- It finishes (terminates).
- It releases the CPU voluntarily (cooperative scheduling).
- It blocks due to an event such as an I/O interrupt or waiting for another process.
What events cause a process to release the CPU in non-preemptive scheduling?
In non-preemptive scheduling, a process may release the CPU if:
- It finishes (terminates).
- It voluntarily releases the CPU (cooperative scheduling).
- It blocks due to events like I/O interrupts or waiting for another process.
What is preemptive scheduling in operating systems?
In preemptive scheduling, the operating system interrupts processes to regain control of the CPU. A process executes until its time slice expires or a higher-priority process becomes ready. The current process is then suspended and placed back in the Ready queue, while a new process is selected for execution.
What happens when a time slice expires in preemptive scheduling?
When a time slice expires in preemptive scheduling:
- A clock interrupt returns control of the CPU to the scheduler.
- The current process is suspended and placed in the Ready queue.
- A new process is selected from the Ready queue and executed on the CPU.