A Look Inside Linux series
A series of short topics on how Linux works and how to make it work the way you want it to, which I present during the weekly sessions of the Linux User Net. The target audience is Hams who are new to Linux and want to know more about it, as well as experienced Linux users who can learn more about their chosen operating system. These are my notes for the presentations. (Russ, KC7MM)
Layer 2 of the Linux system
A computer operating system has two main tasks:
Last week we looked at the Linux kernel, which carries out the first of those tasks. It's the first layer of the Linux OS.
Today we'll look at the application layer, which runs on top of the kernel to perform the second task. Here is where we can run the software does the work we need done.
The application layer does two things:
This layer is where the real work of the computer is done, where it performs the tasks that do useful work for its users. Here is where servers for things such as databases and Web sites run in the background, while at the same time users can work directly with the system in the foreground via a command line interface.
Three basic elements of the Linux system come into play here. They are:
Linux is designed from the ground up to be a multi-user system. That is, any number of users can simultaneously log in and work independently of each other, limited only by the available system resources.
This capability is implemented through the mechanism of users executing programs in shells.
Every program is run this way. A user is given a shell, which inherits the user's permissions. The user can then use those permissions to run programs.
When a Linux system is installed on a computer, it creates a single user, named root.
There's a lot going on in a Linux system, and much of it happens in this application layer. It breaks down into three basic categories:
Basic system services such as networking, printing, and audio run at this level. We saw that the Linux kernel makes the system's hardware available through software interfaces. Programs running in the application layer connect to those interfaces and use them to implement the protocols needed to make them useful to applications.
Let's take network services as an example.
Services run in the background. That is, they are configured and then left to run on their own, without direct user interaction. These services are referred to as daemons.
These services run with root permissions, so they can be started, stopped, and configured only by the system administrator.
Here we get to programs that do the things that motivate people to build and use computers: to do work that is useful to us.
The system gives us the capability of working with these programs by providing an interactive shell. The shell writes to the screen a prompt for us to log in as a user. Once logged in, the shell gives us the ability to run programs and to interact with them. We are working at the command line. This is often referred to as the command line interface, or CLI.
Why a CLI? Well, Linux is an implementation of a Unix-like system. In the days when Unix was created, the means of user interaction with a computer was a teletype machine, (TTY), called a terminal. (In a modern Linux system, our terminal is a program that emulates the operation of a TTY on a video screen.)
By necessity, the Unix user interface was written to work within the capabilities of the terminal, which consisted of of plain text characters and some control codes (hence the
Ctl key). User commands were typed out on the keyboard, and data from the computer was printed out on scrolling paper sheets.
Back to the shell. There are many shells available for Linux. The one most used for interactive sessions is the BASH shell. It provides:
The CLI is loved by many, feared by some. On a Linux system that has a graphical user interface, using the CLI is an option. In my computer use, I find that it works better than the GUI for many tasks, so it gets used often. You can think of it as a handy tool in your Linux toolbox, one you can grab when you feel the need.
These are application programs that run unattended: they run as daemons, with no CLI.
They are accessed through an I/O interface (most often TCP/IP). They provide services such as Web pages, databases, messaging, network file storage, code repositories. (Many ham radio programs use
rigctld for rig control; it runs as an application server.)
The manner in which application servers are run in the background resembles the system services we talked about earlier, with a couple of major differences:
The application layer is where the work of the computer is done, by running application programs.
It's here that we users can log into the system and use it for our particular purposes.
The interface that's available here is the text-based command line terminal.
Next time we'll look at the Linux layer that provides the capability of working with graphics.