Week 5 Flashcards

1
Q

What questions do scheduling have to deal with.

A

Which process should run?
How long should it run?
How do we allocate memory?
Should one process get more memory than another?

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

What is the workload in the scheduling process?

A

The workload is the set of processes running on the system.

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

How is effectiveness is scheduling measured?

A

It can mean both performance as measured by turn around time, and fairness as measured by Jain’s fairness index.

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

What is FIFO? What are the pros? What are cons?

A

The first in first out policy states that the first jo to arrive is the first job to run.

Pros: simple to implement.

Cons: Suffers from the convoy effect, wherein short running jobs get stuck behind a single long running job.

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

What is the equation for turnaround time?

A

Turnaround = Tcompletion - Tarrival

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

What is the policy of shortest job first? What are some pros? What are some cons?

A

The shortest job first policy dictates that the job with the shortest duration should run next.

Pros: assuming that all jobs arrive at the same time, solves the convey efffect problem from the previous example.

Cons: If the jobs don’t arrive at the same time, the convoy effect is still an issue.

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

What is a preemptive scheduler?

A

A scheduler is preemptive if it can stop one process to run a different process.

We can leverage context switching mechanisms.

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

How does the OS regain control from a process?

A

Use a cooperative approach: wat for a process to voluntarily give up control.

Use a non cooperative approach: set a hardware timer interrupt that will regularly give control back to the OS.

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

What is the shortest time to completion (STCF) policy? What are pros, and what are cons?

A

It is similar to SJF but incorporates preemption.

STCF says that the job that has the least amount of time remaining should be scheduled, preempting any runnning jobs.

Pros: The convoy effect is no longer an issue.

Cons: We don’t always know how long a job will take. Also not great for response time.

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

What is the equation for response time?

A

Tresponse = Tfirstrun - Tarrival

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

What is the round robin policy? What are some pros and cons.

A

The RR policy requires that each job be run for a fixed duration of time before switching to the next job.
The amount of time each job runs is called a time slice.

Pros: Good for workloads where response time is important. It is fair, meaning that all jobs receive a proportional share of execution time.

Cons: Context switching has overhead. The smaller the time slice, the more time that is spent context switching and the less spent on job execution.

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

What are Multi-level feedback queues?

A

The MLFQ places jobs into queues and each queue is assigned a priority level.

Short running jobs will have a higher priority than the long running CPU jobs.

We will observe how much its time slice a job uses to estimate the job type.

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

What are the pros of a multilevel feedback queue? What are some cons?

A

Pros: Good for mixed workloads.

Cons: What if the job’s behaviour changes over time? What if the system has alot of short running jobs and one long job.
(The solution to this is priortity boost).

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

What is the basic idea behind the proportional share scheduler? What is an example of a proportional share scheduler?

A

Instead of optimizing for turnaround time or response time, a proportional share scheduler attempts to give every job a fair share of resources.

An example of a proportional share scheulder is lottery scheduling.

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

What is lottery scheduling?

A

Is a type of proportional share scheduling where the scheduler assigns lottery tickets to jobs and a job is scheduled when it wins the lottery.

The more tickets a job has, the more chances it has to win.

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

True or false, lottery scheduling is deterministic.

A

False, it is probabilistic, not deterministic.

17
Q

What is stride scheduling?

A

While lottery scheduling is probablilistic, stride scheduling is deterministic, it guarantees the proportions are correct.

Each job is given a stride, which is calculated by dividing a large number by the job’s proportion of tickets.

Every time a job runs, the scheduler increments a counter (called the pass value) by the stide amount.

The scheduler runs the job with the lowest pass value.

18
Q

Why would you choose lottery scheduling over stride scheduling and vice versa.

A

Lottery is simple to implemet. New processes can enter at any time.

Stride, is difficult to add new jobs but it is deterministic and guarantees the proportions are correct.