Skip to main content
InterviewHubPRO
Section Overview
Q25

Question 25 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

50%
Linux OS Internals (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

How do you trace live system calls using `strace`?

senior LevelCode Examplelinux-osAdvanced Internals

In Simple Words: strace intercepts and records all system calls executed by a process and the signals received:

bash
# Attach to running process PID 1042 and track syscalls:
strace -p 1042 -f -e trace=network,file -s 200

# Profile and count system calls by execution time:
strace -c -p 1042
  • Vital for diagnosing why a process is hanging (e.g. waiting on a blocked connect() or missing config file returning ENOENT).
  • Production Warning: Incurs 50-80% performance overhead; avoid on high-throughput production paths without filtering!