Linux Kernel Learning

Source: Internet
Author: User

1: Vim csope ctags

Linux kernel design and implementation

Deep understanding of Linux kernel elk

Linux Device DriverProgram

Deep understanding of Linux Virtual Memory Management

Gain an in-depth understanding of the Linux Network

Chapter 1. Overview

1: Synchronous and critical zone synchronization and critical regions

2: Shared Memory

Shared Memory provides the fastest way for processes to exchange and share data. A process starts
By issuing a shmget () system call to create a new shared memory having a required size. After
Obtaining the IPC resource identifier, the process invokes the shmat () system call, which returns
The starting address of the new region within the process address space. When the process wishes
Detach the shared memory from its address space, it invokes the shmdt () system call.
Implementation of shared memory depends on how the kernel implements process address spaces

3: Process Management

UNIX makes a neat distinction between the Process and the program it is executing. To that end,
Fork () and _ exit () system cballs are used respectively to create a new process and to terminate it,
While an exec ()-like system call is invoked to load a new program. After such a system call is
Executed, the process resumes execution with a brand new address space containing the loaded
Program.

4: Zombie Processes

How can a parent process inquire about termination of its children? The wait4 () System Call allows
A process to wait until one of its children terminates; it returns the process ID (PID) of
Terminated child.

The solution lies in a special system process called init, which is created during system initialization. When a process terminates, the kernel changes the appropriate process descriptor pointers of all

Existing Children Of The terminated process to make them become children of init. This process
Monitors the execution of all its children and routinely issues wait4 () system CILS, whose side
Effect is to get rid of all orphaned zombies.

5: virtual address spaces
Virtual address spaces also allow other efficient strategies, such as the copy on write strategy
Mentioned earlier. For example, when a new process is created, the kernel just assigns the parent's
Page frames to the Child address space, but marks them read-only. An exception is raised as soon
The parent or the child tries to modify the contents of a page. The exception handler assigns a new
Page frame to the affected process and initializes it with the contents of the original page.

Chapter 2. Memory addressing

    • Logical Address

Encoded ded in the machine language instructions to specify the address of an operand or of
Instruction. This type of address embodies the well-known 80x86 segmented architecture
That forces MS-DOS and Windows programmers to divide their programs into segments. Each
Logical Address consists of a segment and an offset (or displacement) that denotes the distance
From the start of the segment to the actual address.

    • Linear address (also known as virtual address)

A single 32-bit unsigned integer that can be used to address up to 4 GB that is, up
4,294,967,296 memory cells. linear addresses are usually represented in hexadecimal
Notation; their values range from 0x00000000 to 0xffffffff.

    • Physical address

Used to address memory cells in memory chips. They correspond to the electrical signals sent
Along the address pins of the microprocessor to the memory bus. Physical addresses are
Represented as 32-bit or 36-bit unsigned integers.

The memory management unit (MMU) transforms a logical address into a linear address by means
A hardware circuit called a segmentation unit; subsequently, a second hardware circuit called
Paging unit transforms the linear address into a physical address

---- Segment selectors and segmentation registers

A logical address consists of two parts: a segment identifier and an offset that specifies the relative address within the segment. The segment identifier is a 16-bit field called the segment Selector

to make it easy to retrieve segment selectors quickly, the processor provides segmentation registerswhose only purpose is to hold segment selectors; these registers are called CS, SS, DS, es, FS, and Gs. although there are only six of them, A program can reuse the same segmentation register for different purposes by saving its content in memory and then restoring it later. three of the six segmentation registers have specific purposes:

CS

The code segment register, which points to a segment containing program instructions
SS
The stack segment register, which points to a segment containing the current program Stack
DS
The data segment register, which points to a segment containing global and static data

the remaining three segmentation registers are general purpose and may refer to arbitrary data segments.

The CS register has another important function: it contains des a 2-bit field that specifies the current
Privilege level (CPL) of the CPU. The value 0 denotes the highest privilege level, while the value 3
Denotes the lowest one. Linux uses only levels 0 and 3, which are respectively called Kernel modeand user mode.

    • Segment Descriptors

Each segment is represented by an 8-byte segment descriptor that describes the segment
Characteristics. segment descriptors are stored either in the Global Descriptor Table (gdt) or in
Local Descriptor Table (LDT ).

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.