Date: September 1, 2024
Topic: Process Lifecycle States
Recall
Lifecycle States include:
- New
- Ready
- Running
- Waiting
- Terminated
In the Running state, it is possible to go back to:
- Ready (interrupt)
- Waiting (I/O or event wait)
- Terminated (process conclusion)
Notes
Process Lifecycle States

Process lifecycle states. Possible states are shown in the nodes
Starting a Process
- When a process is created, it enters a new state
- OS performs admission control and if determined to be OK, the OS will allocate and initiate a PCB and initial resources
- This is provided that there are some minimum available resources
Ready and Running
- The process is then in a ready state, where the scheduler dispatch schedules it on the CPU
- When a process is running, it can be interrupted and context switched to idle (ready state)
- A scheduler dispatch can execute the process again on the CPU, moving to a running state
Running State Branches
Interrupt:
- A running process can be interrupted such that a context switch is performed, going back to the ready state
I/O or Event Wait:
- A running process may need to initiate a longer operation like reading from a disk / waiting for a timer / input from a keyboard etc.
- The process then enters a waiting state until the timer or event completes, moving back to the ready state
Termination:
- When the process finishes or encounters some error, it returns the appropriate exit code (either SUCCESS or ERROR)
<aside>
💡
CPU is able to execute processes in either a running or ready state
</aside>
Processes can spawn child processes
Child processes can be created either by:
- fork: child continues from same point
- exec: child starts from first instruction
Process Creation

All processes come from a single root
In OS, a process can create child processes
- Some processes are privileged (root) processes
- When the initial boot process is done and the OS is loaded on the machine , it creates some initial processes
- When a user logs in, a user shell process is created
- When a user types in commands like
ls or emcas, new processes are spawned from shell parent process
Mechanisms for Process Creation
Fork - child continues from same point
- Copies the parent PCB into the new child PCB
- When the fork is complete, both processes (parent and child) continue at the exact same point
Exec - child starts from first instruction
- Replace child image, loading a new program and starts from the first instruction
- A fork is initially called, then the child image is replaced
Parent Processes
For UNIX-based OS, the parent of all processes is init
For Android OS, the parent of all processes is zygote
<aside>
📌 SUMMARY: Processes can have the following lifecycle states: new; ready, running, waiting; terminated. Processes are created from another processes either through fork or exec
</aside>
Date: September 1, 2024
Topic: Process Scheduling
<aside>
📌 SUMMARY: The CPU scheduler determines which process from a ready queue should run next. This operation should be minimized so that the actual process running time $T_p$ is maximized. Process scheduling is done in a few ways; I/O request, expiring time slice, forking a child and waiting for an interrupt.
</aside>