A kernel has generally four basic responsibilities:
4.Handling system calls
The first responsibility is called device management. A computer system has several devices connected to it: not only the CPU and memory are available, but also disks (and disk controllers), network cards, graphical cards, sound cards, … Because every device operates differently, the kernel is required to know what the device can do and how to address and manipulate each device so that it plays nice in the entire system. This information is stored in the device driver: without such driver, the kernel doesn’t know the device and will therefore not be able to control it.
Next to the device drivers, the kernel also manages the communication between the devices: it governs access to the shared components so that all drivers can happily operate next to each other. All communication must adhere to strict rules and the kernel makes sure that these rules are followed.
The memory management component manages the memory usage of the system: it keeps track of used and unused memory, assigns memory to processes who require it and ensures that processes can’t manipulate the data of one another. To do this, it uses the concept of virtual memory addresses: addresses for one process are not the real addresses, and the kernel keeps track of the correct mappings. It is also possible for data not to be really present in memory although it is present for a process: such data is stored on a swap space. Because swap space is much, much slower than real memory, use of this space should be limited to data that isn’t read often.
To ensure that each process gets enough CPU time, the kernel gives priorities to processes and gives each of them a certain amount of CPU time before it stops the process and hands over the CPU to the next one. Process management not only deals with CPU time delegation (called scheduling), but also with security privileges, process ownership information, communication between processes and more.
Finally, for a kernel to actually work on a system, it must provide the means to the system and the programmer to control itself and give or receive information from which new decisions can be made.
A Linux operating system, like Gentoo Linux, uses Linux as the kernel.