THINK FIRST·CODE LATER

← Operating Systems
Chapter 4 · Week 4

CPU Scheduling I: Classic Algorithms and Metrics

Answered 0/30 Correct 0
Sign in to save progress across devices
Q1

Which scheduler decides which ready process gets the CPU next, typically every few milliseconds?

Q2

Which is not a responsibility of the CPU scheduler?

Q3

In non-preemptive scheduling, when can the scheduler take the CPU from a running process?

Q4

A process arrives at 2, first runs at 5, needs 6 units of CPU and finishes at 15. What are its turnaround, waiting and response times?

Q5

Tasks T1 = 1 s, T2 = 10 s, T3 = 1 s all arrive at t = 0 and are scheduled with non-preemptive SJF. What is the average waiting time?

Q6

Same tasks (T1 = 1, T2 = 10, T3 = 1) with SJF, but arrival times 0, 2 and 4. What is the throughput?

Q7

What is the convoy effect?

Q8

For the workload A(0,3), B(2,6), C(4,4), D(6,5), E(8,2) [arrival, burst], FCFS gives average waiting 4.60. What does non-preemptive SJF give?

Q9

Same workload with SRTF. Which process runs from time 4 to 8?

Q10

Which statement about SJF is correct?

Q11

With exponential averaging (α = 0.5), the previous prediction is τ = 10 ms and the actual burst was 6 ms. What is the next prediction?

Q12

In exponential averaging, what does α = 1 mean?

Q13

Five processes arrive at 0: P1 (burst 10, priority 3), P2 (1, 1), P3 (2, 4), P4 (1, 5), P5 (5, 2). Non-preemptive priority (1 = highest). What is the average waiting time?

Q14

What is aging in priority scheduling?

Q15

In Round Robin, what happens as the time quantum q becomes very large?

Q16

For the workload A(0,3), B(2,6), C(4,4), D(6,5), E(8,2), Round Robin with q = 2 (new arrivals queued before the preempted process) gives which order for the first four slices?

Q17

On that workload, RR (q = 2) has the worst average waiting time (6.00) of the algorithms compared, yet interactive systems use it. Why?

Q18

A time quantum is 4 ms and a context switch costs 0.5 ms. What fraction of CPU time is spent on context switches when processes always use their full quantum?

Q19

Under HRRN, a job has waited 6 ms and needs 3 ms of CPU. What is its response ratio?

Q20

Why can't long jobs starve under HRRN?

Q21

In an MLFQ, a process repeatedly uses its entire time quantum. What happens to it?

Q22

Why do real MLFQ schedulers periodically boost all processes to the top queue?

Q23

Which job type benefits most from being classified as I/O-bound by an MLFQ?

Q24

Three processes hold 50, 30 and 20 lottery tickets. About what share of the CPU does the second process receive over a long period?

Q25

Student X runs 1 process and student Y runs 9 CPU-bound processes on a shared server. Which policy gives each student about half of the CPU?

Q26

A batch system's main goal is to finish as many jobs per hour as possible. Which metric should it optimize?

Q27 Short answer

For the processes below (all times in ms), draw the Gantt chart and compute each process's turnaround and waiting time and the averages for (a) FCFS and (b) SRTF.

Process Arrival Burst
P1 0 8
P2 1 4
P3 2 9
P4 3 5
Q28 Short answer

Using HRRN on the workload A(0,3), B(2,6), C(4,4), D(6,5), E(8,2) [arrival, burst], show the response ratios at each decision point, the Gantt chart and the average waiting time. Compare with FCFS (average waiting 4.60).

Q29 Short answer

Trace an MLFQ with three queues — Q0 (quantum 2), Q1 (quantum 4), Q2 (FCFS) — for the jobs batch (arrival 0, burst 12), edit1 (1, 1), sim (3, 7), edit2 (5, 2). New jobs enter Q0; a job that uses its full quantum is demoted; the CPU serves the highest non-empty queue; arrivals during a slice are queued before the demoted job. Give the Gantt chart and each job's turnaround.

Q30 Short answer

You manage the EdgeCampus GPU job queue (Chapter 3). Jobs have very different lengths (2 minutes to 1 hour), users complain that tiny test jobs wait behind long training jobs, but long jobs must also finish eventually. Which scheduling algorithm(s) from this chapter would you use, and why? Mention how you would estimate job lengths.