🧠 What Are Process Types?
In Operating Systems, processes are categorized based on how they’re created, how they interact with others, and what roles they serve in the system.
Let’s break them down.
🧩 1. User Process vs System Process
| Type | Description | Example |
|---|---|---|
| User Process | Created by the user (directly or indirectly) | Browser, VS Code, Python script |
| System Process | Created and managed by the OS to support system functionality | init, systemd, sshd, cron |
👆 User processes run in user mode, while system processes may run in kernel mode (fully privileged).
🧩 2. Foreground Process vs Background Process
| Type | Description | Example |
|---|---|---|
| Foreground Process | Requires user interaction; visible | Text editor, game |
| Background Process | Runs silently in the background | Auto-updater, indexing service, cron job |
In Linux:
bash
CopyEdit
# Foreground $ python3 script.py # Background $ python3 script.py &
🧩 3. Independent Process vs Cooperating Process
| Type | Description | Shared Data? | Example |
|---|---|---|---|
| Independent | Doesn’t share data with other processes | ❌ | Two different terminal windows |
| Cooperating | Shares data via memory, files, or IPC | ✅ | Client-server apps, threads in same process |
Cooperating processes require synchronization and communication, often using:
Pipes
Sockets
Message queues
🧩 4. Parent Process vs Child Process
| Type | Description | Created via |
|---|---|---|
| Parent | The original process | fork() in UNIX |
| Child | New process created by parent | Inherits part of parent’s resources |
Linux Example:
pid_t pid = fork();
-
If
pid == 0: child process -
If
pid > 0: parent process
Every child process can become a parent too — forming a process hierarchy/tree.
🧩 5. Daemon Process (Linux/Unix)
-
Background process that detaches from terminal
-
Usually starts at boot and runs until shutdown
-
Used for long-running services
Example:
/etc/init.d/ssh # SSH Daemon
/etc/init.d/cron # Cron Daemon🧩 6. Zombie & Orphan Processes (Advanced)
| Type | Description |
|---|---|
| Zombie | Process finished execution but parent hasn’t read its exit status. Occupies minimal system resources. |
| Orphan | Parent process died before child. Gets adopted by init (PID 1) in Linux. |
ps aux | grep defunct # To see zombies🧠 Interview-Ready Summary:
OS processes can be classified as user/system, foreground/background, independent/cooperating, parent/child, or special system-level (like daemons, zombies, and orphans).
Each type affects how the OS schedules, secures, and manages execution and communication between processes.