System calls
When we want to understand what a program is doing or how it's running under the hood.
Programs make system calls to request services from the kernel—opening files, allocating memory, creating processes, and more.
We can use tracking , by using strace which let us observe every system call a program makes:
strace (Linux) and dtruss (macOS)
# Trace all system calls
strace ./my_program
# Trace only file-related calls
strace -e trace=file ./my_program
# Follow child processes (important for programs that start other programs)
strace -f ./my_program
# Trace a running process
strace -p <PID>
# Show timing information
strace -T ./my_program