- Mastering Embedded Linux Programming
- Chris Simmonds
- 541字
- 2021-07-30 09:45:03
What does the kernel do?
Linux began in 1991 when Linus Torvalds started writing an operating system for Intel 386 and 486-based personal computers. He was inspired by the Minix operating system written by Andrew S. Tanenbaum four years earlier. Linux differed in many ways from Minix, the main differences being that it was a 32-bit virtual memory kernel and the code was open source, later released under the GPL 2 license.
He announced it on the 25th August 1991 on the comp.os.minix newsgroup in a famous post that begins as Hello everybody out there using minix - I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things).
To be strictly accurate, Linus did not write an operating system, he wrote a kernel instead, which is one component of an operating system. To create a working system, he used components from the GNU project, especially the toolchain, C library, and basic command-line tools. That distinction remains today, and gives Linux a lot of flexibility in the way it is used. It can be combined with a GNU user space to create a full Linux distribution that runs on desktops and servers, which is sometimes called GNU/Linux; it can be combined with an Android user space to create the well-known mobile operating system or it can be combined with a small Busybox-based user space to create a compact embedded system. Contrast this with the BSD operating systems, FreeBSD, OpenBSD, and NetBSD, in which the kernel, the toolchain, and the user space are combined into a single code base.
The kernel has three main jobs: to manage resources, to interface with hardware, and to provide an API that offers a useful level of abstraction to user space programs, as summarized in the following diagram:

Applications running in user space run at a low CPU privilege level. They can do very little other than make library calls. The primary interface between the user space and the kernel space is the C library, which translates user level functions such as those defined by POSIX into kernel system calls. The system call interface uses an architecture-specific method such as a trap or a software interrupt to switch the CPU from the low privilege user mode to the high privilege kernel mode, which allows access to all memory addresses and CPU registers.
The system call handler dispatches the call to the appropriate kernel subsystem: scheduling calls to the scheduler, the filesystem, calls to the filesystem code, and so on. Some of those calls require input from the underlying hardware and will be passed down to a device driver. In some cases, the hardware itself invokes a kernel function by raising an interrupt. Interrupts can only be handled in a device driver, never by a user space application.
In other words, all the useful things that your application does, it does them through the kernel. The kernel, then, is one of the most important elements in the system.
- Java Web開發學習手冊
- Unreal Engine Physics Essentials
- JavaScript全程指南
- 機器學習系統:設計和實現
- Mastering Selenium WebDriver
- Mastering Python Scripting for System Administrators
- GitLab Repository Management
- Android 應用案例開發大全(第3版)
- Visual Basic程序設計實踐教程
- Visual C++開發入行真功夫
- Mastering Data Mining with Python:Find patterns hidden in your data
- 從零開始學Python網絡爬蟲
- Qt5 C++ GUI Programming Cookbook
- Scala Functional Programming Patterns
- Mastering jQuery Mobile