Week 1 - processes , sheduling and threads Flashcards

(13 cards)

1
Q

multitasking

A

Cpu switches between processes frequently and rapidly creating the illustion of processes being executed at same time

whether that actually happens depends on no of cores

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

creating process / loading program into memory

A

loading program into memory or creating a process:
we copy the static file ( binary) with text segments , data segments … into the process’ virtual adress space. We also allocate memory for the heap and the stack which grow towards each other. Heap grows in size when objects created when program runs and stack grows in size when local variables declared and function calls occur

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

process

A

instance of a program executed by the cpu

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

read

A

usually processes are allocated different memory but if processes are instances of the same program in theory you could share the data and text ( the binary file) but the stack and heap cannot be shared as they depend on what objects created and what functions called at runtime which can be different

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

what is context switching

A

when cpu switches between process:
process state is saved ( relevant info stored in the pcb) and we switch to another process whose state we have have to reload ( using values in pcb). time spent context switching is time the cpu is doing non productive work - not executing a process and so we seek to minimise as much as possible

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

what is premptive scheduling

A

Os interrupts a running process to allow another process to run

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

what is non premptive scheduling

A

we only switch processes when a process terminates or enters a waiting state

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

what is waiting time

A

time a process spends in the ready queue

Average waiting time is the average of all the waiting times of processes

WE WANT TO MINIMISE AWT (average wai..)

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

First come first serve scheduling

A

NON PREEMPTIVE
selects the process thats been in the queue the longest

the average waiting time impacted by the order of arrival of processes

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

SJF- Shortest job first

A

so essentially SJF (shortest job first algorithm)
gives priority to processes according to those that have the shortest burst time (time to execute)

minimises AWT compared to FCFS as FCFS only achieves this mimimum if processes come in that eact order

non - premptive : once a process is selected according to shortest burst time runs on cpu untll it terminates or enters waiting state

premptive - if a process is running but a process with a shorter burster ( shorter than remaining burst time of process arives) then we interrupt running process and switch to the process with shorter burst

issue with SJF is that it can lead to starvation as you can constantly have processes with shorter burst times arriving and so longer processes will be starved

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

priority scheduling

A

prioriorty :
priority not determined by burst time only but other factors ie age

can be non preemptive - even if process arrives with higher priority must wait for current process to terminate or enter a waiting state

can be premptive - if process arrives with higher priority it will interrupt the current process and we switch to higher priority one

different priority assignment to processes change the average waiting time

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

round robin scheduling

A

round robin scheduling:
uses a fifo CIRCULAR queue
we use time quantums - a maximum period of time a process executes on cpu before interrupt and forced to switch

if process finishes executing before time quantum finishes or enters a waiting state it releases cpu and next process scheduled

if maximum time quantum finishes and process isnt done then we prempt and place the process at the back of the queue unless theres no other process

waiting time is the time spent not executing

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

multi level queue scheduling

A

so multi level priority queues:

we have different levels of queues that can each have a different scheduling algorithm and we place different classes of processes in different queues

processes cant move between queues and top level is highest priority and bottom level is lowest priority

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