UNIX Lecture Notes – Chapter 01

Categories:

Recommended

1.1 Introduction

A modern software application typically needs to manage both private and system resources. Private resources are its own data, such as the values of its internal data structures. System resources are things such as files, screen displays, and network connections. An application may also be written as a collection of cooperating threads or sub-processes that coordinate their actions with respect to shared data. These threads and sub-processes are also system resources.

Modern operating systems prevent application software from managing system resources directly, instead providing interfaces that these applications can use for managing such resources. For example, when running on modern operating systems, applications cannot draw to the screen directly or read or write files directly. To perform screen operations or file I/O they must use the interface that the operating system defines. Although it may seem that functions from the C standard library such as getc() or fprintf() access files directly, they do not; they make calls to system routines that do the work on their behalf.

The interface provided by an operating system for applications to use when accessing system resources is called the operating system’s application programming interface (API ). An API typically consists of a collection of function, type, and constant definitions, and sometimes variable definitions as well. The API of an operating system in effect defines the means by which an application can utilize the services provided by that operating system.

It follows that developing a software application for any platform1 requires mastery of that plat- form’s API. Therefore, aside from designing the application itself, the most important task for the application developer is to master the system level services defined in the operating system’s API. A program that uses these system level services directly is called a system program, and the type of programming that uses these services is called system programming. System programs make re- quests for resources and services directly from the operating system and may even access the system resources directly. System programs can sometimes be written to extend the functionality of the operating system itself and provide functions that higher level applications can use.

These lecture notes specifically concern system programming using the API of the UNIX operating system. They do not require any prior programming experience with UNIX. They also include tutorial information for those readers who have little experience with UNIX as a user, but this material can be skipped by the experienced UNIX users.

In the remainder of these notes, a distinction will be made between the user’s view of UNIX and the programmer’s view of UNIX. The user’s view of UNIX is limited to a subset of commands that can be entered at the command-line and parts of the file system. Some commands and files are not available to all users, as will be explained later. The programmer’s view includes the programming language features of the kernel API, the functions, types, and constants in all of the libraries, the various header files, and the various files used by the system. Familiarity with basic C programming is assumed.

Attribution

Stewart Weiss (2019), UNIX Application and System Programming, URL: http://www.compsci.hunter.cuny.edu/~sweiss/course_materials/unix_lecture_notes.php

This work is licensed under Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) :  (https://creativecommons.org/licenses/by-sa/4.0/).

VP Flipbook Maker

Turn your content into engaging flipbooks with Visual Paradigm Online Flipbook Maker! Effortlessly convert your work into interactive flipbooks and customize them with the intuitive design tools. Experience it now and elevate your digital publications!