当前位置:网站首页>Tianshu night reading notes -- memory paging mechanism
Tianshu night reading notes -- memory paging mechanism
2022-06-25 01:17:00 【ma_ de_ hao_ mei_ le】
Friend chain
In modern operating systems , Will use the paging mechanism
stay 32bit Operating system , For a process , He has 4GB Of memory space
Which is low 2G Belonging to the process itself , high 2G Is the kernel space , All processes see the same value in kernel space , In other words, it's shared , But the process does not have permission to access this memory directly , Different processes also cannot directly access the low level of other processes 2GB Memory space ( User space )
All processes see the same memory address , These addresses are actually virtual addresses , They have a translation relationship with the physical address
The transformation relationship is as follows :
Catalog : Paging Directory , You can think of it as a table of contents , Each item points to a page table ( We agreed that this table is called CNMDTABLE), It's an address , Add... To this address cr3 Register value , Get the address of the page table
page : Used to indicate that we want CNMDTABLE Which item in the , Or an address ( We use positioning WCNMADDR)
The offset : Use this offset +WCNMADDR You can get the physical address
When calculating the page , We can determine whether this page exists , Because the status of the page is recorded in the page table , If this page does not exist , It triggers a page failure interrupt , Change pages from disk to memory
12 The offset of bit indicates , Each page can reach a maximum of 4MB, But actually a page is 4kb
When switching between different processes ,cr3 The value of is different , In this way, different physical addresses can be calculated from the same virtual memory address
Page memory protection mechanism
The detailed structure of each item in the page table

P Used to indicate whether this page exists
W Used to indicate whether it is writable
U:1 Represented as a user page R3 level ,0 Represented as a system page R0 level
But there is no flag bit indicating whether the page can be executed
Later, CPU Architecture solves this problem
Page table entries are expanded to 64bit, among NX If enabled, the page is not executable

边栏推荐
- Text editor for QT project practice - Episode 10
- 图片旋转移动缩放渐变
- Text editor for QT project practice -- Episode 9
- Scala responsibility chain pattern
- Scala adapter pattern
- Scala trait construction mechanism
- Golang示例续期锁:Redis+Channel+sync.Mutex
- 粉丝福利,JVM 手册(包含 PDF)
- Go language operators (under Lesson 8)
- 最新QQ微信域名防红PHP程序源码+强制跳转打开
猜你喜欢

Using macro code to generate handwriting automatically in word or WPS

15.线程同步的几种方法

JS Chapter 1 Summary

Preliminary understanding of qtoolbutton

Zuckerberg demonstrated four VR head display prototypes, and meta revealed the "family" of metauniverse

数组中关于sizeof()和strlen

汇编语言(2)基础知识-debug

Bi-sql Union

Bi SQL alias

Powerbi - for you who are learning
随机推荐
Scala object blending trait
改造一下 BeanUtils,优雅的实现 List 数据拷贝
4年工作經驗,多線程間的5種通信方式都說不出來,你敢信?
2022 simulated 100 questions of safety officer-c certificate examination and online simulated examination
Scala IO read by character
Scala template method pattern
Zuckerberg demonstrated four VR head display prototypes, and meta revealed the "family" of metauniverse
Bi-sql like
2种常见的设备稼动率OEE监测方法
How to store dataframe data in pandas into MySQL
Scala classes inherit multiple attributes
Add information on the left and add parts on the right of the status bar
归并排序求逆序数
Bi skill - judge 0 and null
图书馆管理系统代码源码(php+css+js+mysql) 完整的代码源码
新手看过来,带你一次性了解“软考”
This national day! Tencent cloud wecity will accompany you to travel and light up the city landmark
Preliminary understanding of qtoolbutton
Tencent cloud wecity Industry joint collaborative innovation to celebrate the New Year!
“一个优秀程序员可抵五个普通程序员!”