Process Models

202310091231
Status: #idea
Tags: OS

Process Models

2-State Process Model

Entry
Dispatcher
(Short-term scheduler)
Exit
Not Running
Running

Info

Short-term scheduler is the most frequently

3-State Model - Blocked state

4-State Model - New state

Warning

If PID exhaustion occurs, attempting to create a process will fail

5-State Model - Terminated state

Attention

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

Warning

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

Admit
Dispatch
Timeout
Release
Event wait
Event completion
Suspend
Activate
(Mid-term scheduler)
New
Ready
Running
Exit
Blocked
Suspend

Info

Suspend (mid-term scheduler) is reducing multi-programming in favour of increasing CPU utilisation

Caution

Long term scheduler: Increases multi-programming
Mid-term scheduler: Swaps processes. Multi-programming CPU utilisation
Short-term scheduler: No effect on multi-programming

7-State Model - 2 swap states

Admit
Admit
(Low resources)
Activate
Suspend
Event over
Activate
Suspend
Event over
Dispatch
Timeout
Event wait
Release
Suspend
(Just timed-out)
New
Ready
Ready-suspend
Blocked-suspend
Blocked
Exit
Running

Warning

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.

Info

Memory mapped IO does not involve a kernel buffer.

9-State Model - UNIX model

fork
Enough
resources
Low
resource
Swap out
Swap in
wakeup
Swap out
wakeup
Reschedule
process
preempt
return
syscall / interrupt
exit
sleep
Created
Ready
(Memory)
Ready
(Swapped)
Blocked
(Memory)
Sleep
(Swapped)
Kernel running
User running
Preempted
Zombie

Note

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

Caution

In UNIX model, a swapped, blocked process can NOT be unswapped.


References