{"id":20494,"date":"2026-04-09T21:20:15","date_gmt":"2026-04-09T13:20:15","guid":{"rendered":"https:\/\/92it.top\/?p=20494"},"modified":"2026-04-09T21:20:15","modified_gmt":"2026-04-09T13:20:15","slug":"%e7%bc%96%e7%a8%8b%e8%af%ad%e8%a8%80%e7%9a%84%e5%bc%82%e6%ad%a5%e5%9c%a8%e8%ae%a1%e7%ae%97%e6%9c%ba%e4%b8%ad%e6%98%af%e5%a6%82%e4%bd%95%e5%ae%9e%e7%8e%b0%e7%9a%84%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=20494","title":{"rendered":"\u7f16\u7a0b\u8bed\u8a00\u7684\u5f02\u6b65\u5728\u8ba1\u7b97\u673a\u4e2d\u662f\u5982\u4f55\u5b9e\u73b0\u7684\uff1f"},"content":{"rendered":"\n<p><strong>\u524d\u8a00\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5f02\u6b65\uff08Async\uff09\u5728\u8ba1\u7b97\u673a\u5e95\u5c42\u5230\u5e95\u662f\u600e\u4e48\u5b9e\u73b0\u7684\uff1f<\/p>\n\n\n\n<p>\u5206 4 \u5c42\u8bb2\uff0c<strong>\u4ece\u786c\u4ef6 \u2192 \u64cd\u4f5c\u7cfb\u7edf \u2192 \u8bed\u8a00 \u2192 \u4ee3\u7801<\/strong>\uff0c\u4f60\u770b\u5b8c\u5c31\u5f7b\u5e95\u61c2\u4e86\u3002<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u6838\u5fc3\u771f\u7406<\/strong>\uff1a<strong>\u5f02\u6b65 = \u4e0d\u963b\u585e\u3001\u4e0d\u7b49\u5f85\u3001\u4e0d\u5360\u7ebf\u7a0b\u3001\u9760 \u201c\u901a\u77e5\u201d \u5b8c\u6210\u3002<\/strong><\/p>\n\n\n\n<ul>\n<li>\u540c\u6b65\uff1a\u6211\u505a\u5b8c\uff0c\u4f60\u624d\u80fd\u505a\u3002<\/li>\n\n\n\n<li>\u5f02\u6b65\uff1a\u6211\u53bb\u5fd9\uff0c\u4f60\u522b\u7b49\uff0c\u505a\u5b8c\u6211\u901a\u77e5\u4f60\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u5e95\u5c42\u7b2c\u4e00\u539f\u7406\uff1aCPU \u4e0d\u80fd\u540c\u65f6\u5e72\u4e24\u4ef6\u4e8b<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u5355\u6838 CPU \u540c\u4e00\u65f6\u523b\u53ea\u80fd\u6267\u884c\u4e00\u6761\u6307\u4ee4\u3002<br>\u90a3\u4e3a\u4ec0\u4e48\u5f02\u6b65\u80fd \u201c\u540c\u65f6\u201d \u505a\u5f88\u591a\u4e8b\uff1f<br>\u56e0\u4e3a\uff1a\u5f02\u6b65\u4e0d\u662f \u201c\u540c\u65f6\u6267\u884c\u201d\uff0c\u800c\u662f \u201c\u5feb\u901f\u5207\u6362\u6267\u884c\u201d\uff01<br>\u8fd9\u53eb \u5e76\u53d1\uff08Concurrency\uff09\u3002<br><\/pre>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u64cd\u4f5c\u7cfb\u7edf\u5e95\u5c42\uff1a\u5f02\u6b65\u9760 3 \u4e2a\u4e1c\u897f\u5b9e\u73b0\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>1. <strong>\u4e2d\u65ad\uff08Interrupt\uff09\u2014\u2014 \u5f02\u6b65\u7684\u786c\u4ef6\u57fa\u7840<\/strong><\/p>\n\n\n\n<p>\u952e\u76d8\u3001\u7f51\u5361\u3001\u786c\u76d8\u3001\u9f20\u6807\uff0c<strong>\u5168\u662f\u5f02\u6b65\u5de5\u4f5c<\/strong>\u3002<\/p>\n\n\n\n<p><strong>\u6240\u6709\u5f02\u6b65\uff0c\u6700\u65e9\u6765\u6e90\u90fd\u662f\u786c\u4ef6\u4e2d\u65ad\u3002<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u4f8b\u5b50\uff1a<br>\u4f60\u8bfb\u53d6\u786c\u76d8\u6587\u4ef6\uff1a<br>CPU \u53d1\u6307\u4ee4\uff1a\u8bfb\u786c\u76d8<br>CPU \u4e0d\u7b49\uff01\u76f4\u63a5\u53bb\u5e72\u522b\u7684<br>\u786c\u76d8\u8bfb\u5b8c \u2192 \u53d1 \u786c\u4ef6\u4e2d\u65ad<br>CPU \u505c\u4e0b\u624b\u91cc\u4e8b \u2192 \u5904\u7406\u6570\u636e<br>\u8fd9\u5c31\u662f\u6700\u539f\u59cb\u7684\u5f02\u6b65\u3002<\/pre>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>2. <strong>\u975e\u963b\u585e I\/O\uff08Non-blocking I\/O\uff09<\/strong><\/p>\n\n\n\n<p><strong>\u6240\u6709\u5f02\u6b65 99% \u90fd\u662f\u4e3a\u4e86\u89e3\u51b3 I\/O \u7b49\u5f85\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li>\u8bfb\u6587\u4ef6<\/li>\n\n\n\n<li>\u53d1\u7f51\u7edc\u8bf7\u6c42\uff08AJAX\uff09<\/li>\n\n\n\n<li>\u8bfb\u6570\u636e\u5e93<\/li>\n\n\n\n<li>\u8c03\u7528\u63a5\u53e3<\/li>\n<\/ul>\n\n\n\n<p>\u6240\u6709\u5f02\u6b65\u7684\u672c\u8d28\u90fd\u662f\uff1a<\/p>\n\n\n\n<p><strong>I\/O \u64cd\u4f5c\u4e0d\u963b\u585e\u7ebf\u7a0b\uff0cCPU \u76f4\u63a5\u79bb\u5f00\u3002<\/strong><\/p>\n\n\n\n<p>\u540c\u6b65\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u8bfb\u6587\u4ef6 \u2192 \u7b49\u5f85 \u2192 \u8bfb\u5b8c \u2192 \u7ee7\u7eed\n\nCPU \u8bf4\uff1a\u8bfb\u786c\u76d8\uff01\nCPU \u539f\u5730\u6b7b\u7b49 \u2192 \u5565\u4e5f\u4e0d\u5e72\n\u786c\u76d8\u8bfb\u5b8c \u2192 CPU \u7ee7\u7eed\n<\/pre>\n\n\n\n<p>\u5f02\u6b65\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u8bfb\u6587\u4ef6 \u2192 \u7acb\u523b\u8fd4\u56de \u2192 CPU \u53bb\u505a\u522b\u7684 \u2192 \u8bfb\u5b8c\u901a\u77e5 \u2192 \u56de\u6765\u5904\u7406\n\nCPU \u8bf4\uff1a\u8bfb\u786c\u76d8\uff01\nCPU \u7acb\u523b\u8d70\u4e86 \u2192 \u53bb\u5e72\u522b\u7684\n\u786c\u76d8\u8bfb\u5b8c \u2192 \u53d1\u4e2d\u65ad\u901a\u77e5 OS\nOS \u544a\u8bc9\u7a0b\u5e8f\uff1a\u597d\u4e86\uff01\n<\/pre>\n\n\n\n<p>\u8fd9\u5c31\u662f\u5f02\u6b65\u7684\u672c\u8d28\uff1a<\/p>\n\n\n\n<p>CPU \u7edd\u5bf9\u4e0d\u7b49\u5f85\u6162\u901f\u8bbe\u5907\uff08\u786c\u76d8 \/ \u7f51\u7edc\uff09\uff0c\u8bbe\u5907\u5b8c\u6210\u540e\u4e3b\u52a8\u901a\u77e5\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>3. <strong>\u4e8b\u4ef6\u5faa\u73af\uff08Event Loop\uff09\u2014\u2014 \u5f02\u6b65\u7684\u5927\u8111<\/strong><\/p>\n\n\n\n<p>\u64cd\u4f5c\u7cfb\u7edf\u4f1a\u7ef4\u62a4\u4e00\u4e2a<strong>\u961f\u5217<\/strong>\uff1a<\/p>\n\n\n\n<ul>\n<li>\u952e\u76d8\u6309\u4e0b \u2192 \u8fdb\u961f\u5217<\/li>\n\n\n\n<li>\u7f51\u7edc\u6570\u636e\u56de\u6765 \u2192 \u8fdb\u961f\u5217<\/li>\n\n\n\n<li>\u5b9a\u65f6\u5668\u5230\u65f6\u95f4 \u2192 \u8fdb\u961f\u5217<\/li>\n\n\n\n<li>\u6587\u4ef6\u8bfb\u5b8c \u2192 \u8fdb\u961f\u5217<\/li>\n<\/ul>\n\n\n\n<p>CPU \u4e0d\u65ad\u5faa\u73af\uff1a\u961f\u5217\u6709\u4efb\u52a1\u5c31\u6267\u884c\uff0c\u6ca1\u6709\u5c31\u4f11\u606f\u3002<\/p>\n\n\n\n<p>\u8fd9\u53eb <strong>Event Loop\uff08\u4e8b\u4ef6\u5faa\u73af\uff09<\/strong><\/p>\n\n\n\n<p>Node.js\u3001\u6d4f\u89c8\u5668\u3001JavaScript\u3001Python asyncio\u3001ServiceNow \u5ba2\u6237\u7aef\u811a\u672c<\/p>\n\n\n\n<p><strong>\u5168\u90e8\u9760 Event Loop \u5b9e\u73b0\u5f02\u6b65\u3002<\/strong><\/p>\n\n\n\n<p>\u5b83\u7684\u5de5\u4f5c\u8d85\u7ea7\u7b80\u5355\uff1a<\/p>\n\n\n\n<p><strong>Event Loop \u65e0\u9650\u5faa\u73af\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">1.\u770b\u6709\u6ca1\u6709\u4efb\u52a1\u8981\u6267\u884c\n\u67092.\u5c31\u6267\u884c\n3.\u6ca1\u6709\u5c31\u4f11\u7720 CPU\uff08\u6781\u4f4e\u529f\u8017\uff09\n4.\u5916\u90e8\u4e8b\u4ef6\u6765\u4e86\uff08\u7f51\u7edc\u3001\u786c\u76d8\u3001\u5b9a\u65f6\u5668\uff09\u2192 \u5524\u9192\n5.\u6267\u884c\u56de\u8c03<\/pre>\n\n\n\n<p><strong>\u8fd9\u5c31\u662f\u5f02\u6b65\u7684\u5168\u90e8\u771f\u76f8\uff01<\/strong><\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39<\/strong>4. <strong>\u7f16\u7a0b\u8bed\u8a00\uff1a\u56de\u8c03\u51fd\u6570\uff08Callback\uff09<\/strong><\/p>\n\n\n\n<p>\u8bed\u8a00\u53ea\u662f\u628a\u64cd\u4f5c\u7cfb\u7edf\u7684\u5f02\u6b65<strong>\u5305\u88c5\u6210\u51fd\u6570<\/strong>\u3002<\/p>\n\n\n\n<p>\u4f60\u544a\u8bc9\u7cfb\u7edf\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u7b49\u8fd9\u4ef6\u4e8b\u505a\u5b8c\uff0c\u5e2e\u6211\u8c03\u7528\u8fd9\u4e2a\u51fd\u6570\u3002<\/pre>\n\n\n\n<p>\u8fd9\u4e2a\u51fd\u6570\u5c31\u662f <strong>callback<\/strong>\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u603b\u7ed3\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5f02\u6b65\u5728\u8ba1\u7b97\u673a\u5e95\u5c42\u7684\u5b9e\u73b0\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>\u786c\u4ef6\u4e2d\u65ad<\/strong> \u2192 \u8bbe\u5907\u4e3b\u52a8\u901a\u77e5 CPU\uff0c\u4e0d\u8f6e\u8be2\u3001\u4e0d\u7b49\u5f85<\/li>\n\n\n\n<li><strong>\u975e\u963b\u585e I\/O<\/strong> \u2192 CPU \u4e0d\u5361\u7b49\u6162\u901f\u8bbe\u5907\uff0c\u76f4\u63a5\u79bb\u5f00<\/li>\n\n\n\n<li><strong><strong>\u4e8b\u4ef6\u961f\u5217 + \u4e8b\u4ef6\u5faa\u73af<\/strong>\uff08Event Loop\uff09<\/strong> \u2192 \u7ba1\u7406\u4efb\u52a1\u4e0e\u56de\u8c03<\/li>\n\n\n\n<li><strong>\u56de\u8c03\u51fd\u6570<\/strong> \u2192 \u4e8b\u4ef6\u5b8c\u6210\u540e\u6267\u884c\u7684\u4ee3\u7801<\/li>\n<\/ol>\n\n\n\n<p>\u4e00\u53e5\u8bdd\uff1a<strong><strong>\u5f02\u6b65 = CPU \u4e0d\u7b49\u5f85 I\/O\uff0c\u9760\u4e2d\u65ad + \u901a\u77e5 + \u56de\u8c03\u56de\u6765\u7ee7\u7eed\u6267\u884c\u3002<\/strong><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00\ud83d\udd16 \u5f02\u6b65\uff08Async\uff09\u5728\u8ba1\u7b97\u673a\u5e95\u5c42\u5230\u5e95\u662f\u600e\u4e48\u5b9e\u73b0\u7684\uff1f \u5206 4 \u5c42\u8bb2\uff0c\u4ece\u786c\u4ef6 \u2192 \u64cd\u4f5c\u7cfb\u7edf \u2192 \u8bed\u8a00 \u2192 \u4ee3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/20494"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20494"}],"version-history":[{"count":2,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/20494\/revisions"}],"predecessor-version":[{"id":20496,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/20494\/revisions\/20496"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}