Getting to Run: Process States
Every process exists in 1 of 5 states at any given time: (Some OS have more states besides these 5.)
- New: After a user issued a command to run a program, the data of the program, including the binary code, is being copied to memory to create the process.
- Ready: All the data needed for the process to run is ready, so the process is in the line to start executing on a CPU.
- Running: The operating system assigned a CPU to the process, so the process's instructions are fetched by the CPU and get executed. Only one process can run on one CPU at any given moment.
- Waiting: The process might have issued an I/O request so it paused its execution until the I/O is done, or it is waiting for some event (e.g., until a process that it created is terminated.) At this stage, the process is removed from the CPU on which it was running until it continues running again, but the process's data is still in memory.
- Terminated: The process is on the way to being removed from memory, either since all its instructions were successfully executed, or some critical error that occurred prevents it from continuing running.