A running instance of a program is known as a process. Depending on their current activity, processes can be in different states and are executed within the system's main memory ( for example, RAM).
There are five states that a process may be in, namely:
New: When a process is created for performing a particular task, it is in a New state.
Running: When the instructions of a process are being executed, the process is Running.
Waiting: When a process is waiting for an event to occur, such as receiving a data packet, waiting for the user's input, or writing to secondary memory, the process is Waiting.
Ready: When a process has been successfully created but hasn't yet been assigned a processor to begin/resume its execution, it is in the Ready state.
Terminated: When a process has finished its execution, it is in the Terminated state.
The diagram below illustrates how the process above states interacts during a process's evolution from its creation to its termination.
Note: The numbers in the diagram do not denote the sequence of states, rather, they are just used to label the arrows.
The following list corresponds to the arrows in the diagram above:
New
Ready
Running
Running
Waiting
Running
Free Resources