Table of Contents

GNU/LINUX Architecture

      • The GNU/Linux operating system is organized into a number of layers.
      • Understanding the internals of the kernel isn’t necessary for application development, knowing how the operating system is organized is important.
      • High-level architecture and Linux Kernel Architecture

 

GNU/LINUX: High-Level Architecture

      • At the core is the Linux kernel, which mediates access to the underlying hardware resources such as memory, the CPU via the scheduler, and peripherals.
      • The shell provides user access to the kernel. The shell provides command interpretation and the means to load user applications and execute them.
      • Applications provide useful functions for the operating system, such as windowing systems, Web browsers, e-mail programs, language interpreters, and of course, programming and development tools.

 

GNU/LINUX: Linux Kernel Architecture

  • GNU System Libraries (glibc): The glibc is a portable library that implements the standard C library functions, including the top half of system calls. Example printf, scanf functions defined in stdio.h
  • System Call Interface: When an application calls a function like fopen, it is calling a privileged system call that is implemented in the kernel.
  • Kernel Components: init, Process Scheduler, Memory Manager, Virtual File System, Network Interface, Inter-Process Communication (IPC), Loadable Modules.
  • Device Drivers
  • Architecture-Dependent Code
  • Hardware
Layers of GNU/LINUX: Linux Kernel Architecture
Layers of GNU/LINUX: Linux Kernel Architecture

 

 

Explanation of different layers of GNU/LINUX: Linux Kernel Architecture

 

init

      • The init component is performed upon the booting of the Linux kernel.
      • This function is very architecture dependent because different processor architectures have different init requirements.
      • After performing hardware and kernel component initialization, the init component opens the initial console (/dev/console) and starts up the init process.
      • This process is the mother of all processes within GNU/Linux and has no parent (unlike all other processes, which have a parent process).

Process Scheduler

      • The Linux kernel provides a preemptible scheduler to manage the processes running in a system.

Memory Manager

      • It provides physical to virtual memory mapping functions (and vice-versa) as well as paging and swapping to a physical disk.
      • Since the memory management aspects of Linux are processor dependent, the memory manager works with architecture-dependent code to access the machine’s physical memory.
      • While the kernel maintains its own virtual address space, each process in user space has its own virtual address space that is individual and unique.

Virtual File System

      • The Virtual File System (VFS) is an abstract layer within the Linux kernel that presents a common view of differing filesystems to upper-layer software.
      • Linux supports a large number of individual filesystems, such as ext2, Minix, NFS, and Reiser. Rather than present each of these as a unique filesystem, Linux provides a layer into which filesystems can plug their common functions (such as open, close, read, write, select, and so on).
      • The VFS also interfaces with the device drivers to mediate how the data is written to the media. The abstraction here is also useful because it doesn’t matter what kind of hard disk (or other media) is present, the VFS presents a common view and therefore simplifies the development of new filesystems.
Virtual File System GNU/Linux Layer
Virtual File System GNU/Linux Layer

 

Network Interface

      • The Linux network interface offers a very similar architecture to what we saw with the VFS.
      • The network interface component is made up of three layers that work to abstract the details of networking to higher layers while presenting a common interface regardless of the underlying protocol or physical medium (see Figure below).
      • Common interfaces are presented to network protocols and network devices so that the protocol and physical device can be interchanged based upon the actual configuration of the system. Like the VFS, flexibility was a design key.
Network Interface layer GNU/Linux
Network Interface layer GNU/Linux

 

Inter-Process Communication (IPC)

      • The IPC component provides the standard System V IPC facilities. This includes semaphores, message queues, and shared memory.
      • Like VFS and the network component, the IPC elements all share a common interface

Loadable Modules

      • Loadable kernel modules are an important element of GNU/Linux as they provide the means to change the kernel dynamically.
      • The footprint for the kernel can, therefore, be very small, with required modules dynamically loaded as needed.
      • Outside of new drivers, the kernel module component can also be used to extend the Linux kernel with new functionality.

Device Drivers

      • The device drivers component provides the plethora of device drivers that are available.
      • Almost half of the Linux kernel source files are devoted to device drivers.

Architecture-Dependent Code

      • At the lowest layer in the kernel stack is architecture-dependent code.
      • Given the variety of hardware platforms that are supported by the Linux kernel, source for the architecture families and processors can be found here.

Hardware

      • While not part of the Linux kernel, the hardware element is important to discuss given the number of processors and processor families that are supported.
      • The kernel source provides information on these supported elements.