Find the Process Causing High CPU Usage on Raspberry Pi¶
If your Raspberry Pi is slow or the fan keeps spinning, run top over SSH while the problem is happening. Sort by CPU usage, watch which process stays at the top, and use its PID to find the program or service behind it.
Find high CPU usage with top¶
- Press uppercase P to sort by CPU usage.
- Watch a few refreshes while the Pi is slow. Write down the
PIDandCOMMANDof any process that repeatedly appears near the top. - Press 1 to switch between the combined CPU summary and per-core readings. Press q to quit.
In the usual Irix mode, a process at 100% is using about one logical CPU's worth of time. On a four-core Pi 4, that is about a quarter of total CPU capacity. A multithreaded process can exceed 100% in this mode. The summary at the top reports CPU time across the board when the per-core view is off. top manual
The three load averages from uptime cover 1, 5, and 15 minutes. They include runnable tasks and tasks in uninterruptible waits, such as some storage operations. If load is high while the CPU spends time in I/O wait (wa), check storage and other sources of slowdown. Linux load average manual
Check the same process with top and ps¶
Replace 1234 with the PID you wrote down. Read the second top sample for CPU usage over the one-second refresh interval.
ps gives you the parent PID (PPID), elapsed time in seconds, and the process's average CPU usage since it started. If the process spent most of its life idle and just became busy, the ps percentage can be much lower than the latest top reading. ps manual
On a Pi 4B running Trixie, a test Python process slept for five seconds and then ran a single busy loop. During the loop, top showed 100.0% for python3, while ps reported 21.6% over the life of the process so far. The combined CPU summary showed 74.8% idle at the second refresh.
Trace the PID to a systemd service¶
Run this in the same shell, with pid still set to the process you found.
If the result is user@1000.service or a similar user manager unit, check which user unit owns the process. Run the following as the same logged-in user that owns the process.
On the test Pi, the system manager returned the user manager unit, and the user manager returned the specific temporary service. A scope such as session-3.scope can point to a login session, so use the process name and parent PID to narrow it down. If the process has already exited, return to the live top view and catch its next occurrence. systemctl manual
Keep checking the symptom¶
- If CPU usage looks normal while the Pi is hot or the fan is loud, check the temperature, clock, and throttling flags.
- If the Pi slows down under memory pressure, find which processes are using swap.