Interview Prep/Linux/Processes, memory and OOM

`top` shows load and CPU fine, but an app reports frequent `java.lang.OutOfMemoryError: unable to create native thread`.

AdvancedTroubleshootingProcesses, memory and OOM
Answer

Likely causes → Thread limits, not heap: TasksMax= of the systemd unit (default often 15% of pid_max or 4915 on some versions), ulimit -u, or pids.max in a container.

Diagnose →

ls /proc/<PID>/task | wc -l
systemctl show app -p TasksMax -p TasksCurrent
cat /proc/<PID>/limits | grep processes

Fix → Raise TasksMax= (or infinity) and LimitNPROC= in the unit if the thread count is legitimate; otherwise fix thread pool sizing.

Prevent → Bound thread pools in the app; monitor task counts.

All Linux questions Roadmap: Linux

More on Processes, memory and OOM