Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Complete spaces with a suitable word/phrase

Process execution consists of a cycle of CPU execution and I/O wait

Process execution consists of a cycle of CPU bursts and I/O bursts

CPU Scheduler selects from among the processes in memory that are ready to execute, and
allocates the CPU to one of them

Time it takes for the dispatcher to stop one process and start another running: called
Dispatch latency

State 3 Scheduling Criteria: Max CPU utilization, Max Throughput, Min Turnaround time, Min
Waiting time, Min Response time.

If there are n processes in the ready queue and the time quantum is q, then each process
gets 1/n of the CPU time in chunks of at most q time units at once. No process waits more
than (n-1)q time units

With multilevel queue, ready queue is partitioned into separate queues; Each queue has its
own scheduling algorithm

Increasing the priority of the process is known as aging

True/False

ready queue is not FIFO in general (answer: T)

in nonpreemptive scheduling: Once a process is in the running state, it will continue until it
terminates or blocks itself for I/O or to request some OS service (answer: T)

in preemptive scheduling: Currently running process may be interrupted and moved to ready
state by the OS (answer: T)

nonpreemptive Shortest-Job-First (SJF) Scheduling is also called Shortest-Remaining-Time-


First (SRTF) – (answer: False)

With Priority Scheduling: Starvation may exist where low priority processes may never
execute (True)

Round Robin (RR) scheduling is non preemptive (False)

With multilevel queue, fixed priority scheduling may cause starvation (TRUE)

With Multilevel Feedback Queue: A process can move between the various queues (TRUE)
Select all correct answers:

CPU scheduling decisions may take place when a process

1. Switches from running to waiting state (ex. I/O request, explicit wait)

2. Switches from running to ready state (ex. Interrupt)

3. Switches from waiting to ready (ex. I/O complete)

4. Terminates (ex. after last instruction)

Select all decisions under which scheduling is non preemptive (answer 1 & 4)

Select all decisions under which scheduling is preemptive (answer 2 & 3)

In FCFS scheduling:

1- The process that requests the CPU first is allocated the CPU first
2- The average waiting time is often quite long
3- Non preemptive
4- Preemptive
5- Convoy effect
6- Optimal scheduling

(Answers: 1, 2, 3, 5)

in RR scheduling:

1- Higher turnaround than SJF


2- Better response
3- Non preemptive
4- Preemptive
5- When time quantum is large, RR is the same as FIFO

(Answers: 1, 2, 4, 5)

With multilevel queue scheduling:

1- Ready queue is partitioned into several queues


2- All queues have the same scheduling algorithm
3- May serve all from high priority queue then next high priority queue
4- Each queue may get a certain amount of CPU time which it can schedule amongst its
processes
5- A process can move between the various queues

(Answers: 1, 3, 4)

Multilevel-feedback-queue scheduler may be defined by the following parameters

1- number of queues
2- scheduling algorithms for each queue
3- method used to determine when to upgrade priority
4- method used to determine when to demote priority
5- method used to determine which queue a process will enter when that process
needs service

(Answers: 1, 2, 3, 4, 5)

Exercise
Let us have the following set of procedures P1 … P5 to be scheduled, where the CPU burst is
given in milliseconds, and a small priority number means high priority:
Process Arrival time CPU burst Priority
P1 0 4 3
P2 1 1 2
P3 2 3 2
P4 3 2 1
P5 4 2 1
a. Draw Gantt chart to schedule these processes using each of the following scheduling
algorithms:
• FCFS scheduling
• SJF scheduling –preemptive
• priority scheduling - non preemptive
• RR (time quantum = 2)
b. Calculate the turnaround time, waiting time for each process and for each of the
scheduling algorithms, and fill in the following table:

P1 P2 P3 P4 P5

turnaround time
Average waiting

Average
turnaround

turnaround

turnaround

turnaround

turnaround

time
time

time

time

time

time

waiting waiting waiting waiting waiting


time time time time time

FCFS

preemptive
SJF
non-
preemptive
priority

RR

c. Based on the previous table, what is the best algorithm to schedule the given processes
P1…P5 ?

(More exercises: see slides)

You might also like