User:Erbingha/Basics

From WolfTech
Jump to navigation Jump to search

General overview of the Unix operating system. Lists main features, advantages and disadvantages of Unix.

Strictly speaking, the term "UNIX Operating System" refers only to those operating systems that have passed the UNIX standards test of the X-Open Foundation, which owns the UNIX trademark. X-Open acquired the trademark and standards from AT&T, the original creator of UNIX. In practice, "UNIX" refers to any operating system that provides the programs, commands, and programming interfaces normally found on official "UNIX". There are two main variants of UNIX, which have roots in the same original source code from the 1970s and 1980s: System V (AT&T) and Berkeley UNIX, whose last version is called 4.4BSD. There is also one important UNIX "work-alike" -- Linux -- that looks like UNIX to most users and programmers, but has a totally separate origin and shares no source code with official "UNIX". Also, note that the core of the new MacOS X is straight Berkeley UNIX. To the normal user, the biggest difference among these variants of UNIX is the type of shell, or command interpreter, you normally use when connected from a command line login, or the "look and feel" of the graphical desktop when connected via an X-Windows session. The general user programs and utilities are pretty much standardized among UNIX versions. For the system administrator or programmer who needs to use system routines, there are some important differences. The School of Earth Sciences main server computer, pangea, runs "HP Tru64 UNIX", a version originally developed by the former Digital Equipment Corporation, which was acquired by Compaq Computer Corporation, which was recently acquired by Hewlett-Packard Corporation. This version has internals based on System V UNIX, but a user interface more similar to Berkeley UNIX.

UNIX kernel - programs - shell

The UNIX operating environment is organized into three layers. The innermost level of UNIX is the kernel. This is the actual "operating system", a single large program that always resides in memory. Sections of the code in this program are executed on behalf of users to do needed tasks, like access files or terminals. Strictly speaking, the kernel is UNIX. The next level of the UNIX environment is composed of programs, commands, and utilities. In UNIX, the "basic" commands like copying or removing files are implemented not as part of the kernel, but as individual programs, no different really from any program you could write. What we think of as the commands and utilities of UNIX are simply a set of programs that have become standardized and distributed. There are hundreds of these, plus many additional utilities in the public domain that can be installed. The final level of the UNIX environment, which stands like an umbrella over the others, is the shell. The shell processes your terminal input and starts up the programs that you request. It also allows you to manipulate the environment in which those programs will execute in a way that is transparent to the program. The program can be written to handle "standard" cases, and then made to handle unusual cases simply by manipulating its environment, without having to have a special version of the program.


Command-line shell versus Graphical User Interface (GUI)

The traditional UNIX user interface is a simple command-line shell. A text-only terminal window with a fixed number of lines (usually 24) and columns (usually 80) is controlled by the shell program. The shell prints a prompt when it is ready to receive commands. You use the keyboard to type in a command. Then the shell parses and processes the command and executes it for you. The command prints its output, if any, to the same terminal window. When the command is done, the shell prompts you again to enter another command. In general, the terminal window has no graphics capability, although there are specialized graphics terminals and some UNIX programs know how to display (usually monochrome) images on them. Modern personal computers have all moved away from command-line interfaces and created graphical user interfaces (GUI). In a GUI, there are menus or pictoral displays showing all programs that you can run and files that you can access. A pointing device (usually a mouse) is used to select items from the menus or displays. Individual programs open a "window" within the monitor to display their output, and can display either text or color graphics as needed. The keyboard is primarily used to enter text or data, although there are often keyboard equivalents to the various menu options. There is a GUI shell available for UNIX systems, called "X-Windows" or simply "X". This GUI has all the same features that you would find on a personal computer. In fact, the version used most commonly on modern UNIX systems (CDE) is made to look very much like Microsoft Windows. The X-Window system goes beyond personal computer GUIs in that the GUI and the programs that you run within the GUI can be executed on one or more networked computers, such as servers, but all the windows can be displayed on one networked computer or a simple X-terminal device. UNIX programs that date from the traditional command-line days have to be rewritten to make use of the X-Window GUI system, so the standard X-window environment usually includes a simple terminal window running the traditional UNIX shell. That can be used to execute the many traditional commands that do not directly interface to the X-Window GUI. These notes and the GP111 course will primarily use the UNIX command-line shell interface. This simplifies the teaching of the basic UNIX concepts. Some of the most powerful features of UNIX are the ability to link programs together and use programable utility programs for complicated data manipulations. These types of programs are still primarily command-line oriented. The command-line interface will also work over any type of network or telephone link, using any type of dumb terminal or simple computer as the display, so it is more adaptable. People who generally use an X-window workstation or terminal can still run all the command-line programs and commands described in these notes from the "shell" or "terminal" window.

UNIX Processes

A process is an instance of a program, with its needed environment of file connections, etc., running in the CPU. In UNIX, every command or program you run becomes a separate process that is or can be independent of every other one, unlike some systems where you have a single interactive environment that can only execute programs one at a time sequentially. Processes can also be combined in interesting ways to do complicated tasks.

Advantages of UNIX

  • Full multitasking with protected memory. Multiple users can run multiple programs each at the same time without interfering with each other or crashing the system.
  • Very efficient virtual memory, so many programs can run with a modest amount of physical memory.
  • Access controls and security. All users must be authenticated by a valid account and password to use the system at all. All files are owned by particular accounts. The owner can decide whether others have read or write access to his files.
  • A rich set of small commands and utilities that do specific tasks well -- not cluttered up with lots of special options. UNIX is a well-stocked toolbox, not a giant "do-it-all Swiss Army Knife".
  • Ability to string commands and utilities together in unlimited ways to accomplish more complicated tasks -- not limited to preconfigured combinations or menus, as in personal computer systems.
  • A powerfully unified file system. Everything is a "file": data, programs, and all physical devices. Entire file system appears as a single large "tree" of nested directories, regardless of how many different physical devices (disks) are included.
  • A "lean" kernel that does the basics for you but doesn't get in the way when you try to do the unusual.
  • Available on a wide variety of machines - the most truly "portable" operating system.
  • Optimized for program development, and thus for the "unusual" circumstances that are the rule in research. Disadvantages of UNIX
  • The traditional command line shell interface is "user hostile" -- designed for the programmer, not the casual user.
  • Commands often have cryptic names and give very little response to tell the user what they are doing. Much use of special keyboard characters - little typos have unexpected results!
  • To use UNIX well, you need to understand some of the main design features. Its power comes from knowing how to make commands and programs interact with each other, not just from treating each as a fixed "black box".
  • Richness of utilities (over 400 "standard" ones) often overwhelms novices. Documentation is short on examples and tutorials to help you figure out how to use the many tools provided to accomplish various kinds of tasks -- thus the need for these notes and the GP111 "Introduction to UNIX for Earth Scientists" course.