Scheduling Flashcards

1
Q

What does the dispatcher do

A

it performs the actual process switch (mechanism)
- saving/restoring process context
-switching to user mode

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

What does CPU scheduler do?

A

It selects the next process to run (policy)
-schedulers try to meet goals, provide fairness and adhere to priorities

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

What are the two types of schedulers?

A
  1. Short-term Scheduler: selects which process should be executed next and allocates CPU, it is invoked frequently
  2. Long-term Scheduler: selects which processes should be brought into the ready queue, it is invoked infrequently, it controls the degree of multiprogramming
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

enumerate three different process scheduling queues

A
  1. Job queue: Set of all processes in the system
  2. Ready queue: Processes in main memory, state: ready and waiting
  3. Device queues: Process waiting for an I/O device
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the following terms:
Throughput
Turnaround time
Response time
Waiting time

A

Throughput: # of processes that complete per time unit

Turnaround time: time from submission to completion of a job

Response time: Time from request to first response (first time it is dispatched)

Waiting time: time each process waits in the ready queue

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

First-Come First-Served

A

Schedule the processes in the order of arrival
-prone to Convoy effect (a process with high burst time makes a process with lower burst time to wait until it’s completion)
=> Average turnaround time depends on arrival in queue

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

Shortest Job First

A
  • has optimal average turnaround, waiting and response times
  • challenge: can’t know job lengths in advance
  • solution: predict length of next CPU burst for each process -> schedule the process with the shortest burst next
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Preemptive Shortest Job First

A

Idea: SJF, but preempt periodically to make a new scheduling decision; at each time slice schedule job with the shortest remaining time next

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

Round Robin

A

Idea: each process runs for a small unit of CPU time
preempt processes that haven’t blocked by the end of the time slice
append current thread to end of run queue, run next thread
time slice length needs to balance interactivity and overhead

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

Virtual Round Robin

A

RR is unfair for I/O bound jobs, they block before they use up their entire quantum
Idea: Put jobs that didn’t use up their quantum into an additional queue

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

Priority scheduling

A

Associate priority number with each process
Strict priority scheduling: processes with low priorities never execute if there is always a process runnable with a higher priority => starvation

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

Multi-level Feedback Queue

A

Goals: give higher priority to I/O-bound jobs, give low priority to CPU-bound jobs, but run them for longer at a time
Idea: Different queues with different priorities and time slice lengths

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

Priority Donation

A

Problem: process B may wait for result of process A (A has lower priority than B)
Solution: Give priority of B as long as B waits for a

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

Lottery scheduling

A

Issue number of lottery tickets to processes
- more tickets for processes with higher priority
-amount of tickets controls average proportion of CPU for each process

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

What is the purpose of scheduling

A

To find a mapping of processes to resources, so that each process will eventually get the resources it needs.

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

what happens when a process is blocking?

A

It is the state transition from running to waiting. A process needs to wait when it wants to access a resource that isn’t immediately available. It can’t make progress on the CPU so it is not considered by the scheduler.
1. Waiting for I/O device: any request to devices such as hard disks has to wait a usually unknown time for completion.
2. Waiting for other processes: synchronization mechanisms such as mutexes can block a process.

17
Q

What quantitative metrics can be used to estimate the quality of a scheduling policy?

A
  1. Processor utilization: Percentage of time that a processor is not idle
    2.Throughput: Number of processes/threads completed per unit of time
  2. Turnaround time: Time from submission of a process to its completion including the time spent waiting in queues
  3. Waiting time: Time a process spends in ready queue
  4. Response time: Time from submission of a request until the first response is produced
18
Q

What kind of hardware support is required for an OS that implements a non-cooperative scheduling policy?

A

The OS must be able to interrupt a running process, as the OS can’t regain control by itself.

19
Q

Pros and cons of choosing short vs long timeslice lengths

A

(long)
+ fewer context switches per time unit => can improve throughput
- responsiveness of the system decreases as ready processes have to wait longer until they are allowed to run again

20
Q

Compare preemptive vs non-preemptive SJF

A

SJF: always selects the job with the shortest remaining time next

Preemptive SJF: Makes a new scheduling decision periodically and when a new process arrives in the ready queue.

21
Q

How can starvation be avoided with multilevel feedback queue?

A

Priority boost: After some time period S, move all the jobs in the system to the topmost queue