Scheduling Flashcards

1
Q

Scheduling

A

Policies that the OS employs to determine the execution order of ready processes/threads (& which core to execute on multicore systems)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

CPU utilization

A

Percentage of time CPU is busy executing jobs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Throughput

A

The number of processes completed in a given amount of time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Turnaround time

A

The time elapsed between the arrival and completion of a process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Waiting time

A

The time a process spends in the ready queue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Response time

A

The time elapsed between the process’ arrival and its first output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What two metrics does scheduling aim to maximize?

A

CPU utilization and throughput

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What three metrics does scheduling aim to minimize?

A

Turnaround time, waiting time and response time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What assumptions for workloads do we make?

A

Each job runs for the same amount of time
All jobs arrive at the same time
All jobs only use the CPU
Run-time of each job is known
Once started, each jobs runs to completion (preemption)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

First In First Out (FIFO)

A

First Come, First Served (FCFS)
Policy: Jobs are executed in arrival time order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Convoy effect

A

A scheduling phenomenon in which a number of jobs wait for one job to get off a core, causing overall device and CPU utilization to be suboptimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a possible negative consequence of the First In First Out scheduling algorithm?

A

Convoy effect

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Shortest Job First (SJF)

A

Policy: The jobs with the shortest execution time are scheduled first

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

If all assumptions for workloads are true, what is the optimal scheduling algorithm in terms of average waiting time?

A

SJF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Shortest-Time-To-Complete-First (STCF)

A

Policy: Always switch to jobs with the shortest completion time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are the two non-preemptive scheduling algorithms?

A

FIFO and SJF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What sort of scheduler is STCF?

A

Preemptive

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a possible negative consequence of STCF?

A

Starvation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Response time

A

T_firstrun - T_arrival

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Round-Robin is a better scheduler with regards to which metric?

A

Response time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Time quantum/time slice/scheduling quantum

A

A fixed and small amount of time units

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Round-Robin (RR)

A

Policy: Each process executes for a time slice. Switches to another process regardless of whether it has completed its execution or not

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

If the job in a Round-Robin scheduler hasn’t yet completed its execution, what happens?

A

The incomplete job is added to the tail of the ready FIFO queue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

RR is a good scheduler in terms of…

A

response time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

RR is a poor scheduler in terms of…

A

turnaround time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

What scheduler is starvation-free?

A

RR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

What workload assumption is the incorporation of I/O based on?

A

Run-time of each job is known

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

How do we incorporate I/O with scheduling?

A

By treating each CPU burst as a job; then processes performing I/O can run frequently, while other CPU intensive jobs run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

STCF is an optimal scheduling algorithm with regards to minimizing which performance metric?

A

Average turnaround time; if all jobs know their execution times in prior

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

RR is an good scheduling algorithm with regards to minimizing which metric?

A

Average response time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

What is priority-based scheduling?

A

Scheduling based on priority levels assigned to each process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

What are the three priority-based scheduling algorithms?

A

FIFO, SJF, STCF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

What is a negative consequence of priority-based scheduling?

A

Starvation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

What two forms of scheduling does a Multi-Level Queue (MLQ) combine?

A

Priority-based scheduling & RR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

MLQ optimizes … for computation-intensive programs

A

turnaround time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

MLQ minimizes … for interactive programs

A

response time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

Multi-Level-Feedback Queue (MLFQ) optimizes turnaround time by

A

running shorter jobs first

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

Multi-Level-Feedback Queue minimizes response time by

A

attempting to make a system feel responsive for interative users

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

Multi-Level-Feedback-Queue (MLFQ) varies the priority of a job based on what?

A

Its observed behavior

40
Q

Allotment

A

The amount of time a job can spend at a given priority level before the scheduler reduces its priority

41
Q

What rules does the MLFQ have?

A
  1. If Priority(A) > Priority(B), A runs
  2. If Priority(A) = Priority(B), A & B run in RR using the time slice of the given queue
  3. When a job enters the system, it’s placed at the highest priority
  4. Once a job uses up its time allotment, its priority is reduced
  5. After some time period, move all jobs in the system to the topmost queue (highest priority)
42
Q

What doesn’t the MLFQ require prior knowledge of?

A

The CPU usage of a process

43
Q

What is the MLFQ scheduler defined by?

A

Number of queues
Time slice of each queue
Boosting period
Scheduling algorithm for each queue

44
Q

What does the high priority queue in a MLFQ scheduler optimize?

A

Response time

45
Q

What does the low priority queue of a MLFQ scheduler optimize?

A

Turnaround time

46
Q

Fairness

A

To guarantee the fair usage of CPU (CPU time)

47
Q

What is a fair-share scheduler?

A

A scheduler that guarantees that each job obtains a certain percentage of CPU time

48
Q

Describe a probabilistic way to implement lottery scheduling

