From the course: Advanced Linux: The Linux Kernel

What is the Linux kernel? - CentOS Tutorial

From the course: Advanced Linux: The Linux Kernel

Start my 1-month free trial

What is the Linux kernel?

- [Instructor] What is the Linux kernel? Let's talk about it. The kernel is a program. The kernel program has a name. That name is something like V-M-L-I-N-U-Z dash maybe V-M-L-I-N-U-Z dash five dot three dot 18. That program needs to be loaded into memory and run. And that operation is done by a boot loader. With Linux, we often have a boot loader called GRUB. So GRUB reads the kernel file from disk into memory and transfers control to it. The kernel program, like other programs, has command-line parameters. And GRUB is responsible for passing those parameters to the kernel. The Linux kernel has an API. It provides the programming interface. The functions that we can call from user space into the kernel we call system calls. But the Linux kernel also provides virtual file systems proc and sys and the lesser known debugfs and through those virtual file systems, we can interact directly with the kernel, getting information from the kernel and changing things in the kernel. Also our file system has device files. We interact with device drivers by doing operations on those device files. Those are standard system calls like read and write and open. The kernel is a gatekeeper. The kernel enforces privileges. In Linux, we call those privileges capabilities. In the Linux kernel source code, it refers to the capabilities of a process to see if it is allowed to perform some sort of privileged operation. We think of root processes having all the privileges. More precisely, root processes typically have a large set of capabilities. Also CPUs have special instructions that are only allowed to be executed when the CPU itself is in a special supervisory mode. It's in that mode when we're executing inside the kernel. So that means there are assembly language instructions that can only be executed by the kernel. The Linux kernel also implements a number of security policies. The underlying mechanisms used by SELinux, for example. And finally, the kernel provides controlled access to hardware and other resources. It wouldn't be safe say to allow processes to willy-nilly access the disk at will, no. The kernel has to provide controlled access to make sure that things are done in an orderly and safe manner. The kernel is modular. The kernel image itself, that V-M-L-I-N-U-Z file, is relatively small, just a few meg. The kernel image though is sufficient to boot to user space to begin in running some processes. Once we have processes, we can load additional functionality into the kernel through the loadable kernel module mechanism. The loadable module mechanism means we can just load the drivers that we need. We don't need to load drivers for hardware that's not present. We can also just load additional sorts of functionality that's not drivers but say for security or other things.

Contents