KC7MM Wiki

Amateur Radio with KC7MM

User Tools

Site Tools


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)

9. The Linux application layer

Layer 2 of the Linux system


A computer operating system has two main tasks:

  1. Provide a software interface through which the system's hardware can be accessed.
  2. Provide an environment in which application programs can be run.

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.

What it does

The application layer does two things:

  1. It provides an environment in which programs can be executed.
  2. It gives users an interface through which they can interact with the system, in real time. This allows them to:
    • Start and stop programs, and work with them while they are running.
    • Administer the system by installing and configuring software.

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.

How it does it

It's all a shell game

Three basic elements of the Linux system come into play here. They are:

  1. Users: entities that are allowed to log into and use the computer.
  2. Permissions: user access controls for various parts of the system.
  3. The shell: a command environment in which users can operate, employing the permissions they are granted by the system administrator.

It is a multi-user design

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.

How it begins...

When a Linux system is installed on a computer, it creates a single user, named root.

  • The root user is the system administrator, and thus is granted all possible permissions.
  • Given that complete power, root often is referred to as the superuser.
  • When the system first boots up, an interactive shell is created and root is invited to log in to begin working.
  • All system configuration is done by root, including the creation of other users that have more limited permissions. These are the users who run applications.

What runs at this level?

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:

  • System services
  • User interfaces and applications
  • Application servers

System services

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.

  • The kernel runs a device driver for the network hardware that's on the system – let's say it's Ethernet. That provides access to the hardware.
  • In order to use the hardware to conduct network operations, we need additional software that implements the protocols and procedures that underlie Ethernet communications. That software runs in the application layer as a service.
  • Application programs can then call on the service whenever they need to communicate over the network.

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.

User interfaces and applications

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:

  • A set of standard Unix utilities for working with the file system and processes. These are the GNU core utilities that many of us are familiar with, such as ls, cd, cat, and grep.
  • Redirection and pipes for controlling the flow of data between files and utilities.
  • A scripting language for automating the use of utilities and programs, used to create shell scripts.
  • Editors for text files (including shell scripts), e.g. nano and vi.
  • The ability to start, stop, and interact with application programs.

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.

Application servers

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:

  • System services are confined to Linux system operations, while application servers operate in the user realm to perform the work of the computer.
  • System services run with root permissions, while application servers generally run with more limited user permissions. This allows users to administer and interact with their servers, without running the risks inherent in having superuser powers.

Summing up

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.

Return to series index

linuxusernet/inside_linux/application_layer.txt · Last modified: 2022/03/08 22:29 by KC7MM