{"format":"brushup-mindmap-v1","id":"os-00-sheet3","title":"内存管理","structure":"timeline-h","theme":"auto","root":{"id":"bf58d12bd5489ee4093d39481d","topic":"内存管理","expanded":true,"children":[{"id":"a52a50e9a01ab3260e552a7fd9","topic":"作用：","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-c036e009774e06.svg"},"children":[{"id":"51cb7acdc2daa508e5976b987a","topic":"内存空间的分配和回收","expanded":true,"children":[{"id":"99fe203b-97f4-41d2-a027-6be66688b7c7","topic":"OS决定的如何分配回收","expanded":true}]},{"id":"db283d2181fb4081909ccb6b71","topic":"地址转换","expanded":true,"children":[{"id":"7bf53108-30e2-43f3-b116-20ad3ca908ce","topic":"逻辑地址转为物理地址","expanded":true}]},{"id":"0f6b395aa5ea0b005ad96a3523","topic":"内存空间的扩充","expanded":true,"children":[{"id":"6487dd24-b386-47d6-a9a5-f68bbe36c561","topic":"利用例如：覆盖、交换、虚拟存储的技术来实现内存扩充","expanded":true}]},{"id":"9778207ff45a68f9bde328329b","topic":"存储保护","expanded":true,"children":[{"id":"8a805bd3-3ab4-4c6f-891d-65d4b857f1f2","topic":"保证各个作业在不同的存储空间内运行，不受干扰","expanded":true}]},{"id":"08716fc3-3138-42b3-9b91-2bce90c72aab","topic":"考频：低","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"a0d26a3a-a12a-402c-9d94-16ffc386d128","topic":"无","expanded":true}]}]},{"id":"771a25eee418e45106c69b31de","topic":"内存管理的基本原理和要求","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-1235130106af99.svg"},"children":[{"id":"e8f2c9ab-74c3-4421-b017-8a3746c08620","topic":"考频：低","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"2e896c93-375a-47db-946a-887f51860786","topic":"09","expanded":true}]},{"id":"8265414c-68cb-44b5-9f5b-0c166f90e8d2","topic":"流程：","expanded":true,"children":[{"id":"81feb1bf-587e-4811-942c-83c8dccab397","topic":"图示","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-76232d8d951ab7.png","width":505.7,"height":204.96}}]},{"id":"5009aa6651c81e7dfb3e893718","topic":"编译","expanded":true,"children":[{"id":"88db12e49f08f7736bbe68e3e7","topic":"编译的步骤：","expanded":true,"children":[{"id":"98553431-1928-42fb-adcc-10941b17d1ad","topic":"源代码文件 .c","expanded":true,"children":[{"id":"d26dad71-5f74-4d14-9256-08de9e541d7b","topic":"预处理 -> .i","expanded":true,"children":[{"id":"3119a0ac-1c3f-4cd0-b521-e42a64440fff","topic":"编译 -> .s","expanded":true,"children":[{"id":"d5ab1655-083b-447e-8cf9-6655822057bf","topic":"汇编 -> .o","expanded":true,"children":[{"id":"245522b8-ec39-455a-bba2-c90fef9e3a8a","topic":"链接 -> .exe","expanded":true}]}]}]}]}]},{"id":"043f3315-e494-4fc6-98c8-0c2583f066e0","topic":"编译后产生的目标模块地址都是从0开始的相对地址","expanded":true}]},{"id":"acc9eaa596db10ff4af0087358","topic":"链接","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"3052dfd0-2231-4f34-9f3c-283732f551d3","topic":"概念","expanded":true,"children":[{"id":"1a45b441-55f2-4010-8e6e-149e47e7d913","topic":"由链接程序把库函数和目标模块连着一起","expanded":true,"children":[{"id":"d9daaf5f-a45a-421a-a80a-f301a15c85fa","topic":"库代码也需要新分配空间","expanded":true,"style":{"background":"#FF9595"}}]}]},{"id":"db6b51ccfe0a57415bed5b0f57","topic":"静态链接","expanded":true,"children":[{"id":"bf060766-3497-4126-9516-d0bd16335e58","topic":"程序运行前，把目标模块、库文件链接成同一个完整的装配模块，后不再拆开","expanded":true}]},{"id":"224a389276b8bc9d0668d9423c","topic":"装入时动态链接","expanded":true,"children":[{"id":"f9dc73de-0dea-44c4-8874-e8b20f08349c","topic":"程序在装入内存时，边进行装入边链接","expanded":true},{"id":"42c29b09-b9e7-41a6-a9ff-f394be2e6ce7","topic":"易于修改和更新，便于共享","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"68490b4adb88f487aa646a2620","topic":"运行时动态链接","expanded":true,"children":[{"id":"59dcdbf9-f8e2-424a-b7cd-66df096fc78d","topic":"程序装入时不进行链接，运行时才链接（动态链接库DLL）","expanded":true},{"id":"96bbad3c-7209-4ff2-9332-f854d0386dd3","topic":"在执行过程中未被用到的目标模块，都不会被调入内存和被链接到装入模块上","expanded":true},{"id":"3f509ed2-ccf6-4be3-8c98-882f0aa61a35","topic":"优点是能加快程序的装入过程， 还可节省大量的内存空间。","expanded":true,"style":{"background":"#8EDE99"}}]}]},{"id":"88bbab02278b0a1accecd925e1","topic":"装入","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"fb93db98-c389-441c-b540-8dce9287b8b9","topic":"概念","expanded":true,"children":[{"id":"6aba238b-77db-4bc8-b2ac-76b23ad0ee05","topic":"从逻辑地址更改到物理地址","expanded":true}]},{"id":"13eb999960da13f08e91693e86","topic":"绝对装入","expanded":true,"children":[{"id":"267b78b1-40ee-4002-a0d2-ffb6cc4fc65d","topic":"代码中的逻辑地址与物理地址相同，编译时装入（只适用单道程序）","expanded":true}]},{"id":"31baf3afe8794c8ee93928cac0","topic":"可重定位装入\n（静态重定位）","expanded":true,"children":[{"id":"72feccc3-bae6-44b2-aaaa-bbc079431048","topic":"程序执行之前，完成逻辑地址和物理地址的转换，运行时内存不移动也不再申请空间。","expanded":true}]},{"id":"7118cccc0d293adf5ddf392232","topic":"动态运行时装入\n（动态重定位）","expanded":true,"children":[{"id":"cb5f0ed7-a13b-485b-b71b-47e3478ba8d1","topic":"运行时才进行逻辑地址到物理地址的转化","expanded":true},{"id":"728cf15c-8ef2-48b5-b5bb-56569e0a6ed3","topic":"整个系统中只设计一个重定位寄存器，所有进程共享使用","expanded":true,"style":{"background":"#FFABD5"}}]}]},{"id":"06f3127f-a76f-4f27-bc91-2f1a153e7d85","topic":"逻辑地址与物理地址","expanded":true,"children":[{"id":"324b52d0-de58-4bbb-863b-362f1939d90a","topic":"通过MMU（内存管理部件）将逻辑地址转为物理地址","expanded":true}]},{"id":"3fbb9a89-a095-4ced-9355-a4a5e208ae73","topic":"程序运行的内存映像和地址空间","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"f5ff23f4-34e9-4e5c-a7dd-8509405de8ea","topic":"内存中程序几大部分","expanded":true,"children":[{"id":"13ecb7a4-bae7-4646-8a44-aee4f7cfd7e2","topic":"只读代码段（可被共享）","expanded":true},{"id":"697f67e9-c221-43dd-a3fc-2dc1d5b3c963","topic":"数据段（保存全局和静态变量）","expanded":true},{"id":"29bbca81-5b69-48a7-99d0-610fad48aee4","topic":"PCB进程控制块（放在系统区，由操作系统控制）","expanded":true},{"id":"37d36125-e0ae-4d3b-9ce8-c9a2a797151b","topic":"堆（存放动态分配的变量）","expanded":true},{"id":"476d023a-a710-4039-a918-e9308e866024","topic":"栈（实现函数调用）","expanded":true}]},{"id":"6ef0f447-c1f8-4cd8-8d0e-1ab20ed915ea","topic":"图示","expanded":true,"style":{"background":"#FDD834"},"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-0eec13675edffb.png","width":516,"height":419}},{"id":"4ec901b5-c077-400a-8353-5769a04361b3","topic":"MMU（内存管理部件）","expanded":true,"children":[{"id":"d94366e4-af36-4fed-b517-e73cf4d6f56b","topic":"一个把虚拟地址转为物理地址的程序","expanded":true}]},{"id":"e45f3bea-3fb4-4dc5-9bb1-fce1aa94fe29","topic":"在虚拟存储系统中，每个进程都有独立的地址空间，空间中的地址为虚拟地址","expanded":true,"children":[{"id":"c5bc29f6-3de0-4075-870c-bdf81937c485","topic":"可以通过MMU来转为物理地址","expanded":true}]}]},{"id":"ade8d604dc7bfa4bbf52c97ff7","topic":"内存保护","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"30b145a2-9bd9-4587-a159-f8ceb2f15aef","topic":"方法一：上下限寄存器","expanded":true,"style":{"background":"#8EDDF9"}},{"id":"15733745-6000-451d-8d16-3f1609f87b36","topic":"方法二：重定位 + 届地址寄存器","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"31a72de9-aea4-432c-83c3-567a4e97e932","topic":"better","expanded":true}]}]},{"id":"1871d1c0-35ac-4307-a37c-3fd4f56be5c7","topic":"内存共享：","expanded":true,"children":[{"id":"983507cc-6152-4554-bff4-e259d03aa25e","topic":"后面细讲","expanded":true}]},{"id":"1b328bee-29ae-4cca-8ab5-ee6921363497","topic":"内存分配和回收","expanded":true}]},{"id":"31fade1a616a400a7d78285595","topic":"覆盖和交换","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-ee2929a9461dbe.svg"},"children":[{"id":"c2a861faa21ba59cc98f9b79cd","topic":"覆盖和交换","expanded":true,"children":[{"id":"09555561-1f7f-4109-91ae-052161552e3a","topic":"覆盖：","expanded":true,"children":[{"id":"bc060dd4-77af-4a0d-b578-88cc6101726b","topic":"把内存分为固定区 + 覆盖区","expanded":true,"children":[{"id":"b480861f-3d6c-427a-b9c3-f3688fe636cc","topic":"经常活跃的部分放在固定区中","expanded":true},{"id":"7dcfb075-2396-4604-ad64-e365e5322152","topic":"即将访问的段放在覆盖区中，其他放在外存","expanded":true}]},{"id":"05a6bc99-07de-4a1c-90c1-06f74e569c5a","topic":"固定区就是不可被覆盖的","expanded":true},{"id":"0571156e-0f3d-4637-8188-aaa0d8dbe86c","topic":"用于单一连续存储管理","expanded":true,"style":{"background":"#FFABD5"}}]},{"id":"7fe7ed08-a5a1-4229-ac5a-04dbbf6e1750","topic":"交换：","expanded":true,"children":[{"id":"68d128cb-3906-4f4b-a503-cee940024c82","topic":"换出：把处于等待状态的程序从内存移到辅存，就可以把内存空间腾出来","expanded":true},{"id":"8ad391cd-a10b-43e7-a974-31c194e79624","topic":"换入：把准备好竞争CPU进程从辅存移动到内存","expanded":true,"children":[{"id":"6dda09ed-0d38-4e87-867a-4f83f1490af4","topic":"中级调度","expanded":true}]},{"id":"38cd43ab-6a79-4446-89ed-8d72140ee3d4","topic":"不同状态的进程\n能否交换：","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"81e600e4-67fb-438b-b4f9-7265dd998660","topic":"创建态，可以","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"6527aa5f-2ac3-4d18-9f83-3203634964b8","topic":"即创建态 -> 挂起态","expanded":true,"style":{"background":"#FFABD5"}}]},{"id":"fad99151-20c8-4e78-a3b5-239ad14dd4c7","topic":"死锁，可以","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"93d594fb-2316-4bca-a610-205c5d5dc822","topic":"非常好","expanded":true,"style":{"background":"#FFABD5"}}]},{"id":"8f12ad06-7e89-424b-bcc3-63c65636661f","topic":"处于临界区，不行","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"84ae06e3-f809-4af0-bca5-0b1b2e2fb776","topic":"因为这片临界区的访问会一直阻塞，直到该被挂起的进程重新恢复","expanded":true,"style":{"background":"#FFABD5"}}]},{"id":"9e7ee15b-c62f-45bd-814b-b74ce7a74dbd","topic":"正在IO操作，不行","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"b768e6f3-d339-4014-9467-febf63f770d8","topic":"如果是A进程Input阶段，则可能造成新的B进程交换后，输入设备覆盖掉了B进程的指令","expanded":true,"style":{"background":"#FFABD5"}}]}]}]}]},{"id":"b72dc743-6a36-45a9-b079-d53a9d611081","topic":"可重入程序：","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"45eb1a69-8eb1-4f2c-9683-d60541099a90","topic":"法一：共享使用同一块存储空间","expanded":true,"style":{"background":"#FFABD5"}},{"id":"3bbfd447-deea-4130-9ebc-4deb31df8904","topic":"法二：通过动态链接的方式将所需的程序段映射到相关的进程中","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"d4f8985f-a107-40c0-ba7a-57dcb17801ec","topic":"最大的优点：减少了程序段的调入调出","expanded":true,"style":{"background":"#FFABD5"}}]}]},{"id":"4719ad61-a239-4239-84bd-5a8be2ee402f","topic":"考频：低","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"698b9069-2f28-414b-b878-1ad88f6187fd","topic":"无","expanded":true}]}]},{"id":"015a8a71e7e84320ef5d49e0c9","topic":"连续分配","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-44adcb444504eb.svg"},"children":[{"id":"17464934-79a3-429b-af65-ff73fe09f8ad","topic":"连续分配和非连续分配：装入","expanded":true},{"id":"656957e6-abb0-4f1e-ac05-efd7e3cd82de","topic":"内部、外部碎片","expanded":true,"children":[{"id":"6494ff7b-4f91-41ac-97a9-d3396fa6c7fb","topic":"程序使用的空间、程序申请的空间、内存总空间","expanded":true},{"id":"bd4d7230-31e5-41e0-9fa1-a030e25b4d0f","topic":"内部碎片：程序申请空间 - 程序使用的空间","expanded":true,"style":{"background":"#8EDDF9"}},{"id":"4b05b65a-1fac-469f-8912-372954631429","topic":"外部碎片：内存总空间 - 程序申请空间","expanded":true,"style":{"background":"#8EDDF9"}}]},{"id":"e9b9a98f099921b56f4b3b273e","topic":"单一连续分配","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"c48b28b2-fe52-4c16-96da-5140e5182d56","topic":"一个内存空间只给一个进程使用","expanded":true,"style":{"background":"#8EDE99"}},{"id":"d1235174-8e9f-4fb2-a6fd-4c1fe28381ca","topic":"优点：","expanded":true,"children":[{"id":"c3b4e13c-94b9-4312-b255-ddc67959ed41","topic":"简单、无外部碎片、采用覆盖技术","expanded":true}]},{"id":"0303a198-95ad-4026-b015-927d691a3eb7","topic":"缺点：","expanded":true,"children":[{"id":"7a0e07ee-51ee-47fb-b1d8-45dc215061dd","topic":"单用户、单任务、有内部碎片、利用率低","expanded":true}]}]},{"id":"21ab244e258811b31095d98cb5","topic":"固定分区分配","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"0e5b19ac17e9be2f2c603b9056","topic":"分区大小相同","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"e0fa9aa5-f0b7-41ba-baa8-43056e163443","topic":"将内存空间划分为若干固定大小的区域","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"1098924386389a3f0661e907ba","topic":"分区大小不同","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"6dd29e2d-9f5e-4d9d-82d6-5a72276d217f","topic":"划分为多个小分区、适中中分区、少量大分区","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"72eb8a2eec889bd095238910c5","topic":"分区说明表","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"b6af684e-53e7-4ca0-91d4-7da48b9a96c1","topic":"（分区号） | 大小/KB 、始址/KB、状态","expanded":true,"style":{"background":"#8EDE99"},"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-4b92bbcb333ad2.png","width":355,"height":174}}]},{"id":"715caeee-3ba2-4863-92c3-93407df73919","topic":"优点：","expanded":true,"children":[{"id":"0bdb43e0-d735-45fc-bc2b-ec25856e5a2f","topic":"多道程序设计、无外部碎片","expanded":true}]},{"id":"69451b99-10d0-42bd-8e7e-bc04cd9e7d7d","topic":"缺点：","expanded":true,"children":[{"id":"2bf595a6-2ff8-4d84-9056-0e17507628e9","topic":"程序太大，分区装不下","expanded":true},{"id":"f3ea31a1-9af8-4bcf-b05f-a778fce30d1a","topic":"主存利用率低，很多内部碎片","expanded":true},{"id":"8ad736a9-8be6-462c-9b0d-abc83f037f0d","topic":"没有内存共享能力","expanded":true}]}]},{"id":"c01b9f76958802ff6cd1ca2ff9","topic":"动态分区分配","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"c544a886-3a53-4884-bb3d-d8d3a8c2a82f","topic":"图示","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-579e139db575fd.png","width":584,"height":181}},{"id":"200972e366faa14a3aff3a9c26","topic":"记录存储内存使用情况","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"b13b6eb6-fe3e-4ca9-a8d1-23428dcec8b3","topic":"内存分区链、内存分区块","expanded":true,"style":{"background":"#8EDE99"}},{"id":"43c53dcf-2ca9-4a7d-b582-d27ad9ea2811","topic":"分区表","expanded":true,"children":[{"id":"d8ff861d-2f8b-4a08-aef9-7ee85c25909f","topic":"(分区号) | 大小/KB、始址/KB、状态","expanded":true}]}]},{"id":"8e5a765b5bb9283108cf98bfd6","topic":"分配回收","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"b9b8ae620c9901e00e82ab56f2","topic":"动态分区分配算法","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"5513bb3e-fa4a-4526-bb99-427df688483e","topic":"首次适应","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"156b7662-dafa-45f2-b822-6458fcb06c1c","topic":"找到第一个满足的就行","expanded":true,"children":[{"id":"c524667d-50e8-4cdb-a39a-9f0bfae3c2b2","topic":"最好的","expanded":true,"style":{"background":"#FDD834"}}]}]},{"id":"2cdb224d-a0c1-4cc6-b57f-afc2c4ab5186","topic":"最佳适应","expanded":true,"children":[{"id":"26200bee-5fd5-40c3-9baa-4e62ec2f3b2c","topic":"找到最小满足的一个（排序）","expanded":true}]},{"id":"c444c774-2246-4a30-b2ee-de6843dbe7db","topic":"最坏适应","expanded":true,"children":[{"id":"ec631b86-d855-4e5c-b5db-ca3f32deed66","topic":"找到最大满足的一个（排序）","expanded":true}]},{"id":"4815698d-42a8-4f4a-9700-03fe814723f3","topic":"邻近适应","expanded":true,"children":[{"id":"d77f3255-b399-48c1-afd5-ab91d2851d4f","topic":"首次适应 + 指针不回溯","expanded":true}]}]},{"id":"989a5ebdca498b3201ee29e584","topic":"回收（4种）","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"109fc406-2f6d-4646-9d84-6615d75d2b3f","topic":"紧凑技术","expanded":true},{"id":"46a4d71e-68dd-454c-b1b5-884cf9a2eee1","topic":"分区前面有一块","expanded":true,"children":[{"id":"9e734b37-bf4e-48cd-94a4-cfde15d72282","topic":"改前一块的大小","expanded":true}]},{"id":"ede76971-313e-476f-bb34-4a96d53df1ce","topic":"分区后面有一块","expanded":true,"children":[{"id":"862af899-1993-4102-aeb0-71ab315e8c96","topic":"改后一块的大小 + 始址","expanded":true}]},{"id":"c22884e0-6b04-4e88-88f6-b8dcd981917b","topic":"分区前后都有","expanded":true,"children":[{"id":"19e63fde-4997-43a1-a999-4adc543da910","topic":"合并前后两块，改大小","expanded":true}]},{"id":"7f440c47-0aad-4151-bad6-ea6124491ac6","topic":"分区前后都无","expanded":true,"children":[{"id":"2a7c6fff-28bf-4d2f-b158-4c22d1c48295","topic":"新增一块","expanded":true}]}]}]},{"id":"b433cbd3-44ca-4b79-942b-253b0fa77c17","topic":"分配流程：","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"d16726f4-9926-4577-a069-68ca1a2b1848","topic":"系统在初始化后除操作系统占据一部分内存外，其余部分都是【自由空间】。作业申请内存时候，OS分配一个大小相当的内存过去，将作业创建为进程，在作业运行完毕后，在释放内存","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"9a175622-f913-475c-be0c-18871a100367","topic":"申请内存阶段就是装入阶段","expanded":true,"style":{"background":"#FFABD5"}}]}]}]}]},{"id":"3e0934092d99ff80b3a90a94b0","topic":"非连续分配","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-618e04089e020a.svg"},"children":[{"id":"0f0a290dfa0a861c48692be320","topic":"概念","expanded":true,"children":[{"id":"2c7bc02c6158ec2b115e1a5dc1","topic":"页、页表、页框、页帧、块、页面、内存块、物理块、物理页面、页表项、段、段表、段表项","expanded":true,"children":[{"id":"6a28bb0b-c5f5-4407-9e21-0cffc541f634","topic":"对应关系","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"948ceaaa-74f3-4481-8c1d-cfacbe83de3d","topic":"进程的","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"9b4ca701-1af1-42ac-b60a-aa28175eeb16","topic":"页、页面","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"5d081b70-2dd6-4b3b-8625-0af11657d874","topic":"内存的","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"de7ccec2-f6b7-4417-8ce7-b142db23df80","topic":"页框、页帧、块、内存块、物理块、物理页面","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"33e3b502-3f25-45ff-a907-065c6d2a7230","topic":"外存的","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"edc04e71-8332-4a4f-949d-8b98de6248ae","topic":"块、外存块","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"b1a658cf-d939-4b20-a1e0-877f6d79d894","topic":"其他的","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"9d3d77cd-4ebb-428f-bff4-840697c75ff8","topic":"页表、页表项、段表、段表项","expanded":true,"style":{"background":"#8EDE99"}}]}]}]},{"id":"3916a7a1-aecd-427a-be83-3c9088363088","topic":"非连续分配：","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"6f534506-891b-4048-8e91-39371967dd17","topic":"把主存空间划分为大小相等且固定的块，块相对较小，作为主存的基本单位。每个进程也以块为单位进行划分，进程在执行时，以块为单位逐个申请主存中的块空间。","expanded":true,"style":{"background":"#FF9595"}}]}]},{"id":"bf9bfcbabb59f5d9f20f4b917d","topic":"分页存储","expanded":true,"children":[{"id":"0898b22d9bb902ed7059291130","topic":"基本分页存储管理","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"7e908827-f8dc-4609-aab7-6a9566cea26d","topic":"原理","expanded":true,"children":[{"id":"53da1465-a769-41cc-80a0-ab0179538f0e","topic":"把内存划分为数个大小相同且固定的块、块相对较小、作为主存的基本单位","expanded":true},{"id":"fb8c92fc-4dc6-4fac-bd57-09d98918e675","topic":"页面和内存块的完全大小相同","expanded":true,"style":{"background":"#FF9595"}},{"id":"a0c1710f-82b7-496a-bed9-1de229d505d0","topic":"图示","expanded":true,"style":{"background":"#8EDDF9"},"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-17ae3f9ffba064.png"}}]},{"id":"7e3f5460-8146-4ba5-b2f0-4d22325872c1","topic":"转换","expanded":true,"children":[{"id":"27f6d8ac-527b-4f59-b842-247320f0afb7","topic":"内存总大小为 4GB, 内存块大小为4KB, 所以内存中一共可以有 2^20个内存块，内存块编号为0 ~ 2^20 - 1","expanded":true,"children":[{"id":"1d1d5404-6e58-4c4f-a7f5-9dbabc747610","topic":"由此可知【页表项中的块号】至少需要20bit来存储，即至少需要3B来存储（如果需要填充为B）","expanded":true}]}]},{"id":"fc6537c2-7610-473c-8d2a-a56c04af8f89","topic":"数据结构","expanded":true,"children":[{"id":"f7ba8dade559dc9b25484bd533","topic":"逻辑地址","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"9fc7381a-a8c7-4521-aa0a-f0bff7b35e20","topic":"页号、偏置值","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"6d02a6fd-c64a-4e16-b281-cf181af9f4aa","topic":"硬件划分","expanded":true,"style":{"background":"#FF9595"}},{"id":"66f4ff02-293f-47e8-912f-53a8826b3d56","topic":"链接后产生的","expanded":true},{"id":"c085d5ab-f30b-4734-9cb7-0b36f8b735f1","topic":"使用2^n B来设计页面大小，很方便快捷","expanded":true,"style":{"background":"#FDD834"}},{"id":"d1d7660d-d186-411a-8a32-fc70f3e4b562","topic":"按字节寻址 -> 偏置值W的bit数就为 n","expanded":true}]}]},{"id":"890a3eb87a68f0d96337e9552a","topic":"页表寄存器（PTR)","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"fe55c4e3-c640-4f75-9e9d-3a00d52d6378","topic":"页表始址、页表长度","expanded":true,"style":{"background":"#FDD834"}}]},{"id":"12e920d51b2b8b3312629a0ab9","topic":"页表项结构","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"02acdaf2-a473-4c06-9ece-a941352c4926","topic":"（页号）块号","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"a56aa4f8-fa21-4d61-a637-183ca2268a39","topic":"页号并不占用存储空间","expanded":true,"style":{"background":"#FDD834"}}]}]}]},{"id":"3ac87a67a4a8889f1ccf48debf","topic":"基本地址变换机构：\n得到一个逻辑地址，操作流程","expanded":true,"children":[{"id":"a7a0216a-dc15-4ba0-bcec-f94dfc7fb0a1","topic":"对逻辑地址A的页号先进行越界检查，确认不会中断，与页表始址进行相加（块号地址 = F + P * 页表项所占地址个数），就可以对应到块号了。物理地址 = 块号 拼接上(concat) 偏置值","expanded":true,"style":{"background":"#8EDE99"},"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-649fe39bf406bb.png","width":454.22,"height":257.12},"children":[{"id":"91b42b22-50e6-45d4-88f4-55eb2636d677","topic":"两次内存访问","expanded":true},{"id":"97285000-4181-4d36-9d98-74303a7ee9eb","topic":"一次越界检测","expanded":true}]}]},{"id":"9bde9d86-3a92-430f-b1f6-3561eb4bb1b0","topic":"访问内存次数：","expanded":true,"children":[{"id":"0d8b5549-1d47-42eb-9bda-1bce490857c6","topic":"两次","expanded":true,"children":[{"id":"388120c7-61da-4c1f-94ef-462c71da3d70","topic":"访问页表","expanded":true},{"id":"efb82ad3-7353-4454-90bd-8eba8bcbdd06","topic":"访问内存中对应的位置","expanded":true}]}]}]},{"id":"a958e870be1a178c4b5e4b339a","topic":"快表分页存储","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"6b8b75fb-70ba-4cfd-bbe2-fea3d1405aae","topic":"图示","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-41a3213e67c6fb.png","width":457.89,"height":259.1}},{"id":"c3e9273abf0a6ba38b33bb4b75","topic":"多了一个TLB","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"604a1c06-db9e-4ee6-82e0-ef1b08117747","topic":"相联存储器、快表","expanded":true,"style":{"background":"#FF9595"}},{"id":"355895f3-83e8-47d8-904f-10da6fddb992","topic":"快表中存储了页号 + 对应块号","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"d99260eb-7deb-4d55-b6dd-72b7728a9505","topic":"像计网中的路由器的特殊路径一样","expanded":true,"style":{"background":"#ADADAD"}}]}]},{"id":"c85b1d9aae3b152919e65947b5","topic":"命中率","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"8d163750-1917-4105-8684-c6aa0e00a137","topic":"90%左右","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"2bf3b15f-1c33-4558-969c-9a673d878f86","topic":"就有90%的访问只需要访问一次内存即可","expanded":true,"style":{"background":"#FF9595"}}]}]},{"id":"f81ab60eacb818bcd5d7584a2e","topic":"操作流程的改进","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"4e474c19-f836-4050-8459-71a7eb37788e","topic":"进行越界判断，再查快表。如果快表中没有，查慢表","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"607505b2-2eac-4319-ba6f-db69c14b16e7","topic":"也可以快表慢表同时查","expanded":true}]}]}]},{"id":"641a6f081a891f62fcb92ab9ca","topic":"两级页表\n（升级版）","expanded":true,"style":{"background":"#7986CB"},"children":[{"id":"e7186315c1ea2a5707b0ca5f64","topic":"逻辑地址结构","expanded":true,"children":[{"id":"c1684735-923b-48a3-9780-199cdac8326c","topic":"一级页号、二级页号、页内偏移","expanded":true}]},{"id":"a6c9fcf13c08588b7c2c480c79","topic":"第一级页表的名称","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"6cd7aab8-0f8c-4280-8f57-9ece32c39a84","topic":"页目录表/顶级页表/外层页表/一级页表","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"a17a9801-2ef6-4a31-ab7d-a1f75ce27042","topic":"第二级页表的名称","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"332dcc10-a691-4742-afb5-2efa43dfaa8b","topic":"二级页表","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"59c8b0d18a48ccaada2c1923c6","topic":"操作流程","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"f7fea008-c39c-47c8-82bc-d046c813b32b","topic":"获得逻辑地址的一级页号，一级页号进行溢出检测，通过访问一级页表找到对应的二级页表对应的块号。然后先对二级页号进行溢出检测，通过二级页号在二级页表中查找内存块号。找到内存块号就可以访问啦","expanded":true,"style":{"background":"#8EDDF9"},"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-55268c1b2cac58.png","width":382,"height":296},"children":[{"id":"9e9eacde-54bf-43d0-b5b1-31293cbe966e","topic":"图示","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-5867739b404331.png","width":496.46,"height":279.59},"children":[{"id":"84653115-a8ed-4207-a8f8-2dd198c905d1","topic":"三次内存访问","expanded":true},{"id":"d1ba3098-0c5e-41bf-a1f8-b17c064fcbf4","topic":"两次越界查看","expanded":true}]}]}]},{"id":"3ee22c7f-07ce-48ea-989a-8f79ddb0cc64","topic":"特点（了解）：","expanded":true,"children":[{"id":"5f603807-a9f2-459a-9571-c0dad5a3d324","topic":"页目录表中的表项个数\n和\n二级页表的表项个数可以不同","expanded":true,"children":[{"id":"5a6733bf-3028-4439-a0a9-4e3cd217e9e2","topic":"例如：OS中一个顶级页表，一共有2^7个二级页表，每个二级页表可以存储2^9个页表项，每个页面大小为2^10","expanded":true,"children":[{"id":"345d5a62-bac6-4d4c-a573-c93b37718fc4","topic":"则逻辑地址中：页目录号为7bit，页号为9bit，偏置值为10bit","expanded":true}]}]}]}]}]},{"id":"f868db60420a5ca90b61aa1128","topic":"分段存储","expanded":true,"children":[{"id":"10699ee6e36b681949c3b8433e","topic":"分段储存和分页存储出发点上的不同","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"4575615a-6297-4f1b-81df-d3d8435ab289","topic":"分段存储：分段存储是给程序员设计的","expanded":true,"children":[{"id":"b049482a-3e1b-40a2-8cdb-cb5f383f1463","topic":"段：信息的逻辑单位，用户可见","expanded":true}]},{"id":"66f84187-e575-41e4-a4e2-2a1857d9e733","topic":"分页存储：是为操作系统设计的","expanded":true,"children":[{"id":"11907014-9e1b-43de-b22c-7ae81256ed23","topic":"页：信息的物理单位，用户不可见","expanded":true}]}]},{"id":"3d5b430aeaea3f885307691717","topic":"基本分段存储","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"bc1bf8afdeaa5fab858328ea2a","topic":"逻辑地址结构","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"b51ab082-c1ed-42cb-bcc5-2662ab9fd78d","topic":"段号 + 偏置值","expanded":true,"style":{"background":"#8EDDF9"}}]},{"id":"2095b57f-ad36-4ad5-8fd0-b84c7eae1f48","topic":"段表寄存器","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"847a11d2-8614-4161-a2c5-6be9b42f0d68","topic":"段表始址 + 段表长度","expanded":true,"style":{"background":"#8EDDF9"}}]},{"id":"58eba1967f1a58768136fb5a6a","topic":"段表项","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"2cb3e685-bbe1-4e1d-baf4-faa18250afa2","topic":"（段号）| 段长、始址（没有内存块咯）","expanded":true,"style":{"background":"#8EDDF9"}}]},{"id":"e0994b161a1b90f599feb9066c","topic":"操作流程","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"3b7772e5-efed-4ac4-8927-b1438a5b2b2d","topic":"首先获得逻辑地址，判断段号是否越界，然后访问段表，查看对应段的偏置值有无越界，随后即可访问","expanded":true,"style":{"background":"#8EDDF9"},"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-a215c4d927f041.png","width":467.27,"height":278.92},"children":[{"id":"82eb2fc6-3c94-4ec9-ac04-47efb49fc22f","topic":"两次内存访问","expanded":true},{"id":"ae767089-59d9-49ce-a3c3-87eaa5777de1","topic":"两次越界检测","expanded":true}]}]},{"id":"603bec1f7ac88dd06ec86a9660","topic":"分段的地址是二维的（了解）","expanded":true}]},{"id":"4e9a9b5bfaa813976384d9277e","topic":"段页存储方式\n（升级版）","expanded":true,"style":{"background":"#7986CB"},"children":[{"id":"da59c2077cea5db96483184693","topic":"逻辑地址结构","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"df61f573-b050-4393-bb40-717103d6641d","topic":"段号、页号、偏置值","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"54589379-2e8d-4fc3-b86d-db12f2bb9f02","topic":"在程序员设计分段时，还是太大了","expanded":true}]}]},{"id":"4d9b529f-a968-43cf-9c7c-0ed075520228","topic":"段表项","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"fe83fc83-ca47-40b7-8e52-f6b3491e27dd","topic":"（段号）、页表长度、页表始址","expanded":true,"style":{"background":"#8EDDF9"}}]},{"id":"eaca880b-400b-4d8a-8bce-6ceefbeee9ac","topic":"页表项","expanded":true,"children":[{"id":"0ac3c91c-4bba-4c16-9e01-f530f4d19664","topic":"（页号）、块号","expanded":true}]},{"id":"cd0bb0b4b53a1f8e3ef39be7a8","topic":"操作流程","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"9787a7aa-adf5-4d5b-a7c0-669b109fb647","topic":"首先获得逻辑地址，判断段号是否越界，访问段表项，判断页号是否越界，就页表始址+偏置值","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-fe3d841bf5b0a5.png","width":468.85,"height":281.99},"children":[{"id":"3a5421c0-62a4-4844-afb9-afe9877ef8c0","topic":"三次内存访问","expanded":true},{"id":"600928f7-59b8-4259-ae42-aa7270d4f52b","topic":"两次检测","expanded":true}]}]},{"id":"2cd9e8ab0e591942cfeaca65bb","topic":"引入快表","expanded":true,"children":[{"id":"a60afe16-71c1-4122-bb64-145f4fa1d09b","topic":"关键字：段号、页号","expanded":true,"children":[{"id":"a88a30cc-8664-4e71-ae35-d35b2eef5886","topic":"值：页帧号、保护码","expanded":true}]}]}]},{"id":"e35dccf7-4b17-4f36-862e-2f2a9d8b717f","topic":"采用分页/分段管理（了解）","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"2f15dd41-5525-44c4-ab1e-012be25f02ff","topic":"提供给用户的物理空间 = 总空间 - 段表/页表空间","expanded":true,"style":{"background":"#FFABD5"},"children":[{"id":"3233cd7e-3c8e-4600-92c9-257b1a70087a","topic":"所以分页、分段无法确定要分配多少空间给用户","expanded":true,"style":{"background":"#FFABD5"}}]}]}]},{"id":"fbaed2c1-12d6-43fe-aa80-059f21b4b706","topic":"考频：超高","expanded":true,"style":{"background":"#BA69C8"},"children":[{"id":"97d44ba0-1cd9-4eae-a798-b867d0765782","topic":"09、10*2、14*2、16、17、19*3、21、13大","expanded":true}]}]},{"id":"f288d13b513a0a584297c9bc19","topic":"虚拟内存","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-b46a6fdcc50657.svg"},"children":[{"id":"c8a9aeaa-142f-4d9c-b5da-b0350519aab7","topic":"考频：超高","expanded":true,"style":{"background":"#BA69C8"},"children":[{"id":"b5ee95f4-4d20-45e3-8535-d9a21159d951","topic":"11*2、12、13、14*2、15*2、16*2、19、20、21*2、22*2、09大、10大、12大、15大、17大、18大、20大","expanded":true}]},{"id":"dd1b92a7-d598-402c-a57e-e31f2d6ebee0","topic":"为什么使用虚拟内存","expanded":true,"children":[{"id":"d7145062-3308-48df-bc83-4f5c4f4ac9d6","topic":"若同时运行的进程太多，则需要很多的内存，当一个程序没有内存空间可用时，那么它甚至无法运行。 所以，在物理上扩展内存相对有限的条件下，应尝试以一些其他可行的方式在逻辑上扩充内存。","expanded":true}]},{"id":"1398909a-2147-4098-bc94-14cf5c49e77e","topic":"虚拟内存的空间大小约束","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"ff647a53-943f-42f7-bef9-5e4ebfaa9a4c","topic":"实际容量 ≤ 内存+外存","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"081c4bf7-e2e3-4f7a-9ece-d4fcdab7b587","topic":"硬件硬性要求","expanded":true,"style":{"background":"#FDD834"}}]},{"id":"33082e69-32db-4335-b31e-0ad239f87215","topic":"最大容量 ≤ 计算机地址位数容纳的最大容量","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"5d060b10-bf38-478f-ac02-871d6d2b5472","topic":"例如32位地址系统，虚存最大为2^{32} B","expanded":true,"style":{"background":"#FDD834"}}]}]},{"id":"40040055-c539-4728-a728-cc6db95e324c","topic":"虚存的好处和缺点","expanded":true,"children":[{"id":"35b26589-aede-45a7-8cba-debcdeba9a4c","topic":"好处：使用了外存空间扩充了内存空间，通过一定程度的换入换出使得整个系统在逻辑上能够使用一个远远超出其物理内存大小的内存容量","expanded":true,"style":{"background":"#8EDE99"}},{"id":"59754a1e-75e9-447c-a6b0-ed39dbcdc115","topic":"缺点：虚拟内存技术调换页面时需要访问外存，会导致平均访存时间增加，若使用了不合适的替换算法，则会大大降低系统性能","expanded":true,"style":{"background":"#7986CB"}}]},{"id":"cbb9bc7b18abee739bf619e0d4","topic":"虚拟内存的基本概念","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"30a82717f1e81c02cf3fbb8339","topic":"传统存储管理方式","expanded":true,"children":[{"id":"a089990ab098aab8a5d6493bef","topic":"一次性","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"6a9eb83f-19a8-49f6-a219-abc69382e1dc","topic":"程序一次性全部装入内存","expanded":true,"children":[{"id":"89755a3b-55fa-49b8-ac0d-e6f7c922b7dd","topic":"程序大，运行不了","expanded":true},{"id":"3c604d8b-ef7d-4f32-88a9-4f526765c75f","topic":"程序多，并发度低","expanded":true}]}]},{"id":"1838a61a6da8ed4ebfb54abf03","topic":"驻留性","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"e0544428-d697-41d9-bb53-7471d6723a88","topic":"程序直至运行结束才会被换出内存","expanded":true}]}]},{"id":"775b20d6a339abbb331bf9d1cc","topic":"局部性原理","expanded":true,"children":[{"id":"b969631e0f7aaf572fe41aef56","topic":"时间局部性","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"fc778842-844a-4611-a2eb-dbcbf6028729","topic":"某条指令被执行，不久会再被执行","expanded":true}]},{"id":"7b99c38f23da79b7f951f8612d","topic":"空间局部性","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"0717ffb0-6199-42c4-906f-07c6799128e6","topic":"访问了某条指令，其相邻的代码/指令也会很快被访问","expanded":true}]}]},{"id":"50685c74bbd91e52058d68ba34","topic":"虚拟存储器的定义和特征","expanded":true,"children":[{"id":"9b90abed-9371-4b8e-8aa7-677d7d8e8932","topic":"特点：","expanded":true,"children":[{"id":"28764122-59c5-4cc2-bde5-73956a7f2ad1","topic":"分内余外","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"6246d9c0-1b97-4790-94a9-feca8e793800","topic":"部分装入内存，其余留在外存","expanded":true}]},{"id":"bb2e9cec-1b7f-493a-abe9-ba37a084e698","topic":"内需调入","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"c246cd04-bb6c-40ae-af63-1a41bfa30ad7","topic":"程序执行过程中，所访问的信息不在内存，需要OS把信息调入到内存中","expanded":true}]},{"id":"04684835-ab7f-4b8a-89f9-c3f5a72f5f48","topic":"空闲调出","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"d55bf7f2-a900-449e-a926-a22c5efa5d15","topic":"OS将内存中暂时不需要的内容换出到外存","expanded":true}]}]},{"id":"081a34b7592bafa9b6a069a9e4","topic":"多次性","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"17444d88-461c-48e8-9d7d-5f870405c63c","topic":"作业无须运行时全部装入内存，可以分多次完成装入","expanded":true}]},{"id":"c42a2998c2d8045e8b835a10d9","topic":"对换性","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"8cd7ff64-84c6-46ce-8991-bb740bfa5946","topic":"作业无须常驻内存，可以在运行过程中换入换出","expanded":true}]},{"id":"97aa3a902a5a9ef437807a1e44","topic":"虚拟性","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"e65b9ca3-38cf-4b70-877e-375b5f64da4f","topic":"逻辑上扩充内存的容量","expanded":true}]}]},{"id":"44db023d07ab0edda1c259d39a","topic":"虚拟内存技术的实现","expanded":true,"children":[{"id":"71d85c3568eb378c63371b090d","topic":"要建立在","expanded":true,"children":[{"id":"651b24d2-0e13-41e0-b38e-3ef3aa7cc14b","topic":"非连续分配的情况下","expanded":true}]},{"id":"bd99231a49bb7adb5546d9e4ca","topic":"三大虚拟内存实现方式","expanded":true,"children":[{"id":"8c060148-60be-4d71-8573-4c881b912511","topic":"请求分页存储","expanded":true},{"id":"3c80ad87-deb3-4973-8b0b-3f7e62485a72","topic":"请求分段存储","expanded":true},{"id":"4612f6a1-880c-4e10-bf77-9906dbc04f13","topic":"请求段页式存储","expanded":true}]},{"id":"918858f5667b7368c4718a9c3e","topic":"需要的四个硬件支持","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"2e5eb8b9-7079-45c9-93e4-a870326d5272","topic":"一定的内外存","expanded":true,"style":{"background":"#FDD834"}},{"id":"df370509-5b8f-48fa-b966-c144ce21ae21","topic":"页表/段表数据结构","expanded":true,"style":{"background":"#FDD834"}},{"id":"4eb24296-f3eb-4c5e-83be-291881cfa2bf","topic":"中断机制","expanded":true,"style":{"background":"#FDD834"}},{"id":"48244d63-04ad-4369-b074-2fc673ab3267","topic":"地址变换","expanded":true,"style":{"background":"#FDD834"}}]}]}]},{"id":"8c39bb9faf5a47151a18082780","topic":"请求分页管理","expanded":true,"children":[{"id":"6f7b6d8bb3f908a7b048bbab7c","topic":"页表机制","expanded":true,"children":[{"id":"af16649f-b034-473f-b1b3-ded2b016ba09","topic":"图示","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-b0268e0c8e63f5.png","width":699,"height":120}}]},{"id":"017a8ed2569a9589dc217bc209","topic":"缺页中断机构","expanded":true,"children":[{"id":"984390d3-487c-47a7-92b5-7501e59d85cd","topic":"内存有空闲块","expanded":true,"children":[{"id":"41f6a616-4ed7-40a5-9bb2-d848813c3b24","topic":"直接分配空闲块给缺页部分，修改【页表】","expanded":true}]},{"id":"e1e63d4b-eada-4173-abb0-89a80aa71cfc","topic":"内存无空闲块","expanded":true,"children":[{"id":"1a590755-5152-4864-8781-5b8a57afffa8","topic":"通过算法淘汰某页","expanded":true,"children":[{"id":"085c5da7-4fb5-4fe6-8f57-897773b17273","topic":"【若被修改了，写回外存】","expanded":true,"style":{"background":"#FF9595"}},{"id":"e9641430-9227-4b12-b98b-871677a4a9ee","topic":"【若该页也存在于快表中，一并删除】","expanded":true,"style":{"background":"#FF9595"}}]}]}]},{"id":"6469dbea8008af87d24cc81d00","topic":"地址变化机构","expanded":true,"children":[{"id":"950329fb-f15e-497b-afec-3f50f4cde1ae","topic":"图示","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-7002a53a7a17e4.png","width":560.31,"height":464.88}}]}]},{"id":"a5a9c6a8a4bb3f66aec18b693a","topic":"页面分配策略","expanded":true,"children":[{"id":"9b3a159d7afb48d0b930ebbd6e","topic":"调入页面的时机","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"48fb73a6e7d8cb36856f9b8a38","topic":"预调页","expanded":true,"children":[{"id":"03c1feb8-695a-44ba-a1d3-af3ddc9903e4","topic":"根据局部性原理，一次调入若干相邻的页","expanded":true},{"id":"5a1b97b5-e3c4-4711-b410-d4fb9c355012","topic":"成功率不高，进程首次调入时，由程序员指定预调页","expanded":true}]},{"id":"20cb031b32eb60861f887b3243","topic":"请求调页","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"917f83be-db4e-4619-8bea-b670e08557f0","topic":"运行时进行调页","expanded":true,"style":{"background":"#8EDDF9"}}]}]},{"id":"dd1b7c26f758cbc4bbee6af76a","topic":"从何处调用页面","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"c50bdf11fa7ba5f09e2e69e257","topic":"外存结构","expanded":true,"children":[{"id":"2e2b8af0-3211-4c01-a945-b9a46be82304","topic":"对换区 + 文件区","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"807d42ad-3cd7-4622-adbb-c30ccdf9409a","topic":"对换区是连续分配","expanded":true},{"id":"d0080bd3-002c-4db7-bf09-e57f25233a14","topic":"文件区是离散分配","expanded":true}]}]},{"id":"5cbabb2cd2f9886025453a88c7","topic":"系统有足够对换区","expanded":true,"children":[{"id":"627d922e-03fb-4f7d-b111-c99d49bc1c51","topic":"直接 内存 ↔ 对换区","expanded":true,"style":{"background":"#8EDDF9"}}]},{"id":"92c85562c958a7968a9fbb38ea","topic":"系统没有足够对换区","expanded":true,"children":[{"id":"4219952d-d4c7-4bfa-a970-346a9b481691","topic":"不会被修改的：文件区 → 内存","expanded":true,"style":{"background":"#8EDDF9"}},{"id":"88920ee2-5989-4ecb-a753-fecd74e62a1a","topic":"会被修改的：对换区 ↔ 内存","expanded":true,"style":{"background":"#8EDDF9"}}]},{"id":"a60928c16c28fe2cc8b188a8d0","topic":"Unix方式","expanded":true,"children":[{"id":"1f8d59e4-38e1-44b0-b18b-836013187f5e","topic":"首次都是 文件区 → 内存","expanded":true,"style":{"background":"#8EDDF9"}},{"id":"77aa0fa7-13b8-459c-a809-60d5b8b7ae44","topic":"其余 对换区 ↔ 内存","expanded":true,"style":{"background":"#8EDDF9"}},{"id":"b9c7757e-bb7b-4334-9c8a-4346f4e88709","topic":"图示","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-acb501c3ef5b6a.png"}}]}]},{"id":"41e99203137b9f17ab18e9e3c8","topic":"驻留集大小","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"5d4b3f29-12b2-4e01-9552-6381865ddd9f","topic":"驻留集：","expanded":true,"children":[{"id":"8c7e1950-8ab1-4849-81cb-dfbef019c25c","topic":"分配给进程的物理块大小（OS概念）","expanded":true}]},{"id":"6a9b982cf9daf0674cb03b0a82","topic":"固定分配 VS 可变分配","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"4c03d1c3-d477-4b78-b4b4-6cdf8c5e62e7","topic":"固定：每个进程的驻留集刚开始就确定","expanded":true},{"id":"94630b40-82fd-4ed8-827d-33ab78208638","topic":"可变：每个进驻留集是可变的","expanded":true}]},{"id":"bd5ade1bf9abb09a6b36bb4f59","topic":"局部置换 VS 全局置换","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"692f50f6-ecef-44d3-be14-ac5134714eaa","topic":"局部：缺页时，进程先自己进行页面置换，OS不干预。根据进程的缺页率，OS再进行空闲块分配的","expanded":true,"style":{"background":"#8EDE99"}},{"id":"8c6dbb49-f6b1-4919-a387-1b56e02a4616","topic":"全局：进程缺页，OS直接送一块","expanded":true,"children":[{"id":"62511c65-e684-4457-8f49-b464e841899e","topic":"如果没有空闲块，就选择”未锁定”的页面置出外存","expanded":true}]}]},{"id":"14d7bee3-4a1c-44e2-9e55-c827775100ea","topic":"联合：","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"b75e9ec2-136c-4c88-b3c1-73e7a8b8edfe","topic":"固定分配局部置换","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"b0a6e87a-df0e-48f4-93d6-1cc3d2da831e","topic":"驻留集大小不变，自己内部置换","expanded":true}]},{"id":"887a31e2-ebd4-4855-85df-daa658531650","topic":"可变分配全局置换","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"d591147b-0a26-4687-b71b-9be3c40d04e5","topic":"驻留集大小可变，缺页就给你新的","expanded":true}]},{"id":"5e175eb7-a7b0-4ab5-8258-b93bb0d5d269","topic":"可变分配局部置换","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"331b552b-8293-470c-bbf4-fb58f7edf336","topic":"最好，灵活调配，缺页率高就给新的，低就拿走","expanded":true}]}]}]}]},{"id":"7e5af49068cb52341cebaad727","topic":"页面置换算法","expanded":true,"children":[{"id":"eeb9fb92fc587827575ac85561","topic":"OPT","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"74638fe2-9dab-45fc-8017-d48a8fec1adc","topic":"最佳置换算法","expanded":true},{"id":"f2d8d087-6a1f-4c60-94bd-7d9edf831b03","topic":"无法实现、找最长时间不被访问的块置换（作为算法的评价标准）","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"de6b6771e90b66a841fdfbddfa","topic":"FIFO","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"359f2dba-3724-4203-8766-d268f8b434fb","topic":"先进先出","expanded":true,"children":[{"id":"82cd4df1-08bf-4eaf-9739-522e19900162","topic":"队列类算法","expanded":true,"style":{"background":"#FF9595"},"children":[{"id":"3d406875-2c57-4f9a-8e1c-6da369afa9be","topic":"会出现Belady异常：总分配的内存物理块（内存块）数增加，导致缺页率也会增加","expanded":true,"style":{"background":"#FF9595"}}]}]},{"id":"173314c0-a62a-4262-b320-e7cd99474035","topic":"实现简单，性能差","expanded":true},{"id":"35b17b00-99fd-48ad-922d-d976fc0dc5af","topic":"与首次适应进行区分","expanded":true}]},{"id":"5c9b5da8afbb377da51fdb22c4","topic":"LRU","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"670e1639-74b3-46c7-82b3-0dab49907c9f","topic":"LAST RECENTLY USED","expanded":true},{"id":"1ca2d602-3644-4f5b-b4fa-571ba43258a4","topic":"实现困难，需要硬件支持、开销大","expanded":true,"style":{"background":"#8EDDF9"}},{"id":"ff0e3a34-f002-4315-aa11-b75c38530d9a","topic":"使用堆栈进行模拟","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"16961122-73fe-4af4-b9ba-cc222b9aac5a","topic":"堆栈上方的是新的，下方的是旧的，pop从下面pop出现，上面push进入","expanded":true,"style":{"background":"#8EDDF9"},"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-bda8d28fcac7a7.png","width":252,"height":147},"children":[{"id":"80afdf22-c2af-438d-b480-8acec2848f2e","topic":"王道的做法是底层实现的方法。（用访问字段的值来模拟堆栈）","expanded":true,"style":{"background":"#FDD834"},"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-ce12e7ff17429c.png","width":402,"height":135}}]}]}]},{"id":"0a1b742594f94718690afb9d8f","topic":"CLOCK","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"a98f0c5a-6ebd-4326-9350-1b38eb17cd23","topic":"简单CLOCK（NRU算法）","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"543ed729-8403-411c-8f23-a21a5f44c80c","topic":"只使用访问位","expanded":true,"children":[{"id":"fefac02c-aff6-4f8d-8190-892501ad5571","topic":"第一轮扫描的时候，把访问位为0的换出，边扫描边把访问位全部置为0。进行第二轮扫描","expanded":true}]}]},{"id":"64089b81-ee28-4cbd-acc0-8f873fadfa4d","topic":"改进CLOCK置换算法","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"c8317962-98c4-4726-a005-6e294334cca7","topic":"使用访问位 + 修改位","expanded":true,"children":[{"id":"09c30e4a-9f89-435e-a02f-1721c6d3a9bf","topic":"优先淘汰没有被修改过的页面","expanded":true},{"id":"4469c0d1-0be6-46bd-90f7-9ddec639d6fe","topic":"四级访问：","expanded":true,"style":{"background":"#8EDDF9"},"children":[{"id":"eee96b98-3718-4f93-865e-aa6a6468c431","topic":"（书中的P用的A来表示）","expanded":true},{"id":"2a7eafe0-cbe0-4dfd-b3b9-7fa9fcb08b12","topic":"P = 0，M = 0","expanded":true,"children":[{"id":"a5848a40-de27-4e7c-8095-c0549b1267f8","topic":"未访问，未修改","expanded":true}]},{"id":"5934fa28-f24c-4004-9522-72e59cd5e2c6","topic":"P = 0，M = 1","expanded":true,"children":[{"id":"82429ef8-15d2-48e4-b745-f2d31113a485","topic":"未访问，有修改","expanded":true,"children":[{"id":"c4a87512-9f69-47c7-91cc-e4b60d9f8065","topic":"本次扫描结束后把所有的P都改为0，然后重复扫描","expanded":true}]}]},{"id":"7b4cb26b-b605-4358-a1cc-6320e4c7b82e","topic":"P = 1，M = 0","expanded":true,"children":[{"id":"c893a997-3585-4135-bfc7-4cbab45c145b","topic":"访问过，未修改","expanded":true}]},{"id":"d71be280-7338-491d-a3c5-386c8821fea1","topic":"P = 1， M = 1","expanded":true,"children":[{"id":"8c2af841-5404-4eec-bd6a-a50b70d1a032","topic":"访问过，修改过","expanded":true}]}]}]}]}]}]},{"id":"b938db582d79f548001f5b9658","topic":"抖动 & 工作集","expanded":true,"children":[{"id":"c71a29225a287a9806478be805","topic":"抖动定义","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"1d189549-b5ad-4a60-9df4-01657d802a6a","topic":"刚换出的马上要换入主存，刚换入的马上要换出","expanded":true,"style":{"background":"#8EDE99"}},{"id":"3db3720f-267c-446e-93f7-5a898c1d0f46","topic":"产生原因：","expanded":true,"children":[{"id":"f137e553-bd42-41a7-8717-3e21abd0b2bf","topic":"某个进程频繁访问的页面数目高于可用的物理页面帧数","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"432bd8ea-8a1d-434d-8635-7ce2064bdd2a","topic":"解决办法：","expanded":true,"children":[{"id":"c57c5ab1-dd8c-4e56-a5b0-03eb7a738201","topic":"工作集","expanded":true,"style":{"background":"#8EDE99"}}]}]},{"id":"cde89388ccb88e7a1fed9bb214","topic":"工作集W和时间t和工作窗口大小delta","expanded":true,"children":[{"id":"6ad809ed-cd9b-4292-b348-93584727d289","topic":"基于局部性原理，OS实时跟踪进程，用最近访问过的页面来确定工作集。例如在t1时刻，工作集窗口大小为5，窗口内的页面是2, 3, 5, 3, 2，此时工作集为{2, 3, 5}","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"cf133367-a593-4ee4-934a-694c758eb2bb","topic":"随后操作系统为进程分配【 > 工作集的驻留集】大小，就会保证不抖动","expanded":true,"style":{"background":"#8EDE99"}},{"id":"afdd5e73-4b96-4c65-b711-bf7a95d74dd3","topic":"拓展：","expanded":true,"children":[{"id":"10382889-fb44-4192-b2a1-ec6dbd7cf9d8","topic":"有些OS会根据工作集来设计页面置换算法，根据进程近期访问的页面来确定换什么页面","expanded":true}]}]}]},{"id":"942a39292588c399aedbe975de","topic":"工作集和驻留集关系","expanded":true,"children":[{"id":"36301029-6b94-49f9-b048-98ef2aae4397","topic":"工作集  < 驻留集","expanded":true,"style":{"background":"#8EDE99"}}]}]},{"id":"21bda5ad-1d65-4aa4-a26f-5579a3e03704","topic":"内存共享、内存映射文件","expanded":true,"children":[{"id":"b7e7cb51-eaa6-4626-8f62-c46b32e22ff3","topic":"页框分配：","expanded":true,"children":[{"id":"877c120d-b885-4fe8-acc1-6832e14e2c47","topic":"即页面分配策略，连续、非连续分配","expanded":true}]},{"id":"fd0d8788-c878-4dca-882b-8b2edeb05880","topic":"内存映射文件：","expanded":true,"style":{"background":"#8EDE99"},"children":[{"id":"d1984a29-3ffd-4a55-b10d-a4a5e6b5a855","topic":"mmp, Memory-Mapped File","expanded":true,"style":{"background":"#8EDE99"}},{"id":"9ff779f6-031a-4b59-aa1a-d232cf35c2a1","topic":"通过内存映射，使得多个进程的某一个虚拟进程地址区域对应内存中同一个物理地址区域","expanded":true,"style":{"background":"#8EDE99"}}]},{"id":"b68a9e7c-bafb-44a2-9e75-72b3f1937b00","topic":"虚存性能因素：","expanded":true,"children":[{"id":"293f8f1f-3303-4081-9c62-ed1f0732435e","topic":"缺页率是影响虚存性能的最主要因素","expanded":true,"style":{"background":"#FF9595"}},{"id":"543734e4-9001-4bcc-b7ea-5356cf1f683d","topic":"提高性能的办法","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"b72b0868-716e-462f-82e6-470538e4b145","topic":"设置好页面大小","expanded":true,"style":{"background":"#FDD834"},"children":[{"id":"44fc2195-82d1-49ee-bb2e-c0c3f1a15496","topic":"太大会增加内部碎片","expanded":true,"style":{"background":"#FDD834"}},{"id":"49ab240f-b7de-4b9d-a6ce-6433f44ff2b4","topic":"太小会使得缺页率高、页表过长","expanded":true,"style":{"background":"#FDD834"}}]},{"id":"bda8358e-81d4-4489-b5bc-16542fa29172","topic":"设置好工作集、驻留集","expanded":true,"style":{"background":"#FDD834"}},{"id":"9edfcc5c-6332-4999-adef-724acea664a7","topic":"设置好LRU、CLOCK置换算法","expanded":true,"style":{"background":"#FDD834"}},{"id":"361ea049-f48f-4bab-99dc-909959cf04bb","topic":"提高程序的局部性","expanded":true,"style":{"background":"#FDD834"}}]}]}]},{"id":"27fa73b7-d73e-4e72-b95d-96f578e22645","topic":"地址翻译：","expanded":true,"children":[{"id":"f8ffa3cd-5b90-4602-9926-163496dd7126","topic":"详细看计组","expanded":true},{"id":"3ec5db2f-250f-4321-bbf0-ac8e1e3b84c2","topic":"虚地址 -> 物理地址","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-d5d5e28ef67eb4.png","width":375.09,"height":362.19},"children":[{"id":"d202c3dd-525d-4a24-8e3e-39673822f93a","topic":"物理地址 -> 数据","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-08d30e6e093df9.png","width":360.47,"height":366.93}}]}]}]},{"id":"6fc325be-bd1b-4c59-a8b2-8a55d0d1ac2f","topic":"END","expanded":true,"image":{"src":"https://gastigado.cnies.org/d/BrushUP/mm-7989069c498fc7.svg"}}]},"relations":[{"id":"c272876f-4e34-4205-aeeb-e78525f27073","from":"72eb8a2eec889bd095238910c5","to":"1098924386389a3f0661e907ba","bidirectional":false}],"summaries":[{"id":"8b14ec94-0442-4d20-b1a3-c967c7782839","parentId":"d5ab1655-083b-447e-8cf9-6655822057bf","start":0,"end":0,"label":"ci,so,exe"},{"id":"2d2297d4-764d-4a66-a9aa-ef72b0ddaec8","parentId":"88bbab02278b0a1accecd925e1","start":1,"end":2,"label":"只有装入到连续地址空间中，不能修改"},{"id":"58e3d97e-f56a-46ee-8e18-4a1c020a067c","parentId":"88bbab02278b0a1accecd925e1","start":3,"end":3,"label":"不连续空间，装入部分代码即可运行，动态分配内存"},{"id":"539a006f-404d-4e73-ba47-bc4c7e541d4a","parentId":"9e9eacde-54bf-43d0-b5b1-31293cbe966e","start":0,"end":1,"label":"如果是N级页表，则为N+1次内存访问，N次越界检测"},{"id":"eaa1d7ef-eb25-4dce-8214-0da9aad057a8","parentId":"1398909a-2147-4098-bc94-14cf5c49e77e","start":0,"end":1,"label":"需要两种都满足"},{"id":"e41fd047-7a15-4e4d-8be9-95b1be3a39c3","parentId":"bd99231a49bb7adb5546d9e4ca","start":0,"end":2,"label":"与非请求模式的区别：采用了虚拟内存的技术，不需要把页/页面全部都先放入内存中，而是在运行中检测到缺页再去外存中读取"},{"id":"99c0fa44-6f26-4272-8f23-2d6e2fb4f63c","parentId":"4469c0d1-0be6-46bd-90f7-9ddec639d6fe","start":3,"end":4,"label":"如果会搜到这里，P其实已经更改为0了"},{"id":"ffef5e98-a203-42a0-9f61-cd7ff744955b","parentId":"b68a9e7c-bafb-44a2-9e75-72b3f1937b00","start":0,"end":0,"label":"TLB、Cache命中率都没有这么主要"}],"boundaries":[{"id":"0dbe8376-c4f6-4e91-b6b7-a187d46775fe","parentId":"4e9a9b5bfaa813976384d9277e","start":1,"end":1,"label":"有变化"},{"id":"54de3fff-4c78-40ec-add4-544fc6f05cc7","parentId":"6f7b6d8bb3f908a7b048bbab7c","start":0,"end":0,"label":"在非虚拟存储的页表、段表是基本固定的，而虚拟存储的页表要实时记得要不要修改页表项"},{"id":"97964080-dcc7-42bb-82de-264975c40e9e","parentId":"1a590755-5152-4864-8781-5b8a57afffa8","start":0,"end":1,"label":"容易忘"},{"id":"60e7c849-6913-4190-944c-50898117c45b","parentId":"ff0e3a34-f002-4315-aa11-b75c38530d9a","start":0,"end":0,"label":"区别：考试做法这里面不考虑页面对应哪一个物理块。"}]}