Two State Process Model in Operating System
Last Updated :
26 Apr, 2025
The process in an operating system passes from different states starting from its formation to its completion. A process consists of program data and its associated data and a process control block (PCB). A process may change its state because of the following events like I/O requests, interrupt routines, synchronization of processes, process scheduling algorithms, etc. The process may run or may not and if it is running then that has to be maintained by the systems for appropriate progress of the process to be gained.
Two-State Process Model
The simplest model in the process state will be a two-state model as it consists of only two states that are given below:
- Running State: A state in which the process is currently being executed.
- Not Running State: A state in which the process is waiting for execution.
Process Transitions
Running to Blocked
A process moves from the Running state to the Blocked state when it cannot continue its execution due to a dependency or external condition. This typically happens when the process needs to wait for some resource, such as input/output (I/O) operations or access to a resource that is unavailable at the moment.
Examples of conditions that may cause a process to be blocked:
- Waiting for data from a file or network resource
- Waiting for user input
- Waiting for a semaphore or mutex in a multi-threaded environment
- Accessing a blocked I/O device
Example Scenarios:
- I/O Wait: A process performing a file read operation moves to the Blocked state while it waits for data to be fetched from storage.
- Memory Allocation: A process might move to the Blocked state if it requests memory but must wait for memory to be allocated or freed by another process.
- Synchronization Wait: In multi-threaded applications, a process may enter a Blocked state if it is waiting for a lock or semaphore to be released by another thread.
Blocked to Running
A process transitions from the Blocked state to the Running state when the event it was waiting for is completed, allowing it to resume execution. The process enters the Running state once the required resource becomes available or the condition it was waiting for is fulfilled.
Example transitions:
- The process waiting for I/O finishes its operation and data becomes available, so the process moves back to the Running state.
- If a thread was blocked on a lock, once the lock is available, the process can continue its execution.
Role of the CPU Scheduler in this transition:
- The CPU scheduler plays a key role in managing the transitions from Blocked to Running. Once a process becomes unblocked, the CPU scheduler will determine whether it is eligible to be executed (based on priority, CPU availability, etc.).
- If the process is ready to run and has the highest priority (or according to the scheduling policy), the CPU scheduler will allocate CPU time to it and move the process to the Running state.
Execution of Process in Two-state Model
A two-state can be created anytime no matter whether a process is being executed or not.
- Firstly, when the OS creates a new process, it also creates a process control block for the process so that the process can enter into the system in a non-running state. If any process exit/leaves the system, then it is known to the OS.
- Once in a while, the currently running process will be interrupted or break-in and the dispatcher (a program that switches the processor from one process to another) of the OS will run any other process.
- Now, the former process(interrupted process) moves from the running state to the non-running state and one of the other processes moves to the running state after which it exits from the system.
Two State Process ModelProcesses that are not running must be kept in a sort of queue, and wait for their turn to execute. In the Queuing diagram, there is a single queue in which the entry is a pointer to the process control block (a block in which information like state, identifier, program counter, context data, etc, are stored in a data structure) of a particular process.
Queuing DiagramWe must know that a queue may have linked list blocks in which each block represents one process. The behavior of the dispatcher can be seen in the queuing diagram, a process that is interrupted is transferred to the queue waiting process, and if the process has been completed, it is terminated. After that again dispatcher takes another process from the queue and executes that process.
Advantages of the Two State Process Model
- Simple and easy to understand.
- It is ideal for basic systems or educational settings.
- It is useful for basic process management and helps track whether a process is running or waiting for a resource.
- Ideal for explaining foundational concepts like process scheduling and resource handling.
Limitations of the Two State Process Model
- Lacks granularity, missing important states like Ready, New, or Terminated.
- Insufficient for complex scheduling algorithms used in modern operating systems.
- Oversimplified compared to multi-state models which offer better process tracking and management in real-time, preemptive, or multi-threaded systems.
Applications and Use Cases
Basic Systems that Use a Simple Two-State Model:
- Early operating systems or simple embedded systems often used the two-state model. These systems are designed with fewer resources and simpler task management, where the overhead of managing multiple process states is unnecessary.
- Examples include basic batch processing systems or systems with limited task-switching capabilities.
How the Two-State Model Applies to Real-World OS Examples:
- The two-state model may be found in historical or minimal operating systems, such as early UNIX versions or embedded operating systems designed for small, specialized tasks.
- It serves as a teaching tool for understanding process scheduling in simple systems before transitioning to more advanced, multi-state models used in modern OS like Linux, Windows, and macOS.
Similar Reads
What is OSI Model? - Layers of OSI Model The OSI (Open Systems Interconnection) Model is a set of rules that explains how different computer systems communicate over a network. OSI Model was developed by the International Organization for Standardization (ISO). The OSI Model consists of 7 layers and each layer has specific functions and re
13 min read
DBMS Tutorial â Learn Database Management System Database Management System (DBMS) is a software used to manage data from a database. A database is a structured collection of data that is stored in an electronic device. The data can be text, video, image or any other format.A relational database stores data in the form of tables and a NoSQL databa
7 min read
Introduction of ER Model The Entity-Relationship Model (ER Model) is a conceptual model for designing a databases. This model represents the logical structure of a database, including entities, their attributes and relationships between them. Entity: An objects that is stored as data such as Student, Course or Company.Attri
10 min read
TCP/IP Model The TCP/IP model is a framework that is used to model the communication in a network. It is mainly a collection of network protocols and organization of these protocols in different layers for modeling the network.It has four layers, Application, Transport, Network/Internet and Network Access.While
7 min read
Operating System Tutorial An Operating System(OS) is a software that manages and handles hardware and software resources of a computing device. Responsible for managing and controlling all the activities and sharing of computer resources among different running applications.A low-level Software that includes all the basic fu
4 min read
Computer Network Tutorial A Computer Network is a system where two or more devices are linked together to share data, resources and information. These networks can range from simple setups, like connecting two devices in your home, to massive global systems, like the Internet. Below are the main components of a computer netw
7 min read
Normal Forms in DBMS In the world of database management, Normal Forms are important for ensuring that data is structured logically, reducing redundancy, and maintaining data integrity. When working with databases, especially relational databases, it is critical to follow normalization techniques that help to eliminate
7 min read
Types of Operating Systems Operating Systems can be categorized according to different criteria like whether an operating system is for mobile devices (examples Android and iOS) or desktop (examples Windows and Linux). Here, we are going to classify based on functionalities an operating system provides.8 Main Operating System
11 min read
ASCII Values Alphabets ( A-Z, a-z & Special Character Table ) ASCII (American Standard Code for Information Interchange) is a standard character encoding used in telecommunication. The ASCII pronounced 'ask-ee', is strictly a seven-bit code based on the English alphabet. ASCII codes are used to represent alphanumeric data. The code was first published as a sta
7 min read
What is an Operating System? An Operating System is a System software that manages all the resources of the computing device. Acts as an interface between the software and different parts of the computer or the computer hardware. Manages the overall resources and operations of the computer. Controls and monitors the execution o
9 min read