System Concepts
You may view the REAL/IX Operating System as a layered
entity, as illustrated in Figure 2-1. Users always interact directly
with the user level, usually through the shell. From the shell,
one may call utilities and user programs, which in turn may call library
routines. In the user-level of the operating system, one opens and
closes files (which are actual data files, or are special files that
correspond to system devices), reads and writes data, and so forth.
The kernel level of the operating system is accessed
through system calls, which are called directly by utility programs
and user processes, or through library routines. Kernel-level processes
(or functions) handle the details of interacting with the internal
structures of files, processes, and devices. The hardware
control level of the system is accessed through kernel-level processes,
usually drivers.
User
Level |
Shell |
| Utilities and User Programs |
| Library Routines |
| |
Kernel
Level |
System Calls |
| |
File Subsystem |
Process Subsystem |
Networking |
| I/O Subsystem |
| Device Drivers |
| |
| Hardware Control |
Figure 1 - REAL/IX Operating System
The discussions in this white paper frequently talk
about user-level activities versus kernel-level activities. One of
the features which makes UNIX operating systems so popular is that
most of the kernel is written in the C programming language, a high-level
language that is also used for user-level programming.
However, there are fundamental differences between user-level
and kernel-level code:
- Each user-level program is coded separately, with its own main(
) routine that controls the flow of execution. The entire
kernel, however, has one main( ) routine, and all
other kernel-level processes operate as functions of that routine.
- Whereas the operating system may "page out" a user-level
process from main memory, a kernel-level process is never paged
out.
- Each user-level process executes in a private area of user-address
space and is generally unaffected by other user-level processes.
All kernel-level processes, however, have full access to the address
space of all other kernel-level processes. There are many things
that a kernel-level process should not do to another process'
address space, data structures, and so forth, but there are no
built-in protection mechanisms.
System Calls
System calls are the highest level of the kernel, and
are the means by which a user-level process requests service from
the kernel. You might access system calls directly from a C language
or FORTRAN program, or indirectly (by calling a C subroutine) from
a program written in another language. To the programmer, system calls
are indistinguishable from library routine calls.
All system calls take the form of functions, meaning
they can return a value. A return value of -1 usually indicates unsuccessful
execution. When a call returns -1, an external variable called errno
(defined in errno.h ) describes the nature of the problem.
All valid errnos are defined on the intro(2) manual
page; the specific meanings of errnos returned by individual
system calls are listed on the individual manual pages.
Library Routines
Library routines are part of the user level. In most
cases, the library routines call system calls. For example, the fopen
library routine calls the open system call; the sleep
library routine calls the alarm, pause, and signal
system calls. As a general rule, the library routines execute a bit
more slowly than the corresponding system calls, but also are safer
for the novice programmer, since they usually include some checks
and clean up operations that the programmer would otherwise need to
code.
Privileges
The REAL/IX Operating System recognizes three basic
privileges: regular, superuser, and realtime. Regular privileges are
the standard privileges that allow you to execute the commands listed
in Section 1 of the manual pages, where you can only affect your own
files and processes (or those whose owners have granted you access).
Superuser privileges are the traditional administrative privileges,
which allow access to all files and processes on the system; a number
of administrative functions are only executed by the superuser. Realtime
privileges assigned to a user or a process are required to use a number
of the special REAL/IX features for realtime programming; restricted
assignment of these privileges ensures that a time-sharing program
cannot inadvertently affect the realtime responsiveness of the system.
Realtime users and processes have more privileges than
regular users, but fewer privileges than the superuser. A superuser
can do anything that a realtime user can.
Some examples of actions that are allowed for both realtime
and superusers are:
- change the priority of an executing realtime process.
- initiate an asynchronous I/O operation.
- set the file descriptor of an opened file to bypass the buffer
cache.
- preallocate memory for the stack region of the program's data
space.
- perform all shared memory, message, user-level semaphore, and
binary semaphore operations.
Only superusers can do the following:
- access files owned by other users and groups, modify user logins
and groups or give realtime privileges to a user.
- modify administrative files, including files for system initialization,
message-of-the-day, and accounting.
- run sysgen(1M) or modify any files involved in system
configuration; this implies that only a superuser may install
a driver.
- shutdown the system.
Realtime privileges are controlled by a system table
that is loaded with the setrtusers(1) command, usually during
boot time. Processes executed by a user who is listed in this table
are allowed to become realtime processes when the setrt(2)
system call is issued. Use the rtusers(1) command to get a
list of users with realtime permissions on your system.
Data Structures and Header Files
The REAL/IX Operating System uses header files to localize
information of interest to several user-level and kernel-level processes.
Localizing common information reduces the overhead to individual processes,
enhances the portability of code, and ensures that all programs compiled
on the system are using the same definitions for a specific entity.
A program that needs to access structures in a particular
header file uses a #include statement that references the file.
If information changes in the header file, all programs that reference
that header file automatically incorporate those changes when they
are recompiled. Without the header files, all programs would have
to declare these structures, and would all require recoding when the
definitions changed. The use of header files is a major help when
porting programs from one system to another and when two or more processes
must agree on the meaning of a defined variable.
System header files are located under the /usr/include
directory. This directory includes a number of definitions that
are of interest to user-level processes, such as the definition of
the a.out header of executable object files and the definitions
in value.h of the sizes of various data elements. The
sys subdirectory defines structures that are more involved
with the kernel processes and drivers, such as user.h and
proc.h that describe the basic data structures used in
scheduling processes. Header files in the sys directory
also define kernel macros and I/O controls (IOCTLs) that are used
by drivers and their associated user-level processes.
Header files are all standard ASCII files coded using
C language conventions; for technical users, they also provide a quick
reference to data structures implemented on the system.
System Time
A number of system and application programs identify
the local clock time. The most obvious example is the electronic mail
facilities, which indicate the time the mail was sent. For instance,
a standard header received from the mail(1) command is:
From user Tue Mar 27 14:09 EST 1990
Similar date outputs are required for reports associated
with user applications and so forth. Traditionally, this information
is controlled by the $TZ environmental variable, which records standard
designation for the time zone (in this case, EST, meaning Eastern
Standard Time), the number of whole hours from Greenwich Mean Time
(GMT), and whether Daylight Savings Time is observed. If Daylight
Savings Time is observed, the time stamp shown above would print "EDT"
rather than "EST" during the times Daylight Savings Time
is observed in the United States.
This scheme worked well when UNIX operating systems
were used mostly by small development groups in the United States,
but have become too parochial with so many users working in other
countries. To address this problem, this release of the REAL/IX Operating
System uses a more inclusive method of defining time conversion satisfying
the requirements of the POSIX 1003.1 standard.
Manual Page Format
The REAL/IX Operating System provides on line documentation
in the form an on line copy of the REAL/IX Operating System reference
manuals. Access to the on line reference manuals is through the use
of the man(1) command. man locates and prints the entry
from the on line reference manuals for the named command in the specified
section. If no section is specified, man searches through the
entire set of online documentation for the title. By default, the
output (commonly referred to as the manual page) is directed to the
user's terminal. Figure 2-2 shows the format of the on line manual
page. Note that through the use of REAL/IX Operating System pipes
and filters, you may redirect the output of the man command
to a file or device.
| COMMAND (n) |
COMMAND (n)
|
|
NAME
command - a brief description of the command, typically
the long form of the command name, representative of the
command's function
SYNOPSIS
command [ arguments ] [ options ] [ object ] ... [ object
]
DESCRIPTION
detailed description of the command's operation, including
the applicable use of options, arguments, and objects, and
the results the user may expect from the execution of the
command
DIAGNOSTICS
error messages the user may encounter when using the command
BUGS
lists known non-fatal anomalies related to the command's
execution
FILES
files related to and/or affecting the command or the command's
execution
SEE ALSO
similar or related commands that affect related files or
otherwise provide the user with more information
|
Figure 2 - Online Manual Page Format
- COMMAND(n) is the command name and the reference manual
section number (n) where it is found
- NAME shows the command name and gives a brief description
of the command's name (i.e. uucp - UNIX to UNIX system copy).
- SYNOPSIS shows the syntax for the command.
- DESCRIPTION provides a detailed description of the
command's operation. A list of arguments and options is provided
enabling the user to tailor the command to provide exact results.
The expected results of the command's execution is listed for
reference.
- DIAGNOSTICS provides a list of non-syntactical error
messages the user may encounter when executing the command.
- FILES lists the applicable files that are related to
and/or are affected by the command's execution. Note that not
all commands will make use of the FILES section.
- BUGS lists documented bugs applicable to the command
that are not repaired prior to release. Typically these bugs are
not fatal to the command's execution, but rather provide the user
with additional (and unexpected) results from execution.
- SEE ALSO is a list of related commands that will assist
the user in understanding this command, or will affect the files
listed in the FILES section.
-
Note that Figure 2-2 is a representation of what
you can expect when using the on line documentation feature of
the REAL/IX Operating System. For a more detailed explanation
of the manual page format, execute the command string man 1
intro for on line documentation or refer to the hardcopy of
the REAL/IX Reference Manual intro(1) command.
Go to Chapter 3 TOC