1. Introduction
Process creation is one of the most fundamental operations performed by an operating system. Every program that executes on a computer must first be transformed into a process before it can utilize CPU time, memory, files, and other system resources.
Process creation enables:
Program execution
Multitasking
Concurrent processing
Parent-child process hierarchies
Resource sharing
A process may be created in several situations:
User-Initiated Process Creation
When a user launches an application such as:
Browser
Text editor
Media player
the operating system creates a new process for that program.
Process-Initiated Creation
An existing process may create additional processes to perform specific tasks.
Examples:
Web servers creating worker processes
Compilers spawning helper processes
System Initialization
During system startup, the operating system creates essential system processes and services.
Examples:
systemd
login manager
network services
Process creation is therefore a critical mechanism that allows modern operating systems to support multitasking and concurrent execution.
Objectives of Process Creation
The operating system must ensure that every newly created process:
Receives a unique identity
Has a valid execution environment
Obtains necessary resources
Can be scheduled for execution
Remains isolated from other processes
2. Concept of Process Creation
A process is not created arbitrarily by hardware. Instead, process creation is a carefully controlled operation managed entirely by the operating system.
Creating a process involves much more than simply loading a program into memory.
The operating system must:
Create process metadata
Allocate memory
Initialize execution state
Establish scheduling information
Assign resources
Register the process with the scheduler
Thus, process creation can be defined as:
The operating system operation that establishes a new execution environment and prepares a program for execution.
Process Hierarchy
Most modern operating systems create processes using a parent-child relationship.
When one process creates another:
Original process → Parent Process
Newly created process → Child Process
This forms a hierarchical process structure known as:
Process Tree
Such hierarchies help the operating system:
Manage resources
Track ownership
Handle process termination
Support process synchronization
3. Process Creation Steps (Internal Working)
Creating a process involves several internal operating system operations.
Step 1: Request for Process Creation
The process creation sequence begins when a request is made.
This request may originate from:
User actions
System initialization
Existing processes
Typically, the request is generated through:
System Calls
Examples:
fork()
CreateProcess()
spawn()
The operating system receives the request and begins the creation procedure.
Step 2: PCB Allocation
The operating system creates a new:
Process Control Block (PCB)
The PCB is the primary data structure used to manage a process.
It stores information such as:
Process ID
Process state
CPU registers
Scheduling information
Memory details
Open files
Without a PCB:
The operating system cannot manage the process.
Step 3: Assign Process ID (PID)
Each process receives a unique:
Process Identifier (PID)
The PID allows the operating system to:
Identify processes uniquely
Track execution
Manage scheduling
Handle communication
Example:
PID 101 → Browser
PID 102 → Terminal
PID 103 → Text Editor
No two active processes share the same PID.
Step 4: Memory Allocation
The operating system creates the process address space.
Typical memory regions include:
High Address
+------------------+
| Stack |
+------------------+
| Heap |
+------------------+
| Data Segment |
+------------------+
| Text Segment |
+------------------+
Low Address
The OS allocates:
Code segment
Data segment
Heap
Stack
Memory protection mechanisms are also established.
Step 5: Initialize Execution Context
The execution context determines where execution begins.
The operating system initializes:
Program Counter (PC)
Points to:
First instruction to execute
CPU Registers
Initialized to default values.
Stack Pointer
Configured to the top of the process stack.
Processor State
Initial execution mode is established.
The process now has a valid execution environment.
Step 6: Set Scheduling Parameters
The scheduler must know how to manage the process.
The operating system assigns:
Priority
Scheduling class
CPU accounting information
These parameters influence:
CPU allocation
Execution order
Step 7: Add to Ready Queue
The newly created process is inserted into the:
Ready Queue
The process is now waiting for CPU allocation.
At this stage:
Process exists
Resources allocated
Execution context initialized
but:
CPU execution has not yet begun.
Step 8: Process Becomes Ready
The process enters the:
Ready State
The scheduler eventually selects it for execution.
Once selected:
CPU execution begins
The process transitions to:
Running State
4. Parent–Child Relationship
Most operating systems organize processes hierarchically.
When a process creates another process:
Parent Process
|
+----> Child Process
The relationship provides:
Resource inheritance
Execution tracking
Process control
Parent Process
The process initiating creation.
Responsibilities may include:
Monitoring child
Waiting for completion
Managing resources
Child Process
The newly created process.
May:
Execute independently
Share resources
Load a different program
Characteristics
Resource Inheritance
Child processes often inherit:
Open files
Environment variables
Security attributes
Working directory
Concurrent Execution
Parent and child usually execute concurrently.
Synchronization
Parents may wait for child completion using:
wait()
waitpid()
5. Process Creation in UNIX Systems
UNIX and Linux systems use a highly influential process creation model.
The model consists of two major system calls:
fork()
exec()
This design provides:
Flexibility
Process control
Efficient program execution
5.1 fork() System Call
Concept
The fork() system call creates a new process by duplicating the calling process.
The newly created process becomes:
Child Process
while the original process remains:
Parent Process
Working of fork()
When fork() executes:
New PCB created
New PID assigned
Address space duplicated
Execution context copied
Child inserted into ready queue
After creation:
Both parent and child continue execution
Example
Execution Behavior
After fork():
Parent
|
fork()
|
----------------
| |
Parent Child
Both processes execute independently.
Important Properties
Return Value
fork() returns:
0 in child process
Child PID in parent process
Negative value on failure
Concurrent Execution
Parent and child execute simultaneously.
Separate Address Spaces
Each process eventually obtains independent memory.
5.2 exec() System Call
Concept
Unlike fork(), exec() does not create a new process.
Instead:
exec() replaces the current process image with a new program.
The process continues to exist, but its contents change completely.
Example
After exec():
Previous code removed
New program loaded
Execution begins from new program
Important Properties
No New Process Created
PID remains unchanged.
Existing Process Reused
Process identity remains the same.
Complete Program Replacement
Memory image replaced entirely.
5.3 fork() + exec() Model
This combination is the standard UNIX process creation model.
Sequence
Parent Process
|
fork()
|
Child
|
exec()
|
New Program Loaded
Why Two Separate Calls?
fork():
Creates process
exec():
Loads program
This separation provides flexibility because the child can:
Modify environment
Redirect files
Change permissions
before loading the new program.
6. Process Creation Variations
6.1 Copy-on-Write (COW)
Duplicating an entire address space can be expensive.
Modern operating systems optimize fork() using:
Copy-on-Write
Concept
Initially:
Parent and child share memory pages
Actual copying occurs only when:
One process modifies data
Benefits
Faster process creation
Reduced memory usage
Improved performance
6.2 vfork()
vfork() is a specialized version of fork().
Characteristics
Child temporarily shares parent address space
Intended for immediate exec() execution
Faster than traditional fork()
Purpose
Reduce process creation overhead.
7. Resource Sharing During Creation
Different operating systems allow different resource-sharing policies.
Option 1: Share All Resources
Parent and child share:
Files
Memory
Devices
Rare in modern systems.
Option 2: Share Some Resources
Common approach.
Shared resources may include:
Open files
Environment variables
while memory remains independent.
Option 3: Share No Resources
Processes operate completely independently.
Provides:
Strong isolation
Better protection
8. Process Tree
Processes naturally form hierarchical structures.
Example:
init/systemd
│
├── Process A
│ ├── Process B
│ └── Process C
│
└── Process D
Each process originates from another process except the root process.
Root Process
In Linux systems, the root process is typically:
systemd
Historically:
init (PID 1)
Modern systems:
systemd (PID 1)
All user processes ultimately descend from this root process.
Importance of Process Trees
Process trees help:
Manage resources
Track process ownership
Handle termination
Monitor execution