Process Scheduling (Week 6) Flashcards

1
Q

what is scheduling

A

The task of managing CPU sharing among a pool of ready processes/threads and is possible only with context switching facility.

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

what is a scheduler

A

The scheduler chooses one of the ready threads to allocate to the CPU when it is available.

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

what is a scheduling policy

A

The scheduling policy determines when it is time for a thread to be removed from the CPU and allocated to another thread.

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

what is a scheduling mechanism?

A

The scheduling mechanism determines how the process manager can determine it is time to interrupt the CPU, and how a thread can be allocated to and removed from the CPU.

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

how many logical parts is the scheduling mechanism composed of ?

A

3 logical parts

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

what are the 3 logical parts

A

enqueuer, dispatcher, and context switcher

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

what is the enqueuer

A

–> When a process/thread is changed into the ready state, the enqueuer enqueues the corresponding descriptor into a list of processes that are waiting for the CPU (or the ready list).

–> The enqueuer may place the new process anywhere in the list, depending on the scheduling policy.

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

what is the dispatcher

A

–> The dispatcher is invoked after the current process is removed from the CPU.

–> The dispatcher removes one of the threads from the ready list and then allocates it to the CPU by loading its CPU registers in the thread’s descriptor into the CPU.

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

what is the context switcher?

A

–> When the scheduler switches the CPU from executing one process to another, the context switcher saves the contents of all CPU registers (PC, IR, condition status, processor status, and ALU status) for the thread being removed into its descriptor.

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

_______ and ________ can have a
dramatic effect on the performance of a multiprogrammed computer.

A

Scheduler and its scheduling policy

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

how is the time take to finish a process by the processor determined

A

dependent on how often it gets to execute on the CPU as dispatched by the scheduler

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

what is the aim of the scheduler

A

–> decrease average time taken by a process to execute on the computer

–> increase the throughput of a computer in terms of the number of processes that get executed per unit time

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

what can a policy control

A

–> CPU utilization (busy and not kept idle)
–> Avg time a process waits for a service (reduce the time)
–> avg amount of time to complete a job (reduce the time)

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

what is the wait time W(pi)

A

W(pi) = Total time Pi spent waiting in the ready list (wait time)

Waiting time is defined as the total time which a process spends waiting for the CPU in the ready list.

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

what is the turnaround time [T trnd(pi)]

A

Let T trnd(pi) = Time from pi first enter ready to last exit ready (turnaround time)

Turnaround time is the time from the arrival of the process to its completion by the CPU. This includes the time it spent waiting for the CPU

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

what are the 2 types of schedulers

A

preemptive
non-preemptive

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

what are non - preemptive schedulers

A

when a process gets the CPU it will not be interrupted or cut short (pre-empted). It will have the oppourtunity to fully complete before the CPU is given to the next process.

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

types of non preemptive schedulers

A

First-Come-First-Served (FCFS)
Shortest Job First (SJF) (Non preemptive)
Priority (PR) (Non preemptive)

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

what are preemptive schedulers

A

the process take turns to share the CPU and they can be interrupted midway and the CPU can be allocated to another process before the process can finish

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

what are the types of Preemptive (involuntary) Schedulers

A

Shortest Job First (SJF) (Preemptive)
Priority (PR) (Preemptive)
Round Robin (RR)
Multi-level Queues

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

what is the first come first serve scheduling algorithm

A

Scheduler picks up first job to arrive in the
ready list.

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

advantage of first come first serve scheduling algorithm

A

Simplest CPU scheduling algorithm

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

disadvantage of first come first serve scheduling algorithm

A

Convoy effect: short process behind long process and waiting for the long process to finished. This results in lower CPU and devices utilization.

23
Q

how does the first come first serve scheduling algorithm work

A

–> The process to request first will be allocated the CPU first

–> It is non-preemptive

–> Using a FCFS queue, PCB of new process will be linked to the tail of the queue

–> When CPU is free, process at the head of the FCFS queue will be allocated the CPU

24
Q

what is Shortest Job First (SJF) (Nonpreemptive)

A

Scheduler picks up shortest job to arrive in
the ready list.

