Hardware and Software Concepts:Application Programming Interfaces (APIs).
Application Programming Interfaces (APIs)
Today’s applications require access to many resources that are managed by the operating system, such as files on disk and data from remote computers. Because the operating system must act as a resource manager, it typically will not allow processes to acquire these resources without first explicitly requesting them.
Application programming interfaces (APIs) provide a set of routines that programmers can use to request services from the operating system (Fig. 2.7). In most of today’s operating systems, communication between software and the operating system is performed exclusively through APIs. Examples of APIs include the Portable Operating System Interface (POSIX) standards and the Windows API for developing Microsoft Windows applications. POSIX recommends standard APIs that are based on early UNIX systems and are widely used in UNIX-based operating systems. The Win32 API is Microsoft’s interface for applications that execute in a Windows environment.
Processes execute function calls defined by the API to access services pro- vided by a lower layer of the system. These function calls may issue system calls to request services from the operating system. System calls are analogous to interrupts for hardware devices—when a system call occurs, the system switches to kernel mode and the operating system executes to service the system call.
Self Review
1. Why must processes issue system calls to request operating system services?
2. How does the POSIX attempt to improve application portability?
Ans: 1) To protect the system, the operating system cannot allow processes to access operating system services or privileged instructions directly. Instead, the services that an operating system can provide to processes are packaged into APIs. Processes can access these
services only through the system call interface, which essentially puts the operating system in control. 2) Software written using a particular API can be run only on systems that implement the same API. POSIX attempts to address this problem by specifying a standard API for UNIX-based systems. Even many non-UNIX systems now support POSIX.
Comments
Post a Comment