Sobes.tech
Middle

What are system calls? Which ones do you know?

sobes.tech AI

Answer from AI

System calls (syscalls) are the interface between a user application and the kernel of the operating system. They allow programs to request the OS to perform operations that require kernel privileges, such as working with files, networks, processes, and memory.

Examples of system calls in Unix-like OSes:

  • open() — open a file
  • read() — read data from a file
  • write() — write data to a file
  • fork() — create a new process
  • exec() — execute another program
  • wait() — wait for a child process to finish
  • kill() — send a signal to a process
  • mmap() — map a file or device into memory

Each syscall is usually implemented as an interrupt that switches the processor to kernel mode to safely perform the operation.