5 questions to test your understanding
A C program calls printf("Hello"). At what point does execution cross from user mode into kernel mode?
Why are system calls significantly more expensive than ordinary function calls within a program?
Calling the C standard library function printf() is itself a system call that directly transitions the CPU into kernel mode.
The separation between user mode and kernel mode exists to prevent buggy or malicious programs from crashing the entire system by directly accessing hardware or modifying other processes' memory.
What mechanism allows a user-space program to request a privileged operation from the kernel without compromising the user/kernel protection boundary, and how does the CPU ensure the transition is controlled?