Interview kitsBlog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2026 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Operating Systems
Operating Systemseasy

What is a system call and why do we need user/kernel mode?

Tags
#syscall#kernel#user-mode
Back to categoryPractice quiz

Answer

A system call is the controlled entry point into the OS kernel for privileged operations (I/O, memory, processes). User/kernel mode separation protects the system from buggy or malicious applications.

Advanced answer

Deep dive

System calls enforce safety and resource control:

  • User mode cannot access hardware directly.
  • Kernel mode validates parameters and permissions.
  • Each syscall has overhead (mode switch, checks).
  • Batching or async I/O reduces syscall overhead.

Examples

File read flow:

read() -> kernel validates FD -> copy data -> return to user

Common pitfalls

  • Assuming syscalls are free; they are expensive in hot paths.
  • Passing unchecked user pointers in kernel code.
  • Doing per-byte syscalls instead of buffering.

Interview follow-ups

  • How do syscalls affect performance?
  • What is the difference between trap and interrupt?
  • How does mmap reduce syscall count?