Linux Mastery
The Human Knowledge Project
03 — Processes, Memory & the Running System
Why This Chapter Matters
Every application you open becomes alive.
Your web browser.
Your terminal.
Your text editor.
Your music player.
Every one of them begins life as a program stored on disk.
When Linux starts that program, it becomes a process.
Processes are the living, active part of an operating system.
Understanding processes is one of the biggest steps toward understanding how Linux actually works.
1. What Is a Process?
A process is a running program.
When you launch:
- a terminal
- a browser
- a text editor
- a system service
Linux creates one or more processes.
Linux systems often run many processes simultaneously.
Some belong to:
- users
- the desktop environment
- networking
- audio systems
- hardware management
- the kernel itself
2. Program vs. Process
Beginning Linux users often confuse programs and processes.
Although they are closely related, they are not the same thing.
A program is a collection of instructions stored on disk.
A process is a program that is currently running.
Think of it this way:
A blueprint describes a house.
A blueprint is not a house.
Likewise:
A program describes work.
A process performs work.
One program may produce many different processes.
For example, you can open several terminal windows at the same time.
Each terminal is a separate process, even though they all began from the same program.
THKI Memory Aid
Program → Stored
Process → Running
3. Viewing Running Processes
To display running processes:
ps
A more detailed view:
ps aux
Observe:
- users
- process IDs
- memory usage
- CPU usage
- commands
Important columns:
## USER
PID
## %CPU
## %MEM
## COMMAND
PID means:
- Process ID
Each running process has its own PID.
4. Real-Time Process Monitoring
Linux can display live system activity.
Run:
top
Observe:
- CPU usage
- memory usage
- running tasks
- system load
To exit:
q
A friendlier alternative:
htop
If not installed:
sudo apt install htop
5. Understanding Memory
Linux uses:
- RAM
- cache
- buffers
- swap space
To display memory usage:
free -h
Options:
-h
means:
- human readable
Observe:
- total memory
- used memory
- free memory
- swap usage (see Appendix A)
Linux often uses unused RAM for caching to improve performance.
Unused RAM is often considered wasted RAM.
6. System Uptime & Load
Linux systems continuously track:
- how long the system has been running
- how busy the CPU is
- how many processes are competing for resources
To display uptime and system load:
uptime
Example output:
14:02:11 up 2 days, 3:17, 3 users, load average: 0.42, 0.51, 0.48
Meaning:
| Field | Meaning |
| --------------- | -------------------------------- |
| 14:02:11 | current system time |
| up 2 days, 3:17 | how long system has been running |
| 3 users | logged-in users |
| load average | system workload averages |
The three load-average numbers commonly represent:
- 1 minute average
- 5 minute average
- 15 minute average
These values estimate how heavily the CPU and scheduler are being used.
Low values usually indicate:
- light system activity
- responsive performance
High values may indicate:
- heavy CPU demand
- overloaded systems
- excessive background tasks
- insufficient resources
System administrators use uptime and load monitoring to:
- detect overloaded systems
- monitor stability
- identify performance problems
- understand long-term behavior
Long uptimes may also indicate system stability.
7. Foreground and Background Jobs
Some programs occupy the terminal while running.
Example:
ping google.com
To stop:
ctrl + C
You can launch a program into the background using:
program &
Example:
firefox &
To view background jobs:
jobs
Why run programs in the background?
Linux allows programs to continue running while the terminal remains available for additional commands.
This is useful when:
- a program takes a long time
- monitoring must continue
- downloads are running
- editors or browsers are opened from terminal
- scripts run continuously
- multiple tasks are needed simultaneously
Example:
firefox &
The shell launches Firefox while immediately returning control of the terminal.
Without:
&
the terminal may remain occupied by the running process.
Background processing is one of the foundations of multitasking in Unix/Linux systems.
8. Killing Processes
Sometimes processes freeze or misbehave.
To terminate a process:
kill PID
Example:
kill 2481
To force termination:
kill -9 PID
Use force carefully.
Abrupt termination may:
- lose data
- interrupt writes
- destabilize programs
9. Process Trees
Processes often create child processes.
To view process hierarchy:
pstree
If unavailable:
sudo apt install psmisc
Linux systems are built from many interacting processes.
(more in Appendix A)
10. The Linux Scheduler
Linux rapidly switches CPU attention among processes.
This creates the appearance of simultaneous execution.
The scheduler decides:
- which process runs
- for how long
- at what priority
Modern systems may manage thousands of active processes.
(See Appendix A — Scheduler)
11. Daemons
Many Linux services run silently in the background.
These background service processes are often called daemons.
Examples
- printing
- networking
- audio
- SSH
- scheduling
Daemon names often end with:
d
sshd
systemd
cupsd
- (See Appendix A — Daemons)
12. Practice Exercises
1.
Run:
ps aux
Observe:
- running programs
- memory usage
- process IDs
2.
Run:
top
Observe:
- CPU activity
- memory changes
- running tasks
Exit using:
q
3.
Install and run:
sudo apt install htop
then:
htop
Compare it with top.
4.
Run:
free -h
Record:
- total RAM
- used RAM
- swap size
5.
Run:
uptime
Observe:
- uptime duration
- load averages
6.
Run:
ping google.com
Stop using:
## CTRL+C
7.
Launch a background job:
sleep 300 &
Then run:
jobs
8.
Run:
pstree
Observe process hierarchy.
13. Key Ideas
Linux systems are collections of running processes.
Processes:
- consume memory
- use CPU time
- interact with devices
- communicate with users
- create child processes
Understanding:
- processes
- memory
- jobs
- monitoring
- termination
is central to Linux system administration.