In a computer, system call, also known as a system call, refers to a service running in user space (user state) that requests the operating system kernel to run with higher privileges. System calls provide an interface between the user program and the operating system. Most system interactive operational requirements are performed in the kernel state. such as device IO operations, interprocess communication.
APIs (application Programming Interface, application programming interfaces) are pre-defined functions designed to provide the ability of applications and developers to access a set of routines based on a piece of software or hardware without having to access the source code. Or understand the details of the internal working mechanism.
- The API focuses on providing services to the upper layer, while system calls focus on sending a clear request through the core of the down layer of soft interrupts. The API belongs to the user state, and the system call belongs to the kernel state.
- In general, the API libraries provided by the operating system follow certain standards to achieve portability of applications over different systems. The standard provides an API up-to-the-shelf interface, and the operating system can vary depending on how the API is implemented.
- An API is an interface to an application that implements more than just the underlying services and resources, but also encapsulates other applications, so that API and system calls are not necessarily linked. First: An API can not invoke any system calls, providing only user-configured services (such as functions for mathematical operations). Second: An API may invoke multiple system calls. Third: Multiple APIs can invoke the same system call that encapsulates the different functionality.
System calls and APIs