{"id":196,"date":"2009-04-11T03:19:26","date_gmt":"2009-04-10T19:19:26","guid":{"rendered":"http:\/\/www.alunwk.com\/?p=196"},"modified":"2009-04-11T03:19:26","modified_gmt":"2009-04-10T19:19:26","slug":"osc-main-memory-notes","status":"publish","type":"post","link":"https:\/\/wukan.me\/?p=196","title":{"rendered":"OSC Main Memory Notes"},"content":{"rendered":"<p>\u521a\u521a\u82b1\u4e86\u4e24\u4e2a\u534a\u5c0f\u65f6\u628aOSC\u7684\u7b2c\u516b\u7ae0\uff0dMain Memory\u8bfb\u5b8c\u4e86\uff0c\u5728\u8fd9\u91cc\u7528\u81ea\u5df1\u7684\u8bdd\u603b\u7ed3\u4e00\u4e0b\u8bb0\u7684\u7b14\u8bb0\u3002<br \/>\n8.1 Background<br \/>\n\u7b2c\u4e00\u5c0f\u8282\u662f\u80cc\u666f\u77e5\u8bc6\u4ecb\u7ecd\u3002<br \/>\n8.1.1\u9996\u5148\u63d0\u5230\u7684\u662f\u57fa\u672c\u7684\u786c\u4ef6\uff0c\u5bc4\u5b58\u5668\u3001\u5185\u5b58\u548c\u9ad8\u901f\u7f13\u5b58(Cache)\u3002\u8fd8\u4ecb\u7ecd\u4e86protection\uff0c\u8bf4\u7528\u6237\u6a21\u5f0f(user mode)\u4e0b\uff0c\u7a0b\u5e8f\u8bbf\u95ee\u7684\u5185\u5b58\u7a7a\u95f4\u662f\u6709\u9650\u5236\u7684\uff0cprotection\u7684\u6982\u5ff5\u8d2f\u7a7f\u4e8e\u6574\u4e2a\u7ae0\u8282\u30028.1.2\u4ecb\u7ecd\u4e86\u5730\u5740\u8f6c\u6362\u673a\u5236(address binding)\uff0c\u7a0b\u5e8f\u5728\u6267\u884c\u7684\u65f6\u5019\u4f1a\u628a\u76f8\u5e94\u7684\u5730\u5740\u8bfb\u5165\u5230\u5185\u5b58\u4e2d\u30028.1.3\u4ecb\u7ecd\u4e86\u903b\u8f91\u5730\u5740(logical address)\u548c\u7269\u7406\u5730\u5740(physical address)\u7684\u6982\u5ff5\uff0c\u903b\u8f91\u5730\u5740\u6307\u7684\u662fCPU\u4ea7\u751f\u7684\u5730\u5740\uff0c\u800c\u7269\u7406\u5730\u5740\u5219\u6307\u7684\u662f\u5185\u5b58\u6240&#8221;\u89c1\u5230&#8221;\u7684\u5730\u5740\u3002\u8fd9\u4e24\u4e2a\u6982\u5ff5\u5f88\u91cd\u8981\uff0c\u8c8c\u4f3c\u6574\u4e2a\u4e00\u7ae0\u90fd\u5728\u8ba8\u8bba\u5982\u4f55\u5728\u5c06logical address\u8f6c\u6362\u6210physical address\u30028.1.4\u548c8.1.5\u4ecb\u7ecd\u4e86\u52a8\u6001\u8bfb\u53d6(dynamic loading)\u548c\u52a8\u6001\u94fe\u63a5(dynamic linking)\uff0c\u524d\u8005\u662f\u6307\u4e00\u6bb5\u7a0b\u5e8f\u53ea\u6709\u5f53\u88ab\u8c03\u7528\u65f6\u624d\u4f1a\u8bfb\u53d6\u3002\u540e\u8005\u662f\u8ddf\u9759\u6001\u94fe\u63a5(static linking)\u76f8\u5bf9\u7684\u4e00\u4e2a\u6982\u5ff5\uff0c\u5177\u4f53\u770b\u5f97\u4e0d\u662f\u5f88\u660e\u767d\u3002<br \/>\n8.2 Swapping<br \/>\nswapping\u6280\u672f\u53ef\u4ee5\u5c06\u8fdb\u7a0b\u5728\u5185\u5b58\u548c\u4e00\u4e2a\u53eb\u505abacking store\u7684\u5730\u65b9\u8c03\u6765\u8c03\u53bb\u3002\u6bd4\u5982\u4e00\u4e2a\u8fdb\u7a0b\u6240\u9700\u8981\u7684\u5185\u5b58\u4e0d\u591f\u4e86\uff0c\u5c31\u53ef\u4ee5\u628a\u5b83swap out\u5230backing store\uff0c\u7b49\u5230\u6709\u8db3\u591f\u5185\u5b58\u65f6\u518d\u628a\u5b83swap in\u63a5\u7740\u6267\u884c\u3002<br \/>\n8.3\u00a0 Contiguous Memory Allocation<br \/>\n\u9996\u5148\u5462\uff0c\u5185\u5b58\u603b\u662f\u88ab\u5206\u4e3a\u4e24\u90e8\u5206\uff0c\u4e00\u90e8\u5206\u7559\u7ed9\u64cd\u4f5c\u7cfb\u7edf\uff0c\u53e6\u4e00\u90e8\u5206\u5219\u7ed9\u7528\u6237\u8fdb\u7a0b\u6240\u4f7f\u7528\u3002<br \/>\n8.3.1\u4ecb\u7ecd\u4e24\u79cd\u5bc4\u5b58\u5668\uff1arelocation register, limit register\u3002\u524d\u8005\u5b58\u6709\u7269\u7406\u5730\u5740\u7684\u6700\u5c0f\u503c\uff0c\u540e\u8005\u5b58\u50a8\u903b\u8f91\u5730\u5740\u7684\u6700\u5927\u503c\u30028.3.2\u4ecb\u7ecd\u4e86\u5185\u5b58\u7684\u5206\u914d\u65b9\u5f0f\u3002\u6700\u7b80\u5355\u7684\u4e00\u79cd\u662f\u628a\u5185\u5b58\u5206\u6210\u4e3a\u51e0\u4e2a\u56fa\u5b9a\u5927\u5c0f(fixed-sized)\u7684\u533a\u57df(partition)\u3002\u4e4b\u540e\u8fd8\u4ecb\u7ecd\u4e86hole\u7684\u6982\u5ff5\uff0c\u6307\u7684\u662f\u5185\u5b58\u4e2d\u6240\u6709\u53ef\u4ee5\u88ab\u4f7f\u7528\u7684\u90e8\u5206\u3002\u8fd8\u4ecb\u7ecd\u4e86\u4e09\u79cd\u5206\u914dholes\u7684\u7b97\u6cd5\uff1afirst-fit, best-fit, worst-fit\u30028.3.3\u4ecb\u7ecd\u4e86\u788e\u7247(fragmentation)\u3002\u788e\u7247\u5206\u4e3aexternal fragmentation\u548cinternal fragmentation\u4e24\u79cd\u3002\u524d\u8005\u6307\u7684\u662f\u5728\u5206\u914d\u5185\u5b58\u7684\u65f6\u5019\uff0c\u5373\u4f7f\u6709\u8db3\u591f\u5927\u5c0f\u7684\u7a7a\u95f4\uff0c\u53ef\u662f\u8fd9\u4e9b\u7a7a\u95f4\u4e0d\u662f\u8fde\u7eed\u7684\u3002\u800c\u540e\u8005\u6307\u5206\u914d\u7ed9\u8fdb\u7a0b\u7684\u7a7a\u95f4\u53ef\u80fd\u4f1a\u5927\u4e8e\u8fdb\u7a0b\u5b9e\u9645\u9700\u8981\u7684\u7a7a\u95f4\uff0c\u8fd9\u79cd\u788e\u7247\u4e3b\u8981\u4ea7\u751f\u5728\u56fa\u5b9a\u533a\u57df\u5927\u5c0f\u7684\u5206\u914d\u65b9\u5f0f\u65f6\u3002\u6700\u540e\u63d0\u5230\u4e86\u9488\u5bf9\u788e\u7247\u7684\u89e3\u51b3\u65b9\u6848\uff1a\u5206\u9875(paging)\u548c\u5206\u6bb5(segmentation)\uff0c\u8fd9\u4e24\u5927\u6280\u672f\u4e5f\u662f\u672c\u7ae0\u5269\u4f59\u90e8\u5206\u7740\u91cd\u8ba8\u8bba\u7684\u5185\u5bb9\u3002<br \/>\n8.4 Paging<br \/>\n\u5206\u9875\u6280\u672f\u5141\u8bb8\u4e00\u4e2a\u8fdb\u7a0b\u8de8\u8d8a\u4e0d\u8fde\u7eed\u7684\u7269\u7406\u7a7a\u95f4\u3002<br \/>\n8.4.1\u9996\u5148\u4ecb\u7ecd\u4e24\u4e2a\u6982\u5ff5\uff1aframes, pages\u3002\u524d\u8005\u662f\u5c06\u7269\u7406\u7a7a\u95f4\u5212\u5206\u6210\u76f8\u540c\u5927\u5c0f\u7684\u90e8\u5206\uff0c\u540e\u8005\u662f\u5c06\u865a\u62df\u903b\u8f91\u7a7a\u95f4\u5212\u5206\u6210\u76f8\u540c\u5927\u5c0f\u7684\u90e8\u5206\u3002\u6700\u57fa\u672c\u7684\u60c5\u51b5\u662f\u903b\u8f91\u5730\u5740\u5206\u6210\u4e24\u90e8\u5206:page number, page offset\u3002\u5728\u5c06\u903b\u8f91\u5730\u5740\u8f6c\u6362\u6210\u7269\u7406\u5730\u5740\u65f6\uff0c\u5148\u901a\u8fc7page table\u67e5\u627e\u5c06page number\u8f6c\u6362\u6210frame number\uff0c\u5219\u7269\u7406\u5730\u5740\u7531frame number,page offset\u4e24\u90e8\u5206\u7ec4\u6210\u3002paging\u7684\u4e00\u4e2a\u7279\u70b9\u662f\u5c06\u7528\u6237\u6240\u770b\u5230\u7684\u5185\u5b58\u4e0e\u5b9e\u9645\u7269\u7406\u7684\u5185\u5b58\u5206\u5f00\u4e86\u30028.4.2\u8c08\u4e86\u786c\u4ef6\u5bf9\u5206\u9875\u6280\u672f\u7684\u652f\u6301\u3002\u6700\u7b80\u5355\u7684\u60c5\u51b5\u662f\u7528\u4e00\u5806\u5bc4\u5b58\u5668\u6765\u505a\u4e3apage table\u3002\u53ef\u662f\u5f53page\u6570\u91cf\u7279\u522b\u5927\u7684\u65f6\u5019\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5c31\u4e0d\u53ef\u884c\u4e86\u3002\u5bb9\u6613\u60f3\u5230\u7684\u65b9\u6cd5\u662f\u628apage table\u653e\u5230\u5185\u5b58\u4e2d\u53bb\uff0c\u53ef\u662f\u8fd9\u6837\u5b50\u6548\u7387\u592a\u4f4e\u4e86\u3002\u73b0\u5728\u7684\u6807\u51c6\u505a\u6cd5\u662f\u4f7f\u7528\u9ad8\u901f\u7f13\u5b58\uff0c\u8fd9\u79cd\u6280\u672f\u88ab\u79f0\u4e3a TLB\u3002TLB\u4e2d\u7684\u6bcf\u4e00\u9879(entry)\u7531\u4e24\u90e8\u5206\u7ec4\u6210\uff1akey, value\u3002\u8fd9\u6837\u5b50\uff0c\u5f53\u67e5\u627epage number\u7684\u65f6\u5019\u4f1a\u5148\u5230TLB\u4e2d\u53bb\u67e5\u627e\uff0c\u627e\u4e0d\u5230\u518d\u53bb\u5185\u5b58\u4e2d\u627e\uff0c\u540c\u65f6\u5c06\u8be5\u9879\u6dfb\u52a0\u5230TLB\u4e2d\u4ee5\u65b9\u4fbf\u4e0b\u4e00\u6b21\u67e5\u627e\u3002\u6b64\u5916\uff0cTLB\u8fd8\u6709\u4e00\u4e2a\u5f88\u91cd\u8981\u7684\u53c2\u6570\u662f\u547d\u4e2d\u7387(hit ratio)\u30028.4.3\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528paging\u6280\u672f\u6765\u8fdb\u884c\u4fdd\u62a4\uff0c\u5927\u6982\u610f\u601d\u662f\u5f53\u5bf9page number\u8fdb\u884c\u8f6c\u6362\u65f6\u4f1a\u5224\u65ad\u8f6c\u6362\u540e\u7684\u7269\u7406\u5730\u5740\u662f\u5426\u662f\u6709\u6548\u7684(valid)\u30028.4.4\u4ecb\u7ecd\u4e86shared pages\u6280\u672f\uff0c\u591a\u4e2a\u8fdb\u7a0b\u53ef\u4ee5\u5171\u4eab\u540c\u6837\u7684pages\u3002<br \/>\n8.5 Structure of the Page Table<br \/>\n\u8be5\u5c0f\u8282\u4ecb\u7ecd\u4e86\u82e5\u5e72\u79cd\u7ec4\u7ec7page table\u7684\u65b9\u5f0f\u3002<br \/>\n8.5.1\u4ecb\u7ecd\u4e86\u5206\u5c42\u6cd5(Hierarchical Paging)\uff0c\u5f53page\u7279\u522b\u591a\u7684\u65f6\u5019\uff0c\u53ef\u4ee5\u5c06page\u5206\u6210\u4e24\u5c42\u3002\u901a\u8fc7\u5916\u5c42 page number\u68c0\u7d22\u5230\u5185\u5c42page number\uff0c\u518d\u901a\u8fc7\u5185\u5c42page number\u6765\u68c0\u7d22\u7269\u7406\u5730\u5740\u30028.5.2\u4ecb\u7ecd\u4e86\u5229\u7528\u54c8\u5e0c\u8868\u6765\u7ec4\u7ec7 page table\u30028.5.3\u4ecb\u7ecd\u4e00\u79cdinverted page tables\u7684\u6280\u672f\uff0c\u4e0d\u8fc7\u770b\u5f97\u4e0d\u662f\u5f88\u61c2\u3002<br \/>\n8.6 Segmentation<br \/>\n\u5206\u6bb5\u6280\u672f\u5c31\u50cf\u6211\u4eec\u5199x86\u6c47\u7f16\u7684\u65f6\u5019\uff0c\u628a\u7a0b\u5e8f\u5206\u6210\u4e0d\u540c\u7684\u6bb5\u3002\u6bcf\u4e00\u6bb5\u6620\u5c04\u5230\u5185\u5b58\u7684\u4e00\u90e8\u5206\uff0c\u7136\u540e\u6bcf\u4e00\u6bb5\u4e2d\u7684\u504f\u79fb\u5728\u8f6c\u6362\u6210\u7269\u7406\u5730\u5740\u65f6\u8981\u52a0\u4e0a\u6bb5\u7684\u57fa\u5730\u5740(base)\uff0c\u540c\u65f6\u4e0d\u80fd\u8d85\u8fc7\u6bcf\u4e00\u4e2a\u6bb5\u7684\u9650\u5236(limit)\u3002<br \/>\n8.7 Example: The Intel Pentium<br \/>\n\u4ecb\u7ecd\u4e86Intel Pentium\u4e2d\u7684segmentation\u548cpaging\u6280\u672f\uff0c\u6ca1\u4ed4\u7ec6\u770b\uff0c\u4e5f\u4e0d\u592a\u660e\u767d\u3002<br \/>\n8.8 Summary<br \/>\n\u8c8c\u4f3c\u5916\u56fd\u4eba\u5199\u4e66\u90fd\u559c\u6b22\u6bcf\u4e00\u7ae0\u6700\u540e\u4e00\u8282\u603b\u7ed3\u4e00\u4e0b~~~<br \/>\nOS\u7b2c\u4e8c\u6b21\u5b9e\u9a8c\u5b66\u957f\u5fd8\u8bb0\u6316\u7a7a\u4e86\uff0c\u8981\u6211\u4eec\u5206\u6790\u4ee3\u7801\u7136\u540e\u5199\u4e00\u4e2a\u8be6\u7ec6\u7684\u62a5\u544a&#8230;&#8230;\u8fd8\u4e0d\u5982\u586b\u4ee3\u7801\u5462:(<br \/>\n\u53ea\u597d\u5148\u8865\u4e00\u8865\u64cd\u4f5c\u7cfb\u7edf\u5173\u4e8e\u5185\u5b58\u7ba1\u7406\u90e8\u5206\u7684\u77e5\u8bc6\u4e86\u3002<br \/>\n\u672c\u6765\u60f3\u4eca\u665a\u628a\u865a\u62df\u5185\u5b58\u4e00\u7ae0\u4e5f\u770b\u4e86\uff0c\u4e0d\u8fc7\u8c8c\u4f3c\u7cbe\u529b\u5df2\u7ecf\u4e0d\u80fd\u5f88\u96c6\u4e2d\u4e86<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521a\u521a\u82b1\u4e86\u4e24\u4e2a\u534a\u5c0f\u65f6\u628aOSC\u7684\u7b2c\u516b\u7ae0\uff0dMain Memory\u8bfb\u5b8c\u4e86\uff0c\u5728\u8fd9\u91cc\u7528\u81ea\u5df1\u7684\u8bdd\u603b\u7ed3\u4e00\u4e0b\u8bb0\u7684\u7b14\u8bb0\u3002 8.1 Background \u7b2c\u4e00\u5c0f\u8282\u662f\u80cc\u666f\u77e5\u8bc6\u4ecb\u7ecd\u3002 8.1.1\u9996\u5148\u63d0\u5230\u7684\u662f\u57fa\u672c\u7684\u786c\u4ef6\uff0c\u5bc4\u5b58\u5668\u3001\u5185\u5b58\u548c\u9ad8\u901f\u7f13\u5b58(Cache)\u3002\u8fd8\u4ecb\u7ecd\u4e86protection\uff0c\u8bf4\u7528\u6237\u6a21\u5f0f(user mode)\u4e0b\uff0c\u7a0b\u5e8f\u8bbf\u95ee\u7684\u5185\u5b58\u7a7a\u95f4\u662f\u6709\u9650\u5236\u7684\uff0cprotection\u7684\u6982\u5ff5\u8d2f\u7a7f\u4e8e\u6574\u4e2a\u7ae0\u8282\u30028.1.2\u4ecb\u7ecd\u4e86\u5730\u5740\u8f6c\u6362\u673a\u5236(address binding)\uff0c\u7a0b\u5e8f\u5728\u6267\u884c\u7684\u65f6\u5019\u4f1a\u628a\u76f8\u5e94\u7684\u5730\u5740\u8bfb\u5165\u5230\u5185\u5b58\u4e2d\u30028.1.3\u4ecb\u7ecd\u4e86\u903b\u8f91\u5730\u5740(logical address)\u548c\u7269\u7406\u5730\u5740(physical address)\u7684\u6982\u5ff5\uff0c\u903b\u8f91\u5730\u5740\u6307\u7684\u662fCPU\u4ea7\u751f\u7684\u5730\u5740\uff0c\u800c\u7269\u7406\u5730\u5740\u5219\u6307\u7684\u662f\u5185\u5b58\u6240&#8221;\u89c1\u5230&#8221;\u7684\u5730\u5740\u3002\u8fd9\u4e24\u4e2a\u6982\u5ff5\u5f88\u91cd\u8981\uff0c\u8c8c\u4f3c\u6574\u4e2a\u4e00\u7ae0\u90fd\u5728\u8ba8\u8bba\u5982\u4f55\u5728\u5c06logical address\u8f6c\u6362\u6210physical address\u30028.1.4\u548c8.1.5\u4ecb\u7ecd\u4e86\u52a8\u6001\u8bfb\u53d6(dynamic loading)\u548c\u52a8\u6001\u94fe\u63a5(dynamic linking)\uff0c\u524d\u8005\u662f\u6307\u4e00\u6bb5\u7a0b\u5e8f\u53ea\u6709\u5f53\u88ab\u8c03\u7528\u65f6\u624d\u4f1a\u8bfb\u53d6\u3002\u540e\u8005\u662f\u8ddf\u9759\u6001\u94fe\u63a5(static linking)\u76f8\u5bf9\u7684\u4e00\u4e2a\u6982\u5ff5\uff0c\u5177\u4f53\u770b\u5f97\u4e0d\u662f\u5f88\u660e\u767d\u3002 8.2 Swapping swapping\u6280\u672f\u53ef\u4ee5\u5c06\u8fdb\u7a0b\u5728\u5185\u5b58\u548c\u4e00\u4e2a\u53eb\u505abacking store\u7684\u5730\u65b9\u8c03\u6765\u8c03\u53bb\u3002\u6bd4\u5982\u4e00\u4e2a\u8fdb\u7a0b\u6240\u9700\u8981\u7684\u5185\u5b58\u4e0d\u591f\u4e86\uff0c\u5c31\u53ef\u4ee5\u628a\u5b83swap out\u5230backing store\uff0c\u7b49\u5230\u6709\u8db3\u591f\u5185\u5b58\u65f6\u518d\u628a\u5b83swap in\u63a5\u7740\u6267\u884c\u3002 8.3\u00a0 Contiguous Memory Allocation \u9996\u5148\u5462\uff0c\u5185\u5b58\u603b\u662f\u88ab\u5206\u4e3a\u4e24\u90e8\u5206\uff0c\u4e00\u90e8\u5206\u7559\u7ed9\u64cd\u4f5c\u7cfb\u7edf\uff0c\u53e6\u4e00\u90e8\u5206\u5219\u7ed9\u7528\u6237\u8fdb\u7a0b\u6240\u4f7f\u7528\u3002 8.3.1\u4ecb\u7ecd\u4e24\u79cd\u5bc4\u5b58\u5668\uff1arelocation register, limit register\u3002\u524d\u8005\u5b58\u6709\u7269\u7406\u5730\u5740\u7684\u6700\u5c0f\u503c\uff0c\u540e\u8005\u5b58\u50a8\u903b\u8f91\u5730\u5740\u7684\u6700\u5927\u503c\u30028.3.2\u4ecb\u7ecd\u4e86\u5185\u5b58\u7684\u5206\u914d\u65b9\u5f0f\u3002\u6700\u7b80\u5355\u7684\u4e00\u79cd\u662f\u628a\u5185\u5b58\u5206\u6210\u4e3a\u51e0\u4e2a\u56fa\u5b9a\u5927\u5c0f(fixed-sized)\u7684\u533a\u57df(partition)\u3002\u4e4b\u540e\u8fd8\u4ecb\u7ecd\u4e86hole\u7684\u6982\u5ff5\uff0c\u6307\u7684\u662f\u5185\u5b58\u4e2d\u6240\u6709\u53ef\u4ee5\u88ab\u4f7f\u7528\u7684\u90e8\u5206\u3002\u8fd8\u4ecb\u7ecd\u4e86\u4e09\u79cd\u5206\u914dholes\u7684\u7b97\u6cd5\uff1afirst-fit, best-fit, worst-fit\u30028.3.3\u4ecb\u7ecd\u4e86\u788e\u7247(fragmentation)\u3002\u788e\u7247\u5206\u4e3aexternal fragmentation\u548cinternal fragmentation\u4e24\u79cd\u3002\u524d\u8005\u6307\u7684\u662f\u5728\u5206\u914d\u5185\u5b58\u7684\u65f6\u5019\uff0c\u5373\u4f7f\u6709\u8db3\u591f\u5927\u5c0f\u7684\u7a7a\u95f4\uff0c\u53ef\u662f\u8fd9\u4e9b\u7a7a\u95f4\u4e0d\u662f\u8fde\u7eed\u7684\u3002\u800c\u540e\u8005\u6307\u5206\u914d\u7ed9\u8fdb\u7a0b\u7684\u7a7a\u95f4\u53ef\u80fd\u4f1a\u5927\u4e8e\u8fdb\u7a0b\u5b9e\u9645\u9700\u8981\u7684\u7a7a\u95f4\uff0c\u8fd9\u79cd\u788e\u7247\u4e3b\u8981\u4ea7\u751f\u5728\u56fa\u5b9a\u533a\u57df\u5927\u5c0f\u7684\u5206\u914d\u65b9\u5f0f\u65f6\u3002\u6700\u540e\u63d0\u5230\u4e86\u9488\u5bf9\u788e\u7247\u7684\u89e3\u51b3\u65b9\u6848\uff1a\u5206\u9875(paging)\u548c\u5206\u6bb5(segmentation)\uff0c\u8fd9\u4e24\u5927\u6280\u672f\u4e5f\u662f\u672c\u7ae0\u5269\u4f59\u90e8\u5206\u7740\u91cd\u8ba8\u8bba\u7684\u5185\u5bb9\u3002 8.4 Paging \u5206\u9875\u6280\u672f\u5141\u8bb8\u4e00\u4e2a\u8fdb\u7a0b\u8de8\u8d8a\u4e0d\u8fde\u7eed\u7684\u7269\u7406\u7a7a\u95f4\u3002 8.4.1\u9996\u5148\u4ecb\u7ecd\u4e24\u4e2a\u6982\u5ff5\uff1aframes, pages\u3002\u524d\u8005\u662f\u5c06\u7269\u7406\u7a7a\u95f4\u5212\u5206\u6210\u76f8\u540c\u5927\u5c0f\u7684\u90e8\u5206\uff0c\u540e\u8005\u662f\u5c06\u865a\u62df\u903b\u8f91\u7a7a\u95f4\u5212\u5206\u6210\u76f8\u540c\u5927\u5c0f\u7684\u90e8\u5206\u3002\u6700\u57fa\u672c\u7684\u60c5\u51b5\u662f\u903b\u8f91\u5730\u5740\u5206\u6210\u4e24\u90e8\u5206:page number, page offset\u3002\u5728\u5c06\u903b\u8f91\u5730\u5740\u8f6c\u6362\u6210\u7269\u7406\u5730\u5740\u65f6\uff0c\u5148\u901a\u8fc7page table\u67e5\u627e\u5c06page number\u8f6c\u6362\u6210frame number\uff0c\u5219\u7269\u7406\u5730\u5740\u7531frame number,page offset\u4e24\u90e8\u5206\u7ec4\u6210\u3002paging\u7684\u4e00\u4e2a\u7279\u70b9\u662f\u5c06\u7528\u6237\u6240\u770b\u5230\u7684\u5185\u5b58\u4e0e\u5b9e\u9645\u7269\u7406\u7684\u5185\u5b58\u5206\u5f00\u4e86\u30028.4.2\u8c08\u4e86\u786c\u4ef6\u5bf9\u5206\u9875\u6280\u672f\u7684\u652f\u6301\u3002\u6700\u7b80\u5355\u7684\u60c5\u51b5\u662f\u7528\u4e00\u5806\u5bc4\u5b58\u5668\u6765\u505a\u4e3apage table\u3002\u53ef\u662f\u5f53page\u6570\u91cf\u7279\u522b\u5927\u7684\u65f6\u5019\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5c31\u4e0d\u53ef\u884c\u4e86\u3002\u5bb9\u6613\u60f3\u5230\u7684\u65b9\u6cd5\u662f\u628apage table\u653e\u5230\u5185\u5b58\u4e2d\u53bb\uff0c\u53ef\u662f\u8fd9\u6837\u5b50\u6548\u7387\u592a\u4f4e\u4e86\u3002\u73b0\u5728\u7684\u6807\u51c6\u505a\u6cd5\u662f\u4f7f\u7528\u9ad8\u901f\u7f13\u5b58\uff0c\u8fd9\u79cd\u6280\u672f\u88ab\u79f0\u4e3a TLB\u3002TLB\u4e2d\u7684\u6bcf\u4e00\u9879(entry)\u7531\u4e24\u90e8\u5206\u7ec4\u6210\uff1akey, value\u3002\u8fd9\u6837\u5b50\uff0c\u5f53\u67e5\u627epage number\u7684\u65f6\u5019\u4f1a\u5148\u5230TLB\u4e2d\u53bb\u67e5\u627e\uff0c\u627e\u4e0d\u5230\u518d\u53bb\u5185\u5b58\u4e2d\u627e\uff0c\u540c\u65f6\u5c06\u8be5\u9879\u6dfb\u52a0\u5230TLB\u4e2d\u4ee5\u65b9\u4fbf\u4e0b\u4e00\u6b21\u67e5\u627e\u3002\u6b64\u5916\uff0cTLB\u8fd8\u6709\u4e00\u4e2a\u5f88\u91cd\u8981\u7684\u53c2\u6570\u662f\u547d\u4e2d\u7387(hit ratio)\u30028.4.3\u4ecb\u7ecd\u4e86\u5982\u4f55\u4f7f\u7528paging\u6280\u672f\u6765\u8fdb\u884c\u4fdd\u62a4\uff0c\u5927\u6982\u610f\u601d\u662f\u5f53\u5bf9page number\u8fdb\u884c\u8f6c\u6362\u65f6\u4f1a\u5224\u65ad\u8f6c\u6362\u540e\u7684\u7269\u7406\u5730\u5740\u662f\u5426\u662f\u6709\u6548\u7684(valid)\u30028.4.4\u4ecb\u7ecd\u4e86shared &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/wukan.me\/?p=196\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;OSC Main Memory Notes&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,5],"tags":[83,86,87],"class_list":["post-196","post","type-post","status-publish","format-standard","hentry","category-3","category-5","tag-notes","tag-operating-system-concepts","tag-os"],"_links":{"self":[{"href":"https:\/\/wukan.me\/index.php?rest_route=\/wp\/v2\/posts\/196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wukan.me\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wukan.me\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wukan.me\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wukan.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=196"}],"version-history":[{"count":0,"href":"https:\/\/wukan.me\/index.php?rest_route=\/wp\/v2\/posts\/196\/revisions"}],"wp:attachment":[{"href":"https:\/\/wukan.me\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wukan.me\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wukan.me\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}