System Calls & the Kernel Interface Questions

The boundary between user space and the kernel: how programs request privileged services through system calls, the user/kernel mode transition, and the semantics of core POSIX calls such as fork, exec, wait, open, read, write, and stat. Covers syscall numbers, arguments, return values and errno, and how libc wrappers relate to the underlying trap. This is the foundational interface for all systems programming on Unix/Linux.

MediumTechnical
94 practiced

During an outage you must inspect a process's memory layout and open files to identify a leak. Describe which /proc/<pid> entries you would inspect (/proc/<pid>/maps, /proc/<pid>/smaps, /proc/<pid>/fd, /proc/<pid>/status), what useful fields each contains, and concrete commands to extract and interpret the data quickly in real time on a busy host.

EasyTechnical
55 practiced

What does umask() do, how does it interact with file creation permissions, and why is it important when writing tools that create reports, temporary files, or secret-bearing artifacts?

MediumTechnical
84 practiced

Write C code or pseudocode for a function that copies data from one file descriptor to another robustly. It must correctly handle partial reads, partial writes, EINTR, and end-of-file without corrupting the destination.

MediumTechnical
63 practiced

You suspect a running process is leaking file descriptors and hitting EMFILE. Describe, step-by-step and with concrete commands, how you would locate and confirm the leak on a production Linux host without restarting the process. Include use of /proc/<pid>/fd, lsof, strace, and explain trade-offs between using strace vs eBPF/bpftrace for live systems.

MediumTechnical
57 practiced

You need to rotate logs atomically across multiple processes writing to the same filename. Explain how rename(2) enables atomic rotation, what happens to existing file descriptors after rename, and when copytruncate is required. Propose a robust log rotation strategy that avoids losing logs and works with long-lived processes that keep files open.

Unlock Full Question Bank

Get access to all 45 System Calls & the Kernel Interface interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.