Process State Models: Student - Feedback@sti - Edu
Process State Models: Student - Feedback@sti - Edu
Process State Models: Student - Feedback@sti - Edu
There are two (2) essential elements of a process, the program code – which Two-State Process Model (Stallings, 2018)
can be shared with other processes that are executing the same program, and An operating system controls the course of execution that involves the process
the set of data associated with the program code. Note that a computer's of determining an interleaving pattern for execution and allocating resources
kernel can execute multiple processes at a time, thus supporting thousands of to processes. In a two-state process model, a process can either be in a
processes on a single system (Gregg, 2021). At any given point in time, while running state or in a not running state.
a program is executing, the process itself can be uniquely characterized by the • Not running state – When the OS creates a new process, it creates a
following elements: process control block for the new process and adds the new process into
• Identifier – It is a unique identifier for each process. the not running state of the system. Then, the process waits for an
• Process State – It indicates the current activity of a process. A process opportunity to execute.
state can be any of the following (Silberschatz, Galvin & Gagne, 2018) • Running state – The dispatch portion of the OS selects a particular
o New – The process is being created. process to run. Then, it enters the running state. Intermittently, the
o Ready – The process is waiting to be assigned to a processor. currently running process will be interrupted and the dispatch portion has
o Running – The instructions are being executed. to select other processes to run. Subsequently, the interrupted process
o Waiting – The process is waiting for a particular event to occur. returns to the queue in the not running state, while a completed process
o Terminated – The process has finished the execution. exits the system.
• Priority – It refers to the priority level relative to other processes.
• Program counter – It indicates the address of the next instruction to be
executed for a particular process.
• Memory pointer – It contains pointers to program codes and data
associated with the process, including any memory blocks shared with
other processes.
• Context data – These are the data present in a processor's registers
during process execution.
Figure 1. The state transition in a two-state process model.
Source: Operating Systems: Internal and Design Principles (9th ed.), 2018 p. 136
However, some processes in the not running state are ready to execute but Null → New Running → Exit Blocked → Ready
are blocked, waiting for an I/O operation to complete. The dispatcher could not New → Ready Running → Ready Ready → Exit
just select any process since there is only one (1) queue. Rather, the Ready → Running Running → Blocked Blocked → Exit
dispatcher would have to scan the queue looking for the process that is not
blocked and that has been in the queue the longest. This makes the Suspended Processes (Stallings, 2018)
implementation of the two-state process model inadequate. The three (3) principal states which are Ready, Running, and Blocked, provide
a systematic way of modeling the behavior of a process and guide the
Five-State Process Model (Stallings, 2018) implementation of an operating system. Some OS are constructed using only
This model naturally handles processes through the implementation of five these three (3) states. However, there are good justifications for adding other
unique states which are the following: states to a model.
• New state: A process that has just been created and has not yet been
admitted to the pool of executable processes by the OS. In a suspended process model, processes that are not immediately available
• Ready state: A process that is prepared to execute when given the for execution can occur. These processes may or may not be waiting for a
opportunity. specific event. If a process is waiting for a particular event, this means that the
• Running state: The process that is currently being executed. blocked state is independent of the suspended state, and the occurrence of
• Blocked state/Waiting state: A process that cannot execute until some the blocking event does not enable the process to be executed immediately.
event occurs, such as the completion of an I/O operation.
• Exit state: A process that has been released from the pool of executable A process can be placed in a suspended state by any of the following:
processes by the OS, either because it halted or it was terminated. a. The process itself
b. A parent process
c. The operating system
• User mode – This is referred to as the less-privileged mode, since user In some operating systems, a process can be terminated by the process that
programs execute in this mode. created it, or when the parent process itself is terminated.
• Kernel mode – This is referred to as the more-privileged mode, where the
software has complete control of the processor and its instructions, References:
Gregg, B. (2021). System performance: Enterprise and Cloud (2nd ed.). Pearson Education, Inc.
registers, and memory. Silberschatz, A., Galvin, P. & Gagne, G. (2018). Operating systems concepts (10th ed.). John Wiley & Sons, Inc.
Stallings, W. (2018). Operating systems: Internal and design principles (9th ed.). Pearson Education Limited
Certain instructions and memory regions can only be executed and accessed
in the more-privileged mode. This is necessary to protect the OS and the key
operating system tables, such as process control blocks, from interferences
by user programs.
Process Switching: When the operating system controls the currently running
processes, a process switch may occur at any time. Thus, the OS needs to
provide a regaining control feature if a process is blocked, suspended, or
paused. Process switching usually involves interrupts or traps. Interrupts are
external events that are independent of the currently running process, while
traps are related to errors or exception conditions generated within the
currently running process. On the other hand, a supervisor call due to an
explicit request can still occur to interrupt a process execution.