Operating Systems Scheduling (PPT 3) Flashcards

1
Q

What is scheduling?

A

It is the process of deciding when a process gets CPU time and how long does it have it for.

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

What are the three types of scheduling?

A

Long term
-When a process is added to the pool of processes waiting to be executed

Medium Term
-When a process is moved into main memory

Short Term

  • When a process is moved from Ready to Running
  • When a process is taken of the CPU, e.g. Running to blocked or Ready
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is user-oriented criteria?

A

When a good user experience is put at the forefront of scheduling decisions

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

What is system-oriented criteria?

A

When the efficiency and utilisation of the machine is at the forefront of scheduling decisions, rather than the user.

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

What is important to accommodate for in user-oriented criteria?

A
  • Low response times meaning things happen immediately

- Event deadlines are met so things happen at the right time.

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

What does the scheduling algorithm have an influence over?

A
  • Priority of processes
  • Order in which processes are executed
  • How much CPU time is given to each process
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What should a scheduling mechanism generally do?

A
  • Favour short jobs
  • Favour I/O bound jobs to get good I/O device utilisation and better interactive performance
  • Determine the nature of a job and schedule accordingly
  • Be cheap (efficient) to implement
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Name four types of scheduling algorithm

A
  • First Come First Serve
  • Round Robin
  • Shortest Job First
  • Shorts Remaining Time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does First Come First Serve work?

A

When the current process finishes, the process at the head of the ready queue is selected next. It is then allowed to run to completion. Any process becoming ready joins the ready queue

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

What are some characteristics of First Come First Serve?

A
  • Simple to implement
  • Favours long processes over short ones because a Running process is allowed to stay running until it completes and Exits
  • Favours CPU-bounded processes, i.e. ones that are limited by the power of the computer
  • FCFS is a non-pre-emptive algorithm
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is CPU-Bounded?

A

It is when a process is limited by the CPU processing power.

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

What is I/O Bounded?

A

It is when a process is limited by external events (I/O), such as waiting for a keystroke.

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

How does Round Robin work?

A

Processes are dispatched by FIFO but are given a fixed time on the CPU. A timer interrupt is used to provide the time slice. It may require many visits to the CPU to complete a task but time is shared equally

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

What is Time Slicing?

A

This is when the OS sets an interrupting clock to generate an interrupt at some point in the future. This interrupt is the processes’ quantum (time slot or time slice)

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

What are benefits of Time Slicing?

A
  • It allows the OS to regain control of the processor and then pre-empt any process
  • Provides reasonable response times and prevents the system being held up by processes in an infinite loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What are some characteristics of Round Robin?

A
  • Effective in time-sharing environments
  • Penalises I/O bound processes because they often block quickly. Means they make less use of their time slice that CPU bound processes.
  • Is a pre-emptive algorithm
17
Q

What does pre-emption mean?

A

This is “butting-in” or interrupting the execution of the program code. If the OS is able to stop the process executing and take the CPU away, then this is pre-emption. A scheduling algorithm is pre-emptive if the OS can take the CPU away from a process

18
Q

How is pre-emption useful?

A

It helps in a situation where there is a high number of high priority processes. It can prevent one process from starving other processes by pre-empting it and returning it to its ready state

19
Q

How does Shortest Job First work?

A

This is when the process with the shortest expected execution time is dispatched to the processor next.

20
Q

What are some characteristics of Shortest Job First?

A
  • Non-Pre-emptive
  • Reduces average waiting time compared to FCFS
  • Must know in advance how long process will take
  • Possible user abuse (e.g. underestimating the run time)
  • Long processes may get starved by short ones
21
Q

How does Shortest Remaining Time work?

A

Process with the shortest estimated run time to completion is run next. Can be pre-empted by another process if it is estimated to run faster

22
Q

What are some characteristics of Shortest Remaining Time?

A
  • Still requires estimates on the future run time
  • Higher overhead than SJF
  • No additional interrupts generated as in RR
  • Elapsed service time must be recorded
23
Q

The following processes (Pn) exist at time 0, each with a total run-time requirement of T units:
P0 (T=7), P1 (T=13), P2 (T=5), P3 (T=3), P4 (T=2)
Draw a Gantt chart that illustrates when each process runs when using the following types of scheduling: (i) SJF(SPN); (ii) RR.

A

Example Gantt chart

         Process				      Waiting time
	P0:*******					         0
	P1:          *************			         7
	P2:                            *****			20
	P3:                                   ***		25
	P4:                                       **		28
	Time:        7                   20     25  28 30
Average waiting time = (0+7+20+25+28)/5 = 16
24
Q

What are the three different types of priority a process can have?

A

-High priority
I/O, User interface and urgent or important processes

-Medium priority
Disk access for periodic saving or less urgent or important that UI processes

-Low priority
Background processes or processes that run slowly and do not affect UI

25
Q

What possible priority policies can a scheduling algorithm have?

A

It can decide which queue to access next by one of three ways:

  • Empty High queue, then empty Medium and finally Low
  • Take 3 processes from High, 2 from Medium and 1 from Low
  • Take 10 from High, 4 from Medium and 2 from Low
26
Q

What is a benefit of having multiple Ready queues?

A

Having more than one queue relating to priority means that once a process has been pre-empted and is returning to the ready state, it can change its priority to a new one if it needs to

27
Q

How does the Microsoft Windows Thread Dispatching Priorities System work?

A

It has 32 Ready queues : 16 Real time and 16 variable. Threads cannot move between real time and variable classes. Threads can migrate up and down the variable priority queues but not the real time ones. Pre-emption works by making threads with real time precedence have priority over others. If a thread becomes ready with a higher priority than the one running, it is pre-empted

28
Q

How does the MS priority relationships work?

A

Processes have a base priority level. A thread starts off with the base priority plus or minus 2. Threads can migrate up and down the Dynamic Priority but cannot go lower than the base priority. Threads can be boosted and fall in many ways:

  • If a thread blocks due to I/O it is boosted
  • If interactive, it is boosted
  • If CPU bounded, it falls
29
Q

How has MS thread scheduling been designed?

A

It has been designed to help Interactive threads the most, I/O threads next and CPU bounded threads the least