{"id":2969,"date":"2019-11-22T10:25:40","date_gmt":"2019-11-22T02:25:40","guid":{"rendered":"https:\/\/www.aoisnow.net\/blog\/?p=2969"},"modified":"2019-11-22T10:25:40","modified_gmt":"2019-11-22T02:25:40","slug":"tont-38233-%e6%97%b6%e5%b8%b8%e8%a2%ab%e8%af%af%e8%a7%a3%e7%9a%84-3gb-%e9%80%89%e9%a1%b9","status":"publish","type":"post","link":"https:\/\/www.aoisnow.net\/blog\/archives\/2969","title":{"rendered":"TONT 38233 \u65f6\u5e38\u88ab\u8bef\u89e3\u7684 \/3GB \u9009\u9879"},"content":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1a<a href=\"https:\/\/devblogs.microsoft.com\/oldnewthing\/20040805-00\/?p=38233\" target=\"_blank\" rel=\"noopener\">https:\/\/devblogs.microsoft.com\/oldnewthing\/20040805-00\/?p=38233<\/a><\/p>\n<p class=\"\">It\u2019s simple to explain what it does, but people often misunderstand.<\/p>\n<p>\u89e3\u91ca\u8fd9\u4e2a\u9009\u9879\u201c\u662f\u4ec0\u4e48\u201d\u5f88\u5bb9\u6613\uff0c\u4f46\u4eba\u4eec\u53c8\u8bef\u89e3\u5b83\u7684\u542b\u4e49\u3002<\/p>\n<p>The \/3GB switch changes the way the 4GB virtual address space is split up. Instead of splitting it as 2GB of user mode virtual address space and 2GB of kernel mode virtual address space, the split is 3GB of user mode virtual address space and 1GB of kernel mode virtual address space.<\/p>\n<p>\/3GB \u9009\u9879\u4f7f\u5f97 4GB \u865a\u62df\u5730\u5740\u7a7a\u95f4\u7684\u5212\u5206\u65b9\u5f0f\u53d1\u751f\u4e86\u53d8\u5316\u3002\u539f\u6765\u662f\u5212\u5206\u4e3a 2GB \u7684\u7528\u6237\u6a21\u5f0f\u865a\u62df\u5730\u5740\u7a7a\u95f4\u548c 2GB \u7684\u5185\u6838\u6a21\u5f0f\u865a\u62df\u5730\u5740\u7a7a\u95f4\uff0c\u542f\u7528\u540e\u5219\u53d8\u6210\u4e86 3GB \u7528\u6237\u6a21\u5f0f\u865a\u62df\u5730\u5740\u7a7a\u95f4\u548c 1GB \u5185\u6838\u6a21\u5f0f\u865a\u62df\u5730\u5740\u7a7a\u95f4\u3002<\/p>\n<p>That\u2019s all.<\/p>\n<p>\u4ec5\u6b64\u800c\u5df2\u3002<\/p>\n<p>And yet people think it does more than that.<\/p>\n<p>\u7136\u800c\u4eba\u4eec\u5374\u4ecd\u7136\u60f3\u592a\u591a\u3002<\/p>\n<p>I think the problem is that people think that \u201cvirtual address space\u201d means something other than just \u201cvirtual address space\u201d.<\/p>\n<p>\u6211\u8ba4\u4e3a\uff0c\u95ee\u9898\u53ef\u80fd\u51fa\u5728\u4eba\u4eec\u8ba4\u4e3a\u300e\u865a\u62df\u5730\u5740\u7a7a\u95f4\u300f\u8fd9\u4e2a\u8bf4\u6cd5\u6709\u5176\u5b57\u9762\u542b\u4e49\u4e4b\u5916\u7684\u4e1c\u897f\u3002<\/p>\n<p>The term \u201caddress space\u201d refers to how a numerical value (known as an \u201caddress\u201d) is interpreted when it is used to access some type of resource. There is a physical address space; each address in the physical address space refers to a byte in a memory chip somewhere. (Note for pedants: Yes, it\u2019s actually spread out over several memory chips, but that\u2019s not important here.) There is an I\/O address space; each address in the I\/O address space allows the CPU to communicate with a hardware device.<\/p>\n<p>\u672f\u8bed\u300e\u5730\u5740\u7a7a\u95f4\u300f\u6307\u7684\u662f\u5f53\u5b58\u53d6\u67d0\u79cd\u7c7b\u578b\u7684\u8d44\u6e90\u65f6\uff0c\u4e00\u4e2a\u6570\u5b57\u503c\uff08\u5373\u6240\u8c13\u300e\u5730\u5740\u300f\uff09\u662f\u5982\u4f55\u88ab\u5bf9\u5e94\u89e3\u91ca\u7684\u3002\u4e00\u79cd\u5730\u5740\u7a7a\u95f4\u88ab\u79f0\u4f5c\u7269\u7406\u5730\u5740\u7a7a\u95f4\uff0c\u6bcf\u4e2a\u7269\u7406\u5730\u5740\u7a7a\u95f4\u4e2d\u7684\u300e\u5730\u5740\u300f\u90fd\u6307\u5411\u5728\u5185\u5b58\u82af\u7247\u4e2d\u7684\u67d0\u4e2a\u5b57\u8282\u3002\uff08\u81f4\u8bfb\u6b7b\u4e66\u8005\uff1a\u6ca1\u9519\uff0c\u8fd9\u4e2a\u5730\u5740\u7684\u786e\u662f\u56ca\u62ec\u4e86\u591a\u5757\u5185\u5b58\u82af\u7247\u7684\u8303\u56f4\uff0c\u4e0d\u8fc7\u5728\u8fd9\u91cc\u8fd9\u4e0d\u662f\u91cd\u70b9\u3002\uff09\u8fd8\u6709\u4e00\u79cd\u53ebI\/O\u5730\u5740\u7a7a\u95f4\uff0c\u5176\u4e2d\u7684\u5730\u5740\u4f7f\u5f97CPU\u5f97\u4ee5\u4e0e\u67d0\u4e2a\u786c\u4ef6\u8bbe\u5907\u8fdb\u884c\u901a\u8baf\u3002<\/p>\n<p>And then there is the virtual address space. When people say \u201caddress space\u201d, they usually mean \u201cvirtual address space\u201d.<\/p>\n<p>\u518d\u6765\u5c31\u662f\u865a\u62df\u5730\u5740\u7a7a\u95f4\u4e86\u3002\u5f53\u4eba\u4eec\u63d0\u53ca\u300e\u5730\u5740\u7a7a\u95f4\u300f\u65f6\uff0c\u901a\u5e38\u6307\u7684\u5c31\u662f\u300e\u865a\u62df\u5730\u5740\u7a7a\u95f4\u300f\u3002<\/p>\n<p>The virtual address space is the set of possible pointer values (addresses) that can be used at a single moment by the processor. In other words, if you have an address like 0x12345678, the virtual address space determines what you get if you try to access that memory. The contents of the virtual address space changes over time, for example, as you allocate and free memory. It also varies based on context: each process has its own virtual address space.<\/p>\n<p>\u865a\u62df\u5730\u5740\u7a7a\u95f4\u662f\u5728\u67d0\u4e00\u65f6\u523b\u5904\u7406\u5668\u53ef\u4ee5\u4f7f\u7528\u7684\u4e00\u7ec4\u53ef\u80fd\u7684\u6307\u9488\u503c\uff08\u5730\u5740\uff09\u3002\u6362\u53e5\u8bdd\u8bf4\uff0c\u5982\u679c\u4f60\u6709\u4e00\u4e2a\u7c7b\u4f3c0x12345678\u8fd9\u6837\u7684\u5730\u5740\uff0c\u90a3\u4e48\u5982\u679c\u8bd5\u56fe\u8bbf\u95ee\u8fd9\u4e2a\u5730\u5740\u7684\u5185\u5b58\u7684\u8bdd\uff0c\u662f\u7531\u865a\u62df\u5730\u5740\u7a7a\u95f4\u6765\u51b3\u5b9a\u4f60\u83b7\u53d6\u5230\u7684\u5185\u5bb9\u7684\u3002\u865a\u62df\u5730\u5740\u7a7a\u95f4\u7684\u5185\u5bb9\u968f\u65f6\u95f4\u4e0d\u65ad\u53d8\u5316\uff0c\u4f8b\u5982\uff0c\u6bcf\u5f53\u5206\u914d\u548c\u91ca\u653e\u5185\u5b58\u65f6\uff08\u90fd\u4f1a\u53d1\u751f\u53d8\u5316\uff09\u3002\u4f9d\u636e\u573a\u666f\u4e0d\u540c\uff0c\u865a\u62df\u5730\u5740\u7a7a\u95f4\u7684\u6240\u6307\u4e5f\u4f1a\u53d1\u751f\u53d8\u5316\uff0c\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u6709\u5176\u81ea\u5df1\u7684\u865a\u62df\u5730\u5740\u7a7a\u95f4\u3002<\/p>\n<p>Saying that 2GB (or 3GB) of virtual address space is available to user mode means that at any given moment in time, out of the 4 billion virtual addresses available in a 32-bit value, 2 billion (or 3 billion) of them are potentially usable by user-mode code.<\/p>\n<p>\u67092GB\uff08\u62163GB\uff09\u865a\u62df\u5730\u5740\u7a7a\u95f4\u5bf9\u7528\u6237\u6a21\u5f0f\u53ef\u7528\u8fd9\u4e2a\u8bf4\u6cd5\uff0c\u610f\u5473\u7740\u5728\u4efb\u4f55\u7ed9\u5b9a\u7684\u65f6\u523b\uff0c\u572832\u4f4d\u503c\u3001\u517140\u4ebf\u7684\u865a\u62df\u5730\u5740\u4e2d\uff0c\u670920\u4ebf\uff08\u621630\u4ebf\uff09\u7684\u5730\u5740\u5bf9\u7528\u6237\u6a21\u5f0f\u7684\u4ee3\u7801\u662f\u6f5c\u5728\u53ef\u7528\u7684\u3002<\/p>\n<p class=\"\">Over the next few entries, I\u2019ll talk about the various consequences and misinterpretations of the \/3GB switch.<\/p>\n<p>\u5728\u63a5\u4e0b\u6765\u7684\u51e0\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u5c06\u8ba8\u8bba\u6709\u5173\u4eba\u4eec\u5bf9\/3GB\u9009\u9879\u7684\u4e0d\u540c\u62d3\u5c55\u89e3\u91ca\uff0c\u4ee5\u53ca\u7531\u6b64\u5f15\u53d1\u7684\u8bef\u89e3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u94fe\u63a5\uff1ahttps:\/\/devblogs.microsoft.com\/oldnewthing\/2004080 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-2969","post","type-post","status-publish","format-standard","hentry","category-tont_history"],"_links":{"self":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts\/2969","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/comments?post=2969"}],"version-history":[{"count":0,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/posts\/2969\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/media?parent=2969"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/categories?post=2969"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aoisnow.net\/blog\/wp-json\/wp\/v2\/tags?post=2969"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}