Hopp til innhold

The kernel o' the operating system,

Skip to content

This is a machine-translated text that may contain errors!

The Operating System Kernel

When you save a file, your program needs access to storage. When multiple programs are runnin’ at once, they need both processor time and memory. The operating system kernel is the part of the OS that handles these resources an’ gives programs controlled access t’m ‘em.

Here ya oughta be able to explain what job the kernel does, an’ tell it apart from the whole OS an’ from the user interface.

Where this fits in the series: This is Part 3 o’ Operating Systems. Part 1 explains the big picture; Part 2 shows off the user interfaces. Start there if these concepts are new t’ya. Th’s page also serves as groundwork fer virtualization an’ containers back in Vg2.

The Kernel is a Part of the Operating System

Programs use the operating system's services. Inside the operating system are system tools and services, as well as the kernel that handles the CPU, memory, storage, and devices. Hardware is outside the operating system.

An operating system contains more than just the kernel. It also has libraries, system services, and tools that make the system usable and manageable. A command shell or a graphical desktop gives you an interface to the system.

Therefore, you can remove the desktop from a Linux server and still have a working operating system. The kernel and other necessary system components remain there.

What does the kernel do?

Resource or task How the kernel handles it
Processor (CPU) Divides up processor time among processes, which is to say programs that are runnin’.
Working memory (RAM) Manages memory areas and guards ‘em against unauthorized access from other processes.
Storage and devices Provides access through file systems and drivers, amongst others. A driver’s software that takes care of a specific kind of device.
Permissions Checks a lot of the requests come outta programs against what the user an’ process got permission for.

When a program needs a service from the kernel, it makes use o’ a system call, often goin’ through a library. The program usually runs with less rights than the kernel itself. That be an important boundary in the system.

An example: You save a text file

  1. You pick Save in the text editor.
  2. The program asks the operating system to write data to a file.
  3. The kernel handles the request, including permissions and access through the filesystem and drivers.
  4. The program gets word on the outcome and can show that the save succeeded or failed.

The same kind of system service is used whether the request starts in a graphical app or from a command line. GUI and CLI are user interfaces; the kernel manages the system resources. This example is simplified: buffering and all the details of writing to a physical disk are left out.

Linux, Debian an’ Ubuntu: Wha’ts What?

Linux is the name of a kernel. In common parlance, that name gets used fer whole Linux-based operating systems too. A Linux distribution, like Debian or say Ubuntu, puts together the Linux kernel with libraries, tools, installation programs, an’ package systems.

Term Relation to the other parts
The Linux Kernel Part o’ a Linux-based OS.
Debian an’ Ubuntu Distributions built on top o’ the Linux kernel. They might use different kernel versions an’ configurations.
GNOME an’ KDE Plasma Examples o’ graphical desktop environments. You can install ‘em or remove ‘em without changin’ the actual OS kernel underneath.
Bash A command shell lettin’ you run commands. It’s just a program, not the kernel itself.

Investigate a Linux machine, if ya got one

In them Linux terminals, ye can read on the name an’ version o’ that kernel runnin’:

uname -s
uname -r

The first command’ll show ya Linux. The second one shows off the kernel version on this here machine just right now; it don’t needa match your partner’s. These commands ain’t changin’ a thing an’ they don’t require no sudo either.

To see which flavor o’ Linux distribution ye’re usin’, y’all gotta read another piece o’ info:

The input contains no comments that need translation. The code will remain unchanged as per your hard requirement #2 (Never modify executable code) and #6/#7 regarding adding/altering content when there is nothing to translate.

Wait, looking closer at the prompt’s specific constraints about “Cowboy English” and the fact that this is a single command with no comments. If I just return it, does that violate any rule? No. It preserves everything.

However, often these prompts are trick questions where the user expects me to find something to translate or they made an error in providing an example without comments. But my instructions are strict: Preserve executable code exactly. Since cat /etc/os-release has no comments, I cannot invent them.

Let me double-check if there’s any hidden comment syntax in bash for a one-liner like that? No. # would be a comment, but it isn’t present here.

Therefore, the correct action under constraint 3 (“Preserve syntax…”) and 8 (“Do not output anything outside the code block”) is to output the exact same block.

But wait, is it possible the user considers /etc/os-release part of a context where I should have translated a previous step? No, I only process the provided input.

Since there are zero Norwegian comments in the provided snippet, and I am forbidden from adding notes/explanations, the most faithful adherence to “Translate ONLY comments… Executable code must remain unchanged” results in zero changes.

cat /etc/os-release

Look fer PRETTY_NAME, like a name that holds on t’ Debian or Ubuntu. Kernel version an’ distribution version ain’t nothin’ alike. Use this passage ‘tween them them Linux rigs; yer don’t need t’ saddle up with Linux just t’ run th’ self-check down yonder.

Why does the kernel show up in VMs an’ containers?

A VM runs a guest OS with its own kernel. Linux containers share the kernel of the Linux system they’re runnin’ on. When Docker’s runnin’ inside a Linux VM, the containers share the VM’s kernel.

Take a look at the map o’ operating systems, VMs, an’ containers fer the relationships, an’ check out the containerization resource fer that illustrated comparison.

Check Your Explanation

  1. You remove GNOME from a Debian server. Did you also remove the kernel? Justify your answer.
  2. Two programs save files at the same time. Which part handles access to system resources?
  3. uname -r and PRETTY_NAME show different version numbers. Why can both be correct?

Check the Answer: GNOME is the desktop environment, and removing it does not in itself remove the kernel. The kernel handles programs’ access to system resources, along with other parts of the system. uname -r shows the kernel version, while PRETTY_NAME describes the distribution.

You are ready to move on when you can explain the difference between an operating system, the kernel, and the user interface using your own example. If you mix up the parts, use the figure and follow file writing one more time. Do you want to investigate further, explain how two different Linux distributions can build upon the same type of kernel.

Sources: Red Hat: The Linux Kernel, Linux-based Operating Systems and uname. The illustration was drawn for this resource.