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
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.

MediumTechnical
58 practiced

A helper process exits with an unexpected status code, and your daemon must decide whether to restart it, log it, or quarantine the host. How would you interpret exit codes, signals, and core-dump indicators in waitpid() results?

HardTechnical
56 practiced

Explain semantics and practical implications of O_DIRECT on Linux: how it bypasses the page cache, alignment constraints for buffers and file offsets, effects on write/read performance (especially for databases), and how to design accurate benchmarks to verify O_DIRECT behavior on a specific filesystem and block device.

MediumTechnical
101 practiced

Describe how to set a file descriptor to non-blocking mode in C using fcntl(2) or by passing O_NONBLOCK to open(2). Explain race conditions when setting flags after open, how to avoid them, and common bugs in servers that forget to handle EAGAIN/EWOULDBLOCK properly (especially with edge-triggered epoll).

MediumTechnical
54 practiced

When a signal interrupts a blocking system call, how do you decide whether to retry, fail, or propagate the error? Explain why this matters for long-running services that handle log files, sockets, or child processes.

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.