5. Operating systemsSyscalls
Syscalls
A system call is how an ordinary program asks the operating system kernel to do something it isn’t allowed to do itself, like reading a file, sending network data or starting a process. User programs run in a restricted CPU mode that can’t touch hardware or other programs’ memory. To make a request, the program puts a call number and arguments in registers and executes a special instruction that switches the CPU into kernel mode at a fixed, trusted entry point; the kernel checks the request, does the work and returns. It’s like a bank teller window: you can’t walk into the vault, but you can pass a slip through. Each crossing costs far more than a normal function call, which is why I/O gets buffered and batched.
In this lesson: Step across the user/kernel boundary.