Nepedia
Back to Discover
Fluent Reader
💻

System call

technology Maturity 9-11 Next article →

A computer program often needs to do things it cannot do alone. It might need to use a camera or save a file to a disk. To do this, the program makes a system call. This is a special request sent to the operating system. The operating system is the main software that runs the computer.

Linux kernel interfaces
Linux kernel interfaces

System calls act as a bridge. They allow a program to ask for services from the core part of the computer, called the kernel. Without these calls, a program would be stuck in its own small world.

Most modern computers use a security model to stay safe. This model uses different levels of privilege, often called rings. A normal program runs at a low privilege level. This means it cannot touch the hardware or change other programs. If a program wants to use a device, it must use a system call. This often happens through an interrupt. An interrupt is a signal that tells the CPU to stop what it is doing. The CPU then moves control to the kernel. The kernel checks if the request is safe before it does the work.

Linux kernel interfaces
Linux kernel interfaces

Writing these calls can be very hard for a programmer. To make it easier, most systems use a library. A library is a collection of helpful tools that sits between the program and the operating system. On Unix-like systems, this is often the C library, or libc. On Windows, it is part of the Native API. These libraries use wrapper functions to help. A wrapper function takes the program's request and puts the right information into the processor. This makes the code much easier to write and move to different computers.

Linux kernel interfaces
Linux kernel interfaces

History shows how these tools have changed over time. In the past, many people wrote code in assembly language. IBM's OS/360 used a library of assembly language macros for its system calls. Today, many systems use high-level languages instead. Linux 2.5 began using fast instructions on x86 computers to make calls quicker. These instructions are called SYSCALL and SYSRET. They allow the computer to switch control to the kernel without the extra work of a standard interrupt.

Linux kernel interfaces
Linux kernel interfaces

There are many different kinds of system calls. They can be grouped into six main categories. Some manage processes, which are running programs. Others manage files, like opening or deleting them. Some handle devices, like a mouse or a printer. Other calls manage memory or help programs talk to each other. Different systems have different amounts of calls. Windows has about 2000 calls. Linux and OpenBSD each have over 300. NetBSD and FreeBSD have close to or over 500 calls.

Linux kernel interfaces
Linux kernel interfaces
443 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (1)
File:Linux kernel interfaces.svg
Linux kernel interfaces.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.