05 October 2006

Application Programming Interface (API)

A very important distinguishing feature among operating systems is the application programming interface (API). Essentially, the API is the set of system calls that relays instructions from the software application to the operating system (OS) kernel. In order for an application, such as MS Word or Adobe Acrobat, to run on a computer it is necessary for that version of the application to transmit its system needs in the language used by the operating system. The generic term of art for that common vocabulary is "API."

An API consists of a vocabulary of system calls, or basic instructions/requests for memory, processing capacity, and so on. The kernel responds to these instructions by attempting to allocate system resources to the program. Each system call is likely to correspond to a small piece of programming code, known as an internal. In the conventional concept of an API, each system call corresponds to one of the following:
  • function or subroutine;
  • procedure;
  • variable;
  • data structure;

Function/Subroutine: this is essentially a portion of programming code that executes a discrete step, such as pushing downward a set of values stored in a memory register; both subroutines and procedures exist in computer programs as well as in kernel system call sets.

Procedure: a set of related control statements that cause one or more programs to be performed [*]. A fairly important type of API procedure is the remote procedure call (RPC), in which a client requests access to system resources located on a different machine.

Variable: closely analogous to mathematical variables; in the execution of a program, however, the API needs to associate variables with a corresponding numerical value as value inputs change. As the variable's provisional numerical value changes, the variable must be recorded as having its new value. The value of the variable may take different formats, which are communicated to the kernel with sigils, i.e., symbols that specify the data type. Variables are typically scalar (i.e., countable numerals), alphanumeric, or floating point.

Data Structure: the mode by which the data is organized for computing efficiency. Typically, a good API will recognize just enough basic systems of organizing data for every occasion, but not so many as to allow redundancy. If there are not enough data structures recognized, certain programs that employ them will not operate as efficiently, while too many will increase the number of internals needlessly, thereby making the kernel excessively large. The basic forms of data structure include queue, stack, linked list, heap, dictionary, and tree.
The API paradigms above are usually used in the context of an OS running on tangible hardware. (Sorry, I realize that has got to be the most tautological sentence I've typed since graduating from high school!) In some cases, however, an OS may be running on a virtual machine. An example of this is JavaScript, which runs on an interpreter so that programmers aren't required to know how JavaScript API's relate to lower levels of abstraction [*].

RESOURCES: Wikipedia entry--see also subroutine, variable, and data structure; "Application Programming Interface,"Software Engineering Institute, Carnegie Mellon Univ.; "Unix for Web developers," eXtropia tutorials [1 2]; Dictionary of Algorithms and Data Structures;



Post a Comment

<< Home