summaryrefslogtreecommitdiffstats
path: root/kernel.md
diff options
context:
space:
mode:
Diffstat (limited to 'kernel.md')
-rw-r--r--kernel.md49
1 files changed, 29 insertions, 20 deletions
diff --git a/kernel.md b/kernel.md
index bb16a62..a4f5567 100644
--- a/kernel.md
+++ b/kernel.md
@@ -1,5 +1,9 @@
1% The Linux Kernel 1% The Linux Kernel
2 2
3---
4subtitle: WTF is Linux
5---
6
3[back](index.md) 7[back](index.md)
4 8
5TODO: A word about how the kernel is in charge of enforcing security 9TODO: A word about how the kernel is in charge of enforcing security
@@ -9,11 +13,11 @@ TODO: Talk about `dmesg`
9Role 13Role
10---- 14----
11 15
12A kernel is a piece of software that is loaded at boot time. It is a 16A kernel is a piece of software that's loaded at boot time. It's a component
13component that is responsible for "orchestrating" the OS in different 17that's responsible for "orchestrating" the OS in different manners. There are
14manners. There are different types of kernel in this world, and they may 18different types of kernel in this world, and they may have different
15have different responsibilities. We will be focusing solely on the role 19responsibilities. We will be focusing solely on the role of the Linux kernel
16of the Linux kernel here. 20here.
17 21
18### Hardware control and abstraction 22### Hardware control and abstraction
19 23
@@ -29,21 +33,22 @@ Without hardware control, each software would have to consciously and
29constantly collaborate with each other to avoid conflict when accessing 33constantly collaborate with each other to avoid conflict when accessing
30each piece of hardware. 34each piece of hardware.
31 35
32With the Linux kernel accessing the hardware is gated by an API: each 36With the Linux kernel, accessing the hardware is gated by an API: each
33software that wants to access the hard drive has to go use system calls 37software that wants to access the hard drive has to use system calls (e.g.:
34(e.g.: `read(2)` / `write(2)`), and the kernel will then schedule 38`read(2)` / `write(2)`), and the kernel will then schedule these tasks
35these tasks sequentially. 39as it see fits, without having to "collaborate" with anyone.
36 40
37Another important point, is that without the Linux kernel, each piece of 41Another important point, is that without the Linux kernel, each piece of
38software would have to care if the hard drive is a spinning disk, an 42software would have to care if the hard drive is a spinning disk, an
39SSD, or a USB stick, or if is connected using a SATA cable, a USB cable, 43SSD, or a USB stick, or if is connected using a SATA cable, a USB cable,
40etc. 44etc.
41 45
42The Linux kernel allows us to not care about this, and provides us with 46The Linux kernel allows us to not care about this, and provides us with the
43the filesystem abstraction, and mount points. To the software developer 47[file system](./file-system.md) abstraction, and [mount
44doing a `read` on a file doesn't change if the file is stored on an 48points](./file-system.md#mounts). To the software developer doing a `read` on a
45SSD or even on a network filesystem, because the kernel will check that 49file doesn't change if the file is stored on an SSD or even on a network file
46for us, and apply the appropriate logic. 50system, because the kernel will check that for us, and apply the appropriate
51logic.
47 52
48### Multitasking 53### Multitasking
49 54
@@ -60,7 +65,7 @@ Each of these 5 applications feels responsive even if the CPU can only run 4 of
60them at the time. 65them at the time.
61 66
62This is because the kernel is responsible for switching the tasks that the CPU 67This is because the kernel is responsible for switching the tasks that the CPU
63runs (a.k.a. scheduling). Theses tasks / applications are switched quickly and 68runs (a.k.a. scheduling). These tasks / applications are switched quickly and
64in such a way that they feel responsive to the user. 69in such a way that they feel responsive to the user.
65 70
66The Linux kernel also provides developers with another abstraction to 71The Linux kernel also provides developers with another abstraction to
@@ -75,7 +80,7 @@ and if they want to run more tasks concurrently than the amount of
75available CPU cores, they would have to implement their own task 80available CPU cores, they would have to implement their own task
76scheduler. 81scheduler.
77 82
78Thankfully we do not have to care about that, because the Linux kernel 83Thankfully we don't have to care about that, because the Linux kernel
79cares about it for us instead. 84cares about it for us instead.
80 85
81Sources 86Sources
@@ -93,9 +98,9 @@ The official sources of the Linux kernel can be found in
93 [Debian](https://sources.debian.org/patches/linux/5.7.6-1/), 98 [Debian](https://sources.debian.org/patches/linux/5.7.6-1/),
94 [Gentoo](https://gitweb.gentoo.org/proj/linux-patches.git/tree/?h=5.7)) 99 [Gentoo](https://gitweb.gentoo.org/proj/linux-patches.git/tree/?h=5.7))
95 100
96The official programming language of the Linux kernel is C. It is 101The official programming language of the Linux kernel is C. It's heavily
97heavily documented in the `Documentation` subdirectory, using the 102documented in the `Documentation` subdirectory, using the sphinx documentation
98sphinx documentation system. 103system.
99 104
100 105
101Versioning 106Versioning
@@ -129,10 +134,14 @@ TODO: Also refer to their Debian, Ubuntu, etc. packages.
129Configuring the kernel 134Configuring the kernel
130---------------------- 135----------------------
131 136
137TODO
138
132```sh 139```sh
133make nconfig 140make menuconfig
134``` 141```
135 142
143TODO: explain what's a module
144
136Building the kernel 145Building the kernel
137------------------- 146-------------------
138 147