Process Management on Linux, macOS, and Windows: Monitoring, Killing, and Background Execution
A process is a running instance of a program that the operating system tracks with a unique identifier called a Process ID (PID), alongside its own memory space and resources. Process management is the set of techniques for finding, monitoring, and, when necessary, terminating those running instances.
Have you ever started a Python script for a machine learning experiment, popped to make a cup of tea, and then promptly forgotten all about it? Hours later, you glance at your system monitor and wonder whether it’s still working or just quietly sulking in the corner.
I once left a script running for three days before realising it was printing “Hello World” in an infinite loop thanks to a misplaced indent. Embarrassing? Absolutely. Educational? Without question.
Processes sometimes need our attention — whether to check their progress, free up system resources, or save our fans from sounding like an aircraft taking off. Processes can be obedient helpers or stubborn little gremlins hiding in the background, and knowing how to find, monitor, and, when necessary, end them is a vital skill.
In this post, we’ll tour the essentials of process management on Linux, macOS, and Windows. We’ll talk about background and foreground execution, and you’ll learn to recognise when a process needs encouragement… or when it’s time to show it the door.
What Is a Process? Understanding PIDs
Think of your computer as a busy workshop, and each process as one of its workers. When you open a programme or run a script, your operating system issues that worker a unique badge — a Process ID (PID) — along with a workspace and the tools to do its job.
Some of these workers are quiet, efficient types. Others gobble up CPU cycles like biscuits at a meeting. A few might wander off and stop doing anything useful, in which case you may need to intervene.
How to Check Running Processes on Linux, macOS, and Windows
Before managing processes, we first need to see who’s on shift.
Linux/macOS Process Monitoring: ps and top
Two classic tools reign supreme here: ps and top. One gives you a snapshot; the other offers a constantly updating live view.
ps: The Instant Snapshot
ps (short for “process status”) lists what’s running at the moment you call it. It can be terse or detailed depending on the options you choose.
| Command |
Purpose |
Flag Breakdown |
ps aux |
The standard, detailed snapshot. |
a: All users u: User-oriented format (shows CPU/MEM) x: Include daemon processes (no terminal) |
ps -ef |
Alternative layout (System V style). |
-e: Every process -f: Full format listing |
ps aux \| grep python |
Search for a specific process. |
Pipes the full snapshot into grep to filter for a keyword. |
Example output of ps aux:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 103764 6332 ? Ss May02 0:02 /sbin/init
you 5678 0.0 0.5 45678 3210 pts/0 S+ 10:30 0:00 python my_script.py
The columns tell you who owns the process, how much CPU/memory it’s using, when it started, and the command that launched it. STAT deserves special mention: R means running, S means sleeping, and Z is a “zombie” — a process that’s finished but still hanging around in the table.
Tip: Zombie processes aren’t undead in the horror-film sense — they’ve already finished but their “desk” in the system hasn’t been cleared. Usually harmless, but if you see a lot of them, it’s worth investigating.
Watch out: When piping into `grep`, the `grep` command itself will often show up in its own results — don’t panic, that’s normal.
top: The Live Dashboard
If ps is a photo, top is a CCTV feed.
Run:
and watch as the busiest processes bubble to the top in real time. Press q to quit, P to sort by CPU, M for memory, N for PID.
Tip: If you’re investigating performance issues, leave `top` running for a while — you’ll spot “spikes” that a single `ps` snapshot might miss.
Windows Process Monitoring: Task Manager and tasklist
Windows offers both the visual comfort of Task Manager and the precision of tasklist.
Task Manager
- Open it with
Ctrl + Shift + Esc or right-click the taskbar → Task Manager.
- Processes tab – applications and background tasks with CPU/memory usage.
- Details tab – like
ps aux, but in a neat grid.
Tip: The Details tab in Task Manager is perfect for finding the PID you’ll need for `taskkill`.
tasklist: The Console View
tasklist
Similar in spirit to ps, this lists the image name, PID, session, and memory usage.
Filter with:
tasklist | findstr python
Process Management Takeaways: When to Escalate from SIGTERM to SIGKILL
🔒 Subscribe to keep reading.
References
🔒 Subscribe to keep reading.