Five-State Process Model
Exit: where you can keep your zombie processes
If your processor doesn’t have preemption, then if an infinite loop happens it will still be in Running state.
Refine the not-running state:
- Running: the process currently executed
- Ready: a process that can be executed
- Blocked/Waiting: a process that cannot execute, because it waits for something, such as the completion of an I/O operation
- New: a new process to enter the system, created but has not yet been admitted to the pool of executable processes by the OS. Typically, a new process has not yet been loaded into main memory, although its Process Control Block has been created. In disk storage.
- Exit: a halted or aborted process (like for Zombie Process)
What is a Preemption?
- There are several other alternative causes for this transition (Running → Ready), which are not implemented in all operating systems. Of particular importance is the case in which the OS assigns different levels of priority to different processes. Suppose, for example, that process A is running at a given priority level, and process B, at a higher priority level, is blocked. If the OS learns that the event upon which process B has been waiting has occurred, moving B to a ready state, then it can interrupt process A and dispatch process B. We say that the OS has preempted process A.
The stages in depth
The New and Exit states are useful constructs for process management. The New state corresponds to a process that has just been defined. For example, if a new user attempts to log on to a time-sharing system or a new batch job is submitted for execution, the OS can define a new process in two stages. First, the OS performs the necessary. An identifier is associated with the process. Any tables that will be needed to manage the process are allocated and built. At this point, the process is in the New state. This means that the OS has performed the necessary actions to create the process but has not committed itself to the execution of the process. For example, the OS may limit the number of processes that may be in the system for reasons of performance or main memory limitation. While a process is in the new state, information concerning the process that is needed by the OS is maintained in control tables in main memory. However, the process itself is not in main memory. That is, the code of the program to be executed is not in main memory, and no space has been allocated for the data associated with that program. While the process is in the New state, the program remains in secondary storage, typically disk storage.
Process is terminated when it reaches a natural completion, when it aborts due to an unrecoverable error, or when another process with the appropriate authority causes the process to abort. Termination moves the process to the exit state. No longer eligible for execution! Tables and other info are temporarily preserved by the OS (time to access needed info if needed).
- Null → New
- New → Ready
- Ready → Running: Time to select a process to run, the OS chooses one of the processes in the Ready state. Job of the Scheduler (OS) or Dispatcher.
- Running → Exit
- Running → Ready: The most common reason for this transition is that the running process has reached the maximum allowable time for uninterrupted execution (in Multiprogramming). Also different levels of priority
- Running → Blocked: - A process is put in the Blocked state if it requests some- thing for which it must wait. A request to the OS is usually in the form of a system service call; that is, a call from the running program to a procedure that is part of the operating system code.
- Blocked → Ready
- Ready → Exit
- Blocked → Exit