No history yet

Linux Architecture

The Layers of Linux

An operating system isn't a single, monolithic program. It's a stack of different software layers, each with a specific job. Think of it like a building. At the very bottom, you have the physical foundation and structure. Above that are the core systems like plumbing and electricity. Finally, you have the rooms and the people who use them. Linux is built in a similar way, with distinct layers that handle everything from the raw hardware to the applications you use every day.

Foundation and Core

The lowest level is the Hardware Layer. This is all the physical stuff you can touch: the CPU, memory (RAM), storage drives, and network cards. This layer provides the basic resources that the entire system is built upon. The operating system's fundamental purpose is to manage this hardware and make it available to software.

Lesson image

Sitting directly on top of the hardware is the most critical piece of the OS: the Kernel. It's the bridge between the hardware and the software. The kernel has complete control over everything in the system. When an application needs to access memory, write a file to a disk, or send data over the network, it has to ask the kernel for permission. The kernel coordinates all these requests, ensuring that programs don't interfere with each other and that hardware resources are shared fairly.

The Linux® kernel is the main component of a Linux operating system (OS) and is the core interface between a computer’s hardware and its processes.

The kernel handles several key tasks:

  • Process Management: Deciding which programs get to use the CPU and for how long.
  • Memory Management: Keeping track of which parts of RAM are in use, by whom, and allocating it to new processes.
  • Device Drivers: Acting as a translator between the hardware (like a printer or graphics card) and the software that wants to use it.
  • System Calls: Providing a secure way for applications to request services from the kernel.

Life in User Space

Everything that isn't the kernel or the hardware exists in what's called User Space. This is where your applications, files, and day-to-day interactions happen. Unlike the kernel, programs in user space have restricted access to hardware. They must go through the kernel to get anything done. This separation is a crucial security feature; a crashing application in user space won't take down the entire operating system.

User space itself is made up of several important parts.

System Libraries: These are shared collections of code that applications use to perform common tasks. For instance, instead of every application developer writing code from scratch to open a file, they can simply use a function from a system library (like the C standard library, libc). These libraries then make the necessary system calls to the kernel on the application's behalf.

System Utilities: These are the programs that perform system management tasks. When you format a disk, create a user, or configure a network connection, you're using a system utility. These are just regular programs, but their purpose is to manage the system.

Finally, we have the Shell. This is a special program that provides an interface for the user to interact with the kernel. When you type a command into a terminal, the shell is what reads your command, interprets it, and tells the kernel what to do.

Shell

noun

A command-line interpreter that acts as an interface between the user and the operating system's kernel. It executes commands read from standard input or from a file.

All these components work in harmony. An application uses a system library to make a request, the library makes a system call to the kernel, and the kernel interacts with the hardware to fulfill the request. This layered architecture provides stability, security, and a clear separation of concerns, making Linux a powerful and flexible operating system.