Skip to content

Resource Management#

Outside of memory the kernel also has to manage all kinds of other resources that are available to the system. Here's what the IEEE says about kernel resource management:

Resource management is the dynamic allocation and de-allocation by an operating system of processor cores, memory pages, and various types of bandwidth to computations that compete for those resources. The objective is to allocate resources so as to optimize responsiveness subject to the finite resources available.

We've already briefly covered "memory pages" above, which just means memory/RAM. Cores we also know about, right? CPU Cores. We covered those in the hardware section.

This statement is interesting: "various types of bandwidth". There are other components a kernel has to manage such as networking, disk access, and more. The kernel takes care of juggling so that software and run on a system along side other software.

The final statement pretty much nails down what is meant by "resource management" from a kernel's perspective: "The objective is to allocate resources so as to optimize responsiveness subject to the finite resources available."

Despite the fact computers are crazy fast these days there is still a finite amount of hardware resources available and their allocation, their use, must be balanced and managed so that the user of the system can execute/run the software they want to use.

Here are some screenshots from my local macOS at the time of writing. These screenshots show you the various parts of the system - CPU, RAM, battery, disk and networking - under management by the macOS kernel.

CPU Usage

CPU Usage

Above we can see the processes (covered later) running on my local system. These all have characteristics that are being managed by the kernel for us: memory usage, threads, GPU usage, the user, etc.

RAM Usage

RAM Usage

As with CPU usage we can see the kernel is managing the memory usage of each process. Some of the processes here and we can see repeated throughout each screenshot.

Battery Usage

Battery Usage

As I'm on a laptop macOS is also concerning itself with the battery and its usage. I unplugged my mains power adapter before taking this screenshot so that you can see how the kernel is monitoring the potential battery (energy) usage of each process running on the system - energy/electricity is a finite resource too.

Disk Usage

Disk Usage

Obviously my MacBook Pro has a disk in it. In my case it's an NVMe style SSD. Above we can see all the processes that are reading and writing information from and to the disk. Yet another task the kernel has to manage.

Network Usage

Network Usage

And finally we have networking. The kernel provides the "networking stack" (covered later) so that processes can talk to other computers on the same or remote networks.

The above screenshots are hiding quite a bit of complexity from us but that's fine. For now we're just getting an idea of what a kernel is and why we need one.