Chp 2 Process/Threads Flashcards
How does the OS keep track of each process?
Process Control Block
Process
Program in execution
Instance of a program being executed by an OS
What is the concrete representation of a process?
PCB
Who creates the PCB for a process?
OS
Process Ready-> Running caused by
OS
Process Running -> blocked caused by
process
Process Running -> Ready caused by
OS
Process Blocked -> Ready caused by
Another process releasing the resources it was waiting for
How many processes is the cpu running at a time
1
Context switch
The transfer of control from one process to another
CPU state
Consists of all intermediate values held in any CPU registers and hardware flags at the time of interruption
3 parts of a process image
Executable program
Associated data needed by the program
Execution context
What is in execution context
ID, state, cpu registers, stack, etc.
What is PCB
A snapshot that contains all necessary and sufficient data to restart a process where it left off
Where (broad) is the PCB?
In the context
Where is the PCB?
One entry in the OSs process table (array or linked list)
What are two parts of process (broad)
User address space, context
What does user address space contain?
Program, dataW
What does context contain
Stack, PCB
4 ways a process can be created
System Boots
User requests to run an application
An existing process spawns a child process
A batch system takes on the next job in line
3 ways a process can be terminated
Regular completion
Fatal Error
Killed by another process via the kernel
2 events that lead to process pause/dispatch
I/O Wait - OS triggered
Preemptive timeout - Hardware Interrupt triggered
When the CPU switches to another process (context switch) what two things must it do?
The system must save the state of the old process
The system must load the saved state for the new process
Does the system do useful work during context switching
no
What events trigger the OS to switch processes?
Interrupts: External, Asynchronous
Executions (traps): Internal, synchronous (but involuntary)
System calls (traps): Voluntary synchronous events after calling a specific OS service
Long term scheduler
Decides to add a program to the pool of processes to be executed (job scheduling)
Medium term scheduler
The decision to add to the number of processes that are partially or fully in main memory (swapping)
Short term scheduling
CPU scheduling, decides as to which available processes in memory are to be executed by the processor
Which scheduler controls the degree of multiprogamming
Long term scheduler
I/O bound process
spends more time in I/O than computations, many short CPU bursts
CPU-bound process
Spends more time doing computations, few very long CPU bursts
Which scheduler removes processes from memory “temporarily” to reduce degree of multiprogramming?
Medium term scheduler