The Linux operating system

This session concerns Linux, which is a common operating system. By operating system, we mean the suite of programs which make the computer work. Linux is used by the workstations and multi-user servers within the school.

According to the Wikipedia article on Linux [1], "Linux refers to the family of Unix-like computer operating systems using the Linux kernel. Linux can be installed on a wide variety of computer hardware, ranging from mobile phones, tablet computers and video game consoles, to mainframes and supercomputers. Linux is a leading server operating system, and runs the 10 fastest supercomputers in the world.

The development of Linux is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed, both commercially and non-commercially, by anyone under licenses such as the GNU General Public License.

Typically Linux is packaged in a format known as a Linux distribution for desktop and/or server use. Some popular mainstream Linux distributions include Debian (and its derivatives such as Ubuntu), Fedora and openSUSE. Linux distributions include the Linux kernel and supporting utilities and libraries to fulfill the distribution's intended use.

A distribution oriented toward desktop use may include a Graphical User Interface or Windowing system. Some popular windowing systems for Linux include the X Window System and the GNOME and KDE Plasma desktop environments. A distribution intended to run as a server may omit any graphical environment from the standard install and instead include other software such as the Apache HTTP Server and a SSH server like OpenSSH. Because Linux is freely redistributable, it is possible for anyone to create a distribution for any intended use. Commonly used applications with desktop Linux systems include the Mozilla Firefox web-browser, the OpenOffice.org office application suite and the GIMP image editor."

The lab systems in the CS lab are Fedora distributions running the GNOME windowing system.

Linux Architecture

Linux is a hardware independent architecture derived from UNIX. It is divided into three levels. They are user, kernel and hardware levels. The hardware level contains device drivers and machine specific components. The kernel level is a mix of machine-dependent and machine-independent software. The user level is a collection of applications, like shells, editors and utilities.

These levels may be thought of like the wheel of an automobile [2]:

  • The hardware and device drivers present a stable set of definitions to support many types of kernels, like an axle hub assembly supports the diameter and width of many rims.
  • The kernel interfaces with the hardware and device drivers and presents a stable set of interfaces to support standard Linux application programs, like a rim supports certain types of tires.
  • The application programs enable the users to accomplish meaningful work with the hardware, like getting from place to place.

Hardware & Device Drivers

At the innermost heart of Linux is the hardware. Since all hardware is different (even among manufacturers of the same type of device), a driver is used to provide a modular interface between the actual hardware device and the operating system.  Device drivers are written and distributed by the device manufacturer.

The kernel

The kernel is the main operating system component. The kernel is an interface between the applications and the hardware that does the actual work. The kernel is responsible for process/job management, memory management and  device management (via the device drivers). In addition, the kernel provides input/output (I/O) services to storage devices such as hard disk drives, thumb drives and optical drives. Finally, the kernel provides a means for user services to access its functionality called system calls. A system call by a usder process gives that process access to the kernels functionality.

As an illustration of the way that the shell and the kernel work together, suppose a user types rm myfile (which has the effect of removing the file myfile). The shell searches the filestore for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process rm myfile has finished running, the shell then returns the Linux prompt % to the user, indicating that it is waiting for further commands.

Application Programs

Application programs are the things people do with the computer. There are many different types of applications ranging from office productivity programs like OpenOffice.org to graphics programs like GIMP.  There are two special application programs that deserve their own discusstion: the shell and the windowing system.

The shell

The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. The commands are themselves programs: when they terminate, the shell gives the user another prompt ($ on our systems).

The adept user can customise his/her own shell, and users can use different shells on the same machine. Staff and students in the school have the bash (Bourne again shell)  shell by default.

The bash shell has certain features to help the user inputting commands.

Filename Completion - By typing part of the name of a command, filename or directory and pressing the [Tab] key, the bash shell will complete the rest of the name automatically. If the shell finds more than one name beginning with those letters you have typed, it will beep, prompting you to type a few more letters before pressing the tab key again.

History - The shell keeps a list of the commands you have typed in. If you need to repeat a command, use the cursor keys to scroll up and down the list or type history for a list of previous commands.

The Windowing System

Since our systems are desktop systems, the lab systems come with a windowing system as well as the shell. One very nice feature of Linux systems is that the windowing system is seperate from the kernel. This allows users the ability to choose the windowing system of their choice! (Windows does not give you this choice). The windowing system used for most Linux systems is called X Windows. The X Window System, known simply as "X", is a portable, network-transparent window system which runs on many different computers. One of the guiding philosophies of The X Window System (and also Linux itself) is that its functionality is achieved through the co-operation of separate components, rather than everything being entwined in one huge mass. The advantage of this is that a particular part of the system can be changed simply by replacing the relevant component [3].

Thus, in conjunction with the X Window system, window managers are used to actually manage the windows. The X Windows system provides the basic windowing functionality and the window manager provides the specific handeling of specific windows. More recently, desktop environments have been developed to provide a more comprehensive interface to the operating system. Examples of popular desktop environments are, GNOME, KDE, CDE and XFCE. Our lab systems run the GNOME desktop environment.

Files and processes

Everything in Linux is either a file or a process. A process is an executing program identified by a unique PID (process identifier).

A file is a collection of data. They are created by users using text editors, running compilers etc.

Examples of files:

  • a document (report, essay etc.)
  • the text of a program written in some high-level programming language
  • instructions comprehensible directly to the machine and incomprehensible to a casual user, for example, a collection of binary digits (an executable or binary file);
  • a directory, containing information about its contents, which may be a mixture of other directories (subdirectories) and ordinary files.

The Directory Structure

All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root.

Image: The Unix file structure

In the diagram above, we see that the directory ee51ab contains the subdirectory unixstuff and a file proj.txt

Starting an Terminal session

To start an Xterm session, click on the Unix Terminal icon on your desktop, or from the drop-down menus

The Unix Terminal icon

An Xterminal window will appear with a Linux prompt, waiting for you to start entering commands.

Image: A terminal window at the Linux prompt

References

  1. http://en.wikipedia.org/wiki/Linux, Wikipedia.com, viewed 1/14/11.
  2. http://www.techtinker.com/linux/LinuxArchitecture.html, TechTinker.com, viewed 1/14/11.
  3. http://xwinman.org/intro.php, viewed 1/14/11.