Q: You need to inspect the current state of a running process without attaching external debugging tools. What files in the `/proc` filesystem give you process information like memory usage, open file descriptors, and CPU affinity?
The Linux /proc filesystem exposes the kernel's data structures as text files, allowing deep process inspection without external tools.
#Linux #Linux / SRE — Scenario-Based Interview Questions #L1 #SRE #Systems #Troubleshooting
🎙️ Candidate Opening & Architectural Context
""In an interview, I explain my systematic Linux troubleshooting methodology using Brendan Gregg's USE method. The interviewer is testing: Understanding /proc filesystem structure, process introspection.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Initial Diagnostics & Root Cause Analysis
The Linux /proc filesystem exposes the kernel's data structures as text files, allowing deep process inspection without external tools.
/proc/1234/status: Summary of memory usage (VmPeak, VmRSS, VmSwap), process state, UIDs, thread count, etc./proc/1234/stat: CPU time, process state (S=sleeping,R=running,Z=zombie), PPid, nice value./proc/1234/fd/: Directory listing all open file descriptors.ls -la /proc/1234/fd/shows which files/sockets the process has open./proc/1234/maps: Virtual memory map showing loaded libraries, heap, stack regions, and their permissions.
2️⃣
Remediation & Permanent Safeguards
For a process with PID 1234, key files are: Quick example: cat /proc/1234/status | grep VmRSS shows exact resident memory used. cat /proc/1234/limits shows if file descriptor limits are exhausted.
/proc/1234/limits: Current hard/soft limits (ulimits) for file descriptors, core dump size, CPU time, etc./proc/1234/cgroup: Which cgroups (namespaces and resource limits) the process belongs to.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: /proc/1234/status: Summary of memory usage (VmPeak, VmRSS, VmSwap), process state, UIDs, thread count, etc.."
⚡ 60-Second Elevator Pitch Talking Points
- /proc/1234/status: Summary of memory usage (VmPeak, VmRSS, VmSwap), process state, UIDs, thread c...
- /proc/1234/stat: CPU time, process state (S=sleeping, R=running, Z=zombie), PPid, nice value.
- /proc/1234/fd/: Directory listing all open file descriptors. ls -la /proc/1234/fd/ shows which fi...
Advertisement