Process Concepts and Basic Characteristics
Operating System Process Fundamentals
A process is an execution instance of a program with independent functionality regarding a specific set of data, and it serves as the fundamental unit for resource allocation and protection by the operating system.
Process Entity = Program Segment + Related Data Segment + PCB (Process Control Block)
- Program Segment: This is the mandatory sequence of instructions that the user wishes to execute.
- Related Data Segment: This refers to the data that the user program needs to process; the volume can be large or small. In some cases, a process's data is embedded within the program itself; in such scenarios, there is no separate related data segment.
- Process Control Block (PCB): It is a data structure used to store information regarding execution relevant to the dynamic progress of a process during its forward advancement, effectively capturing the dynamic execution details of that process.
Characteristics of Processes
- Dynamic Nature: The essence of a process is a single execution of a program; therefore, processes are dynamic. Since it constitutes a single execution, a process implies a lifecycle involving the stages of "Creation - Execution - Termination".
- Concurrency: Multiple process entities can execute concurrently within a specific time interval. The introduction of processes aims precisely to allow multiple programs in memory to overlap in their execution times, thereby improving system resource utilization.
- Independence: Each process is an independent basic unit of operation and also serves as the fundamental unit for system resource allocation and scheduling.
- Asynchrony: Processes advance forward at their own independent and unpredictable speeds.
- Structural Nature: To describe and record the changes in the process execution flow, to meet the requirements of independent process operation, and to reflect and control concurrent processes occupying the CPU—allowing a process to execute upon acquiring necessary resources or suspending when unable to obtain them—processes possess this structural characteristic.
Differences Between Processes and Programs
- A program is an ordered set of instructions; it is a static concept with no inherent meaning of execution on its own. In contrast, a process is a single execution instance of a program on the CPU; it is a dynamic concept.
- As software data, programs can be stored for long periods; however, processes exist due to their lifecycle—they are born upon creation, execute upon scheduling, suspend when deprived of resources, and die upon termination.
- As static text, programs do not run, nor are they allocated or scheduled. Processes, however, are independent basic units of operation and serve as the fundamental units for system resource allocation and scheduling.
- There is no one-to-one correspondence between processes and programs. Since a process represents a single execution of a program, multiple executions of the same program can generate multiple processes, while different processes can also contain the same program.
- A program is an ordered set of instructions recorded on a medium (such as a disk), whereas a process consists of three components: the program segment, the data segment, and the PCB.