{"id":130,"date":"2007-04-08T02:50:45","date_gmt":"2007-04-08T06:50:45","guid":{"rendered":"http:\/\/www.cchsu.com\/arthur\/2007\/04\/08\/130\/"},"modified":"2007-04-08T02:54:32","modified_gmt":"2007-04-08T06:54:32","slug":"%e8%a8%98%e6%86%b6%e9%ab%94%e7%94%a8%e9%87%8f%e7%9a%84%e8%bf%b7%e6%80%9d","status":"publish","type":"post","link":"http:\/\/www.cchsu.com\/arthur\/2007\/04\/08\/130\/","title":{"rendered":"\u8a18\u61b6\u9ad4\u7528\u91cf\u7684\u8ff7\u601d"},"content":{"rendered":"<p>\u5728 Windows \u4e2d\uff0c\u82e5\u6309 Ctrl-Alt-Del\uff0c\u53ef\u53eb\u51fa\u5de5\u4f5c\u7ba1\u7406\u54e1 (task manager)\uff0c\u5b83\u53ef\u4ee5\u7528\u4f86\u770b\u8a18\u61b6\u9ad4\u7528\u91cf (\u6aa2\u8996\u2192\u9078\u64c7\u6b04\u4f4d)\uff0c\u4e0d\u904e\u9019\u529f\u80fd\u5012\u662f\u9020\u6210\u6211\u4e0d\u5c11\u56f0\u64fe\u5c31\u662f\u4e86\u3002\u70ba\u4ec0\u9ebc\u5462\uff1f\u56e0\u70ba\u5b83\u7d66\u7684\u8cc7\u8a0a\u80cc\u5f8c\u6709\u500b\u5f88\u9577\u7684\u6545\u4e8b\uff0c\u7136\u5f8c\u82e5\u662f\u9047\u5230\u90a3\u7a2e\u534a\u74f6\u918b\u7684\u8001\u95c6\u6216 reviewer \u62ff\u9019\u500b\u6578\u5b57\u4f86\u505a\u6587\u7ae0\u7684\u6642\u5019\uff0c\u5c31\u5be6\u5728\u662f\u5f88\u5708\u53c9 &#8230;<\/p>\n<p>\u5de5\u4f5c\u7ba1\u7406\u54e1\u4e2d\u7684\u8a18\u61b6\u9ad4\u7528\u91cf\uff0c\u8f03\u7cbe\u78ba\u7684\u540d\u7a31\u662f working set size\uff0cworking set \u662f Windows Virtual Memory Manager (\u4ee5\u4e0b\u7c21\u7a31 VMM) \u66ff\u9019\u500b process \u6240 allocate \u7684 physical memory\u3002(\u6240\u4ee5\u770b\u66f8\u53ea\u770b\u5230\u9019\u88e1\u7684\u4eba\uff0c\u5c31\u6703\u632f\u632f\u6709\u8a5e\u5730\u8aaa\u4f60\u7684\u7a0b\u5f0f\u5f88\u80a5\u8981\u600e\u6a23\u600e\u6a23 &#8230;) Working set \u53c8\u53ef\u5206\u6210\u5169\u90e8\u4efd\uff0c\u4e00\u90e8\u4efd\u662f private working set\uff0c\u53e6\u4e00\u90e8\u4efd\u5247\u662f shared working set\uff0c\u9867\u540d\u601d\u7fa9 private \u5c31\u662f\u53ea\u4f9b\u6b64 process \u6240\u4f7f\u7528\uff0c\u800c shared \u5247\u662f\u7531\u6240\u6709 process \u5171\u7528\u3002(\u984c\u5916\u8a71\uff1a\u56e0\u6b64 .Net \u6216 Java \u7a0b\u5f0f\u5149\u770b working set size \u4e00\u5b9a\u5f88\u80a5\uff0c\u56e0\u70ba\u5b83\u5011\u6709\u4e00\u5927\u584a shared working set) \u6240\u4ee5\u8981\u770b\u4e00\u500b\u7a0b\u5f0f\u7684\u8a18\u61b6\u9ad4\u7528\u91cf\uff0c\u61c9\u8a72\u8981\u770b\u5b83\u7684 private working set\uff0c\u9019\u53ef\u4ee5\u7528 <a href=\"http:\/\/www.microsoft.com\/technet\/sysinternals\/utilities\/ProcessExplorer.mspx\">Process Explorer<\/a> \u4f86\u89c0\u5bdf\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u5c31\u7b97\u662f Private working set \u9019\u500b\u6578\u5b57\uff0c\u4e5f\u662f\u6703\u9a19\u4eba\u7684\u3002\u4f60\u53ef\u4ee5\u7528 <a href=\"http:\/\/msdn2.microsoft.com\/en-us\/library\/ms686234.aspx\">SetProcessWorkingSetSize<\/a>\uff0c\u628a minimum \u548c maximum size \u90fd\u8a2d\u6210 -1\uff0c\u5982\u6b64\u4e00\u4f86 Windows VMM \u6703\u5c07\u6240\u6709 pagable \u7684 page \u5168\u90e8\u6254\u56de\u786c\u789f\u53bb\uff0c\u81ea\u7136\u8a18\u61b6\u9ad4\u7528\u91cf\u5c31\u6703\u8b8a\u5f88\u5c0f\u3002\u5e38\u898b\u7684\u8ff7\u601d\u662f\u300c\u8a18\u61b6\u9ad4\u7528\u91cf\u5c0f = \u7a0b\u5f0f\u5feb = \u6548\u7387\u9ad8\u300d\uff0c\u9019\u4e0d\u4e00\u5b9a\u662f\u5c0d\u7684\uff0c\u8dd1\u7684\u5feb\u7684\u7a0b\u5f0f\u8981\u52aa\u529b\u6e1b\u5c11 page fault\uff0c\u800c\u4e0d\u662f\u4e00\u5473\u8ffd\u6c42\u8a18\u61b6\u9ad4\u7528\u91cf\u5c0f\u3002\u57fa\u672c\u4e0a Windows VMM \u6548\u7387\u9084\u883b\u597d\u7684\uff0c\u800c\u4e14\u82e5\u4f60\u8a18\u61b6\u9ad4\u5920\u5927\u7684\u8a71\uff0c\u5b83\u53cd\u800c\u6703\u5148\u628a\u4e00\u4e9b\u8a18\u61b6\u9ad4\u8981\u4f86\u4ee5\u6e1b\u5c11 page fault (\u6240\u4ee5\u90a3\u5806\u7528 2G RAM \u6e2c Vista \u7136\u5f8c\u72c2\u53eb\u8aaa\u6bcf\u500b process \u90fd\u5f88\u80a5\u7684\uff0c\u7576\u7b11\u8a71\u770b\u770b\u5c31\u597d)\u3002\u82e5\u4f60\u7528\u4e86 SetProcessWorkingSetSize\uff0c\u4f46\u4f60\u7684\u7a0b\u5f0f\u53c8\u4e0d\u5c0f\u5fc3\u8981\u7528\u5230\u5df2\u7d93\u88ab swap \u5230\u786c\u789f\u4e0a\u7684 page \u6642\u8981\u600e\u9ebc\u8fa6\u54a7\uff1f\u90a3\u5c31 page fault \u54a9 &#8230; \u672c\u4f86\u53ef\u4ee5\u597d\u597d\u8dd1\u7684\u6771\u897f\u83ab\u540d\u5176\u5999 swap out \u53c8 swap in\uff0c\u9019\u6a23\u6703\u5feb\u5c31\u6709\u9b3c\u4e86\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u8a18\u61b6\u9ad4\u7528\u91cf\u662f\u500b\u4e0d\u932f\u7684\u53c3\u8003\uff0c\u4f46\u5b83\u548c\u4f60\u7684\u7a0b\u5f0f\u57f7\u884c\u6548\u7387\u4e26\u6c92\u6709\u7d55\u5c0d\u7684\u95dc\u4fc2\u3002\u771f\u6b63\u6709\u5f71\u97ff\u7684\uff0c\u4e00\u662f page fault\uff0c\u53e6\u5916\u4e00\u500b\u5247\u662f memory leak\u3002\u6211\u5011\u5beb\u6771\u897f\u8981\u770b\u8a18\u61b6\u9ad4\u7528\u91cf\uff0c\u4e3b\u8981\u662f\u7528\u4f86\u89c0\u5bdf private working set size \u6709\u6c92\u6709\u6301\u7e8c\u589e\u52a0\u7684\u73fe\u8c61\uff0c\u5b83\u662f\u91cd\u8981\u7684 memory leak \u6307\u6a19\u3002\u81f3\u65bc\u7a0b\u5f0f\u8dd1\u7684\u5feb\u4e0d\u5feb\uff0c\u90a3\u5fc5\u9808\u7531\u5176\u4ed6\u7684\u5404\u7a2e\u56e0\u5b50\u4f86\u5206\u6790\uff0cpage fault \u4e5f\u53ea\u662f\u5176\u4e2d\u4e00\u500b\u800c\u5df2\u3002<\/p>\n<p>\u597d\u5427\uff0c\u6211\u627f\u8a8d\uff0c\u6211\u4e5f\u6709\u7528 SetProcessWorkingSetSize\uff0c\u56e0\u70ba\u6211\u505a\u7684\u6771\u897f\u5728 service context \u88e1\uff0c\u5e73\u5e38\u61c9\u8a72\u4e0d\u592a\u6703\u7528\u5230\u3002<br \/>\n&lt;\u8b0e\u4e4b\u8072&gt;<br \/>\n&nbsp;&nbsp;\u9084\u6709\u4e00\u500b\u539f\u56e0\u662f\u56e0\u70ba\u67d0\u4eba\u61f6\u5f97\u7528\u82f1\u6587\u548c\u90a3\u4e9b\u8336\u5305\u89e3\u91cb\u592a\u591a &#8230; \u5653 &#8230;<br \/>\n&lt;\/\u8b0e\u4e4b\u8072&gt;<\/p>\n<p>PS. Windows \u81ea\u5df1\u4e5f\u6703\u5e79\u9019\u7a2e\u4e8b\uff0c\u82e5\u4f60\u7684\u7a0b\u5f0f\u6709 window\uff0c\u7576\u90a3\u500b window \u88ab minimize \u7684\u6642\u5019\uff0cSetProcessWorkingSetSize \u6703\u81ea\u52d5\u88ab\u547c\u53eb\u3002\u6240\u4ee5\u4f60\u7684\u7cfb\u7d71\u525b\u958b\u6a5f\u8dd1\u7684\u5f88\u6162\u7684\u6642\u5019\uff0c\u4e0d\u8981\u6025\u8457\u628a\u6240\u6709\u8996\u7a97\u6700\u5c0f\u5316\uff0c\u90a3\u53ea\u6703\u62d6\u6162\u4f60\u7684\u7cfb\u7d71\u7f77\u4e86 &#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 Windows \u4e2d\uff0c\u82e5\u6309 Ctrl-Alt-Del\uff0c\u53ef\u53eb\u51fa\u5de5\u4f5c\u7ba1\u7406\u54e1 (task manager)\uff0c\u5b83\u53ef\u4ee5\u7528\u4f86\u770b\u8a18\u61b6\u9ad4\u7528\u91cf (\u6aa2\u8996\u2192\u9078\u64c7\u6b04\u4f4d)\uff0c\u4e0d\u904e\u9019\u529f\u80fd\u5012\u662f\u9020\u6210\u6211\u4e0d\u5c11\u56f0\u64fe\u5c31\u662f\u4e86\u3002\u70ba\u4ec0\u9ebc\u5462\uff1f\u56e0\u70ba\u5b83\u7d66\u7684\u8cc7\u8a0a\u80cc\u5f8c\u6709\u500b\u5f88\u9577\u7684\u6545\u4e8b\uff0c\u7136\u5f8c\u82e5\u662f\u9047\u5230\u90a3\u7a2e\u534a\u74f6\u918b\u7684\u8001\u95c6\u6216 reviewer \u62ff\u9019\u500b\u6578\u5b57\u4f86\u505a\u6587\u7ae0\u7684\u6642\u5019\uff0c\u5c31\u5be6\u5728\u662f\u5f88\u5708\u53c9 &#8230; \u5de5\u4f5c\u7ba1\u7406\u54e1\u4e2d\u7684\u8a18\u61b6\u9ad4\u7528\u91cf\uff0c\u8f03\u7cbe\u78ba\u7684\u540d\u7a31\u662f working set size\uff0cworking set \u662f Windows Virtual Memory Manager (\u4ee5\u4e0b\u7c21\u7a31 VMM) \u66ff\u9019\u500b process \u6240 allocate \u7684 physical memory\u3002(\u6240\u4ee5\u770b\u66f8\u53ea\u770b\u5230\u9019\u88e1\u7684\u4eba\uff0c\u5c31\u6703\u632f\u632f\u6709\u8a5e\u5730\u8aaa\u4f60\u7684\u7a0b\u5f0f\u5f88\u80a5\u8981\u600e\u6a23\u600e\u6a23 &#8230;) Working set \u53c8\u53ef\u5206\u6210\u5169\u90e8\u4efd\uff0c\u4e00\u90e8\u4efd\u662f private working set\uff0c\u53e6\u4e00\u90e8\u4efd\u5247\u662f shared working set\uff0c\u9867\u540d\u601d\u7fa9 private \u5c31\u662f\u53ea\u4f9b\u6b64 process \u6240\u4f7f\u7528\uff0c\u800c shared \u5247\u662f\u7531\u6240\u6709 process \u5171\u7528\u3002(\u984c\u5916\u8a71\uff1a\u56e0\u6b64 .Net \u6216 Java \u7a0b\u5f0f\u5149\u770b working set size \u4e00\u5b9a\u5f88\u80a5\uff0c\u56e0\u70ba\u5b83\u5011\u6709\u4e00\u5927\u584a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,2],"tags":[],"_links":{"self":[{"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/130"}],"collection":[{"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/comments?post=130"}],"version-history":[{"count":0,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/130\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/media?parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/categories?post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/tags?post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}