Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2K views

Operating System Exercises - Chapter 5-Exr

This document contains 8 practice exercises about CPU scheduling algorithms: 1. It asks for a formula to calculate the number of possible schedules for n processes on one processor. 2. It defines the difference between preemptive and nonpreemptive scheduling. 3. It provides a scheduling scenario and asks questions about average turnaround times using FCFS and SJF algorithms. 4. It asks about the advantages of different time quantum sizes in multilevel queueing systems. 5. It asks about the relationships between different scheduling algorithm sets such as priority vs SJF, multilevel feedback queues vs FCFS, and more. 6. It asks why an algorithm favoring

Uploaded by

evilanubhav
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Operating System Exercises - Chapter 5-Exr

This document contains 8 practice exercises about CPU scheduling algorithms: 1. It asks for a formula to calculate the number of possible schedules for n processes on one processor. 2. It defines the difference between preemptive and nonpreemptive scheduling. 3. It provides a scheduling scenario and asks questions about average turnaround times using FCFS and SJF algorithms. 4. It asks about the advantages of different time quantum sizes in multilevel queueing systems. 5. It asks about the relationships between different scheduling algorithm sets such as priority vs SJF, multilevel feedback queues vs FCFS, and more. 6. It asks why an algorithm favoring

Uploaded by

evilanubhav
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

5

CHAPTER

CPU Scheduling

Practice Exercises

5.1 A CPU scheduling algorithm determines an order for the execution of its
scheduled processes. Given n processes to be scheduled on one proces-
sor, how many possible different schedules are there? Give a formula in
terms of n.
5.2 Define the difference between preemptive and nonpreemptive schedul-
ing.
5.3 Suppose that the following processes arrive for execution at the times
indicated. Each process will run the listed amount of time. In answering
the questions, use nonpreemptive scheduling and base all decisions on
the information you have at the time the decision must be made.

Process Arrival Time Burst Time


P1 0.0 8
P2 0.4 4
P3 1.0 1

a. What is the average turnaround time for these processes with the
FCFS scheduling algorithm?

b. What is the average turnaround time for these processes with the
SJF scheduling algorithm?
c. The SJF algorithm is supposed to improve performance, but notice
that we chose to run process P1 at time 0 because we did not know
that two shorter processes would arrive soon. Compute what the
average turnaround time will be if the CPU is left idle for the first 1
unit and then SJF scheduling is used. Remember that processes P1
and P2 are waiting during this idle time, so their waiting time may
increase. This algorithm could be known as future-knowledge
scheduling.

9
10 Chapter 5 CPU Scheduling

5.4 What advantage is there in having different time-quantum sizes on dif-


ferent levels of a multilevel queueing system?
5.5 Many CPU-scheduling algorithms are parameterized. For example, the
RR algorithm requires a parameter to indicate the time slice. Multilevel
feedback queues require parameters to define the number of queues,
the scheduling algorithms for each queue, the criteria used to move
processes between queues, and so on.
These algorithms are thus really sets of algorithms (for example, the
set of RR algorithms for all time slices, and so on). One set of algorithms
may include another (for example, the FCFS algorithm is the RR algorithm
with an infinite time quantum). What (if any) relation holds between the
following pairs of sets of algorithms?
a. Priority and SJF
b. Multilevel feedback queues and FCFS
c. Priority and FCFS
d. RR and SJF
5.6 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 pro-
grams and yet not permanently starve CPU-bound programs?
5.7 Distinguish between PCS and SCS scheduling.
5.8 Assume an operating system maps user-level threads to the kernel using
the many-to-many model where the mapping is done through the use
of LWPs. Furthermore, the system allows program developers to create
real-time threads. Is it necessary to bind a real-time thread to an LWP?

You might also like