Linux

How a program executes a system call?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

  • A program executes a trap instruction. The instruction jump into the kernel while raising the privileged level to kernel space.
  • Once in kernel space, it can perform any privileged operation
  • Once it's finished, it calls a "return-from-trap" instruction which returns to user space while reducing back the privilege level to user space.