8.1 Scheduling Flashcards

1
Q

Scheduling

A

An OS must allocate resources among competing processes
The resource provided by a processor is execution time
- The resource is allocated by means of a schedule

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

Aim of scheduling

A

To assign processes to be executed by the processor over time
- In a way that meets system objectives, such as response time, throughput and processor efficiency

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

Objectives of Scheduling

A
Share time fairly among processes 
Prevent starvation of a process
Use the processor efficiently
Have low overhead
Prioritise processes when necessary
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Long term scheduling

A

Determines which programs are admitted to the system for processing
-May be first come first served
-Or according to priority
Controls degree of multiprogramming
More processes, smaller percentage of time each process is executed

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

Medium term scheduling

A

Part of swapping function

Swapping in decisions are based on the need to manage the degree of multiprogramming

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

Short term scheduling

A
Known as the dispatcher
Executes most frequently
Invoked when an event occurs
-Clock interrupts
-I/O interrupts
-OS calls
-Signals
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Aim of short term scheduling

A

To allocate processor time to optimise certain aspects of system behaviour.
A set of criteria is needed to evaluate the scheduling policy.

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

Short term scheduling criteria USER V SYSTEM

A

User oriented
-Response time
–Elapsed time between request submission until there is an output
System Oriented
-Effective and efficient utilisation of the processor

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

Short term scheduling criteria PERFORMANCE

A
Performance related
- Quantitive, easily measured
-EG Response time & throughput
Non performance related
-Qualitative
-Hard to measure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

FORMULAS

A

Turn around time = Finish Time - Arrival Time
Waiting Time = Start Time - Arrival Time
Throughput = Processes Number / Total Time

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

Priorities

A

Scheduler will always choose a process of higher priority over one of lower priority
Have multiple ready queues to represent each level of priority

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

Starvation

A

Problem
-Lower priority may suffer starvation if there is a steady supply of high priority processes
Solution
-Allow a process to change its priority based on its age or execution history

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

Selection Function

A

Determines which process is selected for execution
If based on execution characteristics then important quantities are
-W = time spent in system so far, Waiting
-E = time spent in Execution so far
-S = total Service time required by the process, including E

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

Decision Mode

A

Specifies the instants in time at which the selection function is exercised
Two categories
-Non-Preemptive
-Preemptive

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

Nonpreemptive vs Preemptive

A

Nonpreemptive
-Once a process is in the running state, it will continue until it terminates or blocks itself for I/O
Preemptive
-Currently running process may be interrupted and moved to ready state by the OS
-Preemption may occur when new process arrives, on an interrupt, or periodically

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

First come first served FCFS

A

Each process joins the ready queue
When the current process ceases to execute, the longest process in the ready queue is selected
A short process may have to wait a very long time before it can execute
Favors CPU-Bound processes
-I/O processes have to wait until CPU bound process completes

17
Q

Round Robin RR

A

Uses preemption based on a clock
-Also known as time slicing, because each process is given a slice of time before being preempted
Clock interrupt is generated at periodic intervals
When an interrupt occurs, the currently running process is placed in the ready queue
-Next ready job is selected

18
Q

Shortest Process Next SPS

A

Nonpreemptive
Process with shortest expected processing time selected next
Short process jumps ahead of longer processes
Predictability of longer processes is reduced
If estimated time for process not correct, the OS may abort it
Possibility of starvation for longer processes

19
Q

Shortest Remaining Time SRT

A

Preemptive version of shortest process next policy

Must estimate processing time and choose the shortest

20
Q

Highest response ratio next HRRN

A

Choose next process with the greatest ratio

Ratio = time spent waiting + expected service time / expected service time

21
Q

Scheduling Algorithms 1

A

The performance of a system as perceived by the user depends on many factors, including user expectations
Two common measures are
-Mean turnaround time: average time in the system
-Mean waiting time: average time spent in ready or blocked state

22
Q

Scheduling Algorithms 2

A

Consider a system with 3 processes in the READY state

  • The scheduler is about to select one of these to become the RUNNING PROCESS
  • Each process is expected to use different CPU times
    • A = 6 units
    • B = 4 units
    • C = 2 units
  • The following slides show the behaviour of the system with different algorithms
23
Q

FCFS

A

The processes are placed in the READY queue where the first process becomes the RUNNING process
No priority, so
-Short, important processes may have to wait for long and unimportant processes to finish

24
Q

SJF Shortest Job First

A

Processes taken from the queue in order of their estimated CPU burst time
The shortest process becomes the running process (C-B-A here)
Priority is given to short tasks
CPU burst times are difficult to estimate
Results may not be as predictable in practice as they are in theory

25
Q

Round Robin 1 RR

A

RR scheduling uses QUANTUM as a period of time
Processes are taken from the queue in some order
The process is allowed to run for a max time (quantum)
If the task does not finish in this time, it is returned to queue
Good for multi-user interactive systems
Length of quantum chosen affects performance