Page 47 - DCAP104_EXPOSURE_TO_COMPUTER_DISCPLINES
P. 47
Exposure to Computer Disciplines
Notes Examples
– /etc/ : System configuration files. Examples
* /etc/passwd
* /etc/group
– /var/ : Runtime changable files. Examples
* /var/run/utmp : Currently logged in users
* /var/log/wtmp : All logins and logouts
– /proc/ : Process information
• Time and Date functions in <time.h>
• uname : system identification
• sysconf, pathconf : Information on system limits
3.1.2 The System Call Model
In computing, a system call is the mechanism used by an application to request service from the
operating system based on the monolithic kernel or to system services on the operating systems
based on the microkernel-structure. System Calls are requests by programs for services to be
provided by the Operating System.
The system call represents the interface of a program to the kernel of the Operating System:
1. The system call API (Application Program Interface) is given in C.
2. The system call is actually a wrapper routine typically consisting of a short piece of assembly
language code.
3. The system call generates a hardware trap, and passes the user’s arguments and an index
into the kernel’s system call table for the service requested.
4. The kernel processes the request by looking-up the index passed to see the service to perform,
and carries out the request.
5. Upon completion, the kernel returns a value which represents either successful completion of
the request or an error. If an error occurs, the kernel sets a global variable, err no, indicating
the reason for the error.
6. The process is delivered the return value and continues its execution.
3.1.2.1 System Call: Motivation behind the Model
The system call model ensures safety, fairness and modularity. The benefits of the system call
model include:
• The Operating System ensures the integrity of its data and the data of other users, by
carefully controlling access to these resources.
• The Operating System ensures fair use of system resources.
• The system call interface is standardized by POSIX (Portable Operating System Interface),
so is identical for all Unix flavors. (BSD, Linux, Solaris, Mach, etc.) regardless how any
operating system actually implements the services the process requests.
40 LOVELY PROFESSIONAL UNIVERSITY