Process Models
202310091231
Status: #idea
Tags: OS
Process Models
2-State Process Model
Short-term scheduler is the most frequently
3-State Model - Blocked state
- Contains 2 queues:
- Ready queue
- Event queues (One for each event)
4-State Model - New state
- New job submission
- Creates PCB and other data structures
- Then, OS tries to load the process (if resources are available)
Once a process is admitted, there is no going back.
If PID exhaustion occurs, attempting to create a process will fail
5-State Model - Terminated state
- Add a terminated state
- Collects terminated data.
- Used for book-keeping purposes - Can be used to profile the process
If it is an unsuccessful termination, the process can reach the terminated state from any previous state.
If it is from Running->Terminated, it may or may not be an abrupt termination
Suspending(swapping) a blocked job can lead to a dangling pointer.
Because its memory will get cleared.
OS needs to be smart enough to redirect this.
6-State Model - Swap from blocked state
Suspend (mid-term scheduler) is reducing multi-programming in favour of increasing CPU utilisation
Long term scheduler: Increases multi-programming
Mid-term scheduler: Swaps processes. Multi-programming
Short-term scheduler: No effect on multi-programming
Unswapping has higher priority than admiting new processes to the ready queue
7-State Model - 2 swap states
Data of an IO call is first placed in a kernel-space buffer. It is then copied into a buffer in user space (if needed).
If the process is suspended, then the copy is postponed.
Memory mapped IO does not involve a kernel buffer.
9-State Model - UNIX model
If the user process which made the syscall is highest priority:
Return to user running
Else:
Preempt the current process.
Pick the highest priority process and context switch
In UNIX model, a swapped, blocked process can NOT be unswapped.