Midterm Flashcards
What is the kernel
The core of the OS. The one program running at all times on the computer
Process
A program in execution; instance of a program being executed by OS
3 components of a process
- (code)Executable program
- (data) Associated data needed by the program
- (context) The execution context of the process which contains all information the OS needs to manage the process (ID, state, CPU registers, stack)
What is and where is PCB?
Process Control Block is included in the context, along with the stack
It is snapshot that contains all necessary and sufficient data to restart a process where it left off (ID, state, CPU registers)
- concrete representation of a process
Where in OS is PCB?
It is one entry in the OS’s process table (array of linked list)
What is in user address space of process?
Program code
Data
What is in context of process
PCB
Stack
What are 3 main components of PCB?
Identification
CPU State info (registers, PC, stack pointer)
Control info (Schedule and state info, links to other processes, memory limits, open files)
5 states of process and what they mean
New: process is being created
Ready: The process is waiting to be assigned to a processor
Running: Instructions are being executed
Waiting: The process is waiting for some event to occur
Terminated: The process has finished execution
New to ready process
admitted
Ready to running process
scheduler dispatch
Running to ready process
Interrupt
Running to waiting process
I/O or event wait
Waiting to Ready process
I/O or event completion
Running to terminated process
exit
What is batch system?
A computer system that processes jobs in groups, or batches, without direct user interaction
4 ways a process can be created
System boot
User requests to run application
Existing process spawns a child process
Batch system takes next job in line
3 ways process is terminated
Regular completion, with or without error code
Fatal error (uncatchable of uncaught)
Killed by another process via the kernel
Return value of fork to parent and child
positive value to parent
0 to child
what does execvp do
replace the existing program
Fork example 1
process 13
2 events that lead to process pause/dispatch
- I/O Wait - OS triggered
- Preemptive timeout - hardware interrupt triggered
What 5 things happen when a current process calls create()
- PCB is allocated and initialized
- The parent field of the new process will be set to self (running process)
- new process P is added to the children list of the currently running process
- The new process P is put in ready list
- The scheduler may choose to dispatch to new process or continue the parent
What is and happens during a process context switch
When cpu switches to another process, the system must save the state of the old process and load the saved state for the new process
Is context switching useful work?
No