Process Basics
What is a Process?
A process is an independent program in execution, representing a running instance of a computer program. In Linux, every command you run creates a unique process with its own memory space, system resources, and process ID (PID).
Process Characteristics
Processes in Linux have several key characteristics:
Characteristic |
Description |
PID |
Unique identifier for each process |
Parent Process |
Process that spawned the current process |
Memory Space |
Isolated memory allocation |
State |
Current execution status (running, sleeping, stopped) |
Process States
stateDiagram-v2
[*] --> Created
Created --> Ready
Ready --> Running
Running --> Blocked
Blocked --> Ready
Running --> Terminated
Terminated --> [*]
Basic Process Commands
Viewing Processes
ps
command:
## List current user's processes
ps
## List all processes
ps aux
top
command:
## Real-time process monitoring
top
## Show detailed process information
ps -ef
Process Hierarchy
In Linux, all processes are descendants of the init
process (PID 1), creating a tree-like process structure. Each process can spawn child processes, forming a parent-child relationship.
Process Identifiers
- PID (Process ID): Unique identifier for each process
- PPID (Parent Process ID): ID of the process that created the current process
LabEx Insight
At LabEx, we understand the importance of process management in Linux system administration and development. Understanding process basics is crucial for efficient system performance and resource management.