{"id":204611,"date":"2025-05-29T13:07:19","date_gmt":"2025-05-29T05:07:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/204611\/"},"modified":"2025-05-29T13:07:19","modified_gmt":"2025-05-29T05:07:19","slug":"%e8%bf%9b%e7%a8%8b%e4%b8%8e%e7%ba%bf%e7%a8%8b%e5%88%9b%e5%bb%ba%e9%80%9f%e5%ba%a6%e5%b7%ae%e5%bc%82%ef%bc%9a%e4%b8%ba%e4%bb%80%e4%b9%88%e5%88%9b%e5%bb%ba%e8%bf%9b%e7%a8%8b%e6%9b%b4%e5%bf%ab%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/204611\/","title":{"rendered":"\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b\u521b\u5efa\u901f\u5ea6\u5dee\u5f02\uff1a\u4e3a\u4ec0\u4e48\u521b\u5efa\u8fdb\u7a0b\u66f4\u5feb\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b\u521b\u5efa\u901f\u5ea6\u5dee\u5f02\uff1a\u4e3a\u4ec0\u4e48\u521b\u5efa\u8fdb\u7a0b\u66f4\u5feb\uff1f<\/h1>\n<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241111\/17313192546731d5d6cec1a.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b\u521b\u5efa\u901f\u5ea6\u5dee\u5f02\u63a2\u7a76<\/strong><\/p>\n<p>\u5bf9\u4e8e\u521b\u5efa\u8fdb\u7a0b\u548c\u7ebf\u7a0b\u7684\u65f6\u95f4\u6548\u7387\u5dee\u5f02\uff0c\u672c\u6587\u5c06\u901a\u8fc7\u7279\u5b9a\u573a\u666f\u8fdb\u884c\u6d4b\u8bd5\u548c\u5206\u6790\u3002<\/p>\n<p>\u4f7f\u7528 multiprocessing \u6a21\u5757\u521b\u5efa\u8fdb\u7a0b\uff0c\u4f7f\u7528 threading \u6a21\u5757\u521b\u5efa\u7ebf\u7a0b\uff0c\u5e76\u5728\u4e0d\u5f00\u542fGIL\u7684\u60c5\u51b5\u4e0b\u8fdb\u884c\u6d4b\u8bd5\u3002\u7ed3\u679c\u663e\u793a\uff0c\u521b\u5efa100,000\u4e2a\u7ebf\u7a0b\u9700\u8981\u82b1\u8d39\u66f4\u957f\u65f6\u95f4\uff0c\u800c\u521b\u5efa\u8fdb\u7a0b\u7684\u901f\u5ea6\u5374\u660e\u663e\u5feb\u4e8e\u7ebf\u7a0b\u3002<\/p>\n<p>\u6839\u636e\u63d0\u4f9b\u7684\u89e3\u7b54\uff0c\u8fd9\u79cd\u5dee\u5f02\u4e0eGIL\u6709\u5173\u3002GIL\uff08\u5168\u5c40\u89e3\u91ca\u5668\u9501\uff09\u662f\u4e00\u79cdPython\u89e3\u91ca\u5668\u4e2d\u7684\u673a\u5236\uff0c\u5b83\u786e\u4fdd\u540c\u4e00\u65f6\u523b\u53ea\u6709\u4e00\u4e2a\u7ebf\u7a0b\u6267\u884cPython\u4ee3\u7801\u3002\u5728IO\u5bc6\u96c6\u578b\u573a\u666f\u4e2d\uff0c\u591a\u7ebf\u7a0b\u53ef\u4ee5\u83b7\u5f97\u8f83\u597d\u7684\u6027\u80fd\uff0c\u800c\u5728CPU\u5bc6\u96c6\u578b\u573a\u666f\u4e2d\uff0cGIL\u4f1a\u9650\u5236\u591a\u7ebf\u7a0b\u7684\u5e76\u884c\u6027\u3002\u56e0\u6b64\uff0c\u5728\u672c\u6587\u7684\u6d4b\u8bd5\u4e2d\uff0c\u521b\u5efa\u8fdb\u7a0b\u6bd4\u521b\u5efa\u7ebf\u7a0b\u66f4\u5feb\u662f\u7531\u4e8e\u6d4b\u8bd5\u4efb\u52a1\u4e3aCPU\u5bc6\u96c6\u578b\u4efb\u52a1\u3002<\/p>\n<p>\u5230\u8fd9\u91cc\uff0c\u6211\u4eec\u4e5f\u5c31\u8bb2\u5b8c\u4e86\u300a\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b\u521b\u5efa\u901f\u5ea6\u5dee\u5f02\uff1a\u4e3a\u4ec0\u4e48\u521b\u5efa\u8fdb\u7a0b\u66f4\u5feb\uff1f\u300b\u7684\u5185\u5bb9\u4e86\u3002\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u57fa\u7840\u77e5\u8bc6\u7684\u5b66\u4e60\u548c\u5de9\u56fa\uff0c\u662f\u4e3a\u4e86\u66f4\u597d\u7684\u5c06\u5176\u8fd0\u7528\u5230\u9879\u76ee\u4e2d\uff0c\u6b22\u8fce\u5173\u6ce8\u516c\u4f17\u53f7\uff0c\u5e26\u4f60\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u77e5\u8bc6\u70b9\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8fdb\u7a0b\u4e0e\u7ebf\u7a0b\u521b\u5efa\u901f\u5ea6\u5dee\u5f02\uff1a\u4e3a\u4ec0\u4e48\u521b&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-204611","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=204611"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/204611\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=204611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=204611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=204611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}