What this topic covers
12 subtopics- System calls12
- Interrupts8
- Dual mode6
- Kernel design4
- Types of OS4
- Virtualisation3
- Booting2
- Kernel2
- I/O1
- Processes1
- Protection1
- Signals1
- Beginner 15
- Intermediate 15
- Advanced 15
About this topic
An operating system sits between programs and hardware: it shares the CPU, memory and devices among processes and protects them from each other. These questions cover the foundations interviewers start with – the kernel, user and kernel mode, how a system call crosses into the kernel, interrupts and DMA – up to the GATE and systems-interview details such as privileged instructions, vDSO and virtualisation. The C programs were compiled and run, and every calculation was computed by a program.
Free preview
Sample questions
Try each one first, then open the answer for the explanation and why the other options are wrong.
On Linux, which of these is a system call rather than a C library function?
Show answer and explanation
Explanation
fork() asks the kernel to create a process. printf() is a library function that formats text in user space and only calls write() when its buffer is flushed; strlen() and qsort() never enter the kernel.
Why the other options are wrong
- APure user-space computation.
- BPure user-space computation.
- CIt formats in user space and eventually calls write().
A C program calls read(fd, buf, n). In which order do these steps happen?
Show answer and explanation
Explanation
On x86-64 Linux the wrapper sets rax to the call number and executes syscall; the kernel indexes its table with rax, runs the handler, and sysret returns with the result in rax.
Why the other options are wrong
- BThe kernel cannot dispatch before the trap.
- CArguments are prepared before the trap.
- DThe handler runs only after the trap and dispatch.
On Linux, clock_gettime() is called millions of times per second by some programs, yet usually never enters the kernel. Why?
Show answer and explanation
Explanation
The vDSO turns a few read-only calls into ordinary function calls. A trap costs far more than reading a shared page.
Why the other options are wrong
- ANo such cache.
- BTime is not constant.
- DIt is a system call, served by the vDSO in the fast case.