|< Day Day Up >|
The Linux operating system has many unique and powerful features. Like other operating systems, Linux is a control program for computers. But like UNIX, it is also a well-thought-out family of utility programs (Figure 1-1) and a set of tools allowing users to connect and use these utilities to build systems and applications.
Figure 1-1. A layered view of the Linux operating system
Linux Has a Kernel Programming Interface
The heart of the Linux operating system is the Linux kernel, which is responsible for allocating the computer's resources and scheduling user jobs so that each one gets its fair share of system resources, including access to the CPU; peripheral devices, such as disk, DVD, and CD-ROM storage; printers; and tape drives. Programs interact with the kernel through system calls, special functions with well-known names. A programmer can use a single system call to interact with many kinds of devices. For example, there is one write system call, not many device-specific ones. When a program issues a write request, the kernel interprets the context and passes the request to the appropriate device. This flexibility allows old utilities to work with devices that did not exist when the utilities were originally written. It also makes it possible to move programs to new versions of the operating system without rewriting them (provided that the new version recognizes the same system calls).
Linux Can Support Many Users
Depending on the hardware and what types of tasks the computer performs, a Linux system can support from 1 to more than 1,000 users, each concurrently running a different set of programs. The per-user cost of a computer that can be used by many people at the same time is less than that of a computer that can be used by only a single person at a time. It is less because one person cannot generally use all the resources a computer has to offer. No one can keep the printers going constantly, keep all the system memory in use, keep the disks busy reading and writing, keep the Internet connection in use, and keep all the terminals busy at the same time. A multiuser operating system allows many people to use these system resources almost simultaneously. The use of costly resources can be maximized, and the cost per user can be minimized. These are the primary objectives of a multiuser operating system.
Linux Can Run Many Tasks
Linux is a fully protected multitasking operating system, allowing each user to run more than one job at a time. Processes can communicate with one another but remain fully protected from one another, just as the kernel is protected from all processes. You can run several jobs in the background while giving all your attention to the job being displayed on your screen, and you can switch back and forth between jobs. If you are running the X Window System (page 15), you can run different programs in different windows on the same screen and watch all of them. This capability ensures that users can be more productive.
Linux Provides a Secure Hierarchical Filesystem
A file is a collection of information, such as text for a memo or report, an accumulation of sales figures, an image, a song, or an executable program. Each file is stored under a unique identifier on a storage device, such as a hard disk. The Linux filesystem provides a structure whereby files are arranged under directories, which are like folders or boxes. Each directory has a name and can hold other files and directories. Directories, in turn, are arranged under other directories, and so forth, in a treelike organization. This structure helps users keep track of large numbers of files by grouping related files into directories. Each user has one primary directory and as many subdirectories as required (Figure 1-2).
Figure 1-2. The Linux filesystem structure
With the idea of making life easier for system administrators and software developers, a group got together over the Internet and developed the Linux Filesystem Standard (FSSTND), which has since evolved into the Linux Filesystem Hierarchy Standard (FHS). Before this standard was adopted, key programs were located in different places in different Linux distributions. Today you can sit down at a Linux system and know where to expect to find any given standard program.
A link allows a given file to be accessed by means of two or more different names. (Windows uses the term shortcut instead of link.) The alternative names can be located in the same directory as the original file or in another directory. Links can be used to make the same file appear in several users' directories, enabling them to share the file easily.
Like most multiuser operating systems, Linux allows users to protect their data from access by other users. It also allows users to share selected data and programs with certain other users by means of a simple but effective protection scheme. This level of security is provided by file access permissions, which limit which users can read from, write to, or execute a file. Access Control Lists (ACLs) have recently been added to the Linux kernel. ACLs give users and administrators finer-grained control over file access permissions.
The Shell: Command Interpreter And Programming Language
In a textual environment, the shell the command interpreter acts as an interface between you and the operating system. When you enter a command on the screen, the shell interprets the command and calls the program you want. A number of shells are available for Linux including these two common ones:
Because users often prefer different shells, multiuser systems can have a number of different shells in use at any given time. The choice of shells demonstrates one of the powers of the Linux operating system: the ability to provide a customized user interface.
Besides performing its function of interpreting commands from a keyboard and sending them to the operating system, the shell is a high-level programming language. Shell commands can be arranged in a file for later execution. Linux calls these files shell scripts; DOS and Windows call them batch files. Their flexibility allows users to perform complex operations with relative ease, often by using rather short commands, and to build with surprisingly little effort elaborate programs that perform highly complex operations.
When you are typing commands to be processed by the shell, you can construct patterns using characters that have special meanings to the shell. The characters are called wildcard characters. These patterns represent a kind of shorthand: Rather than typing in complete filenames users can type in patterns, and the shell will expand them into matching filenames. These patterns are called ambiguous file references. An ambiguous file reference can save you the effort of typing a long filename or a long series of similar filenames. It can also be useful when you know only part of a filename or cannot remember its exact spelling.
Device-Independent Input And Output
Devices (such as a printer or terminal) and disk files all appear as files to Linux programs. When you give a command to the Linux operating system, you can instruct it to send the output to any one of several devices or files. This diversion is called output redirection.
In a similar manner a program's input that normally comes from a keyboard can be redirected so that it comes from a disk file instead. Input and output are device independent; they can be redirected to or from any appropriate device.
As an example, the cat utility normally displays the contents of a file on the screen. When you run a cat command, you can easily redirect its output to go to a disk file instead of the screen.
One of the most important features of the shell is that users can use it as a programming language. Because the shell is an interpreter, it does not compile programs written for it but rather interprets them each time they are loaded from the disk. Loading and interpreting programs can be time-consuming.
Many shells, including the Bourne Again Shell, include shell functions that the shell holds in memory so that it does not have to read them from the disk each time you want to execute them. The shell also keeps functions in an internal format so that it does not have to spend as much time interpreting them.
Job control is a shell feature that allows users to work on several jobs at once, switching back and forth between them as desired. When you start a job it is frequently in the foreground, so it is connected to your terminal. Using job control, you can move the job you are working with into the background and continue running it there while working on or observing another job in the foreground. If a background job then needs your attention, you can move it into the foreground so that it is once again attached to the terminal. The concept of job control originated with BSD UNIX, where it appeared in the C Shell.
A Large Collection Of Useful Utilities
Linux includes a family of several hundred utility programs, often referred to as commands. These utilities perform functions that are universally required by users. An example is sort. The sort utility puts lists (or groups of lists) in alphabetical or numerical order and can be used to sort by part number, last name, city, ZIP code, telephone number, age, size, cost, and so forth. The sort utility is an important programming tool and is part of the standard Linux system. Other utilities allow users to create, display, print, copy, search, and delete files, as well as to edit, format, and typeset text. The man (for manual) and info utilities provide online documentation of Linux itself.
Pipes and filters
Linux allows users to establish both pipes and filters on the command line. A pipe sends the output of one program to another program as input. A filter is a special form of a pipe that processes a stream of input data to yield a stream of output data. A filter processes another program's output, altering it as a result. The filter's output then becomes input to another program.
Pipes and filters frequently join utilities to perform a specific task. For example, you can use a pipe to send the output of the cat utility to sort, a filter. You can then use another pipe to send the output of sort to a third utility, lpr, that sends the data to a printer. Thus, in one command line, you can use three utilities together to sort and print a file.
On a Linux system the system administrator is frequently the owner and only user of the system. This person has many responsibilities. The first responsibility may be to set up the system and install the software.
Once the system is up and running, the system administrator is responsible for downloading and installing software (including upgrading the operating system), backing up and restoring files, and managing such system facilities as printers, terminals, servers, and a local network. The system administrator is also responsible for setting up accounts for new users on a multiuser system, bringing the system up and down as needed, and taking care of any problems that arise.
|< Day Day Up >|