Chp 2 Process/Threads Flashcards
(80 cards)
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