A system call is the controlled entry point through which a user program asks the kernel for a service, such as opening a file, creating a process or allocating memory.
Flow: the program calls a library wrapper (for example open or write in libc), which places the call number and arguments in registers and executes a trap instruction (syscall); the CPU switches to kernel mode and jumps to the kernel's handler; the kernel validates arguments, performs the work, and returns the result to user mode.
Categories: process control (fork, exec, exit), file management (open, read, write, close), device management (ioctl), information (getpid), and communication (pipe, socket). A library function such as printf may call write underneath; strace shows the actual system calls.
Loading…