Scheduling algorithms Flashcards

1
Q

FCFS

A

Schedule in order of arrival

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

Eval FCFS

A
  • Wait time : Highly dependent on arrival times
    (example - arrival in reverse order)
  • Convoy effect : later processes held up behind long running first process (CPU / IO bound explanation)
  • Simple but not robust to different arrival distributions/ processes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

SJF

A
  • Assume length of next cpu burst known for any process
  • Schedule in order of next cpu burst length
  • Use FCFS to break ties
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Walk through eg of SJF and eval

A

example - wait times, average wait time calc

  1. SJF is optimal wrt avg wait time
  2. “what might go wrong” - silherschatz
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

SRTF

A
  • Preemptive version of SJF

- Preempt running process if new process arrives w CPU burst shorter than remaining time of current process.

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

Eval SRTF

A

example - calc wait, avg wait, note preemption

  1. Not optimal in face of new runnable processes arriving - why???
  2. Costly context switches - thrashing
  3. Future burst lengths uncertain
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Predicting burst lengths

A

1 Necessary in both SJF and SRTF to have estimate of next cpu burst length
2 Exponential averaging of past CPU burst lengths (formula - recursion Tn+1 = atn + 1-a Tn with a between 0,1.) Interpretation of different alpha values : discount rate for discounting past burst lengths relative to most recent burst length.

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

Eval : predicting burst lengths

A

1 Choice of alpha / discount rate - history irrelevant high alpha, etc
2 Exponential averaging good predictor only if variance in cpu burst times is small
3 Consideration of load ????? s133

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

Round robin

A
  • Preemptive … why
  • Time sharing systems …. why
  • How:
  • Define time slice - fixed - 10 to 100 ms
  • Process at front of ready queue given CPU for <1 time quantum
  • When time elapses - preemption, appended to ready queue
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Round robin - evaluate

A
  • Fair : each process gets an equal proportion of CPU time
  • Live : no process waits longer than (n-1)q time units before receiving the CPU
  • Usually longer turnaround time than SRTF
  • Shorter average RESPONSE time compared to SRTF
  • Optimal q? Too large = FCFS, too small = thrashing (high context switch overhead)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Priority scheduling

A
  • Associate integer priority with each process
  • allocate COU to highest priority process in ready queue (may be lowest priority value)
  • Can get preemptive and non preemptive variants eg SJF sets priority to be inverse of predicted next CPU burst duration
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Tie breaking

A
  • Problem: if two processes have the same priority, which gets CPU
  • Possibility 1: Round robin - allocate a time slice to each process in turn.
  • Problem 1: Biased towards CPU intensive jobs (why?????????????)
  • Solution : per process quantum based on CPU usage
  • Solution2: just ignore the problem
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Starvation

A

Arguably the biggest problem with static priority systems,

a low priority process is not guaranteed to run - ever

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

Dynamic priority scheduling

A
  • Aim: prevent starvation
  • How : use same scheduling algorithm but allow priorities to change over time
  • How 2:
    Process has STATIC base priority, dynamic effective priority.
  • If the process is starved for say k seconds, increase the effective priority
  • Once process runs, reset effective priority to static base priority
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Example of Computed priority and eval

A

Dijkstra THE

  • Timeslots t, t+1
  • In each time slot, t, measure the CPU use of process j : u_j
  • Priority for process in the next time slot is a function of the past history of priorities and CPU usage
  • ???? Penalises CPU bound supports IO bound???
  • Once considered impractical ( memory required to store history of priorities and CPU usage, overhead of recomputing on each time slice, and possibility that the function itself may be intensive to compute). Now considered acceptable.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly