INTERIX

UNIX Overview

UNIX Primer

UNIX is the dominant operating system for industrial, commercial, scientific, medical and government enterprise computing networks. Not even Windows NT can match the installed base of UNIX systems. Contrary to popular belief, UNIX use has grown each year of its existence. In the last several years, there has been dramatic growth in its development and use. In fact, the Internet uses UNIX's native networking protocol.

The UNIX trademark is owned by The Open Group, a computing industry consortium which oversees compliance to UNIX standards. This helps to maintain the integrity of various commercial UNIX systems and applications.

UNIX was first created in 1969 in Bell Laboratories in Murray Hill,New Jersey, as a replacement and simplification of an older system, MULTICS. (Note the pun: "uni-icks" replaces "multi-icks.")

Before UNIX, most operating systems were written in hardware-dependent assembly language. One of the goals of UNIX was that it be used on various systems, therefore it was written in the C programming language, a language independent of any particular hardware.

In general, operating systems can be bare-bones (DOS, for example) or big and complex (Windows NT). While UNIX supplies more resources and provides more services than early operating systems, it doesn't try to do everything. This makes UNIX somewhat difficult for the inexperienced end-user, compared to systemslike Windows NT with (sic) intuitive user interface.

However, the underlying simplicity of UNIX gives it many advantages. It makes powerful and versatile applications easier to develop. It gives enterprise systems outstanding stability. With its open system architecture, UNIX allows the networking of multiple systems from many different vendors.

Several unique concepts reached maturity first in the UNIX system. Specifically: virtual devices, replaceable command shells, filters, processes cloning, pipes, signals and i/o inheritance.

Virtual Devices:
In UNIX systems, disks, serial i/o, networks, displays, tape drives and most other devices appear in the system as files. Most system calls that can be performed on a regular file can service virtual device files. There are three types of virtual device files in wide use: Character devices, which accept byte-at-at-time input and output commands; Block devices (such as raw disks, tapes and networks), which accept multi-byte transfers; FIFOs, which maintain the order of i/o in a complex multi-plexed architecture.

Replaceable Command Shells:
Unlike most other systems, which maintain a tight coupling between the user command line and the operating system, UNIX takes a liberal approach to command shells. The user command line interface in UNIX systems is just another application that uses standard UNIX services to spawn applications and maintain I/O hierarchies. As a result, there has been much experimentation with shells in the UNIX community. Today, there are four dominant shells in use, with many variations and branches from which to choose:

Bourne Shell - the historic shell which shipped in 1979 with UNIX version 7. This shell is the least common denominator of all modern shells. It is powerful, but lacks advanced features such as data structures and job control.

Korn Shell - a superset of the Bourne Shell, with advanced editing, aliasing, data structures and job control.

C Shell - the original Berkeley shell which uses a "C" programming like syntax for shell commands.

BASH - the powerful GNU shell which has gained in popularity over the last several years.

Filters:
In UNIX systems, the output of one command can be used as input to the next command. While normally limited to ASCII or other Alpha/Numeric data, the filter concept is powerful and extensible. A good shell programmer can accomplish as much with ten lines of UNIX filtered commands as a 3-GL programmer might accomplish in ten thousand lines of traditional code. In the filter model, discrete tools and utilities are used in daisy-chain fashion to parse and manipulate data until a desired result is achieved.

Process Cloning:
In UNIX systems, processes are instantiated by a two-step method. First the parent process clones itself with the fork() command. The two resulting processes are identical in every way except for the return code from the fork() call itself. The child process then identifies itself by its unique return code from fork() and overlays itself with a new process using the exec() system call. This two-step method seems cumbersome until the programmer learns to combine i/o inheritance with process initiation - at which time, it can be seen that the UNIX process model is elegant and powerful.

Pipes:
Pipes are transient fifos that are typically used for inter-process communication (IPC). UNIX pipes operate on the same principal as regular and special files, but do not normally exist as discrete file system entries. Pipes are created with the pipe() system call in UNIX.

Signals:
Signals are the mechanism by which a process suspends normal command flow and handle an external event or "catch a signal." Signals can be sent by hardware devices, other processes, command line users or the process' parent.

I/O Inheritance:
When a process is initiated with an exec() system call, it inherits all of the open files, pipes, devices and i/o streams held open by the parent. By selective use of opening and closing desired files just prior to the exec() call, the parent process can create an elegant multi-process system which can share data and events.

