Chapter 6 CPU Scheduling
What is the Priority scheduling algorithm?
A priority is associated with each process, and the CPU is allocated to the process with the highest priority. Equal-priority processes are scheduled in FCFS order.
What advantage is there in having different time-quantum sizes at different levels of a multilevel queueing system?
A process that needs more frequent service (like an interactive process) can be in a queue with a small time quantum. A process with no need for frequent services can be in a queue with a larger quantum, meaning less context switches making the computer for efficient.
What is Earliest-Deadline-First (EDF) Scheduling?
Earliest-deadline-first (EDF) scheduling dynamically assigns priorities according to deadline. The earlier the deadline, the higher the priority; the later the deadline, the lower the priority.
What is burst time?
Execution time
What is Real-Time CPU Scheduling?
Has two systems: Soft real-time systems and Hard real-time systems. Soft real-time systems: provide no guarantee as to when a critical real-time process will be scheduled Hard real-time systems have stricter requirements. A task must be serviced by its deadline; service after the deadline has expired is the same as no service at all
What is turnaround time?
How long it takes from start to finish
Why is it important for the scheduler to distinguish I/O-bound programs from CPU-bound programs?
I/O-bound programs have the property of performing only a small amount of computation before performing IO. Such programs typically do not use up their entire CPU quantum. CPU-bound programs, on the other hand, use their entire quantum without performing any blocking IO operations. Consequently, one could make better use of the computer's resouces by giving higher priority to I/O-bound programs and allow them to execute ahead of the CPU-bound programs.
Suppose that a scheduling algorithm (at the level of short-term CPU scheduling) favors those processes that have used the least processor time in the recent past. Why will this algorithm favor I/O-bound programs and yet not permanently starve CPU-bound programs?
It will favor the I/O-bound programs because of the relatively short CPU burst request by them; however, the CPU-bound programs will not starve because the I/O-bound programs will relinquish the CPU relatively often to do their I/O.
Explain the difference between preemptive and nonpreemptive scheduling.
Preemptive scheduling allows a process to be interrupted in the midst of its execution, taking the CPU away and allocating it to another process. Nonpreemptive scheduling ensures that a process relinquishes control of the CPU only when it finishes with its current CPU burst.
Which scheduling algorithms are preemptive and which are non-preemptive?
Preemptive: SJF, Round-Robin, multilevel queue, multilevel feedback queue, priority, rate-monotonic, EDF Non-preemptive: FCFS, SJF, priority
Which of the following scheduling algorithms could result in starvation? a. First-come, first-served b. Shortest job first c. Round robin d. Priority
Shortest job first and priority-based scheduling algorithms could result in starvation.
What is the First-Come, First-Served (FCFS) scheduling algorithm?
Simplest CPU scheduling algorithm. With this scheme, the process that requests the CPU first is allocated the CPU first. Uses a FIFO queue. Process enters ready queue, it's PCB is linked to tail of queue. When CPU is free, it's allocated to the process at the head of the queue. The running process is then removed from the queue.
What is response time?
The amount of time between when the process is ready to the moment it's executed
What is the Multilevel Feedback Queue scheduling algorithm?
The multilevel feedback queue scheduling algorithm allows a process to move between queues. The idea is to separate processes according to the characteristics of their CPU bursts. Uses aging as a priority system.
Consider a system implementing multilevel queue scheduling. What strategy can a computer user employ to maximize the amount of CPU time allocated to the user's process?
The program could maximize the CPU time allocated to it by not fully utilizing its time quantums. It could use a large fraction of its assigned quantum, but relinquish the CPU before the end of the quantum, thereby increasing the priority associated with the process.
What is Rate-Monotonic Scheduling?
The rate-monotonic scheduling algorithm schedules periodic tasks using a static priority policy with preemption. If a lower-priority process is running and a higher-priority process becomes available to run, it will preempt the lower-priority process.
What is wait time?
The time spent in the ready queue
What are the different types of scheduling criteria?
There are 5 types of scheduling criteria. They are: CPU Utilization, Throughput, Turnaround time, Waiting time, and Response time.
What is the Multilevel Queue scheduling algorithm?
Used for processes that are classified into different groups. Division made between foreground (RR) and background processes (FCFS). A multilevel queue scheduling algorithm partitions the ready queue into several separate queues. The processes are permanently assigned to one queue, generally based on some property of the process. Each queue has it's own scheduling algorithm. Processes cannot move between queues.
What is the Round-robin scheduling algorithm?
Uses preemption. A small unit of time, called a time quantum or time slice, is defined. The ready queue is treated as a circular queue. The CPU scheduler goes around the ready queue, allocating the CPU to each process for a time interval of up to 1 time quantum.
What is the Shortest-Job-First (SJF) scheduling algorithm?
When the CPU is available, it is assigned to the process that has the smallest next CPU burst. If the next CPU bursts of two processes are the same, FCFS scheduling is used to break the tie. The SJF algorithm can be either preemptive or non-preemptive. The choice arises when a new process arrives at the ready queue while a previous process is still executing. The next CPU burst of the newly arrived process may be shorter than what is left of the currently executing process.
Explain the differences in the degree to which the following scheduling algorithms discriminate in favor of short processes: a. FCFS b. RR c. Multilevel feedback queues
a. FCFS—discriminates against short jobs since any short jobs arriving after long jobs will have a longer waiting time. b. RR— treats all jobs equally (giving them equal bursts of CPU time) so short jobs will be able to leave the system faster since they will finish first. c. Multilevel feedback queues—work similar to the RR algorithm— they discriminate favorably toward short jobs
What is the relation between these pairs of algorithm sets: a. Priority and SJF b. Multilevel feedback queues and FCFS c. Priority and FCFS d. RR and SJF
a. The shortest job has the highest priority. b. The lowest level of MLFQ is FCFS. c. FCFS gives the highest priority to the job having been in existence the longest. d. None. Scheduling algorithms are really sets of algorithms.
Discuss how the following pairs of scheduling criteria conflict in certain settings. a. CPU utilization and response time b. Average turnaround time and maximum waiting time c. I/O device utilization and CPU utilization
• CPU utilization and response time: CPU utilization is increased if the overheads associated with context switching is minimized. The context switching overheads could be lowered by performing context switches infrequently. This could however result in increasing the response time for processes. • Average turnaround time and maximum waiting time: Average turnaround time is minimized by executing the shortest tasks first. Such a scheduling policy could however starve long-running tasks and thereby increase their waiting time. • I/O device utilization and CPU utilization: CPU utilization is maximized by running long-running CPU-bound tasks without performing context switches. I/O device utilization is maximized by scheduling I/O-bound jobs as soon as they become ready to run, thereby incurring the overheads of context switches.