Os 3 Flashcards
What is CPU scheduling?
CPU scheduling is the mechanism that selects which process in the ready queue will be assigned to the CPU next.
When is CPU scheduling necessary?
When more than one process is ready to run but the CPU is free — i.e., multitasking or time-sharing systems.
What are the main CPU scheduling criteria?
CPU utilization, throughput, turnaround time, waiting time, response time.
What is non-preemptive scheduling?
Once a process is assigned the CPU, it keeps it until it voluntarily releases it (e.g., finishes or blocks for I/O).
What is preemptive scheduling?
Processes can be interrupted and the CPU reassigned, usually based on priority or time quantum expiration.
What is First-Come, First-Served (FCFS) scheduling?
Processes are executed in the order they arrive in the ready queue; simple but can cause long waiting times (convoy effect).
What is Shortest Job First (SJF) scheduling?
The process with the smallest estimated run-time-to-completion is selected next, minimizing average waiting time.
What is the difference between preemptive SJF and non-preemptive SJF?
Preemptive SJF (Shortest Remaining Time First) allows a shorter job to preempt a running process; non-preemptive SJF does not.
What is Priority Scheduling?
Each process is assigned a priority, and the CPU is allocated to the process with the highest priority (smallest numerical value if lower number = higher priority).
What is the problem of starvation in Priority Scheduling?
Low-priority processes may never execute if higher-priority processes keep arriving.
What is Aging in CPU scheduling?
Gradually increasing the priority of waiting processes to prevent starvation.
What is Round-Robin (RR) scheduling?
Each process gets a fixed time slice (quantum); after that, it’s preempted and moved to the end of the ready queue.
What are the advantages of Round-Robin scheduling?
Fairness (all processes get CPU time) and good response time for time-sharing systems.
How is time quantum size critical in Round-Robin?
Too small = too much overhead (frequent context switches); too large = similar to FCFS.
What is Multilevel Queue Scheduling?
Processes are divided into queues based on type (e.g., foreground, background), each with different scheduling policies.
What is Multilevel Feedback Queue Scheduling?
A multilevel queue system where processes can move between queues based on behavior (e.g., CPU bursts).
What is Concurrency?
Concurrency is the execution of multiple processes or threads simultaneously (or appearing to be simultaneous) to improve resource utilization and responsiveness.
What is a critical section problem?
When two or more processes access shared resources simultaneously, risking data inconsistency or race conditions.
What are the three requirements for solving the critical section problem?
Mutual exclusion, progress, bounded waiting.
What is Mutual Exclusion?
At most one process can be inside the critical section at any time.
What is a race condition?
When the behavior of a program depends on the relative timing of processes, leading to unpredictable results.
What is a semaphore?
A semaphore is a synchronization tool used to control access to a shared resource by multiple processes in a concurrent system.
What are the two types of semaphores?
Counting semaphores (integer value) and binary semaphores (0 or 1, like mutex locks).
What are the basic operations on semaphores?
Wait (P) — decrease the semaphore value; Signal (V) — increase the semaphore value.
What is busy waiting?
When a process continuously checks for a condition to be true, wasting CPU cycles.
How do semaphores solve the busy waiting problem?
By blocking a process when it cannot proceed, instead of forcing it to spin and check constantly.