Application Programming Interface
Learn how the OS acts as an API in a computer.
We'll cover the following
API
The Application Programming Interface (API) is the interface the OS provides to an application to interact with system libraries. In general, an API refers to a set of agreements between the interacting components of an information system. These agreements often become a well-known standard. For example, the POSIX standard describes the API for a portable OS. The standard guarantees the compatibility of the OS and applications.
The OS’s kernel and device drivers are part of the OS. They dictate which hardware features the application can access. The kernel of the OS provides a mechanism for managing access to the hard drive. This mechanism is called a file system. Similarly, the OS manages access to all peripheral and internal devices of the computer. Besides the kernel, there are special programs called device drivers that help the OS to control devices.
When the application interacts with system libraries, the libraries request the capabilities of the kernel and drivers. If we need a hardware feature and the OS does not support it, we cannot use it.
When the application accesses the system library, it calls a library’s function. A function is a program fragment or an independent block of code that performs a certain task. We can imagine the API as a list of all available functions that the application can call. Besides this, the API describes the following aspects of the interaction between the OS and applications:
- What action the OS performs when the application calls a specific system function
- What data the function receives as input
- What data the function returns as output?
Both the OS and application should follow the API agreements. This guarantees the compatibility of their current versions and future modifications. Such compatibility is impossible without a well-documented and standardized interface.
Get hands-on with 1400+ tech skills courses.