The Kernel

The Kernel

Operating systems are the building blocks of computer systems, and they provide the interface between user applications and computer hardware. Solaris is a multiuser, multitasking operating system developed and sold by Sun Microsystems (, and it is one implementation of the UNIX operating system that draws on both the System V (AT&T) and Berkeley (BSD) systems. Solaris has evolved from little more than a research project to become the dominant UNIX operating system in the international marketplace.

Solaris 9 is the latest in a long line of operating environment releases that are based around the SunOS operating system, which is currently in version 5.9. Solaris is commonly found in large corporations and educational institutions that require concurrent, multiuser access on individual hosts and between hosts connected via the Internet.

Many desktop computer users have never heard of the word Sun in the context of computing, nor are they usually familiar with the term Solaris as an operating environment. However, almost every time that an Internet user sends an e-mail message or opens a file from a networked server running Sun’s Network File System (NFS) product, Solaris is transparently supporting the Internet applications that allow these things to happen. In the enterprise computing industry, Sun is synonymous with highly available, highly reliable performance hardware, while Solaris is often the operating environment of choice to support database servers and application servers. Sun’s hardware solutions are based around the SPARC and UltraSPARC integrated circuit technologies, which can currently support more than 64 processors in a single server system, such as the E10000 StarFire configuration.

UNIX is hard to define because different vendors have historically introduced different features to arrive at the entities that most users would think of as UNIX. However, it is easy enough to list the fundamental characteristics that are common to all UNIX and UNIX-like systems:

  • They have a kernel, written in the C programming language, which mainly manages input/output processing rather than being a complete operating system. The kernel has ultimate responsibility for allocating system resources to complete various tasks.

  • They have a hierarchical file system, which begins with a root directory and from which the branches of all other directories (and file systems) are mounted.

  • System hardware devices are represented logically on the file system as special files (such as /dev/pty, for pseudoterminals).

  • They are process-based, with all services and user shells being represented bya single identifying number (the process ID, or PID).

  • They share a set of command-line utilities that can be used for text and numeric processing of various kinds, such as troff, col, cat, head, tbl, and so on.

  • User processes can be spawned from a shell, such as the Bourne shell, which interactively executes application programs.

  • Multiple processes can be executed concurrently by a single user and sent into the background by using the & operator.

  • Multiple users can execute commands concurrently by logging in from pseudoterminals.

Note that a graphical user interface (GUI) is not necessarily a defining feature of UNIX, unlike other desktop operating systems, which place much stock in “look and feel.” Although CDE remains the default desktop for Solaris 9, Sun plans to integrate the GNOME window manager ( into future maintenance releases. GNOME is currently the leading desktop of Linux users. Integrating GNOME into Solaris 9 will lead to greater interoperability between Solaris and Linux systems, particularly in terms of GUI application development. It will also make porting GUI applications between Solaris and Intel easier, because Linux back-end applications have been able to be executed on Solaris Intel for some time by using lxrun.

The reasons for this distinction are largely historical and related to the UNIX design philosophy. For operating systems that are not layered, changing the window manager or even the look and feel involves rewriting significant portions of back-end code. In the Solaris environment, where the interface and display technologies are appropriately abstracted from the underlying kernel, moving from CDE to GNOME involves simply changing the command to initialize the X11 display manager; the kernel remains unmodified. The layering of the various components of a UNIX system is shown in Figure 2-1.

Click To expand Figure 2-1: Components of a UNIX system

Broadly speaking, a UNIX system is layered according to applications that are invoked through user shells, which are managed by a kernel—which in turn uses file systems to create a persistence storage mechanism. Because the kernel provides the interface between shells and the file system, (and by extension, between applications and the file system), it is considered the central part of UNIX technology.

Solaris kernels can trace their origins to both the System V and BSD variants of UNIX, while Microsoft NT was based on the Virtual Memory System (VMS) kernel originally developed for the high-end VAX systems. Most kernels during the 1960s were written using assembly language or machine (binary) code, so the development of a high-level language for writing kernels (the C language) was one of the founding ideas of UNIX. This level of abstraction from hardware meant that kernels could be ported to other hardware platforms without having to be completely rewritten. The tradition of writing kernels in C continues today, with the Linux kernel (for example) being written in C. Obviously, a kernel alone is not a complete operating environment, so many additional applications (such as the visual editor, vi) were later added to what UNIX users would recognize as the suite of standard UNIX tools.

All UNIX systems have a kernel, which is the central logical processor that provides an interface between the system hardware, the system services, and the user shells that directly enable applications. For example, support for network interfaces is provided in the form of a kernel module and a device file that logically represents the physical device. Services are defined in the services database, and network daemons provide the final layer for supporting applications that use the network to transmit data. Since UNIX kernels are typically written in the C programming language, many systems-level applications and daemons are also written in C.

Of course, UNIX systems share some common characteristics with other operating systems, including the use of a hierarchical file system in which special files called directories are used to arrange related files logically. But UNIX has some distinctive features as well: explicit permissions to read, execute, and modify files on the UNIX file system can be granted to specific users or groups of users, making it easy to share work and collaborate with other users on the system.

Because UNIX was created by active developers, rather than by operating system gurus, the focus was on creating an operating system that suited a programmer’s needs. A Bell System Technical Journal article in 1978 lists the following key guiding principles of UNIX development:

  • Create small, self-contained programs that perform a single task. When a new task needs to be solved, either create a new program that performs it or combine tools from the toolset that already exists to arrive at a solution. This is a similar orientation to the current trend toward encapsulation and independent component building (such as Enterprise JavaBeans), where complicated systems are built from smaller interacting but logically independent modules.

  • Programs should accept data from standard input and write to standard output; thus, programs can be “chained” to process each other’s output sequentially. Interactive input should be avoided in favor of command-line options that specify a program’s actions to be performed. Presentation should be separated from what a program is trying to achieve. These ideas are consistent with the concept of piping, which is still fundamental to the operation of user shells. For example, the output of the ls command to list all files in a directory can be "piped" using the "|" symbol to a program such as grep, to perform pattern matching. The number of pipes on a single command-line instruction is not limited.

  • Creating a new operating system or program should be undertaken on a scale of weeks, not years—the creative spirit that leads to cohesive design and implementation should be exploited. If software doesn’t work, don’t be afraid to build something better. This process of iterative revisions of programs has resurfaced in recent years with the rise of object-oriented development.

  • Make best use of all the tools available, rather than asking for more help. The motivation behind UNIX is to construct an operating system that supports the kinds of toolsets that are required for successful development.

This is not intended to be an exhaustive list of the kernel-oriented characteristics that define UNIX; however, these features are central to understanding the importance that UNIX developers often ascribe to the operating system. It is designed to be a programmer-friendly system.

Part I: Solaris 9 Operating Environment, Exam I