Kernel
- In Turkish
- çekirdek
In short
A kernel is the core part of an operating system that manages the CPU, memory, and hardware devices and controls how programs get access to those resources.
What is an operating system kernel?
The kernel is the central program of an operating system and one of the first things loaded when a computer boots. It stays in memory the whole time the machine runs and acts as the bridge between applications and hardware, deciding which program gets the CPU, how memory is divided, and how data moves to and from disks, networks, and other devices.
The kernel runs in a privileged CPU mode called kernel mode, where it can execute any instruction and access any memory. Regular applications run in a restricted user mode and must ask the kernel for help through system calls whenever they need to read a file, open a network connection, or start a new process. This separation protects the system, because a buggy application cannot directly damage the hardware or other programs' memory.
A good analogy is the front desk of a busy hotel. Guests (programs) cannot walk into the boiler room or make their own room keys; they ask the front desk, which checks permissions and handles the request safely. Well-known kernels include Linux, the Windows NT kernel, and XNU, the kernel behind macOS and iOS.
People often mix up the kernel with the whole operating system or with the shell. The operating system includes the kernel plus tools, libraries, and user interfaces, while the shell is just a program that takes your commands and asks the kernel to carry them out. Kernel designs also differ: monolithic kernels such as Linux run most services in kernel mode, while microkernels keep only the essentials there and move drivers and other services into user space.
At a glance
Key takeaways
- The kernel is the core of the operating system and runs the entire time the computer is on.
- It manages the CPU, memory, devices, and file systems.
- The kernel runs in privileged kernel mode; applications run in restricted user mode.
- Applications request kernel services through system calls.
- Common designs include monolithic kernels and microkernels.
Example
# Print the name and version of the running kernel
uname -sr
# Show the most recent kernel log messages (may require sudo)
sudo dmesg | tail -n 5
# List a few kernel modules (such as drivers) currently loaded
lsmod | head -n 5Readers ask
Is Linux an operating system or a kernel?
Strictly speaking, Linux is a kernel. Complete operating systems built on it, called Linux distributions, combine the kernel with system tools, libraries, and package managers.
What is the difference between kernel mode and user mode?
Kernel mode is a privileged CPU mode where code can access all hardware and memory, and it is reserved for the kernel. User mode is restricted, so applications must use system calls to ask the kernel to perform privileged actions for them.
What is a kernel panic?
A kernel panic is a fatal error that the kernel cannot safely recover from, so it halts the system to prevent data corruption. On Windows the equivalent is usually called a stop error or blue screen.
See also
- System CallOperating Systems, p. 31A system call is a request from a program to the operating system kernel to perform a privileged action, such as reading a file or starting a process.
- ProcessOperating Systems, p. 23A process is a running instance of a program, with its own memory space, resources, and at least one thread of execution managed by the operating system.
- Virtual MemoryOperating Systems, p. 37Virtual memory is an operating system technique that gives each process its own private address space and maps it to physical RAM or disk behind the scenes.
- CPU SchedulingOperating Systems, p. 6CPU scheduling is how an operating system decides which ready process or thread runs on each CPU core next, and for how long, so the processor is shared fairly.
- File SystemOperating Systems, p. 12A file system is the part of an operating system that organizes data on a storage device into files and folders and tracks where each piece is stored.
- LinuxDevOps & Cloud, p. 33Linux is an open-source operating system kernel that powers most servers, cloud platforms, containers, and Android phones, usually packaged as a distribution.
- Operating SystemOperating Systems, p. 21An operating system (OS) is the core software that manages a computer's hardware, shares it out among programs and gives them a common way to use it.
- Kernel ModeOperating Systems, p. 18Kernel mode is the privileged CPU state in which the OS kernel has full access to hardware and memory, while ordinary programs run in restricted user mode.
Spotted a mistake or something missing on this page?Suggest an edit