Update 计算机操作系统 - 内存管理.md
重新绘制配图。
|
After Width: | Height: | Size: 130 KiB |
|
After Width: | Height: | Size: 104 KiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 113 KiB |
|
After Width: | Height: | Size: 149 KiB |
|
After Width: | Height: | Size: 220 KiB |
@@ -18,13 +18,13 @@
|
||||
|
||||
## 虚拟内存
|
||||
|
||||
虚拟内存的目的是为了让物理内存扩充成更大的逻辑内存,从而让程序获得更多的可用内存。
|
||||
虚拟内存的目的是为了让物理内存扩充成更大的逻辑内存,从而让程序获得更多的可用内存。此外,每个进程都有独立的地址空间,一个进程无法直接访问另一个进程的内存,操作系统还可以按页设置读写和执行权限。
|
||||
|
||||
为了更好的管理内存,操作系统将内存抽象成地址空间。每个程序拥有自己的地址空间,这个地址空间被分割成多个块,每一块称为一页。这些页被映射到物理内存,但不需要映射到连续的物理内存,也不需要所有页都必须在物理内存中。当程序引用到不在物理内存中的页时,由硬件执行必要的映射,将缺失的部分装入物理内存并重新执行失败的指令。
|
||||
为了更好的管理内存,操作系统将内存抽象成地址空间。每个程序拥有自己的地址空间,这个地址空间被分割成多个块,每一块称为一页。这些页被映射到物理内存,但不需要映射到连续的物理内存,也不需要所有页都必须在物理内存中。当程序引用到不在物理内存中的页时,硬件触发缺页中断,由操作系统将缺失的页装入物理内存,再重新执行失败的指令。
|
||||
|
||||
从上面的描述中可以看出,虚拟内存允许程序不用将地址空间中的每一页都映射到物理内存,也就是说一个程序不需要全部调入内存就可以运行,这使得有限的内存运行大程序成为可能。例如有一台计算机可以产生 16 位地址,那么一个程序的地址空间范围是 0\~64K。该计算机只有 32KB 的物理内存,虚拟内存技术允许该计算机运行一个 64K 大小的程序。
|
||||
|
||||
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/7b281b1e-0595-402b-ae35-8c91084c33c1.png"/> </div><br>
|
||||
<div align="center"> <img src="pics/vm-mapping.png" width="640px"/> </div><br>
|
||||
|
||||
## 分页系统地址映射
|
||||
|
||||
@@ -32,9 +32,13 @@
|
||||
|
||||
一个虚拟地址分成两个部分,一部分存储页面号,一部分存储偏移量。
|
||||
|
||||
下图的页表存放着 16 个页,这 16 个页需要用 4 个比特位来进行索引定位。例如对于虚拟地址(0010 000000000100),前 4 位是存储页面号 2,读取表项内容为(110 1),页表项最后一位表示是否存在于内存中,1 表示存在。后 12 位存储偏移量。这个页对应的页框的地址为 (110 000000000100)。
|
||||
下图的页表存放着 16 个页,这 16 个页需要用 4 个比特位来进行索引定位。例如对于虚拟地址 0x3ABC(0011 101010111100),前 4 位是页面号 3,读取表项内容为(101 1),页表项最后一位表示是否存在于内存中,1 表示存在。后 12 位是偏移量,直接拼接到页框号 101 后面,得到物理地址 0x5ABC(101 101010111100)。
|
||||
|
||||
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/cf4386a1-58c9-4eca-a17f-e12b1e9770eb.png" width="500"/> </div><br>
|
||||
<div align="center"> <img src="pics/page-translate.png" width="720px"/> </div><br>
|
||||
|
||||
页表存放在内存中,每次访问内存之前都要先查一次页表。CPU 中的快表(Translation Lookaside Buffer, TLB)缓存最近用过的页表项,命中时不用再访问页表。
|
||||
|
||||
64 位系统的地址空间很大,如果用一张页表覆盖全部地址,页表本身就会非常大,因此使用多级页表,只为用到的地址分配下一级页表。例如 x86-64 通常使用 4 级页表,48 位虚拟地址分为 4 个 9 位的页表索引和 12 位的页内偏移。
|
||||
|
||||
## 页面置换算法
|
||||
|
||||
@@ -54,7 +58,7 @@
|
||||
|
||||
举例:一个系统为某进程分配了三个物理块,并有如下页面引用序列:
|
||||
|
||||
```html
|
||||
```text
|
||||
7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1
|
||||
```
|
||||
|
||||
@@ -70,11 +74,11 @@
|
||||
|
||||
因为每次访问都需要更新链表,因此这种方式实现的 LRU 代价很高。
|
||||
|
||||
```html
|
||||
```text
|
||||
4,7,0,7,1,0,1,2,1,2,6
|
||||
```
|
||||
|
||||
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/eb859228-c0f2-4bce-910d-d9f76929352b.png"/> </div><br>
|
||||
<div align="center"> <img src="pics/lru-stack.png" width="720px"/> </div><br>
|
||||
|
||||
### 3. 最近未使用
|
||||
|
||||
@@ -105,7 +109,7 @@ FIFO 算法可能会把经常使用的页面置换出去,为了避免这一问
|
||||
|
||||
当页面被访问 (读或写) 时设置该页面的 R 位为 1。需要替换的时候,检查最老页面的 R 位。如果 R 位是 0,那么这个页面既老又没有被使用,可以立刻置换掉;如果是 1,就将 R 位清 0,并把该页面放到链表的尾端,修改它的装入时间使它就像刚装入的一样,然后继续从链表的头部开始搜索。
|
||||
|
||||
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/ecf8ad5d-5403-48b9-b6e7-f2e20ffe8fca.png"/> </div><br>
|
||||
<div align="center"> <img src="pics/second-chance.png" width="720px"/> </div><br>
|
||||
|
||||
### 6. 时钟
|
||||
|
||||
@@ -113,19 +117,17 @@ FIFO 算法可能会把经常使用的页面置换出去,为了避免这一问
|
||||
|
||||
第二次机会算法需要在链表中移动页面,降低了效率。时钟算法使用环形链表将页面连接起来,再使用一个指针指向最老的页面。
|
||||
|
||||
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/5f5ef0b6-98ea-497c-a007-f6c55288eab1.png"/> </div><br>
|
||||
<div align="center"> <img src="pics/clock.png" width="720px"/> </div><br>
|
||||
|
||||
## 分段
|
||||
|
||||
虚拟内存采用的是分页技术,也就是将地址空间划分成固定大小的页,每一页再与内存进行映射。
|
||||
|
||||
下图为一个编译器在编译过程中建立的多个表,有 4 个表是动态增长的,如果使用分页系统的一维地址空间,动态增长的特点会导致覆盖问题的出现。
|
||||
例如一个程序有代码、全局数据、堆和栈几部分,其中堆和栈会动态增长。如果放在一维的地址空间中,就要预先给每一部分留出位置,某一部分增长到相邻部分的位置时就会发生覆盖。
|
||||
|
||||
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/22de0538-7c6e-4365-bd3b-8ce3c5900216.png"/> </div><br>
|
||||
分段的做法是把每一部分作为一个段,一个段构成一个独立的地址空间。每个段的长度可以不同,并且可以动态增长。地址由段号和段内偏移组成,通过段表找到段的基址,再加上偏移得到物理地址。
|
||||
|
||||
分段的做法是把每个表分成段,一个段构成一个独立的地址空间。每个段的长度可以不同,并且可以动态增长。
|
||||
|
||||
<div align="center"> <img src="https://cs-notes-1256109796.cos.ap-guangzhou.myqcloud.com/e0900bb2-220a-43b7-9aa9-1d5cd55ff56e.png"/> </div><br>
|
||||
<div align="center"> <img src="pics/segments.png" width="740px"/> </div><br>
|
||||
|
||||
## 段页式
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="340" viewBox="0 0 720 340">
|
||||
<style>
|
||||
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #3F3F3F; font-size: 12px; }
|
||||
.title { font-weight: bold; font-size: 15px; fill: #333; text-anchor: middle; }
|
||||
.b { font-weight: bold; }
|
||||
.c { text-anchor: middle; }
|
||||
.e { text-anchor: end; }
|
||||
.sub { font-size: 11px; fill: #6E6E6E; }
|
||||
.note { fill: #C0605A; }
|
||||
.ok { fill: #6A9F68; }
|
||||
.mono { font-family: Menlo, Consolas, monospace; }
|
||||
.arrow { stroke: #555; stroke-width: 1.1; fill: none; marker-end: url(#a); }
|
||||
.red { stroke: #C0605A; marker-end: url(#r); }
|
||||
.green { stroke: #6A9F68; marker-end: url(#g); }
|
||||
.dash { stroke-dasharray: 5 4; }
|
||||
.line { stroke: #555; stroke-width: 1.1; fill: none; }
|
||||
.frame { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }
|
||||
.shadow { fill: #DADADA; }
|
||||
</style>
|
||||
<defs>
|
||||
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#555"/>
|
||||
</marker>
|
||||
<marker id="r" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#C0605A"/>
|
||||
</marker>
|
||||
<marker id="g" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#6A9F68"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="#FFFFFF"/>
|
||||
|
||||
<text x="360" y="28" class="title">时钟算法:用环形链表代替移动页面</text>
|
||||
<rect x="172" y="55" width="56" height="30" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="200" y="74" class="c sub mono" style="fill:#444">A R=1</text>
|
||||
<rect x="249.782" y="87.2183" width="56" height="30" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="277.782" y="106.218" class="c sub mono" style="fill:#444">B R=0</text>
|
||||
<rect x="282" y="165" width="56" height="30" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="310" y="184" class="c sub mono" style="fill:#444">C R=1</text>
|
||||
<rect x="249.782" y="242.782" width="56" height="30" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="277.782" y="261.782" class="c sub mono" style="fill:#444">D R=1</text>
|
||||
<rect x="172" y="275" width="56" height="30" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="200" y="294" class="c sub mono" style="fill:#444">E R=0</text>
|
||||
<rect x="94.2183" y="242.782" width="56" height="30" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="122.218" y="261.782" class="c sub mono" style="fill:#444">F R=1</text>
|
||||
<rect x="62" y="165" width="56" height="30" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="90" y="184" class="c sub mono" style="fill:#444">G R=0</text>
|
||||
<rect x="94.2183" y="87.2183" width="56" height="30" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="122.218" y="106.218" class="c sub mono" style="fill:#444">H R=1</text>
|
||||
<line x1="200" y1="180" x2="270" y2="180" stroke="#C0605A" stroke-width="2" marker-end="url(#r)"/>
|
||||
<circle cx="200" cy="180" r="4" fill="#C0605A"/>
|
||||
<text x="200" y="202" class="c sub note">指针</text>
|
||||
<text x="400" y="70" class="b">发生缺页时,从指针处开始检查:</text>
|
||||
<text x="400" y="100" class="sub" style="fill:#444">C 的 R = 1:清零,指针前进</text>
|
||||
<text x="400" y="124" class="sub" style="fill:#444">D 的 R = 1:清零,指针前进</text>
|
||||
<text x="400" y="148" class="sub" style="fill:#444">E 的 R = 0:换出 E,新页面放在这里,</text>
|
||||
<text x="400" y="172" class="sub" style="fill:#444">指针指向 F</text>
|
||||
<text x="400" y="210" class="sub">效果与第二次机会相同,但只移动指针,</text>
|
||||
<text x="400" y="228" class="sub">不用在链表中移动页面。</text>
|
||||
<text x="30" y="326" class="sub">图中灰色的 C、D 在这次检查中被清零;淡紫色的 E 被换出。</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.1 KiB |
@@ -0,0 +1,153 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="300" viewBox="0 0 720 300">
|
||||
<style>
|
||||
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #3F3F3F; font-size: 12px; }
|
||||
.title { font-weight: bold; font-size: 15px; fill: #333; text-anchor: middle; }
|
||||
.b { font-weight: bold; }
|
||||
.c { text-anchor: middle; }
|
||||
.e { text-anchor: end; }
|
||||
.sub { font-size: 11px; fill: #6E6E6E; }
|
||||
.note { fill: #C0605A; }
|
||||
.ok { fill: #6A9F68; }
|
||||
.mono { font-family: Menlo, Consolas, monospace; }
|
||||
.arrow { stroke: #555; stroke-width: 1.1; fill: none; marker-end: url(#a); }
|
||||
.red { stroke: #C0605A; marker-end: url(#r); }
|
||||
.green { stroke: #6A9F68; marker-end: url(#g); }
|
||||
.dash { stroke-dasharray: 5 4; }
|
||||
.line { stroke: #555; stroke-width: 1.1; fill: none; }
|
||||
.frame { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }
|
||||
.shadow { fill: #DADADA; }
|
||||
</style>
|
||||
<defs>
|
||||
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#555"/>
|
||||
</marker>
|
||||
<marker id="r" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#C0605A"/>
|
||||
</marker>
|
||||
<marker id="g" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#6A9F68"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="#FFFFFF"/>
|
||||
|
||||
<text x="360" y="28" class="title">LRU:5 个页框,链表头是最近访问的页面</text>
|
||||
<text x="30" y="66" class="sub b" style="fill:#444">访问</text>
|
||||
<text x="30" y="236" class="sub b" style="fill:#444">缺页</text>
|
||||
<text x="90" y="66" class="c b mono" style="fill:#444">4</text>
|
||||
<rect x="70" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="90" y="97" class="c sub mono" style="fill:#444">4</text>
|
||||
<rect x="70" y="106" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<rect x="70" y="132" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<rect x="70" y="158" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<rect x="70" y="184" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="90" y="236" class="c sub note">缺页</text>
|
||||
<text x="146" y="66" class="c b mono" style="fill:#444">7</text>
|
||||
<rect x="126" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="146" y="97" class="c sub mono" style="fill:#444">7</text>
|
||||
<rect x="126" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="146" y="123" class="c sub mono" style="fill:#444">4</text>
|
||||
<rect x="126" y="132" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<rect x="126" y="158" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<rect x="126" y="184" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="146" y="236" class="c sub note">缺页</text>
|
||||
<text x="202" y="66" class="c b mono" style="fill:#444">0</text>
|
||||
<rect x="182" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="202" y="97" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="182" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="202" y="123" class="c sub mono" style="fill:#444">7</text>
|
||||
<rect x="182" y="132" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="202" y="149" class="c sub mono" style="fill:#444">4</text>
|
||||
<rect x="182" y="158" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<rect x="182" y="184" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="202" y="236" class="c sub note">缺页</text>
|
||||
<text x="258" y="66" class="c b mono" style="fill:#444">7</text>
|
||||
<rect x="238" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="258" y="97" class="c sub mono" style="fill:#444">7</text>
|
||||
<rect x="238" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="258" y="123" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="238" y="132" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="258" y="149" class="c sub mono" style="fill:#444">4</text>
|
||||
<rect x="238" y="158" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<rect x="238" y="184" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="314" y="66" class="c b mono" style="fill:#444">1</text>
|
||||
<rect x="294" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="314" y="97" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="294" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="314" y="123" class="c sub mono" style="fill:#444">7</text>
|
||||
<rect x="294" y="132" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="314" y="149" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="294" y="158" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="314" y="175" class="c sub mono" style="fill:#444">4</text>
|
||||
<rect x="294" y="184" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="314" y="236" class="c sub note">缺页</text>
|
||||
<text x="370" y="66" class="c b mono" style="fill:#444">0</text>
|
||||
<rect x="350" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="370" y="97" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="350" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="370" y="123" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="350" y="132" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="370" y="149" class="c sub mono" style="fill:#444">7</text>
|
||||
<rect x="350" y="158" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="370" y="175" class="c sub mono" style="fill:#444">4</text>
|
||||
<rect x="350" y="184" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="426" y="66" class="c b mono" style="fill:#444">1</text>
|
||||
<rect x="406" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="426" y="97" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="406" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="426" y="123" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="406" y="132" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="426" y="149" class="c sub mono" style="fill:#444">7</text>
|
||||
<rect x="406" y="158" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="426" y="175" class="c sub mono" style="fill:#444">4</text>
|
||||
<rect x="406" y="184" width="40" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="482" y="66" class="c b mono" style="fill:#444">2</text>
|
||||
<rect x="462" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="482" y="97" class="c sub mono" style="fill:#444">2</text>
|
||||
<rect x="462" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="482" y="123" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="462" y="132" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="482" y="149" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="462" y="158" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="482" y="175" class="c sub mono" style="fill:#444">7</text>
|
||||
<rect x="462" y="184" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="482" y="201" class="c sub mono" style="fill:#444">4</text>
|
||||
<text x="482" y="236" class="c sub note">缺页</text>
|
||||
<text x="538" y="66" class="c b mono" style="fill:#444">1</text>
|
||||
<rect x="518" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="538" y="97" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="518" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="538" y="123" class="c sub mono" style="fill:#444">2</text>
|
||||
<rect x="518" y="132" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="538" y="149" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="518" y="158" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="538" y="175" class="c sub mono" style="fill:#444">7</text>
|
||||
<rect x="518" y="184" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="538" y="201" class="c sub mono" style="fill:#444">4</text>
|
||||
<text x="594" y="66" class="c b mono" style="fill:#444">2</text>
|
||||
<rect x="574" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="594" y="97" class="c sub mono" style="fill:#444">2</text>
|
||||
<rect x="574" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="594" y="123" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="574" y="132" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="594" y="149" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="574" y="158" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="594" y="175" class="c sub mono" style="fill:#444">7</text>
|
||||
<rect x="574" y="184" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="594" y="201" class="c sub mono" style="fill:#444">4</text>
|
||||
<text x="650" y="66" class="c b mono" style="fill:#444">6</text>
|
||||
<rect x="630" y="80" width="40" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="650" y="97" class="c sub mono" style="fill:#444">6</text>
|
||||
<rect x="630" y="106" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="650" y="123" class="c sub mono" style="fill:#444">2</text>
|
||||
<rect x="630" y="132" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="650" y="149" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="630" y="158" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="650" y="175" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="630" y="184" width="40" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="650" y="201" class="c sub mono" style="fill:#444">7</text>
|
||||
<text x="650" y="236" class="c sub note">缺页</text>
|
||||
<text x="650" y="254" class="c sub note">换出 4</text>
|
||||
<text x="60" y="98" class="sub e">头</text>
|
||||
<text x="60" y="202" class="sub e">尾</text>
|
||||
<text x="30" y="284" class="sub">被访问的页面移到链表头(淡紫色);访问 6 时 5 个页框已满,换出链表尾部最久没有访问的 4。11 次访问共缺页 6 次。</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,145 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="400" viewBox="0 0 720 400">
|
||||
<style>
|
||||
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #3F3F3F; font-size: 12px; }
|
||||
.title { font-weight: bold; font-size: 15px; fill: #333; text-anchor: middle; }
|
||||
.b { font-weight: bold; }
|
||||
.c { text-anchor: middle; }
|
||||
.e { text-anchor: end; }
|
||||
.sub { font-size: 11px; fill: #6E6E6E; }
|
||||
.note { fill: #C0605A; }
|
||||
.ok { fill: #6A9F68; }
|
||||
.mono { font-family: Menlo, Consolas, monospace; }
|
||||
.arrow { stroke: #555; stroke-width: 1.1; fill: none; marker-end: url(#a); }
|
||||
.red { stroke: #C0605A; marker-end: url(#r); }
|
||||
.green { stroke: #6A9F68; marker-end: url(#g); }
|
||||
.dash { stroke-dasharray: 5 4; }
|
||||
.line { stroke: #555; stroke-width: 1.1; fill: none; }
|
||||
.frame { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }
|
||||
.shadow { fill: #DADADA; }
|
||||
</style>
|
||||
<defs>
|
||||
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#555"/>
|
||||
</marker>
|
||||
<marker id="r" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#C0605A"/>
|
||||
</marker>
|
||||
<marker id="g" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#6A9F68"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="#FFFFFF"/>
|
||||
|
||||
<text x="360" y="28" class="title">地址转换:虚拟地址 0x3ABC</text>
|
||||
<text x="140" y="70" class="sub b e" style="fill:#444">虚拟地址</text>
|
||||
<rect x="150" y="52" width="22" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="161" y="69" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="172" y="52" width="22" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="183" y="69" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="194" y="52" width="22" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="205" y="69" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="216" y="52" width="22" height="26" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="227" y="69" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="238" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="249" y="69" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="260" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="271" y="69" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="282" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="293" y="69" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="304" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="315" y="69" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="326" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="337" y="69" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="348" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="359" y="69" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="370" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="381" y="69" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="392" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="403" y="69" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="414" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="425" y="69" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="436" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="447" y="69" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="458" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="469" y="69" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="480" y="52" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="491" y="69" class="c sub mono" style="fill:#444">0</text>
|
||||
<text x="194" y="44" class="c sub" style="fill:#766AA8">页号 3</text>
|
||||
<text x="370" y="44" class="c sub">偏移量 0xABC(12 位)</text>
|
||||
<text x="110" y="120" class="c sub b" style="fill:#444">页表</text>
|
||||
<rect x="70" y="130" width="70" height="22" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="105" y="145" class="c sub" style="fill:#444">页框号</text>
|
||||
<rect x="140" y="130" width="50" height="22" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="165" y="145" class="c sub" style="fill:#444">存在</text>
|
||||
<text x="62" y="168" class="sub mono e">0</text>
|
||||
<rect x="70" y="152" width="70" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="105" y="168" class="c sub mono" style="fill:#444">010</text>
|
||||
<rect x="140" y="152" width="50" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="165" y="168" class="c sub mono" style="fill:#444">1</text>
|
||||
<text x="62" y="192" class="sub mono e">1</text>
|
||||
<rect x="70" y="176" width="70" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="105" y="192" class="c sub mono" style="fill:#444">111</text>
|
||||
<rect x="140" y="176" width="50" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="165" y="192" class="c sub mono" style="fill:#444">1</text>
|
||||
<text x="62" y="216" class="sub mono e">2</text>
|
||||
<rect x="70" y="200" width="70" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="105" y="216" class="c sub mono" style="fill:#444">---</text>
|
||||
<rect x="140" y="200" width="50" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="165" y="216" class="c sub mono" style="fill:#444">0</text>
|
||||
<text x="62" y="240" class="sub mono e">3</text>
|
||||
<rect x="70" y="224" width="70" height="24" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="105" y="240" class="c sub mono" style="fill:#444">101</text>
|
||||
<rect x="140" y="224" width="50" height="24" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="165" y="240" class="c sub mono" style="fill:#444">1</text>
|
||||
<text x="62" y="264" class="sub mono e">4</text>
|
||||
<rect x="70" y="248" width="70" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="105" y="264" class="c sub mono" style="fill:#444">---</text>
|
||||
<rect x="140" y="248" width="50" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="165" y="264" class="c sub mono" style="fill:#444">0</text>
|
||||
<text x="62" y="288" class="sub mono e">5</text>
|
||||
<rect x="70" y="272" width="70" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="105" y="288" class="c sub mono" style="fill:#444">000</text>
|
||||
<rect x="140" y="272" width="50" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="165" y="288" class="c sub mono" style="fill:#444">1</text>
|
||||
<text x="130" y="314" class="c sub">……共 16 项</text>
|
||||
<path d="M194,80 V96 H200 V236 H194" class="arrow"/>
|
||||
<text x="210" y="118" class="sub">用页号作下标</text>
|
||||
<text x="290" y="278" class="sub b e" style="fill:#444">物理地址</text>
|
||||
<rect x="300" y="260" width="22" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="311" y="277" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="322" y="260" width="22" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="333" y="277" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="344" y="260" width="22" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="355" y="277" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="366" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="377" y="277" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="388" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="399" y="277" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="410" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="421" y="277" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="432" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="443" y="277" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="454" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="465" y="277" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="476" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="487" y="277" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="498" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="509" y="277" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="520" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="531" y="277" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="542" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="553" y="277" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="564" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="575" y="277" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="586" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="597" y="277" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="608" y="260" width="22" height="26" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="619" y="277" class="c sub mono" style="fill:#444">0</text>
|
||||
<path d="M194,236 H333 V258" class="arrow"/>
|
||||
<text x="341" y="228" class="sub" style="fill:#207773">页框号 101(5)</text>
|
||||
<path d="M370,80 V258" class="arrow dash"/>
|
||||
<text x="378" y="200" class="sub">偏移量原样复制</text>
|
||||
<text x="465" y="310" class="c sub mono b" style="fill:#444">= 0x5ABC</text>
|
||||
<text x="30" y="352" class="sub">4 KB 的页需要 12 位偏移量,16 位地址剩下的 4 位就是页号,页表一共 16 项。</text>
|
||||
<text x="30" y="370" class="sub">如果查到的“存在”位是 0(例如页 4),说明这一页不在内存中,CPU 触发缺页中断。</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,76 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="720" height="250" viewBox="0 0 720 250">
|
||||
<style>
|
||||
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #3F3F3F; font-size: 12px; }
|
||||
.title { font-weight: bold; font-size: 15px; fill: #333; text-anchor: middle; }
|
||||
.b { font-weight: bold; }
|
||||
.c { text-anchor: middle; }
|
||||
.e { text-anchor: end; }
|
||||
.sub { font-size: 11px; fill: #6E6E6E; }
|
||||
.note { fill: #C0605A; }
|
||||
.ok { fill: #6A9F68; }
|
||||
.mono { font-family: Menlo, Consolas, monospace; }
|
||||
.arrow { stroke: #555; stroke-width: 1.1; fill: none; marker-end: url(#a); }
|
||||
.red { stroke: #C0605A; marker-end: url(#r); }
|
||||
.green { stroke: #6A9F68; marker-end: url(#g); }
|
||||
.dash { stroke-dasharray: 5 4; }
|
||||
.line { stroke: #555; stroke-width: 1.1; fill: none; }
|
||||
.frame { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }
|
||||
.shadow { fill: #DADADA; }
|
||||
</style>
|
||||
<defs>
|
||||
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#555"/>
|
||||
</marker>
|
||||
<marker id="r" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#C0605A"/>
|
||||
</marker>
|
||||
<marker id="g" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#6A9F68"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="#FFFFFF"/>
|
||||
|
||||
<text x="360" y="28" class="title">第二次机会:访问过的页面再给一次机会</text>
|
||||
<text x="30" y="86" class="sub b" style="fill:#444">(a) 时间 20 缺页</text>
|
||||
<rect x="150" y="64" width="60" height="34" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="180" y="85" class="c sub mono" style="fill:#444">A R=1</text>
|
||||
<text x="180" y="58" class="c sub">装入 0</text>
|
||||
<line x1="212" y1="81" x2="244" y2="81" class="arrow "/>
|
||||
<rect x="246" y="64" width="60" height="34" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="276" y="85" class="c sub mono" style="fill:#444">B R=0</text>
|
||||
<text x="276" y="58" class="c sub">装入 3</text>
|
||||
<line x1="308" y1="81" x2="340" y2="81" class="arrow "/>
|
||||
<rect x="342" y="64" width="60" height="34" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="372" y="85" class="c sub mono" style="fill:#444">C R=1</text>
|
||||
<text x="372" y="58" class="c sub">装入 7</text>
|
||||
<line x1="404" y1="81" x2="436" y2="81" class="arrow "/>
|
||||
<rect x="438" y="64" width="60" height="34" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="468" y="85" class="c sub mono" style="fill:#444">D R=0</text>
|
||||
<text x="468" y="58" class="c sub">装入 8</text>
|
||||
<line x1="500" y1="81" x2="532" y2="81" class="arrow "/>
|
||||
<rect x="534" y="64" width="60" height="34" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="564" y="85" class="c sub mono" style="fill:#444">E R=1</text>
|
||||
<text x="564" y="58" class="c sub">装入 12</text>
|
||||
<text x="150" y="120" class="sub" style="fill:#444">最老的 A 的 R = 1:清零,移到队尾,装入时间改为 20;再看 B,R = 0,换出 B</text>
|
||||
<text x="30" y="188" class="sub b" style="fill:#444">(b) 处理之后</text>
|
||||
<rect x="150" y="166" width="60" height="34" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="180" y="187" class="c sub mono" style="fill:#444">C R=1</text>
|
||||
<text x="180" y="160" class="c sub">装入 7</text>
|
||||
<line x1="212" y1="183" x2="244" y2="183" class="arrow "/>
|
||||
<rect x="246" y="166" width="60" height="34" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="276" y="187" class="c sub mono" style="fill:#444">D R=0</text>
|
||||
<text x="276" y="160" class="c sub">装入 8</text>
|
||||
<line x1="308" y1="183" x2="340" y2="183" class="arrow "/>
|
||||
<rect x="342" y="166" width="60" height="34" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="372" y="187" class="c sub mono" style="fill:#444">E R=1</text>
|
||||
<text x="372" y="160" class="c sub">装入 12</text>
|
||||
<line x1="404" y1="183" x2="436" y2="183" class="arrow "/>
|
||||
<rect x="438" y="166" width="60" height="34" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="468" y="187" class="c sub mono" style="fill:#444">A R=0</text>
|
||||
<text x="468" y="160" class="c sub">装入 20</text>
|
||||
<line x1="500" y1="183" x2="532" y2="183" class="arrow "/>
|
||||
<rect x="534" y="166" width="60" height="34" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="564" y="187" class="c sub mono" style="fill:#444">新页 R=1</text>
|
||||
<text x="564" y="160" class="c sub">装入 20</text>
|
||||
<text x="30" y="236" class="sub">队头是最早装入的页面。FIFO 会直接换出刚被访问过的 A,第二次机会算法换出的是又老又没被访问的 B。</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,91 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="740" height="330" viewBox="0 0 740 330">
|
||||
<style>
|
||||
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #3F3F3F; font-size: 12px; }
|
||||
.title { font-weight: bold; font-size: 15px; fill: #333; text-anchor: middle; }
|
||||
.b { font-weight: bold; }
|
||||
.c { text-anchor: middle; }
|
||||
.e { text-anchor: end; }
|
||||
.sub { font-size: 11px; fill: #6E6E6E; }
|
||||
.note { fill: #C0605A; }
|
||||
.ok { fill: #6A9F68; }
|
||||
.mono { font-family: Menlo, Consolas, monospace; }
|
||||
.arrow { stroke: #555; stroke-width: 1.1; fill: none; marker-end: url(#a); }
|
||||
.red { stroke: #C0605A; marker-end: url(#r); }
|
||||
.green { stroke: #6A9F68; marker-end: url(#g); }
|
||||
.dash { stroke-dasharray: 5 4; }
|
||||
.line { stroke: #555; stroke-width: 1.1; fill: none; }
|
||||
.frame { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }
|
||||
.shadow { fill: #DADADA; }
|
||||
</style>
|
||||
<defs>
|
||||
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#555"/>
|
||||
</marker>
|
||||
<marker id="r" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#C0605A"/>
|
||||
</marker>
|
||||
<marker id="g" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#6A9F68"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="#FFFFFF"/>
|
||||
|
||||
<text x="370" y="28" class="title">分段:每个段是独立的地址空间</text>
|
||||
<rect x="40" y="100" width="70" height="120" rx="4" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="75" y="164" class="c sub b" style="fill:#444">代码</text>
|
||||
<text x="75" y="240" class="c sub">段 0</text>
|
||||
<text x="75" y="256" class="c sub">长 12K</text>
|
||||
<rect x="132" y="180" width="70" height="40" rx="4" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="167" y="204" class="c sub b" style="fill:#444">全局数据</text>
|
||||
<text x="167" y="240" class="c sub">段 1</text>
|
||||
<text x="167" y="256" class="c sub">长 4K</text>
|
||||
<rect x="224" y="140" width="70" height="80" rx="4" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="259" y="184" class="c sub b" style="fill:#444">堆</text>
|
||||
<text x="259" y="240" class="c sub">段 2</text>
|
||||
<text x="259" y="256" class="c sub">长 8K</text>
|
||||
<line x1="259" y1="136" x2="259" y2="114" class="arrow"/>
|
||||
<text x="259" y="108" class="c sub">可增长</text>
|
||||
<rect x="316" y="140" width="70" height="80" rx="4" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="351" y="184" class="c sub b" style="fill:#444">栈</text>
|
||||
<text x="351" y="240" class="c sub">段 3</text>
|
||||
<text x="351" y="256" class="c sub">长 8K</text>
|
||||
<line x1="351" y1="136" x2="351" y2="114" class="arrow"/>
|
||||
<text x="351" y="108" class="c sub">可增长</text>
|
||||
<text x="440" y="66" class="b">段表</text>
|
||||
<rect x="440" y="76" width="50" height="24" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="465" y="92" class="c sub" style="fill:#444">段号</text>
|
||||
<rect x="490" y="76" width="90" height="24" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="535" y="92" class="c sub" style="fill:#444">基址</text>
|
||||
<rect x="580" y="76" width="70" height="24" rx="3" fill="#EAE9E7" stroke="#BFBEBA" stroke-width="1"/>
|
||||
<text x="615" y="92" class="c sub" style="fill:#444">长度</text>
|
||||
<rect x="440" y="100" width="50" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="465" y="116" class="c sub mono" style="fill:#444">0</text>
|
||||
<rect x="490" y="100" width="90" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="535" y="116" class="c sub mono" style="fill:#444">0x4000</text>
|
||||
<rect x="580" y="100" width="70" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="615" y="116" class="c sub mono" style="fill:#444">12K</text>
|
||||
<rect x="440" y="124" width="50" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="465" y="140" class="c sub mono" style="fill:#444">1</text>
|
||||
<rect x="490" y="124" width="90" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="535" y="140" class="c sub mono" style="fill:#444">0x9000</text>
|
||||
<rect x="580" y="124" width="70" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="615" y="140" class="c sub mono" style="fill:#444">4K</text>
|
||||
<rect x="440" y="148" width="50" height="24" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="465" y="164" class="c sub mono" style="fill:#444">2</text>
|
||||
<rect x="490" y="148" width="90" height="24" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="535" y="164" class="c sub mono" style="fill:#444">0xC000</text>
|
||||
<rect x="580" y="148" width="70" height="24" rx="3" fill="#E6E3FA" stroke="#B8B0DE" stroke-width="1"/>
|
||||
<text x="615" y="164" class="c sub mono" style="fill:#444">8K</text>
|
||||
<rect x="440" y="172" width="50" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="465" y="188" class="c sub mono" style="fill:#444">3</text>
|
||||
<rect x="490" y="172" width="90" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="535" y="188" class="c sub mono" style="fill:#444">0x1C000</text>
|
||||
<rect x="580" y="172" width="70" height="24" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="615" y="188" class="c sub mono" style="fill:#444">8K</text>
|
||||
<text x="440" y="220" class="sub mono" style="fill:#444">地址 = (段号 2, 偏移 0x300)</text>
|
||||
<text x="440" y="240" class="sub" style="fill:#444">0x300 < 8K,没有越界</text>
|
||||
<text x="440" y="260" class="sub mono" style="fill:#444">物理地址 = 0xC000 + 0x300 = 0xC300</text>
|
||||
<text x="440" y="280" class="sub note">偏移 ≥ 段长时触发越界异常</text>
|
||||
<text x="30" y="300" class="sub">各段长度不同、可以单独增长,并且可以按段设置权限(例如代码段只读);但段的大小不固定,</text>
|
||||
<text x="30" y="318" class="sub">内存中会留下大小不一的空闲碎片。段页式在每个段内再分页,兼顾两者。</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.3 KiB |
@@ -0,0 +1,141 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="520" viewBox="0 0 640 520">
|
||||
<style>
|
||||
text { font-family: "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif; fill: #3F3F3F; font-size: 12px; }
|
||||
.title { font-weight: bold; font-size: 15px; fill: #333; text-anchor: middle; }
|
||||
.b { font-weight: bold; }
|
||||
.c { text-anchor: middle; }
|
||||
.e { text-anchor: end; }
|
||||
.sub { font-size: 11px; fill: #6E6E6E; }
|
||||
.note { fill: #C0605A; }
|
||||
.ok { fill: #6A9F68; }
|
||||
.mono { font-family: Menlo, Consolas, monospace; }
|
||||
.arrow { stroke: #555; stroke-width: 1.1; fill: none; marker-end: url(#a); }
|
||||
.red { stroke: #C0605A; marker-end: url(#r); }
|
||||
.green { stroke: #6A9F68; marker-end: url(#g); }
|
||||
.dash { stroke-dasharray: 5 4; }
|
||||
.line { stroke: #555; stroke-width: 1.1; fill: none; }
|
||||
.frame { fill: none; stroke: #999; stroke-width: 1; stroke-dasharray: 4 3; }
|
||||
.shadow { fill: #DADADA; }
|
||||
</style>
|
||||
<defs>
|
||||
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#555"/>
|
||||
</marker>
|
||||
<marker id="r" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#C0605A"/>
|
||||
</marker>
|
||||
<marker id="g" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
|
||||
<path d="M1,1.5 L9.5,5 L1,8.5 z" fill="#6A9F68"/>
|
||||
</marker>
|
||||
</defs>
|
||||
<rect width="100%" height="100%" fill="#FFFFFF"/>
|
||||
|
||||
<text x="320" y="28" class="title">虚拟内存:64 KB 的地址空间,只有 32 KB 物理内存</text>
|
||||
<text x="195" y="52" class="c sub b" style="fill:#444">虚拟页(4 KB 一页)</text>
|
||||
<rect x="150" y="454" width="90" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="195" y="471" class="c sub mono" style="fill:#444">2</text>
|
||||
<text x="142" y="471" class="sub mono e">0K~4K</text>
|
||||
<text x="250" y="471" class="sub mono">0</text>
|
||||
<rect x="150" y="428" width="90" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="195" y="445" class="c sub mono" style="fill:#444">7</text>
|
||||
<text x="142" y="445" class="sub mono e">4K~8K</text>
|
||||
<text x="250" y="445" class="sub mono">1</text>
|
||||
<rect x="150" y="402" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="195" y="419" class="c sub mono" style="fill:#444">×</text>
|
||||
<text x="142" y="419" class="sub mono e">8K~12K</text>
|
||||
<text x="250" y="419" class="sub mono">2</text>
|
||||
<rect x="150" y="376" width="90" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="195" y="393" class="c sub mono" style="fill:#444">5</text>
|
||||
<text x="142" y="393" class="sub mono e">12K~16K</text>
|
||||
<text x="250" y="393" class="sub mono">3</text>
|
||||
<rect x="150" y="350" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="195" y="367" class="c sub mono" style="fill:#444">×</text>
|
||||
<text x="142" y="367" class="sub mono e">16K~20K</text>
|
||||
<text x="250" y="367" class="sub mono">4</text>
|
||||
<rect x="150" y="324" width="90" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="195" y="341" class="c sub mono" style="fill:#444">0</text>
|
||||
<text x="142" y="341" class="sub mono e">20K~24K</text>
|
||||
<text x="250" y="341" class="sub mono">5</text>
|
||||
<rect x="150" y="298" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="195" y="315" class="c sub mono" style="fill:#444">×</text>
|
||||
<text x="142" y="315" class="sub mono e">24K~28K</text>
|
||||
<text x="250" y="315" class="sub mono">6</text>
|
||||
<rect x="150" y="272" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="195" y="289" class="c sub mono" style="fill:#444">×</text>
|
||||
<text x="142" y="289" class="sub mono e">28K~32K</text>
|
||||
<text x="250" y="289" class="sub mono">7</text>
|
||||
<rect x="150" y="246" width="90" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="195" y="263" class="c sub mono" style="fill:#444">3</text>
|
||||
<text x="142" y="263" class="sub mono e">32K~36K</text>
|
||||
<text x="250" y="263" class="sub mono">8</text>
|
||||
<rect x="150" y="220" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="195" y="237" class="c sub mono" style="fill:#444">×</text>
|
||||
<text x="142" y="237" class="sub mono e">36K~40K</text>
|
||||
<text x="250" y="237" class="sub mono">9</text>
|
||||
<rect x="150" y="194" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="195" y="211" class="c sub mono" style="fill:#444">×</text>
|
||||
<text x="142" y="211" class="sub mono e">40K~44K</text>
|
||||
<text x="250" y="211" class="sub mono">10</text>
|
||||
<rect x="150" y="168" width="90" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="195" y="185" class="c sub mono" style="fill:#444">6</text>
|
||||
<text x="142" y="185" class="sub mono e">44K~48K</text>
|
||||
<text x="250" y="185" class="sub mono">11</text>
|
||||
<rect x="150" y="142" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="195" y="159" class="c sub mono" style="fill:#444">×</text>
|
||||
<text x="142" y="159" class="sub mono e">48K~52K</text>
|
||||
<text x="250" y="159" class="sub mono">12</text>
|
||||
<rect x="150" y="116" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="195" y="133" class="c sub mono" style="fill:#444">×</text>
|
||||
<text x="142" y="133" class="sub mono e">52K~56K</text>
|
||||
<text x="250" y="133" class="sub mono">13</text>
|
||||
<rect x="150" y="90" width="90" height="26" rx="3" fill="#C6E4FB" stroke="#7FB2D6" stroke-width="1"/>
|
||||
<text x="195" y="107" class="c sub mono" style="fill:#444">4</text>
|
||||
<text x="142" y="107" class="sub mono e">56K~60K</text>
|
||||
<text x="250" y="107" class="sub mono">14</text>
|
||||
<rect x="150" y="64" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="195" y="81" class="c sub mono" style="fill:#444">×</text>
|
||||
<text x="142" y="81" class="sub mono e">60K~64K</text>
|
||||
<text x="250" y="81" class="sub mono">15</text>
|
||||
<text x="515" y="260" class="c sub b" style="fill:#444">物理页框</text>
|
||||
<rect x="470" y="454" width="90" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="515" y="471" class="c sub" style="fill:#444">页 5</text>
|
||||
<text x="570" y="471" class="sub mono">0K~4K</text>
|
||||
<text x="462" y="471" class="sub mono e">0</text>
|
||||
<rect x="470" y="428" width="90" height="26" rx="3" fill="#FFFFFF" stroke="#BBBBBB" stroke-width="1"/>
|
||||
<text x="515" y="445" class="c sub" style="fill:#444">空闲</text>
|
||||
<text x="570" y="445" class="sub mono">4K~8K</text>
|
||||
<text x="462" y="445" class="sub mono e">1</text>
|
||||
<rect x="470" y="402" width="90" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="515" y="419" class="c sub" style="fill:#444">页 0</text>
|
||||
<text x="570" y="419" class="sub mono">8K~12K</text>
|
||||
<text x="462" y="419" class="sub mono e">2</text>
|
||||
<rect x="470" y="376" width="90" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="515" y="393" class="c sub" style="fill:#444">页 8</text>
|
||||
<text x="570" y="393" class="sub mono">12K~16K</text>
|
||||
<text x="462" y="393" class="sub mono e">3</text>
|
||||
<rect x="470" y="350" width="90" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="515" y="367" class="c sub" style="fill:#444">页 14</text>
|
||||
<text x="570" y="367" class="sub mono">16K~20K</text>
|
||||
<text x="462" y="367" class="sub mono e">4</text>
|
||||
<rect x="470" y="324" width="90" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="515" y="341" class="c sub" style="fill:#444">页 3</text>
|
||||
<text x="570" y="341" class="sub mono">20K~24K</text>
|
||||
<text x="462" y="341" class="sub mono e">5</text>
|
||||
<rect x="470" y="298" width="90" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="515" y="315" class="c sub" style="fill:#444">页 11</text>
|
||||
<text x="570" y="315" class="sub mono">24K~28K</text>
|
||||
<text x="462" y="315" class="sub mono e">6</text>
|
||||
<rect x="470" y="272" width="90" height="26" rx="3" fill="#C6ECE9" stroke="#7DBCB7" stroke-width="1"/>
|
||||
<text x="515" y="289" class="c sub" style="fill:#444">页 1</text>
|
||||
<text x="570" y="289" class="sub mono">28K~32K</text>
|
||||
<text x="462" y="289" class="sub mono e">7</text>
|
||||
<line x1="266" y1="467.0" x2="448" y2="415.0" stroke="#AAA" stroke-width="1" marker-end="url(#a)"/>
|
||||
<line x1="266" y1="441.0" x2="448" y2="285.0" stroke="#AAA" stroke-width="1" marker-end="url(#a)"/>
|
||||
<line x1="266" y1="389.0" x2="448" y2="337.0" stroke="#AAA" stroke-width="1" marker-end="url(#a)"/>
|
||||
<line x1="266" y1="337.0" x2="448" y2="467.0" stroke="#AAA" stroke-width="1" marker-end="url(#a)"/>
|
||||
<line x1="266" y1="259.0" x2="448" y2="389.0" stroke="#AAA" stroke-width="1" marker-end="url(#a)"/>
|
||||
<line x1="266" y1="181.0" x2="448" y2="311.0" stroke="#AAA" stroke-width="1" marker-end="url(#a)"/>
|
||||
<line x1="266" y1="103.0" x2="448" y2="363.0" stroke="#AAA" stroke-width="1" marker-end="url(#a)"/>
|
||||
<text x="30" y="496" class="sub">左边格子中的数字是页框号,× 表示这一页不在内存中,访问它会触发缺页中断,由操作系统从磁盘调入。</text>
|
||||
<text x="30" y="514" class="sub">只有 7 页在内存中,程序照样可以运行;各页映射到哪个页框没有顺序要求。</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.5 KiB |