Linux anatomy: Difference between revisions
m typo |
Add Kernel and Init system sections, add some links. |
||
| Line 10: | Line 10: | ||
"Linux" is a term that has a few meanings, and sometimes you will see debates online (often jokingly) about what part of the software actually counts as Linux. Though some pedants might take issue with this, in this guide we will be using the term "Linux" to refer to '''an entire system''' that runs software on top of the Linux Kernel. | "Linux" is a term that has a few meanings, and sometimes you will see debates online (often jokingly) about what part of the software actually counts as Linux. Though some pedants might take issue with this, in this guide we will be using the term "Linux" to refer to '''an entire system''' that runs software on top of the Linux Kernel. | ||
The basic gist is that Linux is a set of programs and utilities, as well as a core program called a "kernel", that work together to create a system which can be used for many different purposes, and be customized in many ways. Keep reading to gain a better understanding of how these pieces all fit together. | The basic gist is that Linux is a set of programs and utilities, as well as a core program called a "[[Linux anatomy#Kernel|kernel]]", that work together to create a system which can be used for many different purposes, and be customized in many ways. Keep reading to gain a better understanding of how these pieces all fit together. | ||
== Distribution == | == Distribution == | ||
| Line 19: | Line 19: | ||
In short, this is because, unlike macOS or Windows, there is no singular company or organization working on Linux as a whole. The Linux Kernel is worked on by a single large team of dedicated volunteers, but they have enough on their hands with just those responsibilities. And, for reasons that will be explained, it is impossible to have a usable system (especially a desktop system) with only a kernel. | In short, this is because, unlike macOS or Windows, there is no singular company or organization working on Linux as a whole. The Linux Kernel is worked on by a single large team of dedicated volunteers, but they have enough on their hands with just those responsibilities. And, for reasons that will be explained, it is impossible to have a usable system (especially a desktop system) with only a kernel. | ||
So instead, many groups of volunteers have created their own organizations which do the important work of packaging together all the necessary components and building up a usable system on top of the Kernel. Distributions have the job of deciding on a ''package manager'', ''desktop environment'', ''init system'', ''windowing system'', ''compositor'', and more. They also usually come up with a unique look and branding for their distribution, and unique features that might set their distribution apart from their peers. When they do their job well, everything comes together seamlessly to create a cohesive and usable experience that gives a user the particular features they want. | So instead, many groups of volunteers have created their own organizations which do the important work of packaging together all the necessary components and building up a usable system on top of the Kernel. Distributions have the job of deciding on a ''[[Linux anatomy#Package manager|package manager]]'', ''[[Linux anatomy#Desktop environment|desktop environment]]'', ''[[Linux anatomy#Init system|init system]]'', ''[[Linux anatomy#Windowing system|windowing system]]'', ''[[Linux anatomy#Compositor|compositor]]'', and more. They also usually come up with a unique look and branding for their distribution, and unique features that might set their distribution apart from their peers. When they do their job well, everything comes together seamlessly to create a cohesive and usable experience that gives a user the particular features they want. | ||
=== Fixed-release === | === Fixed-release === | ||
| Line 38: | Line 38: | ||
=== Software === | === Software === | ||
As you likely know, a piece of software is any sort of application or tool that runs on the computer. A very general term, this might refer to a tiny tool that simply tells you the time, and it also might refer to the web browser that you're using right now. What differentiates software from libraries is the | As you likely know, a piece of software is any sort of application or tool that runs on the computer. A very general term, this might refer to a tiny tool that simply tells you the time, and it also might refer to the web browser that you're using right now. What differentiates software from libraries is that software ''is run by the user'', and libraries are ''used by the software''. Usually you will interact with software rather than libraries, unless you're a programmer. | ||
=== Libraries === | === Libraries === | ||
| Line 72: | Line 72: | ||
== Kernel == | == Kernel == | ||
The Linux kernel is the core of Linux. Its job is to talk directly with the computer [[hardware]] and create the environment upon which programs and libraries can run. The kernel provides simple functions called [[Syscall|syscalls]] that programs and libraries can use to do very core system operations like opening files. It also manages when programs are allowed to use the CPU so that multiple programs can be run simultaneously, and loads [[Driver|drivers]], which are special programs that devices connected to the computer use to communicate. | |||
== | Conceptually, it might seem that the kernel doesn't have that difficult of a job, but these sorts of core operations are actually quite complex, especially when drivers and complicated modern CPUs are involved. This means the kernel is a sophisticated program which is always being updated and tweaked! | ||
Most users don't have to directly interact with the kernel very much, as there are many layers built up on top of it that you are usually using. In very rare cases though, you might see something called a "kernel panic". When this happens, the kernel has hit an error that is so bad, the entire operating system cannot recover gracefully and must be restarted. This is the same sort of problem as the so-called "Blue Screen of Death", on Windows. Luckily, these sorts of errors are very unusual to see in Linux! | |||
== Kernel space and user space == | |||
The kernel has full control of the computer, and it only lends out its power to programs. This separation of concerns is to prevent a scenario where a program might break or tamper with other programs, take control of devices, read things it shouldn't, etc. If all the programs had unrestricted access to each other and the system, it would be hard to keep a separation between different programs. It wouldn't be possible to have a system that runs with multiple users, because each user could view and modify all files, even if they weren't an [[administrator]]. The kernel is powerful, and only lends out its full power to those with "root" access. | |||
"Kernel space" refers to this "dangerous" part of the computer that only the kernel has access to, and "user space" refers to the safer portion of the computer's memory, CPU and other functionality that is reserved by the kernel for programs. In this context, the "user" refers to programs running on top of the kernel, as opposed to the kernel itself. | |||
In user space, memory isn't usually shared--each program gets its own view of memory and can't peek into other memory. Programs must always run as a user, and programs can only open files that their user has access to. Most programs are not run with so-called "privileged" access, and so can only open some of the files on the computer's drives. If you want to work with kernel space in some way, you have to go through the kernel, with syscalls and such. | |||
== Init system == | == Init system == | ||
Latest revision as of 01:54, 8 July 2026
This is a Novice complexity guide.
This guide introduces a novice Linux user to common terms used to describe various common parts of the core functionality of a typical Linux computer. Maybe you've heard about a "kernel" and want to know what it is, or perhaps you are curious why there are so many different types of Linux you can install.
We only assume some very basic familiarity to computers and operating systems in this guide--if you can install and run programs and you know that Linux and Windows are operating systems, you should be able to follow it.
Linux
"Linux" is a term that has a few meanings, and sometimes you will see debates online (often jokingly) about what part of the software actually counts as Linux. Though some pedants might take issue with this, in this guide we will be using the term "Linux" to refer to an entire system that runs software on top of the Linux Kernel.
The basic gist is that Linux is a set of programs and utilities, as well as a core program called a "kernel", that work together to create a system which can be used for many different purposes, and be customized in many ways. Keep reading to gain a better understanding of how these pieces all fit together.
Distribution
When you are deciding how to install Linux, one of the first considerations you may want to make is selecting a Linux Distribution (often abbreviated as "distro"). There are an incredible variety of Linux distributions out there, and different folks may recommend different distributions depending on your needs and taste.
But what exactly is a distribution in the first place? Why is this so different from how Windows works, where there are just a few "editions" which you have to pick? And why can't you just go to a single website and install "Normal Linux"?
In short, this is because, unlike macOS or Windows, there is no singular company or organization working on Linux as a whole. The Linux Kernel is worked on by a single large team of dedicated volunteers, but they have enough on their hands with just those responsibilities. And, for reasons that will be explained, it is impossible to have a usable system (especially a desktop system) with only a kernel.
So instead, many groups of volunteers have created their own organizations which do the important work of packaging together all the necessary components and building up a usable system on top of the Kernel. Distributions have the job of deciding on a package manager, desktop environment, init system, windowing system, compositor, and more. They also usually come up with a unique look and branding for their distribution, and unique features that might set their distribution apart from their peers. When they do their job well, everything comes together seamlessly to create a cohesive and usable experience that gives a user the particular features they want.
Fixed-release
Some distros prioritize stability, which means that they are very careful about what versions of software are included, and they test the systems for bugs very carefully before upgrading them. These distributions usually release entire new versions of their desktop environments on a cadence, every 6 months or every year, in what is called a "Fixed release" schedule. This can be undesirable for some users, as they may become frustrated that newer software or features are not available yet on their distribution.
Rolling-release
Other distros prioritize new features, which means they give you access to the latest and greatest features and software. However, such distributions can sometimes have more bugs, crashes, or other glitches, because there is usually less time for the creators of the distribution to test the software they are showing. These distros are often "Rolling release", which just means that they do not release a single version every 6 months, but instead update single pieces of software as new updates come in and they appear to be stable.
Power-user distros
Many distributions are designed for power users. They might be minimal, requiring a lot of manual customization and setup, but allowing for a system to be built that is exactly how the user wants it to be. Or perhaps they have the goal of being as free of proprietary software as possible.
Beyond
There are also distributions which focus on creating an environment that is as close to the experience of using Windows as possible, in order to make it easier for Linux beginners to use comfortably. Distributions may also advertise themselves as being ideal for gaming, security research, or for use by lower-power machines. Whatever your needs, there is probably a Linux distribution for you.
Just a few examples of Linux distributions include Linux Mint, Ubuntu, Debian, and Gentoo. Wikipedia has a helpful list of many more.
Software vs. libraries
Software
As you likely know, a piece of software is any sort of application or tool that runs on the computer. A very general term, this might refer to a tiny tool that simply tells you the time, and it also might refer to the web browser that you're using right now. What differentiates software from libraries is that software is run by the user, and libraries are used by the software. Usually you will interact with software rather than libraries, unless you're a programmer.
Libraries
A library is a piece of functionality that can be used by software, to give it the ability to do something useful. You don't use libraries directly; instead, a program you use makes use of it.
Linux software uses many thousands of libraries, and many pieces of software may rely on one single library for functionality. Libraries rely on other libraries, as well! On your computer, there's a whole graph of dependencies putting software together, like puzzle pieces.
Libraries are always changing, and mismatches across software can arise when a change is made. This is where package managers become incredibly useful.
Package manager
The idea behind a package manager is very simple, and it's likely you've encountered one before. The macOS and iOS App Stores, and the Windows Store are examples of package managers created by Apple and Microsoft. However, many apps on these stores are paid, whereas Linux package managers are almost always entirely free.
The main purpose of a package manager is obtaining and organizing versions of libraries and software, and making sure that all the puzzle pieces fit together without overlapping in a bad way. These software and libraries are provided in the form of packages, which are basically tidy containers of installers that tell the system what needs to happen to get your program running.
A Linux distribution generally provides one (or sometimes two) package managers. These package managers usually have a repository which is a collection of software you might want to install. Usually, the distribution will provide a simple graphical application (often called a "Software Center" or Store) for updating your software and installing new software from the repository, and you don't need to worry about the details of the package manager at all. You should always check the Software Center provided by your distribution first when looking for new software to install, because this is almost always the easiest way to install it and keep it updated.
It is still useful to know what sort of package manager your distribution uses though, especially when you want to install new software from the internet that isn't available in the repository. Each package manager has its own way of installing software, so if you download a program it might not be installable on your system. In this way, Linux is different from Windows, where you can click on an .exe installer, or macOS, where you can drag a new program to the Applications folder. But luckily, the package manager often has everything you need, and you don't need to go onto web pages to install random things from the Internet!
Knowing what is available to install on your system gives you power. And if you want to become a more advanced user it may be useful to familiarize yourself with how to use your package manager from the terminal.
Desktop environment
The Desktop Environment, or DE for short, is a set of programs that shape how your experience works. Different DEs can radically change how programs are launched and switched, and displayed on the screen.
Docks, desktops, taskbars, app launchers, settings pages, file managers, and often software updaters are provided by the Desktop Environment. Different environments are suitable for different purposes.
The average user will likely find the choice of DE to be the single most impactful choice in terms of defining an experience of using the computer, because it shapes the look and feel of the desktop the most. Indeed, the biggest visual differences between Windows and macOS (the Dock/Taskbar, File Explorer/Finder, preferences panels, and more) have Linux equivalents determined by the DE.
Some desktop environments, like GNOME, focus on a straightforward singular experience with less customization options and certain consistent design patterns. These environments are sometimes less confusing, because you are forced into a common path which is encountered by more people, and so it'll be easier to compare your desktop with others when trying to figure out how to do something. Some users find the consistent interface to be more pleasing to the eye, as well (but this is very much a matter of individual taste).
Other desktop environments, like KDE, are all about offering as much customization as possible, and creating exactly the desktop you want. These can sometimes be confusing for newer users, if they change options that cause their system to do something they didn't expect, and don't know how to change it back.
There are even more environments which prioritize absolute customization, or allow for all sorts of exotic setups. Ultimately, what DE you choose comes down to what level of expertise you are comfortable with, and where your priorities lie when using an operating system.
Kernel
The Linux kernel is the core of Linux. Its job is to talk directly with the computer hardware and create the environment upon which programs and libraries can run. The kernel provides simple functions called syscalls that programs and libraries can use to do very core system operations like opening files. It also manages when programs are allowed to use the CPU so that multiple programs can be run simultaneously, and loads drivers, which are special programs that devices connected to the computer use to communicate.
Conceptually, it might seem that the kernel doesn't have that difficult of a job, but these sorts of core operations are actually quite complex, especially when drivers and complicated modern CPUs are involved. This means the kernel is a sophisticated program which is always being updated and tweaked!
Most users don't have to directly interact with the kernel very much, as there are many layers built up on top of it that you are usually using. In very rare cases though, you might see something called a "kernel panic". When this happens, the kernel has hit an error that is so bad, the entire operating system cannot recover gracefully and must be restarted. This is the same sort of problem as the so-called "Blue Screen of Death", on Windows. Luckily, these sorts of errors are very unusual to see in Linux!
Kernel space and user space
The kernel has full control of the computer, and it only lends out its power to programs. This separation of concerns is to prevent a scenario where a program might break or tamper with other programs, take control of devices, read things it shouldn't, etc. If all the programs had unrestricted access to each other and the system, it would be hard to keep a separation between different programs. It wouldn't be possible to have a system that runs with multiple users, because each user could view and modify all files, even if they weren't an administrator. The kernel is powerful, and only lends out its full power to those with "root" access.
"Kernel space" refers to this "dangerous" part of the computer that only the kernel has access to, and "user space" refers to the safer portion of the computer's memory, CPU and other functionality that is reserved by the kernel for programs. In this context, the "user" refers to programs running on top of the kernel, as opposed to the kernel itself.
In user space, memory isn't usually shared--each program gets its own view of memory and can't peek into other memory. Programs must always run as a user, and programs can only open files that their user has access to. Most programs are not run with so-called "privileged" access, and so can only open some of the files on the computer's drives. If you want to work with kernel space in some way, you have to go through the kernel, with syscalls and such.