- 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.
- Cocos2d-x游戲開發(fā):手把手教你Lua語(yǔ)言的編程方法
- Mastering Scientific Computing with R
- Learning Laravel 4 Application Development
- 大學(xué)計(jì)算機(jī)基礎(chǔ)(第2版)(微課版)
- 小程序開發(fā)原理與實(shí)戰(zhàn)
- C語(yǔ)言程序設(shè)計(jì)學(xué)習(xí)指導(dǎo)與習(xí)題解答
- 從Java到Web程序設(shè)計(jì)教程
- Web性能實(shí)戰(zhàn)
- Vue.js 3應(yīng)用開發(fā)與核心源碼解析
- 玩轉(zhuǎn).NET Micro Framework移植:基于STM32F10x處理器
- iOS開發(fā)項(xiàng)目化入門教程
- 現(xiàn)代C++語(yǔ)言核心特性解析
- C++從零開始學(xué)(視頻教學(xué)版)(第2版)
- Java EE互聯(lián)網(wǎng)輕量級(jí)框架整合開發(fā):SSM+Redis+Spring微服務(wù)(上下冊(cè))
- R統(tǒng)計(jì)應(yīng)用開發(fā)實(shí)戰(zhàn)