A

Time slice
Scheduler knows how man tickets exists
Scheduler picks a winning ticket from the ticket pool for each time slice

49
Q

What is the objective of Completely Fair Scheduling (CFS)?

A

To fairly divide a CPU evenly among all competing processes.

50
Q

Describe the Completely Fair Scheduling method

A

Choose the process with the lowest virtual runtime
Run each process for a time slice
Determine the time slice based on sched_latency and the number of processes

51
Q

What is virtual runtime (vruntime)?

A

Denotes how long a process has executed

52
Q

What is sched_latency?

A

Used to determine the time slice. Typical value is 48 ms

53
Q

Describe the equation for a process’ time slice

A

sched_latency / the number of processes

54
Q

What parameter do we have in addition to sched_latency to ensure that there are never too many processes running?

A

min_granularity. Set to 6 ms.

55
Q

How does one enable control over process priority in CFS?

A

Niceness (user-space) values

56
Q

What do positive niceness values imply?

A

Lower priority

57
Q

What do negative niceness values imply?

A

Higher priority

58
Q

What sort of tree does a CFS deploy?

A

A red-black tree; balanced binary search tree

59
Q

What is the insertion, deletion and update complexity of the red-black tree deployed by CFS?

60
Q

What is the find min complexity of the red-black tree deployed by CFS?

61
Q

What is the red-black tree deployed by CFS ordered by?

A

vruntime, as a key

62
Q

What does the deploying of a red-black tree in CFS ensure?

A

Low scheduling overhead

63
Q

How does CFS deal with I/O and sleep?

A

Setting the vruntime of a wake-up process to the minimum value found in the RB-tree

64
Q

How does CFS boost interactivity?

A

I/O-bound (interactive) processes typically have shorter CPU bursts and thus will have a lower vruntime –> higher priority

65
Q

How are CPU-bursts scheduled when I/O is considered?

A

As sub-jobs

66
Q

What two scheduling algorithms does MLFQ combine?

A

RR and priority-based scheduling

67
Q

What does proportional share scheduling strive to guarantee for each job?

A

That they all receive a desired amount of CPU time

68
Q

What is CFS based on?

A

vruntime; to determine the execution order

69
Q

What are the three types of multiprocessors?

A
  • Multicore processor
  • Multiprocessor
  • Multithreaded cores
70
Q

What does the cache of a CPU contain?

A

Small & fast form of memory
Holds copies of popular data found in main memory

71
Q

What sorts of locality does the cache utilize?

A

Temporal and spatial

72
Q

What does the main memory of a CPU contain?

A

Holds all the data

73
Q

Is access to the main memory faster or slower than access to the cache?

74
Q

What does a multiprocessor with cache have to ensure the consistency of?

A

Shared resource data stored in multiple caches

75
Q

Define cache affinity

A

The storing of certain states that a process has in the cache of a CPU

76
Q

Will a process run faster or slower if its executed on the same CPU as it has cache affinity for?

77
Q

What sort of affinity should a multiprocessor scheduler consider when making its scheduling decision?

A

cache affinity

78
Q

What does Single-Queue Multiprocessor Scheduling (SQMS) do?

A

Puts all jobs that need to be scheduled into a single queue

79
Q

What sort of multiprocessing does SQMS use? (asymmetric/symmetric)

A

Asymmetric

80
Q

How many processors/cores manage the scheduling queue when using SQMS?

81
Q

What are the pros of SQMS?

A

Simple
Reduced data sharing

82
Q

What are the cons of SQMS?

A

Locking has to be inserted -> lack of scalability
Cache affinity

83
Q

What does Multi-Queue Multiprocessor Scheduling (MQMS) consist of?

A

Multiple scheduling queues

84
Q

Does each processor in MQMS have its own scheduler?

85
Q

What sort of multiprocessing does MQMS use? (asymmetric/symmetric)

86
Q

What are the pros of MQMS?

A

Better cache affinity
Scalability

87
Q

What are the cons of MQMS?

A

Load imbalance

88
Q

What is the solution to load imbalance in MQMS?

A

Migration; switching jobs between processors

89
Q

Define processor affinity

A

The binding of jobs to specific cores

90
Q

Define soft affinity

A

Jobs are expected to execute on a single processor, but it’s possible to migrate them between processors

91
Q

What term does this define: jobs are specified to a subset of processors?

A

Hard affinity

92
Q

What sort of processing is described below?

Jobs are scheduled to different cores to minimize power consumption while providing the required performance by using heterogeneous cores on a single chip

A

Heterogeneous multiprocessing

93
Q

What is a simple but unscalable method for scheduling on multiprocessor systems?

94
Q

What is the widely used scheduling method for modern multiprocessor systems?

95
Q

What architecture introduce new challenges for scheduling?

A

Heterogeneous architecture