Video tutorial:http://v.youku.com/v_show/id_XMTMwNjAwMDc0OA==.html
Main content
? Linux System Structure
? Linux Kernel structure
? Linux Kernel source directory structure
Linux Architecture
From the know, theLinux architecture is composed of user space and kernel space .
? Why are Linux systems divided into user space and kernel space?
? Analysis from the programmer's point of view
-Separate linux bottom and application, do application, do the bottom layer , each dry.
The principle of economics is that division of labor produces efficiency.
From the perspective of security, in order to protect the kernel. Modern CPUs are often implemented with different
Operating mode. Take arm as an example:arm achieves 7 Modes of operation, and the CPU in different modes can
Different from the instructions executed or the registers accessed:
– (1) user mode usr (2) system mode sys (3) management mode svc (4) fast Interrupt Fiq (5) outside the
Broken IRQ (6) data access termination abt (7) undefined directive exception
– Take (2) X86 as an example:X86 implements 4 Different levels of permissions,Ring0- Ring3; Under Ring0 , you can
Execute privileged instruction, can access IO device;Ring3 has a lot of restrictions
– Take Android As an example: put an app on a Java virtual machine and apply it farther away from the bottom
? User space and kernel space are two different states of program execution, and we can
System calls and hardware interrupts to complete the transfer of user space to the kernel space
Linux Kernel Architecture
System call Interface (SCI layer)
– Provides a standard set of system call functions for user space to access the Linux kernel.
? procees Management ( PM )
– Process management is the creation process (fork,exec), stop process (kill, Exit), and control their
Communication between the two (signal , etc.). Also includes process scheduling to control how the active process shares the CPU
? Memory Management ( MM )
– The primary role of memory management is to control the shared memory area of multiple processes
? Virtual File Systems ( VFS )
– Virtual file system that hides the specifics of the various file systems, providing a unified system for file operations
Interface
– Linux provides a large generic model that allows the model to contain all the file system functions
Collection (All documents)
? Device Drivers Device Drivers
– There is a large amount of code in the device driver section of the Linux kernel that controls the specific hardware setup
Preparation.
– Linux drivers are generally divided into network devices, block devices, character devices, miscellaneous devices
? Network protocol stack
– The Kernel network protocol stack provides a rich network protocol implementation for Linux.
Directory structure
? Linux kernel Source is a tree-shaped structure. Feature-related files are placed under different sub-directories
To make the program more readable rows.
? Arch Catalogue
– The arch Directory is the platform directory. All CPU architectures supported by the kernel , which have a corresponding
Sub-directories. Sub-directories for each CPU , further decomposed into boot,mm,kernel and other subdirectories
, respectively, control system boot, memory management, system call. There are also dynamic FM, the main frequency set
Parts, etc.
Summary
? 2% the programmer writes 80% the valid code
– The most important thing to do when you start learning is to look at the code, but to learn a Linux system,
Into the kernel of irrelevant code, tens of thousands of files in a lifetime can not see the end.
? Linux very complex, very powerful.
– Kernel source decompression compiled with 1.3G, by clipping compiled linux image zimage less than 4M
– 4M source image, and most of it doesn't need our attention.
– We just need to know the parts that are helpful for writing code, and the code we need to master
– only part of the red flag in the previous Linux code is needed to know or master
? As a developer you just have to learn to use it and we want to focus on learning just a small part of it
Score of
– Have a certain understanding of the architecture
– The focus of learning is to drive development-related knowledge, function calls, driver protocols, simple
Hardware knowledge
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
WebEx for 4412 Development Board Linux-driven tutorials within the core development basics