A process is using 100% CPU on a production box. What's your approach before killing it?
BeginnerScenarioProcesses, services and systemd
Answer
Situation read → Understand it before you kill it; it might be important.
What I'd do →
top -c # or htop; find PID and command
ps -o pid,ppid,user,etime,cmd -p <PID>
sudo ls -l /proc/<PID>/cwd /proc/<PID>/exe
sudo strace -p <PID> -f -c # syscalls summary, Ctrl+C after a few seconds
If it's legitimate but should be less greedy: renice +10 -p <PID>. If runaway: kill -TERM, then kill -KILL if it ignores TERM.
Why → SIGTERM lets the app clean up; SIGKILL can leave locks and half-written files.
Interview tip → Grab a thread dump (jstack, py-spy dump) before killing for the postmortem.
More on Processes, services and systemd
Your team has a Python API that someone starts with `nohup python app.py &`. Make it a proper service running as a non-root user.BeginnerThe service you created must bind to port 443, but it runs as a non-root user. How?BeginnerYou need to change one setting (memory limit) in a vendor-supplied unit file without editing it. How?BeginnerA service depends on a database on the same host and fails at boot because the DB isn't ready. How do you fix the ordering?IntermediateA service keeps crashing and systemd stops restarting it after a few attempts. How do you tune this?IntermediateA long-running app must reload its config without dropping connections. How do you wire this into systemd?Intermediate