Elegance:
Perhaps the most difficult aspect of the UNIX system for newcomers is that it is an additive system. Each of the fundamental parts is simple - in combination, they create a powerful, flexible system environment.

BIG PICTURE INTRO

UNIX OVERVIEW

NT OVERVIEW

MERGING UNIX, NT

INTERIX ARCHITECTURE

(end of Interix borrowage, begin cLIeNUXage)

USER SKILLS

Interex has put it very well. As a re-hash of the above, what all this means is that there are a few important concepts that a cLIeNUX user wants to be aware of...

Everything is a file

Input and output to, from and between commands can include hardware and virtual devices with the exact same syntax as files. This is particularly useful with virtual devices like /dev/zero, /dev/random, /dev/null and so on. It also means disk partitions and even entire drives can be handled like files. This is dependant on unix's simple and very general model of a file as a named sequence of arbitrary bytes.

Process state is inherited

Environment variables, open files, user permissions, and all other state of a process are inherited from it's parent process. This allows a non-superuser user to spawn as many processes as is reasonable, with a simple consistant means of maintaining control over that user's permissions.

All user-space processes are descended from the state of process ID 1, usually the init program. Active processes form a tree of inheritance, which is shown by the pstree utility, or cLIeNUX status. For example, a shell script invoked by name doesn't effect the environment of the calling shell. However, a shell script can be made to assert it's state effects upon and within the calling shell by invoking it with the shell . (period) built in command.

Process IO control is external to the process

Processes have file-based input and output. Unix starts all new processes with three open file descriptors; stdin, stdout and stderr. A unix shell includes re-direction operators that can be used when a process is started to connect a process to whatever is useful. This is demonstrated by the cLIeNUX guide script. This means that much of what a user may want to do is a service of controls provided by the OS, and not just what applications and utilities provide.

There is one filesystem namespace

The unix filesystem namespace is unified. It is not divided by device. Filesystems on various devices must be mounted on the root filesystem. This is somewhat tedious, particularly with floppies, but is well worth the tedium for the consistancy that results. Work-arounds exist to make floppies auto-mount. cLIeNUX Core doesn't include them.

Use The Source

Unix makes very little distinction between programmer and user. This is very difficult for the new user, but very empowering. Far too often, traditional unix documentation often assumes some knowledge of programming, and often some knowledge of C or utilities ancillary to the C programming language. I have tried to reduce this in cLIeNUX. Even so, this is obviously difficult, but has fundamental advantages.

AT&T wasn't allowed to sell software when they wrote UNIX. They gave UNIX away to many large universities, with sourcecode. Unix has always been relatively open. Classic sources can still be had for a reasonable fee. UNIX thus became a hotbed of development. The Internet is one result of this, to a large extent. Unlike a closed-source software product, in cLIeNUX reading and modifying the sources is not only normal, but encouraged, and in fact almost unavoidable. The lack of proprietariness in the sourcecode itself helps to keep things simple, modular, interoperable, and flexible. The consequences of breaking older versions of things is much reduced.

As a user, this means you should be pleased that the docs are often over your head, rather than constantly telling you "You don't want to know that." In cLIeNUX, you can find out anything you personally are capable of learning. The system itself puts no limits on your skill, and no part of the system is beyond your reach for re-use or modification. This also means you want to at least glance at the programming and C seedocs. This is also why traditional unix docs are often very dry. They tell you want the program does, not what it is for. What it is for is your business, and your problem. This way the docs don't get in the way of people that know what they want.

When you configure a program from source, such as the Linux kernel, you are actually changing the C sourcecode. If you weren't allowed access to sourcecode this would be a much more complex and/or less flexible process than it inately is. Knowing about make , cpp and so on will help, and will empower you.

Two tools are better than one

Although unix apps aren't immune to creeping featurism, and often try to become operating systems in and of themselves, you don't have to play along. This extends to cLIeNUX itself. Linux is free. Try several. The pervasiveness of "What's the best such-and-such?" is based on the idea that you only want one such-and-such, which is often not the case in open source where it would be with other software. THe only significant cost of most open source software is the cost of learning it. That is often a significant cost, of course, but applications that are designed with this in mind usually have a high degree of consistancy with other unix applications.

ed is the standard text editor

ed is the editor the primary author of UNIX wrote for UNIX. Most unix text utilities are descended from it. It's very powerful, but maximally terse. It's hard to learn, but give it a day or two, because it's the most revealing thing about unix besides C.