Design and Implementation of Online Registration Sytem

Only available on StudyMode
  • Download(s) : 17
  • Published : April 12, 2013
Open Document
Text Preview
UNIX Lecture Notes Chapter 1 Introduction to System Programming

Stewart Weiss

Chapter 1

Introduction to System Programming

UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity. - Dennis Ritchie, 1941 - 2011.

Concepts Covered

The kernel and kernel API, System calls and libraries, Processes, logins and shells, Environments, man pages, Users, the root, and groups, Authentication, File system, le hierarchy, Files and directories, 1.1 Introduction

Device special les, UNIX standards, POSIX, System programming, Terminals and ANSI escape sequences, History of UNIX, syscall, getpid, ioctl

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 les, 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 les directly. To perform screen operations or le I/O they must use the interface that the operating system denes. such as Although it may seem that functions from the C standard library access les directly, they do not; they make calls to system routines

getc()

or

fprintf()

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 denitions, and sometimes variable denitions as well. The API of an operating system in eect denes the means by which an application can utilize the services provided by that operating system. It follows that developing a software application for any

platform 1

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 dened in the operating system's API. A program that uses these system level services directly is called a of programming that uses these services is called

system program, and the type system programming. System programs make re-

quests for resources and services directly from the operating system and may even access the system

1

We use the term platform to mean a specic operating system running on a specic machine architecture. 1

UNIX Lecture Notes Chapter 1 Introduction to System Programming

Stewart Weiss

Figure 1.1: Simple I/O model used by beginning programmer.

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 specically 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 le system. Some commands and les are not available to all users, as will be explained later. The programmer's view includes the...
tracking img