scheduling Flashcards
What is the definition and objective of a CPU burst?
The period during which a process is actively executing instructions on the CPU. The process performs computations and executes instructions during this phase.
Explain the concept of an I/O burst and its objective.
The period during which a process is waiting for an I/O operation to be completed. The process is blocked, and the CPU is idle during this phase, waiting for the completion of a specific I/O operation (e.g., reading from disk, network communication).
Describe the typical behavior of the CPU – I/O Burst Cycle.
A process goes through a series of CPU and I/O bursts, creating a cycle. The CPU burst involves active execution on the CPU, while the I/O burst is characterized by the process waiting for an I/O operation to complete. This cycle repeats until the process finishes its task.
Provide an example scenario of a process going through CPU and I/O bursts.
A process might start with a CPU burst, performing computations. It then enters an I/O burst, waiting for data to be read from disk. After the I/O operation completes, the process resumes with another CPU burst.
How do scheduling techniques aim to overlap CPU and I/O bursts?
The goal is to overlap the execution of multiple processes to keep the CPU busy and minimize idle time. While one process is waiting for I/O, the CPU can be assigned to another process that is ready to execute.
What role does the CPU scheduler play when the CPU becomes idle?
The CPU scheduler selects a process from the ready queue to be executed when the CPU becomes idle. It allocates the CPU to the selected process, and the process control block (PCB) of the chosen process is loaded for execution.
How does the CPU scheduler select a process to be executed?
The CPU scheduler selects a process based on a scheduling algorithm, such as first-come, first-served (FCFS), shortest job first (SJF), or priority scheduling. The algorithm determines the order in which processes are chosen from the ready queue.
Explain the concept of a process control block (PCB).
A process control block (PCB) is a data structure containing information about a process. It includes details like process state, program counter, CPU registers, memory limits, and information about the process’s resources. The PCB is crucial for process management in the operating system.
What happens during a context switch, and why is it important?
During a context switch, the operating system saves the state of the current running process and restores the state of a new process to be executed. It involves updating the CPU registers and memory pointers. Context switches are important for multitasking, allowing multiple processes to share the CPU.
Differentiate between preemptive and nonpreemptive scheduling.
In preemptive scheduling, the operating system can interrupt a currently running process to start or resume another process. Nonpreemptive scheduling switches processes only under specific circumstances, such as when a process voluntarily relinquishes the CPU or terminates.
Describe the role of the dispatcher in the CPU-scheduling function.
The dispatcher is responsible for giving control of the CPU’s core to the process selected by the CPU scheduler. It involves switching context from one process to another, switching to user mode, and jumping to the proper location in the user program to resume execution.
What activities are involved in switching context from one process to another?
Context switching involves saving the state of the currently running process and restoring the state of the new process to be executed. It includes saving and loading CPU registers, updating memory pointers, and ensuring a smooth transition between processes.
Explain the concept of voluntary and non-voluntary context switches.
A voluntary context switch occurs when a process gives up control of the CPU voluntarily, such as when it blocks for I/O or terminates. A non-voluntary context switch happens when the CPU is taken away from a process, for example, when its time slice expires or preempted by a higher-priority process.
Why is the dispatch latency important, and how can it be minimized?
Dispatch latency is the time it takes for the dispatcher to stop one process and start another. It is crucial because it impacts system responsiveness. Minimizing dispatch latency involves optimizing the dispatcher’s efficiency and reducing the time taken for context switches.
Name and explain the criteria used for comparing CPU-scheduling algorithms.
CPU Utilization: Keep the CPU as busy as possible. Throughput: The number of processes completed per time unit. Turnaround Time: The interval from process submission to completion. Waiting Time: The time a process spends waiting in the ready queue. Response Time: The time from request submission to the first response produced.