An operating system can be described as an interface between the computer hardware and the user of any computer. It is a group of software that handles the resources of the computer hardware and facilitates basic services for computer programs. An operating system is an essential component of system software within a computer system. The primary aim of an operating system is to provide a platform where a user can run any program conveniently or efficiently.
The operating system controls the jobs and programs that are vital to system health and stability. It also provides these functions: Assigns software to users, Helps detect errors and implements measures to prevent complete system failures, And performs file management tasks.
Linux is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds.
Linux was originally developed for personal computers based on the Intel x86 architecture but has since been ported to more platforms than any other operating system. Because of the dominance of the Linux-based Android on smartphones, Linux also has the largest installed base of all general-purpose operating systems. Linux is the leading operating system on servers (over 96.4% of the top 1 million web servers’ operating systems are Linux), and is the only OS used on TOP500 supercomputers.
Advantages
The main advantage of Linux, is it is an open-source operating system. Linux is freely available to use on the internet. This means the source code is easily available for everyone and you are allowed to contribute, modify and distribute the code to anyone without any permissions.
It has large community support.
The performance of the Linux system is much higher than other operating systems. It allows a large number of people to work at the same time and it handles them efficiently. It is network friendly.
Moreover, Linux is highly modular and easily configured. This makes it easy to squeeze optimal performance from a variety of hardware platforms. Plus, with the source code available, vendors can tweak applications and utilities to meet specific requirements.
In terms of security, Linux is more secure than any other operating system. It does not mean that Linux is 100 percent secure it has some malware for it but is less vulnerable than any other operating system. So, it does not require any anti-virus software.
Key to the success of Linux has been the availability of free software packages under the auspices of the Free Software Foundation (FSF). FSF’s goal is stable, platform-independent software that is free, high quality, and embraced by the user community. FSF’s GNU projec2 provides tools for software developers, and the GNU Public License (GPL) is the FSF seal of approval.
Linux Architecture
Linux is primarily divided into User Space & Kernel Space. These two components interact through a System Call Interface – which is a predefined and matured interface to Linux Kernel for Userspace applications.
The main components of the operating system, starts from the hardware, up to the kernel, basic libraries, and device drivers, etc., and then showing on top of that, both the graphical interface and some of the most important applications, such as tools used by applications, such as Apache, etc.
Hardware Layer: The lowest layer in the Linux system is the hardware, consisting of the physical electronic devices that make up your computer. This layer can include the following: The central processing unit, or CPU, which is responsible for executing most calculations. The random access memory, or RAM, which is a fast storage unit used to hold the temporary information your applications need to run. Storage for data that needs to persist when your computer is powered off. Your computer’s screen. And any USB devices such as a keyboard, mouse, or USB drive.
Kernel: In a Linux system, the operating system is built on top of the Linux kernel, which performs the most vital operations. It is the lowest-level software in a Linux system and has complete control of the system. The kernel starts as soon as your computer boots and remains in your computer’s memory while it’s running. It acts as a bridge between your apps and your machine hardware, enabling the two to communicate effectively. The kernel has four key jobs: Memory management, Process management, Managing device drivers for proper hardware support, And system calls and security assurance. It virtualizes the common hardware resources of the computer to provide each process with its virtual resources. This makes the process seem as if it is the sole process running on the machine. The kernel is also responsible for preventing and mitigating conflicts between different processes. Different types of the kernel are: Monolithic Kernel, Hybrid kernels, Exo kernels, and Micro kernels
System Library: In addition to the basic kernel, the operating system has to include important system libraries. It is an interface to the kernel which hides the complexity of the kernel’s functions from the users. Usually, these are shared libraries or dynamic linked libraries that can be used by more than one program at a time without wasting more memory, and the most important one is libc. Almost every application uses libc. Then, there are all sorts of system services or applications that often run in the background waiting for a task to be done. These are often called daemons. Is the special types of functions that are used to implement the functionality of the operating system.
Applications are the software that enables a user to perform a task in a Linux system. Applications can include the following: System tools, such as compilers. Programming languages. Shells, which are special applications that are often part of the operating system itself. And user apps, which can be anything from browsers, to text editors, to games.
Shell: The Linux shell is an OS-level application that interprets commands. It takes commands from the user and executes the kernel’s functions. It also enables access to files, utilities, and applications, and is an interactive scripting language. You can use shell commands to perform tasks such as moving and copying files, writing to and reading from files, extracting and filtering data, and searching for data. Additionally, you can use a shell to automate tasks.
The shell is available in distinct types of OSes. These operating systems are categorized into two different types, which are the graphical shells and command-line shells.
The graphical line shells facilitate the graphical user interface, while the command line shells facilitate the command line interface. Thus, both of these shells implement operations. However, the graphical user interface shells work slower as compared to the command-line interface shells.
The most common command shell program and the default one for Linux is called bash, which stands for Bourne Again Shell. A terminal is an application, or user interface, where you enter the commands you want to run and receive any output from those commands.
Now, most users on a desktop or laptop will be using a graphical user interface or GUI. Traditionally, Linux systems all used the X Windows system, often just called X. On top of that, there has to be a window manager which controls the actual behavior of windows and their appearance, and on top of that even a desktop manager that controls the entire desktop, and that’s what the user really feels the most common choices in Linux are GNOME and KDE.
System Utility: It provides the functionalities of an operating system to the user. Basic system utilities that are used every day by system administrators include those which let you look at files, view them, edit them, rename them, remove them, that lets you bring network connections up and down, etc.
Also, many developer tools are supplied quite easily on any Linux distribution. These include compilers, debuggers, etc. They’re not additional software that has to be paid for or installed, they are always available on all Linux distributions.
Text Editors: You use text editors to write code in your Linux environment. There are many editors to choose from and they can be grouped into two main categories: Command-line text editors And GUI [Graphical User Interface] text editors
Examples of command-line text editors are: GNU nano, a small and friendly modeless text editor vi, a traditional command-line editor originally created for Unix And vim, a powerful mode-based command line-editor based on vi.
A popular GUI-based editor is gedit, which is the default editor from the GNOME environment. And emacs (e’-max) is another text editor that is one of the oldest free, open source projects still under development. You can use emacs in GUI mode or within a command line.
Gedit is a popular, modern text editor that comes preinstalled on most Linux distros. It’s designed as a general-purpose text editor and in keeping with the philosophy of the GNOME project, it emphasizes simplicity and ease of use, with a clean and simple GUI. Gedit provides many features to enhance your text editing experience, including: An integrated file browser Undo and redo functionality Search and replace functions with support for regular expressions in the search string And extensibility using plugins from the gedit-plugins package. The text editor uses syntax color coding to help you interpret and focus on different aspects of your code.
GNU nano is a command-line text editor that provides: Undo and redo features Search and replace with support for regular expressions in the search string Syntax highlighting Automatic indentation of code Line numbering Line-by-line scrolling And multiple buffers so you can work with many files at the same time .
Linux Distribution
Linux is typically packaged in a Linux distribution. A full Linux distribution and a computer running it, require many ingredients besides just the Linux kernel. And today, there are hundreds of Linux distros, each tailored for a specific audience or task. Each Linux distro includes a unique set of default utilities that are part of the operating system, such as commands and applications that come prepackaged with the distribution.
Each distro has its own graphical user interface, or GUI, that you use to interact with the operating system. Each distro supports a specific set of commands that you can use in the shell, a window for entering and receiving output from commands. And lastly, each distro provides differing levels of support. It could be developed and managed as a community-backed project or maintained by a commercial enterprise.
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Popular Linux distributions include Debian, Fedora Linux, and Ubuntu, which in itself has many different distributions and modifications, Including Lubuntu and Xubuntu. Commercial distributions include Red Hat Enterprise Linux and SUSE Linux Enterprise.
Debian is one of the earliest-rooted distros, known for being stable, reliable, and fully open source. It supports many computer architectures (or types of hardware). These features result in Debian being highly regarded in the server space. Furthermore, Debian is the largest
the community-run distro is currently available.
Another popular distro is Ubuntu. Ubuntu is Debian-based, meaning that it’s built on top of Debian and uses a lot of the same tools as the Debian OS. Ubuntu is developed and managed by Canonical. And Ubuntu has three official editions: Desktop (for personal computers, laptops, and workstations) Server (for simple file servers or multinode clouds) and Core (for the Internet of Things).
Red Hat is known for being stable, reliable, and fully open source. It’s managed by Red Hat, an IBM subsidiary. Today it ships as Red Hat Enterprise Linux (or RHEL), an edition focused entirely on enterprise customers.
Fedora is known as a stable operating system that supports many architectures. It’s also very reliable and secure, offering unique firewall and security features. It’s actively developed, with
a large and growing community.
Another Linux distro is SUSE Linux Enterprise. Also known as SLE, SUSE Linux Enterprise is available in two editions: Server, or SLES and Desktop, or SLED. It supports many architectures,
such as ARM for Raspberry Pi, and uses the SUSE Package Hub, which enables users to install packages that aren’t officially part of SLE.
The unique, do-it-yourself approach of Arch Linux allows users to customize every part of their system. This makes it highly configurable; freedom that makes Arch very popular.
Installing Software and Updates: Both software updates and software installation files for Linux operating systems are distributed in files known as packages. These packages are archive files containing the required components for either installing new software or updating existing software. You use package managers to manage the download and installation of packages. Different Linux distros provide different package managers—some are GUI-based and some are command line tools.
They are distinct file types containing software or updates for different Linux operating systems. .deb files are used for Debian-based distributions such as Debian, Ubuntu, and Mint. Deb stands for Debian. And .rpm files are used for Red Hat-based distributions such as CentOS/RHEL, Fedora, and openSUSE. RPM stands for Red Hat Package Manager.
You use the “sudo apt update” command to find available packages for your distro. The output of this command lists each available package, builds a dependency tree, and lets you know how many packages can be upgraded. To install the packages, use the “sudo apt upgrade” command.
Deb and RPM formats are equivalent, so the contents of the file can be used on other types of Linux OSs. If you find that a package that you want to use is only available in the other format you
can convert it using the alien tool. To convert packages from RPM format to deb, simply use the alien command and specify the package name that you want to convert. To convert to RPM
format, use the –r switch with the alien command.
GUI-based Linux distro package managers include PackageKit and Update Manager. Update Manager is a GUI tool for updating deb-based Linux systems. PackageKit is a GUI tool for
updating RPM-based Linux systems.
Linux Design Principles
GNU/Linux is a multi-user OS. This means not merely that several users can use a single machine, each having their own customized environments, but that several users may use a single machine at the same time, either by logging on from a terminal or another computer, or by leaving a running process after logging out.
In a multiuser system, each user has a private space on the machine; typically, he owns some quota of the disk space to store files, receives private mail messages, and so on. All users are identified by a unique number called the User ID, or UID. To selectively share material with other users, each user is a member of one or more user groups , which are identified by a unique number called a user group ID . Each file is associated with exactly one group.
Linux is a multiprocessing operating system. Processes carry out tasks within the operating system. A program is a set of machine code instructions and data stored in an executable image on disk and is, as such, a passive entity; a process can be thought of as a computer program in action.
The Linux kernel exists in the kernel space, below the userspace, which is where the user’s applications are executed. The code of the kernel component runs in a unique privilege mood known as kernel mode along with complete access to every computer resource. This code illustrates an individual process, runs in an individual address space, and doesn’t need the context switch. Hence, it is very fast and efficient. Kernel executes all the processes and facilitates various services of a system to the processes. Also, it facilitates secured access to processes to hardware.
The architectural perspective of the Linux kernel consists of System call interface, Process Management, the Virtual File system, Memory Management, Network Stack, Architecture, and the Device Drivers.
For the userspace to communicate with the kernel space, a GNU C Library is incorporated which provides a forum for the system call interface to connect to the kernel space and allow transition back to the userspace. A library contains functions that the applications work with. The libraries then, through the system call interface, instruct the kernel to perform a task that the application wants.
System calls: Applications pass information to the kernel through system calls. The system call is the means by which a process requests a specific kernel service. There are several hundred system calls, which can be roughly grouped into six categories: filesystem, process, scheduling, interprocess communication, socket (networking), and miscellaneous.
Process management; is mainly there to execute the processes. These are referred to as the thread in a kernel and are representing the individual virtualization of the particular processor. Processes are separate tasks each with their own rights and responsibilities. If one process crashes it will not cause another process in the system to crash. Each individual process runs in its own virtual address space and is not capable of interacting with another process except through secure, kernel-managed mechanisms.
During the lifetime of a process, it will use many system resources. It will use the CPUs in the system to run its instructions and the system’s physical memory to hold it and its data. It will open and use files within the filesystems and may directly or indirectly use the physical devices in the system. Linux must keep track of the process itself and of the system resources that it has so that it can manage it and the other processes in the system fairly. It would not be fair to the other processes in the system if one process monopolized most of the system’s physical memory or its CPUs.
The most precious resource in the system is the CPU, usually there is only one. Linux is a multiprocessing operating system, its objective is to have a process running on each CPU in the system at all times, to maximize CPU utilization. If there are more processes than CPUs (and there usually are), the rest of the processes must wait before a CPU becomes free until they can be run.
Signals: The kernel uses signals to call into a process. For example, signals are used to notify a process of certain faults, such as division by zero.
Memory management; memory is managed in what are known as pages for efficiency. Linux includes the methods in which to manage the available memory as well as the hardware mechanisms for physical and virtual mappings. Swap space is also provided
File systems Provide a global, hierarchical namespace for files, directories, and other file-related objects and provides file system functions. The Linux filesystem is the collection of files on your machine. It includes the files needed to run the machine and applications as well as your own files containing your work. The top level of the filesystem is the root directory, symbolized by a forward slash (/). Below is a tree-like structure of the directories and files in the system. And the filesystem assigns appropriate access rights to the directories and files.
The very top of the Linux filesystem is the root directory, which contains many other directories and files. One of the key directories is /bin, which contains user binary files. Binary files contain the code your machine reads to run programs and execute commands. It’s called “slash bin” to signify that it exists directly below the root directory. Other key directories include /usr, which
contains user programs, /home, which is your personal working directory where you should store all your personal files, /boot, which contains your system boot files, the instructions vital for system startup, and /media, which contains files related to temporary media such as CD or USB drives that are connected to the system.
Virtual file system; it provides a standard interface abstraction for the file systems. It provides a switching layer between the system call interface and the file systems supported by the kernel.
Network stack; is designed as a layered architecture modeled after the particular protocols. Network protocols: Supports the Sockets interface to users for the TCP/IP protocol suite. Network device drivers: Manages network interface cards and communications ports that connect to network devices, such as bridges and routers.
Processes and scheduler: Creates, manages, and schedules processes.
Virtual memory: Allocates and manages virtual memory for processes
Traps and faults: Handles traps and faults generated by the processor, such as a memory fault.
Physical memory: Manages the pool of page frames in real memory and allocates pages for virtual memory.
Interrupts: Handles interrupts from peripheral devices. As the name suggests, interrupt signals provide a way to divert the processor to code outside the normal flow of control. When an interrupt signal arrives, the CPU must stop what it’s currently doing and switch to a new activity; it does this by saving the current value of the program counter (i.e., the content of the eip and cs registers) in the Kernel Mode stack and by placing an address related to the interrupt type into the program counter.
Device drivers; a significant part of the source code in the Linux kernel is found in the device drivers that make a particular hardware device usable. In Linux environments, programmers can build device drivers as parts of the kernel, separately as loadable modules, or as user-mode drivers (for certain types of devices where kernel interfaces exist, such as for USB devices).
Architecture-dependent code; those elements that depend on the architecture on which they run, hence must consider the architectural design for normal operation and efficie
Linux kernels have most of their functionality contained in modules that are put into the kernel dynamically. This in contrast to monolithic types, is referred to as modular kernels, a number of which can be automatically loaded and unloaded on demand.
In essence, a module is an object file whose code can be linked to and unlinked from the kernel at runtime. Typically, a module implements some specific function, such as a filesystem, a device driver, or some other feature of the kernel’s upper layer. Such a setup allows a user to load or replace modules in a running kernel without the need of rebooting. A module does not execute as its own process or thread, although it can create kernel threads
The Linux kernel associates a special file with each I/O device driver. Block, character, and network devices are recognized.
Linux boot and startup processes
There are two sequences of events that are required to boot a Linux computer and make it usable: boot and startup. The boot sequence starts when the computer is turned on, and is completed when the kernel is initialized and systemd is launched. The startup process then takes over and finishes the task of getting the Linux computer into an operational state.
The first step of the Linux boot process really has nothing whatever to do with Linux. This is the hardware portion of the boot process and is the same for any operating system. When power is first applied to the computer it runs the POST (Power On Self Test) which is part of the BIOS (Basic I/O System).
BIOS POST checks the basic operability of the hardware and then it issues a BIOS interrupt, INT 13H, which locates the boot sectors on any attached bootable devices. The first boot sector it finds that contains a valid boot record is loaded into RAM and control is then transferred to the code that was loaded from the boot sector.
The boot sector is really the first stage of the boot loader. There are three boot loaders used by most Linux distributions, GRUB, GRUB2, and LILO. GRUB2 is the newest and is used much more frequently these days than the other older options.
The primary function of either GRUB is to get the Linux kernel loaded into memory and running. The bootstrap code, i.e., GRUB2 stage 1, is very small because it must fit into the first 512-byte sector on the hard drive along with the partition table. Because the boot record must be so small, it is also not very smart and does not understand filesystem structures. Therefore the sole purpose of stage 1 is to locate and load stage 1.5.
Stage 1.5 of GRUB must be located in the space between the boot record itself and the first partition on the disk drive. This space was left unused historically for technical reasons. Because of the larger amount of code that can be accommodated for stage 1.5, it can have enough code to contain a few common filesystem drivers, such as the standard EXT and other Linux filesystems, FAT, and NTFS. The function of stage 1.5 is to begin execution with the filesystem drivers necessary to locate the stage 2 files in the /boot filesystem and load the needed drivers.
The function of GRUB2 stage 2 is to locate and load a Linux kernel into RAM and turn control of the computer over to the kernel. The kernel and its associated files are located in the /boot directory. The kernel files are identifiable as they are all named starting with vmlinuz. You can list the contents of the /boot directory to see the currently installed kernels on your system.
All of the kernels are in a self-extracting, compressed format to save space. The kernels are located in the /boot directory, along with an initial RAM disk image, and device maps of the hard drives.
After the selected kernel is loaded into memory and begins executing, it must first extract itself from the compressed version of the file before it can perform any useful work. Once the kernel has extracted itself, it loads systemd, which is the replacement for the old SysV init program, and turns control over to it.
This is the end of the boot process. At this point, the Linux kernel and systemd are running but unable to perform any productive tasks for the end user because nothing else is running.
The startup process
The startup process follows the boot process and brings the Linux computer up to an operational state in which it is usable for productive work. systemd is the mother of all processes and it is responsible for bringing the Linux host up to a state in which productive work can be done.
First, systemd mounts the filesystems as defined by /etc/fstab, including any swap files or partitions. At this point, it can access the configuration files located in /etc, including its own. It uses its configuration file, /etc/systemd/system/default.target, to determine which state or target, into which it should boot the host.
The sysinit.target starts up all of the low-level services and units required for the system to be marginally functional and that are required to enable moving on to the basic.target.
After the sysinit.target is fulfilled, systemd next starts the basic.target, starting all of the units required to fulfill it. The basic target provides some additional functionality by starting units that are required for the next target. These include setting up things like paths to various executable directories, communication sockets, and timers
References and Resources also include:
https://opensource.com/article/17/2/linux-boot-and-startup