LDD It's very clear :

Linux It's a virtual memory system , It means that the address seen by the user program does not directly correspond to the physical address used by the hardware . Virtual memory introduces an indirection layer , It allows a lot of good things . With virtual memory , System rerun program can get much more space than physical memory . exactly , Even if a single process can have a virtual address space larger than the physical memory of the system . Virtual memory also allows programs to access the address space of a process , Including mapping member memory to device memory .

thus , We've talked about virtual and physical addresses , But a lot of details have been covered up . Linux The system handles several types of addresses , Each has its own meaning . Unfortunately , Kernel code doesn't always know exactly what type of address is being used in each case , So programmers have to be careful . 
The figure below Linux The address type used in shows how this address type is associated with physical memory .

User virtual addresses 
This is the normal address seen by the user program . The user address is... In length 32 Bits or 64 position , Depending on the underlying hardware structure , And each process has its own virtual address space . 
Physical addresses 
The address used between the processor and system memory . The physical address is 32- perhaps 64- The amount of bits ; even to the extent that 32- Bit systems can use larger physical addresses in some cases . 
Bus addresses 
The address used between the peripheral and the memory . often , They are the same physical addresses used by the processor , But it's not necessary . Some systems can provide a I/O Memory management unit (IOMMU), It remaps the address between the bus and main memory . One IOMMU There are many ways to make things simple ( for example , Make buffers scattered in memory appear continuous to the device , for example ), But when you set DMA During the operation, we should pay attention to IOMMU Programming is an extra step that has to be done . The bus address is highly feature dependent , Of course .

Kernel logical addresses 
These make up the normal kernel address space . These addresses map parts of ( Maybe all of it ) Main memory and often treated as if they were physical memory .  On most systems , There is only one constant offset between the logical addresses and their associated physical addresses (80x86 The upper constant offset is called the linear address / Virtual address , and intel The definition of logical address is not quite the same ).  The logical address uses the local pointer size of the hardware and , therefore , Maybe not in heavy equipment 32- Addressing all physical memory on a bit system . Logical addresses are often stored in unsigned long perhaps void * In variables of type . from kmalloc The returned memory has the kernel logical address .

Kernel virtual addresses 
The kernel virtual address is similar to the logical address , They are all maps from kernel space address to physical address . The kernel virtual address doesn't have to be linear in the logical address space , One to one mapping to physical addresses ,  however . All logical addresses are kernel virtual addresses , But many kernel virtual addresses are not logical addresses . for example , vmalloc The allocated memory has a virtual address ( But there's no direct physical mapping ). kmap function ( Later in this chapter ) Also returns the virtual address . Virtual addresses are often stored in pointer variables .

linux Address space division of more related articles

  1. MCS-51 MCU storage address space division

    1. Preface MCS-51 There's on-chip memory RAM. Off slice RAM and ROM Three spaces . MCS-51 SCM has four storage spaces in physical structure 1. On chip program memory ( Intraslice ROM)2. Off chip program memory ( Off slice ROM)3. On chip number ...

  2. Linux Versioning —— Based on packaging

    be based on Dpkg (Debian system ) Debian GNU / Linux It's a distribution that emphasizes the use of free software . It supports multiple hardware platforms .Debian And its derivative distributions use deb Package format , And use dpkg And its front end as a guarantee ...

  3. linux Partition

  4. Linux memory management 4--- Virtual address space management

    1. Preface The series of articles about memory management described in this paper is mainly the arrangement of the lectures about memory management knowledge by Mr. Chen Lijun . This lecture is mainly divided into three topics to explain memory management : The hardware foundation of memory management . Management of virtual address space . Management of physical address space . Ben ...

  5. Linux Kernel in-depth study of the linear address space of the process - The traditional version

    introduction : understand Linux In the environment , Process address space partition , For our understanding Linux Applications help a lot , Otherwise it will be New And Malloc And so on pointer operation makes dizzy , This article is based on Linux The kernel talks about Linux/Unix Line ...

  6. Linux Process address space && Process memory layout [ turn ]

    One Overview of process spatial distribution       For a process , Its spatial distribution is shown in the figure below : Procedures section (Text): The mapping of program code in memory , Store the binary code of the function body . Initialized data (Data): The variables have been initialized at the beginning of the program ...

  7. Linux User space and kernel address space

    Linux The operating system and drivers run in kernel space , The application runs in user space , They can't simply use pointers to pass data , because Linux The virtual memory mechanism used , Data in user space may be swapped out , When kernel space uses user space pointers , The corresponding number ...

  8. linux install VLAN, How to divide the system VLAN Label the switch

    A few days ago, a physical machine of the company needed to connect to the public network , But the public network needs the network card to label it . Because I haven't done linux Host partition VLAN The operation of , So I went to check , Need to use vconfig This command . But the trouble is , There is no such package in the system source .( Very pit ...

  9. Linux high memory Learning summary

    stay free There is an argument in the command l, It said show detailed low and high memory statistics. In fact, the first is right High Memory It's always zero. I don't know (Linux yes 64 by ). ...

Random recommendation

  1. [django] In user authentication, only login users are allowed to access ( Web security issues )

    When designing an important web page , It is generally required that users who do not access from the login interface cannot enter other pages , So how to set it ? as follows django Medium url.py urlpatterns = [    url(r'^$', 'login ...

  2. About spring The configuration file properties The problem of

    The problem I have is that I will properties Put it in src The bag below cannot be spring Scan to , An error that the configuration file cannot be found will be reported . But if you put it in src Directory can be spring Scan to , Now I don't know why , Write a note , Until the ...

  3. JAVA subject

    1. Create... In the project Number class , Judgment string "mingrikejijiavabu" In the character "i" Several times , And output the result . Method 1 : public class Nu ...

  4. jstree Cascade lookup tree

    <script > obj=$.jstree.reference($('#plugins4')); function PP(obj,e,filename){ if (obj.get_par ...

  5. understand AngularJS Scope of action Scope

    AngularJS in , A subscope will generally pass through JavaScript The prototype inheritance mechanism inherits the properties and methods of its parent scope . With one exception : stay directive Use in scope: { ... }, The scope created in this way is a unique ...

  6. jQuery How to create 、 Revise 、 Add DOM Elements

    For example, sequential execution [ establish ]-> [ modify ]-> [ add to ] Three actions . because jQuery Support chain operation , It's actually the design pattern builder Pattern , So we can string three operations together . First create a p Elements , ...

  7. Python Source analysis

    http://blog.csdn.net/balabalamerobert/article/details/570758

  8. mongodb Query with embedded document

    In this paper, from :http://blog.163.com/wm_at163/blog/static/1321734902012526103825481/ 1 > db.blog.findOne() { ...

  9. 09-UIKit(UICollectionViewController、UITabBarController)

    Catalog : One .UICollectionViewController Two .UITabBarController( Label controller ) 3、 ... and . View and controller life cycle Four . Other controls Back to the top One .UICollect ...

  10. Tasted key-value database ( Two )——MongoDB The good and the bad

    Tasted key-value database ( Two )——MongoDB The good and the bad MongoDB My name comes from the English word "humongous" The middle five letters of , It's a C++ Open source database based on distributed file storage ...