1 of 4

Your RightSignal

Operating systems · 5 of 91 / 3

System calls

The concept

Why your app can't just read the disk itself

A system call is a program's request to the kernel (the OS core that owns the hardware) to do privileged work. Apps run in user mode, where the CPU blocks device instructions; only the kernel, in kernel mode, may run them.

Say a text editor saves your notes. It can't touch the disk, and kernel memory is marked supervisor-only in its page tables. So it puts a request number (write is 1 on x86-64 Linux) in a register and runs the `syscall` instruction.

That instruction enters kernel mode at one fixed entry point. The kernel looks up the number, checks the arguments and writes the file. Then `sysret` returns to user mode with the result: bytes written, or a negative error code.