Note: Much of the following is excerpted from the Linux kernel programming primer and the Linux kernel full annotation
In the work of this time, I found my Visio drawing familiar with the point, always like to what source ah, structure, and so on as a flowchart to draw to understand, because for the graph, there is a very intuitive understanding, so the next is also to map as the center.
about the Linux kernel architecture
When it comes to operating systems, we all know the Windows operating system, the Linux operating system, Apple's iOS operating system, the previously hot Symbian operating system, and the recent consumer electronics very hot Android operating system. A complete operating system is divided into 4 parts.
This can be understood as the mobile phone we use. One of the hardware system is that we see the entire phone, CPU ah, memory ah, these do not take apart to see, and touch screen ah, buttons and so on to see. The OS kernel is what we call Android, but he includes the Linux kernel. Operating system services is a set of Android structure, give us intuitive is that a bit of a cool interface. We can click to achieve the function we want. User application is we often play QQ Ah, navigation ah, of course, there are all kinds of fun games, Angry Birds, graffiti jump, Fruit Ninja, is not want to play a. Alas, still study well, although the mobile phone is nearby.
For a single kernel-mode system of the Linux kernel, you can divide it into the following:
The Linux kernel can also be divided into 5 large modules.
Its relationship and main functions can be seen in the following figure:
about Linux Memory
The physical memory can be divided into the following figure:
The kernel occupies the beginning of the memory, followed by a shared hard disk, the cache portion of the floppy disk, which deducts video memory and 640k to 1m of the BIOS, then the virtual disk, and the last part is the main memory area that is available to all programs.
In Linux memory management, segment transformation: Converts a logical address consisting of a segment selector and an offset within a segment to a linear address. Page Transform: Converts a linear address to a corresponding physical address. As shown in the following figure:
Virtual address: Refers to the program generated by the segment selector and the paragraph offset two parts of the address. Why do you call it a virtual address? Because the addresses of these two parts do not directly access physical memory, they are processed or mapped by the transform mechanism of the segmented address before they correspond to the corresponding physical memory addresses.
Segment Descriptor: Provides the CPU with the information necessary to map a logical address to a linear address. Descriptors are created by the program compiler, linker, loader, or operating system.
Description Table: Save descriptors in descriptor tables, there are two types of
1. Global Descriptor Table---GDT)
2, Local description table (---LDT)
The descriptor chart is an array of memory for a descriptor item consisting of 8 bytes. The processor locates the GDT table and the current LDT table by using the GDT and LDTR registers. Can contain a maximum of 8192 (2^13) descriptors.
Selector: A select part of a logical address that specifies a descriptor that is completed by specifying a descriptive chart and indexing one of the descriptor entries.
Segment Registers: The processor saves the information in the descriptor in the segment register, thus avoiding querying the descriptor table every time the memory is accessed.
Linear address: indirectly points to the corresponding physical address by specifying a page table, a page in the page table, and an offset value in the page.
Page table: An array of simple 32-bit page indicators. The page table itself is also a page of memory, so it contains 4K bytes of memory that can hold 1K 32-bit items.
Offset = 2^12=4k, table =2^10, directory = 2^10, so the linear address space is 2^10*2^10*4k=4g.
Since the 0.11 kernel defines the maximum available virtual memory space for each process as 64M, the logical address of each process can be converted to the address of the linear space with the task number *64m.
about Linux Processes
processes can be run in either the kernel state or the user state, and are awakened when the resource is available, into a ready state; When the process is in an interruptible sleep state, the signal can be awakened; when in a state of uninterrupted sleep, it can only be awakened using wakeup, etc. when the process is paused, The signal can be sent into the ready state; When zombie state, when it has stopped running, the parent process has not invoked the wait query state, once the parent process has called the wait to obtain the child process information, the process task data structure will be released.
about Linux file system and source directory
about Linux kernel makefile
The Linux makefile file is the parameter configuration file that compiles the accessibility software make. The main purpose of make tool software is to automatically determine which files in a program system containing multiple source program files need to be recompiled by identifying which files have been modified.
The main purpose of the makefile here is to instruct the make program to eventually use the build execution program in the tools/directory that is connected to the standalone compilation to connect and merge all the kernels into a running kernel image file image. Specifically, the BOOTSECT.S and SETUP.S in the boot/directory are compiled using the 8086 assembler, respectively, to generate their respective execution modules. All other programs in the source code are compiled using the GNU compiler Gcc/gas and connected to the module system. Then use the build tool to combine the three blocks into a kernel image file image.
URL: http://blog.csdn.net/eastmoon502136/article/details/8711104