Generic System Programming Operations

Contents

Services
Specifications
Errors

Services

The O/S manages the file system, processes, inter-process communication, networking and devices. It manages them to provide services for applications to use.

The O/S provides these services through a Systems Programming API (Application Programmers Interface). Each O/S supplies such an API.

The API will usually be in the language the O/S is written in. MSDOS is written in 8086 Assembler, so the O/S API defines an assembly level interface: load registers and call an interrupt. Unix is written in C, and supplies a C function library. The Java O/S is written in Java and supplies a set of Java classes

There may be other APIs for other languages, which call into the base API set. For example, there is a C library for MSDOS, which just supplies a library of C functions that load registers, call an interrupt and return values back from registers. There is an Ada API for Unix, where Ada procedures call the C API.

Specifications

The API for a language and an O/S must supply a means of specifying the API. This is done using the standard specification method for the languagge. For C, the API specifications are in header files that have to be included into the program at compile time

At link time, the systems functions must be resolved like any other functions of the program are. This may involve linking in other sets of libraries, and may need link parameters to do this.

Errors

The Systems API is the lowest level that an ordinary application can reach. In calling an O/S service, it must be able to find out if the call succeeded. For example, an application needs to know if the call to open a file for writing succeeds, or valuable data might be lost.

Every system call must include an error reporting mechanism. For C, this may be via the function return value. For C++, Ada, Eiffel, Java an exception can be raised, or return values used. Global error variables, or special registers may be set. ``Illegal values'' may be set to indicate errors.

Home Program Development using Unix Home
This page is http://jan.newmarch.name/OS/l6_1.html,
Jan Newmarch (http://jan.newmarch.name) <jan@newmarch.name>

Copyright © Jan Newmarch
Last modified: Wed Nov 19 18:57:52 EST 1997