Once CPU is allocated to a process it cannot
be preempted until it completes its service time.

25
Q

what is the concept behind Shortest Job First (SJF)

A

–> Each process is associated with the length of its service time.

–> When the CPU is available, it is assigned to the process that has the smallest (remaining) service time.

26
Q

what is Shortest Job First (SJF) (preemptive)

A

A current process is preempted if a new process arrives with service time length lesser than the current process’s remaining service time.

27
Q

Shortest-Job-First (SJF) is also called __________

A

Shortest-Remaining-Time - First (SRTF)

28
Q

why is Shortest-Job-First (SJF) optimal

A

it gives minimum average waiting time for
a given set of processes.

29
Q

what is Priority Scheduling

A

Scheduler picks up the job with the highest priority in the ready list.

30
Q

how does priority scheduling work ?

A

A priority number (integer) is associated with each process.

The CPU is allocated to the process with the highest priority.

Equal- priority processes are scheduled in FCFS order.

31
Q

what is the problem with priority scheduling

A

the problem is Starvation where Low priority processes may never be executed.

32
Q

what is the solution for the problem with priority scheduling

A

the Solution is Aging

Increase the priority of the process as time
progresses.

33
Q

what is round robin

A

Scheduler gives a short time-slice to each job

34
Q

explain how does round robin work

A

–> Each process gets a small unit of CPU time (time quantum), usually 10-100 milliseconds.

–> After this time has elapsed, the process is preempted and added to the end of the ready queue.

–> New processes are added to the tail of the ready queue, which is a FCFS circular queue.

35
Q

advantage of round robin

A

Fast response time. It is good for time sharing system.

36
Q

what happens if service time is less than or equal to 1 time quantum

A

If service time is < 1 time quantum, process release CPU voluntarily.

37
Q

what happens if service time is more than 1 time quantum

A

If service time > 1 time quantum, context switch will be executed.

38
Q

explain what does performance in round robin depend on

A

It depends on size of time quantum:

–> large quantum (q). This is equivalent to FIFO

–> small quantum (q). It must be large with respect to the context switch, otherwise overhead is too high

39
Q

what is multilevel queue

A

Implement multiple queues
(eg. Process all foreground processes before background processses, or 80% timeslice to foreground processes, 20% to background processes).

40
Q

how do multilevel queues work

A

–> Processes are classified into groups based on some property of the process.

–> Ready queue is partitioned into separate
queues such as foreground (interactive),
background (batch).

–> The processes are permanently assigned to one queue.

–> Each queue has its own scheduling algorithm.
–> RR for foreground queue
–> FCFS for background.

41
Q

To study policy performance, we need to consider _________

A

simplified model

42
Q

what are we provided with to study policy performance

A

A schedule of processes

arrival time

CPU service time

43
Q

what must we produce to study policy performance

A

Gantt chart

Average waiting and turnaround time

44
Q

what is gantt chart

A

A Gantt chart is a ‘chart’ showing the actual
execution of a series of processes by the CPU.

It shows the start and end of execution of each process.

It does not show the arrival time of each process.

45
Q

what is the assumption for the shortest job first when calculating waiting and turnaround time

A

all the jobs arrive at the same time

46
Q

what does modern OS include in their schedulers

A

–> involuntary CPU sharing – timer interrupts

–> priority based process selection

47
Q

what happens in unix scheduling

A

–> Involuntary CPU Sharing
–> Preemptive algorithms
–> 32 Multi-Level Queues

48
Q

what happens in windows scheduling

A

–> Involuntary CPU Sharing across threads
–> Preemptive algorithms
–> 32 Multi-Level Queues

49
Q

in unix scheduling queues 0 - 7are reserved for ___________

A

system functions

50
Q

in unix scheduling queues 8 - 31 are reserved for ___________

A

space functions

51
Q

what is nice

A

influences queue level

52
Q

in windows scheduling Highest 16 levels are ________

A

real time

53
Q

in windows scheduling Next lower 15 are for _________

A

system/user threads

54
Q

in windows scheduling lowest level is for ______-

A

idle thread