ECM 1413 Processes Flashcards
- A program:
- is a set of instructions for performing a specific task (passive)
- is stored on disk
- A process:
- An instance of a program in execution (active)
- requires CPU resources, memory and I/O
- Multiple process instances of one program
Why do we use processes?
Modularity
Simplifies OS development
Speedup through parallelism
Subdivision of tasks so they can be ran in parallel
Security and stability through isolation
nodes of the process lifecycle
born
ready
waiting
running
died
Born/new
process created but not admitted
Ready
process in main memory, ready to execute
Running
The process has been allocated to a cpu pool and is currently running
The processor might the running of a process on the grounds of an interrupt or timeout and it is back to the ready state
What is a Pressure Control Block (PCB)
Data structure that stores information, details, metadata, about a block. It is important in context switching
Usually every process has parent (except the first). As such, each process stores the ID of the parent process
PCB is the Kernel’s representation of the process
Context Switching. Context:
the current state of the process (the files it has access to, the condition of the variables in the process)
- A context switch is pure overhead - Time required varies with factors like the number of registers that must be copied
To stop running process 1 and start process 2:
1) Change the state of process 1 from running to ready
2) Save the context of process (since it’s back in ready, we will need to use it later again)
3) Load the context of process 2
4) Change the process scheduling state of process 2
This whole process is referred to as a context switch or process switch
Overhead:
any combination of excess or indirect computation time, memory, bandwidth, or other resources that are required to perform a specific task.
With too few context switching:
- There will be the starvation of some processes. No fairness between the processes as some will have to wait too long
With too many context switching:
- Takes too many resources and causes slowdown on overhead
Layout of process in memory
Stack
Heap
data
Text
Text
The actual executable code; fixed-size and read-only