{"id":48954,"date":"2025-07-30T14:14:09","date_gmt":"2025-07-30T06:14:09","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/48954.html"},"modified":"2025-07-30T14:14:09","modified_gmt":"2025-07-30T06:14:09","slug":"gmp%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/48954.html","title":{"rendered":"GMP\u6a21\u578b"},"content":{"rendered":"<p>\u6211\u5c06\u4f1a\u4ece\u4ee5\u4e0b4\u70b9\u5f00\u59cb\u8bb2\u89e3GMP<\/p>\n<p>1\u3001\u4e3a\u4ec0\u4e48\u9700\u8981\u8c03\u5ea6\u5668&#xff1f;<br \/>\n2\u3001Goroutine\u8c03\u5ea6\u5668\u7684GMP\u6a21\u578b\u7684\u8bbe\u8ba1\u601d\u60f3<br \/>\n3\u3001\u8c03\u5ea6\u5668\u7684\u8bbe\u8ba1\u7b56\u7565<br \/>\n4\u3001Go\u8c03\u5ea6\u5668\u8c03\u5ea6\u573a\u666f\u8fc7\u7a0b\u5168\u89e3\u6790<\/p>\n<p>\u4ece\u8fd9\u56db\u70b9\u5f00\u59cb\u8bb2\u7684\u539f\u56e0\u662f&#xff0c;\u4ed6\u4eec\u5206\u522b\u5bf9\u5e94&#xff1a;<br \/>\n\u57fa\u7840\u5fc5\u8981\u6027\u3001\u00a0\u6838\u5fc3\u8bbe\u8ba1\u3001\u8fd0\u4f5c\u673a\u5236\u3001\u5b9e\u6218\u89e3\u6790<\/p>\n<h2 style=\"background-color:transparent\">\u4e00\u3001\u4e3a\u4ec0\u4e48\u9700\u8981\u8c03\u5ea6\u5668&#xff1f;<\/h2>\n<p>\u65e9\u671f\u7684\u5355\u8fdb\u7a0b\u64cd\u4f5c\u7cfb\u7edf&#xff0c;\u9762\u4e34 2 \u4e2a\u95ee\u9898&#xff1a;<\/p>\n<p>1\u3001\u5355\u4e00\u7684\u6267\u884c\u6d41\u7a0b&#xff0c;\u8ba1\u7b97\u673a\u53ea\u80fd\u4e00\u4e2a\u4efb\u52a1\u4e00\u4e2a\u4efb\u52a1\u5904\u7406\u3002<\/p>\n<p>2\u3001\u8fdb\u7a0b\u963b\u585e\u6240\u5e26\u6765\u7684 CPU \u65f6\u95f4\u6d6a\u8d39\u3002<\/p>\n<p>\u90a3\u4e48\u80fd\u4e0d\u80fd\u6709\u591a\u4e2a\u8fdb\u7a0b\u6765\u5b8f\u89c2\u4e00\u8d77\u6765\u6267\u884c\u591a\u4e2a\u4efb\u52a1\u5462&#xff1f; \u540e\u6765\u64cd\u4f5c\u7cfb\u7edf\u5c31\u5177\u6709\u4e86\u6700\u65e9\u7684\u5e76\u53d1\u80fd\u529b&#xff1a; \u591a\u8fdb\u7a0b\u5e76\u53d1&#xff0c;\u5f53\u4e00\u4e2a\u8fdb\u7a0b\u963b\u585e\u7684\u65f6\u5019&#xff0c;\u5207\u6362\u5230\u53e6\u5916\u7b49\u5f85\u6267\u884c\u7684\u8fdb\u7a0b&#xff0c;\u8fd9\u6837\u5c31\u80fd\u5c3d\u91cf\u628a CPU \u5229\u7528\u8d77\u6765&#xff0c;CPU \u5c31\u4e0d\u6d6a\u8d39\u4e86\u3002<\/p>\n<p>\u5982\u4e0b&#xff1a;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"356\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061357-6889b82503dcd.png\" width=\"450\" \/><\/p>\n<p>\u56e0\u4e3a\u4e00\u4e2a\u8fdb\u7a0b\u963b\u585e cpu \u53ef\u4ee5\u7acb\u523b\u5207\u6362\u5230\u5176\u4ed6\u8fdb\u7a0b\u4e2d\u53bb\u6267\u884c&#xff0c;\u800c\u4e14\u8c03\u5ea6 cpu \u7684\u7b97\u6cd5\u53ef\u4ee5\u4fdd\u8bc1\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u90fd\u53ef\u4ee5\u88ab\u5206\u914d\u5230 cpu \u7684\u8fd0\u884c\u65f6\u95f4\u7247\u3002\u8fd9\u6837\u4ece\u5b8f\u89c2\u6765\u770b&#xff0c;\u4f3c\u4e4e\u591a\u4e2a\u8fdb\u7a0b\u662f\u5728\u540c\u65f6\u88ab\u8fd0\u884c\u3002<\/p>\n<h3>\u65b0\u7684\u95ee\u9898&#xff1a;<\/h3>\n<p>\u8fdb\u7a0b\u7684\u521b\u5efa\u3001\u5207\u6362\u3001\u9500\u6bc1&#xff0c;\u90fd\u4f1a\u5360\u7528\u5f88\u957f\u7684\u65f6\u95f4&#xff0c;CPU \u867d\u7136\u5229\u7528\u8d77\u6765\u4e86&#xff0c;\u4f46\u5982\u679c\u8fdb\u7a0b\u8fc7\u591a&#xff0c;CPU \u6709\u5f88\u5927\u7684\u4e00\u90e8\u5206\u90fd\u88ab\u7528\u6765\u8fdb\u884c\u8fdb\u7a0b\u8c03\u5ea6\u4e86\u3002<\/p>\n<p>\u591a\u8fdb\u7a0b\u3001\u591a\u7ebf\u7a0b\u786e\u5b9e\u80fd\u63d0\u9ad8\u4e86\u7cfb\u7edf\u7684 \u5e76\u53d1\u80fd\u529b&#xff0c;\u4f46\u662f\u5728\u5f53\u4eca\u4e92\u8054\u7f51\u9ad8\u5e76 \u53d1\u573a\u666f\u4e0b&#xff0c;\u4e3a\u6bcf\u4e2a\u4efb\u52a1\u90fd\u521b\u5efa\u4e00\u4e2a \u7ebf\u7a0b\u662f\u4e0d\u73b0\u5b9e\u7684&#xff0c;\u56e0\u4e3a\u4f1a\u6d88\u8017\u5927\u91cf \u7684\u5185\u5b58<br \/>\n(\u8fdb\u7a0b\u865a\u62df\u5185\u5b58\u4f1a\u5360\u7528 4GB [32 \u4f4d\u64cd\u4f5c\u7cfb\u7edf], \u800c\u7ebf\u7a0b\u4e5f\u8981\u5927\u7ea6 4MB)\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"340\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061357-6889b8252c9c8.png\" width=\"543\" \/><\/p>\n<p>\u5927\u91cf\u7684\u8fdb\u7a0b \/ \u7ebf\u7a0b\u51fa\u73b0\u4e86\u65b0\u7684\u95ee\u9898<\/p>\n<ul>\n<li>\u9ad8\u5185\u5b58\u5360\u7528<\/li>\n<li>\u8c03\u5ea6\u7684\u9ad8\u6d88\u8017 CPU<\/li>\n<\/ul>\n<h3>\u5982\u4f55\u89e3\u51b3&#xff1a;<\/h3>\n<p>\u597d\u4e86&#xff0c;\u7136\u540e\u5de5\u7a0b\u5e08\u4eec\u5c31\u53d1\u73b0&#xff0c;\u5176\u5b9e\u4e00\u4e2a\u7ebf\u7a0b\u5206\u4e3a \u201c\u5185\u6838\u6001 \u201c\u7ebf\u7a0b\u548c\u201d \u7528\u6237\u6001 \u201c\u7ebf\u7a0b\u3002 \u4e00\u4e2a \u201c\u7528\u6237\u6001\u7ebf\u7a0b\u201d \u5fc5\u987b\u8981\u7ed1\u5b9a\u4e00\u4e2a \u201c\u5185\u6838\u6001\u7ebf\u7a0b\u201d&#xff0c;<\/p>\n<p>\u4f46\u662f CPU \u5e76\u4e0d\u77e5\u9053\u6709 \u201c\u7528\u6237\u6001\u7ebf\u7a0b\u201d \u7684\u5b58\u5728&#xff0c;\u5b83\u53ea\u77e5\u9053\u5b83\u8fd0\u884c\u7684\u662f\u4e00\u4e2a \u201c\u5185\u6838\u6001\u7ebf\u7a0b\u201d<br \/>\n(Linux \u7684 PCB \u8fdb\u7a0b\u63a7\u5236\u5757)\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"337\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061357-6889b8255527c.png\" width=\"407\" \/><\/p>\n<p style=\"text-align:center\">\u7ee7\u7eed\u7ec6\u5206\u4e0b\u53bb<\/p>\n<p style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"339\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061357-6889b825cf3af.png\" width=\"392\" \/>\u00a0<\/p>\n<h3>\u534f\u7a0b\u4e0e\u7ebf\u7a0b\u7684\u7ed3\u5408\u65b9\u5f0f&#xff1a;<\/h3>\n<h5>\u4e00\u3001N:1<\/h5>\n<p>N \u4e2a\u534f\u7a0b\u7ed1\u5b9a 1 \u4e2a\u7ebf\u7a0b&#xff0c;\u4f18\u70b9\u5c31\u662f\u534f\u7a0b\u5728\u7528\u6237\u6001\u7ebf\u7a0b\u5373\u5b8c\u6210\u5207\u6362&#xff0c;\u4e0d\u4f1a\u9677\u5165\u5230\u5185\u6838\u6001&#xff0c;\u8fd9\u79cd\u5207\u6362\u975e\u5e38\u7684\u8f7b\u91cf\u5feb\u901f\u3002\u4f46\u4e5f\u6709\u5f88\u5927\u7684\u7f3a\u70b9&#xff0c;1 \u4e2a\u8fdb\u7a0b\u7684\u6240\u6709\u534f\u7a0b\u90fd\u7ed1\u5b9a\u5728 1 \u4e2a\u7ebf\u7a0b\u4e0a<br \/>\n\u7f3a\u70b9&#xff1a;<br \/>\n1\u3001\u67d0\u4e2a\u7a0b\u5e8f\u7528\u4e0d\u4e86\u786c\u4ef6\u7684\u591a\u6838\u52a0\u901f\u80fd\u529b<br \/>\n2\u3001\u4e00\u65e6\u67d0\u534f\u7a0b\u963b\u585e&#xff0c;\u9020\u6210\u7ebf\u7a0b\u963b\u585e&#xff0c;\u672c\u8fdb\u7a0b\u7684\u5176\u4ed6\u534f\u7a0b\u90fd\u65e0\u6cd5\u6267\u884c\u4e86&#xff0c;\u6839\u672c\u5c31\u6ca1\u6709\u5e76\u53d1\u7684\u80fd\u529b<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"383\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061358-6889b82634818.png\" width=\"468\" \/><\/p>\n<h5>\u4e8c\u30011:1\u00a0<\/h5>\n<p>\u4e3a\u4e86\u89e3\u51b3N:1\u7684\u7f3a\u70b9&#xff0c;\u4ece\u800c\u8bbe\u8ba1\u6210\u4e00\u4e2a\u534f\u7a0b\u5bf9\u5e94\u4e00\u4e2a\u7ebf\u7a0b\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"454\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061358-6889b8265d33e.png\" width=\"529\" \/><\/p>\n<h5>\u4e09\u3001N:M<\/h5>\n<p>M \u4e2a\u534f\u7a0b\u7ed1\u5b9a 1 \u4e2a\u7ebf\u7a0b&#xff0c;\u662f N:1 \u548c 1:1 \u7c7b\u578b\u7684\u7ed3\u5408&#xff0c;\u514b\u670d\u4e86\u4ee5\u4e0a 2 \u79cd\u6a21\u578b\u7684\u7f3a\u70b9&#xff0c;\u4f46\u5b9e\u73b0\u8d77\u6765\u6700\u4e3a\u590d\u6742\u3002<br \/>\n\u6ce8\u610f&#xff1a;\u534f\u7a0b\u4e0e\u7ebf\u7a0b\u662f\u6709\u533a\u522b\u7684&#xff0c;\u7ebf\u7a0b\u7531 CPU \u8c03\u5ea6\u662f\u62a2\u5360\u5f0f\u7684&#xff0c;\u534f\u7a0b\u7531\u7528\u6237\u6001\u8c03\u5ea6\u662f\u534f\u4f5c\u5f0f\u7684&#xff0c;\u4e00\u4e2a\u534f\u7a0b\u8ba9\u51fa CPU \u540e&#xff0c;\u624d\u6267\u884c\u4e0b\u4e00\u4e2a\u534f\u7a0b\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"392\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061359-6889b8274e0d0.png\" width=\"466\" \/><\/p>\n<h3>Go \u8bed\u8a00\u7684\u534f\u7a0b goroutine<\/h3>\n<p>Go \u4e3a\u4e86\u63d0\u4f9b\u66f4\u5bb9\u6613\u4f7f\u7528\u7684\u5e76\u53d1\u65b9\u6cd5&#xff0c;\u4f7f\u7528\u4e86 goroutine \u548c channel\u3002<br \/>\ngoroutine \u6765\u81ea\u534f\u7a0b\u7684\u6982\u5ff5&#xff0c;\u8ba9\u4e00\u7ec4\u53ef\u590d\u7528\u7684\u51fd\u6570\u8fd0\u884c\u5728\u4e00\u7ec4\u7ebf\u7a0b\u4e4b\u4e0a&#xff0c;\u5373\u4f7f\u6709\u534f\u7a0b\u963b\u585e&#xff0c;\u8be5\u7ebf\u7a0b\u7684\u5176\u4ed6\u534f\u7a0b\u4e5f\u53ef\u4ee5\u88ab runtime \u8c03\u5ea6&#xff0c;\u8f6c\u79fb\u5230\u5176\u4ed6\u53ef\u8fd0\u884c\u7684\u7ebf\u7a0b\u4e0a\u3002<br \/>\n\u6700\u5173\u952e\u7684\u662f&#xff0c;\u7a0b\u5e8f\u5458\u770b\u4e0d\u5230\u8fd9\u4e9b\u5e95\u5c42\u7684\u7ec6\u8282&#xff0c;\u8fd9\u5c31\u964d\u4f4e\u4e86\u7f16\u7a0b\u7684\u96be\u5ea6&#xff0c;\u63d0\u4f9b\u4e86\u66f4\u5bb9\u6613\u7684\u5e76\u53d1\u3002<br \/>\nGo \u4e2d&#xff0c;\u534f\u7a0b\u88ab\u79f0\u4e3a goroutine&#xff0c;\u5b83\u975e\u5e38\u8f7b\u91cf&#xff0c;\u4e00\u4e2a goroutine \u53ea\u5360\u51e0 KB&#xff0c;\u5e76\u4e14\u8fd9\u51e0 KB \u5c31\u8db3\u591f goroutine \u8fd0\u884c\u5b8c&#xff0c;\u8fd9\u5c31\u80fd\u5728\u6709\u9650\u7684\u5185\u5b58\u7a7a\u95f4\u5185\u652f\u6301\u5927\u91cf goroutine&#xff0c;\u652f\u6301\u4e86\u66f4\u591a\u7684\u5e76\u53d1\u3002\u867d\u7136\u4e00\u4e2a goroutine \u7684\u6808\u53ea\u5360\u51e0 KB&#xff0c;\u4f46\u5b9e\u9645\u662f\u53ef\u4f38\u7f29\u7684&#xff0c;\u5982\u679c\u9700\u8981\u66f4\u591a\u5185\u5bb9&#xff0c;runtime \u4f1a\u81ea\u52a8\u4e3a goroutine \u5206\u914d\u3002<br \/>\nGoroutine \u7279\u70b9&#xff1a;<\/p>\n<ul>\n<li>\u5360\u7528\u5185\u5b58\u66f4\u5c0f&#xff08;\u51e0 kb&#xff09;<\/li>\n<li>\u8c03\u5ea6\u66f4\u7075\u6d3b (runtime \u8c03\u5ea6)<\/li>\n<\/ul>\n<h3>\u8001\u7248\u672cGMP<\/h3>\n<p>Go \u76ee\u524d\u4f7f\u7528\u7684\u8c03\u5ea6\u5668\u662f 2013 \u5e74\u91cd\u65b0\u8bbe\u8ba1\u7684<\/p>\n<p>\u8001\u8c03\u5ea6\u5668\u6709\u51e0\u4e2a\u7f3a\u70b9&#xff1a;<br \/>\n1\u3001\u521b\u5efa\u3001\u9500\u6bc1\u3001\u8c03\u5ea6 G \u90fd\u9700\u8981\u6bcf\u4e2a M \u83b7\u53d6\u9501&#xff0c;\u8fd9\u5c31\u5f62\u6210\u4e86\u6fc0\u70c8\u7684\u9501\u7ade\u4e89\u3002<br \/>\n2\u3001M \u8f6c\u79fb G \u4f1a\u9020\u6210\u5ef6\u8fdf\u548c\u989d\u5916\u7684\u7cfb\u7edf\u8d1f\u8f7d\u3002\u6bd4\u5982\u5f53 G \u4e2d\u5305\u542b\u521b\u5efa\u65b0\u534f\u7a0b\u7684\u65f6\u5019&#xff0c;M \u521b\u5efa\u4e86 G\u2019&#xff0c;\u4e3a\u4e86\u7ee7\u7eed\u6267\u884c G&#xff0c;\u9700\u8981\u628a G\u2019\u4ea4\u7ed9 M\u2019\u6267\u884c&#xff0c;\u4e5f\u9020\u6210\u4e86\u5f88\u5dee\u7684\u5c40\u90e8\u6027&#xff0c;\u56e0\u4e3a G\u2019\u548c G \u662f\u76f8\u5173\u7684&#xff0c;\u6700\u597d\u653e\u5728 M \u4e0a\u6267\u884c&#xff0c;\u800c\u4e0d\u662f\u5176\u4ed6 M\u2019\u3002<br \/>\n3\u3001\u7cfb\u7edf\u8c03\u7528 (CPU \u5728 M \u4e4b\u95f4\u7684\u5207\u6362) \u5bfc\u81f4\u9891\u7e41\u7684\u7ebf\u7a0b\u963b\u585e\u548c\u53d6\u6d88\u963b\u585e\u64cd\u4f5c\u589e\u52a0\u4e86\u7cfb\u7edf\u5f00\u9500\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"342\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061400-6889b8286bc4e.png\" width=\"505\" \/><\/p>\n<h2>\u4e8c\u3001Goroutine\u8c03\u5ea6\u5668\u7684GMP\u6a21\u578b\u7684\u8bbe\u8ba1\u601d\u60f3<\/h2>\n<p>\u9762\u5bf9\u4e4b\u524d\u8c03\u5ea6\u5668\u7684\u95ee\u9898&#xff0c;Go \u8bbe\u8ba1\u4e86\u65b0\u7684\u8c03\u5ea6\u5668\u3002<br \/>\n\u5728\u65b0\u8c03\u5ea6\u5668\u4e2d&#xff0c;\u51fa\u5217 M (thread) \u548c G (goroutine)&#xff0c;\u53c8\u5f15\u8fdb\u4e86 P (Processor)\u3002<br \/>\nProcessor&#xff0c;\u5b83\u5305\u542b\u4e86\u8fd0\u884c goroutine \u7684\u8d44\u6e90&#xff0c;\u5982\u679c\u7ebf\u7a0b\u60f3\u8fd0\u884c goroutine&#xff0c;\u5fc5\u987b\u5148\u83b7\u53d6 P&#xff0c;P \u4e2d\u8fd8\u5305\u542b\u4e86\u53ef\u8fd0\u884c\u7684 G \u961f\u5217\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"356\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061400-6889b8288bd1d.png\" width=\"477\" \/><\/p>\n<p style=\"text-align:center\">GMP\u6a21\u578b\u00a0<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"395\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061401-6889b82962fd9.png\" width=\"515\" \/><\/p>\n<h3>GMP\u6a21\u578b<\/h3>\n<p>&#xff08;\u4e0a\u65b9\u4e3a\u56fe\u793a&#xff09;<\/p>\n<p>\u5728 Go \u4e2d&#xff0c;\u7ebf\u7a0b\u662f\u8fd0\u884c goroutine \u7684\u5b9e\u4f53&#xff0c;\u8c03\u5ea6\u5668\u7684\u529f\u80fd\u662f\u628a\u53ef\u8fd0\u884c\u7684 goroutine \u5206\u914d\u5230\u5de5\u4f5c\u7ebf\u7a0b\u4e0a\u3002<\/p>\n<ul>\n<li>\u5168\u5c40\u961f\u5217&#xff08;Global Queue&#xff09;&#xff1a;\u5b58\u653e\u7b49\u5f85\u8fd0\u884c\u7684 G\u3002 P \u7684\u672c\u5730\u961f\u5217&#xff1a;\u540c\u5168\u5c40\u961f\u5217\u7c7b\u4f3c&#xff0c;\u5b58\u653e\u7684\u4e5f\u662f\u7b49\u5f85\u8fd0\u884c\u7684 G&#xff0c;\u5b58\u7684\u6570\u91cf\u6709\u9650&#xff0c;\u4e0d\u8d85\u8fc7 256 \u4e2a\u3002\u65b0\u5efa G\u2019\u65f6&#xff0c;G\u2019\u4f18\u5148\u52a0\u5165\u5230 P \u7684\u672c\u5730\u961f\u5217&#xff0c;\u5982\u679c\u961f\u5217\u6ee1\u4e86&#xff0c;\u5219\u4f1a\u628a\u672c\u5730\u961f\u5217\u4e2d\u4e00\u534a\u7684 G \u79fb\u52a8\u5230\u5168\u5c40\u961f\u5217\u3002<\/li>\n<li>P \u5217\u8868&#xff1a;\u6240\u6709\u7684 P \u90fd\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u521b\u5efa&#xff0c;\u5e76\u4fdd\u5b58\u5728\u6570\u7ec4\u4e2d&#xff0c;\u6700\u591a\u6709 GOMAXPROCS(\u53ef\u914d\u7f6e) \u4e2a\u3002<\/li>\n<li>M&#xff1a;\u7ebf\u7a0b\u60f3\u8fd0\u884c\u4efb\u52a1\u5c31\u5f97\u83b7\u53d6 P&#xff0c;\u4ece P \u7684\u672c\u5730\u961f\u5217\u83b7\u53d6 G&#xff0c;P \u961f\u5217\u4e3a\u7a7a\u65f6&#xff0c;M \u4e5f\u4f1a\u5c1d\u8bd5\u4ece\u5168\u5c40\u961f\u5217\u62ff\u4e00\u6279 G \u653e\u5230 P \u7684\u672c\u5730\u961f\u5217&#xff0c;\u6216\u4ece\u5176\u4ed6 P \u7684\u672c\u5730\u961f\u5217\u5077\u4e00\u534a\u653e\u5230\u81ea\u5df1 P \u7684\u672c\u5730\u961f\u5217\u3002M \u8fd0\u884c G&#xff0c;G \u6267\u884c\u4e4b\u540e&#xff0c;M \u4f1a\u4ece P \u83b7\u53d6\u4e0b\u4e00\u4e2a G&#xff0c;\u4e0d\u65ad\u91cd\u590d\u4e0b\u53bb\u3002<\/li>\n<li>Goroutine \u8c03\u5ea6\u5668\u548c OS \u8c03\u5ea6\u5668\u662f\u901a\u8fc7 M \u7ed3\u5408\u8d77\u6765\u7684&#xff0c;\u6bcf\u4e2a M \u90fd\u4ee3\u8868\u4e86 1 \u4e2a\u5185\u6838\u7ebf\u7a0b&#xff0c;OS \u8c03\u5ea6\u5668\u8d1f\u8d23\u628a\u5185\u6838\u7ebf\u7a0b\u5206\u914d\u5230 CPU \u7684\u6838\u4e0a\u6267\u884c\u3002<\/li>\n<\/ul>\n<h3>\u6709\u5173 P \u548c M \u7684\u4e2a\u6570\u95ee\u9898<\/h3>\n<p>1\u3001P \u7684\u6570\u91cf&#xff1a;<\/p>\n<ul>\n<li>\u7531\u542f\u52a8\u65f6\u73af\u5883\u53d8\u91cf $GOMAXPROCS \u6216\u8005\u662f\u7531 runtime \u7684\u65b9\u6cd5 GOMAXPROCS() \u51b3\u5b9a\u3002\u8fd9\u610f\u5473\u7740\u5728\u7a0b\u5e8f\u6267\u884c\u7684\u4efb\u610f\u65f6\u523b\u90fd\u53ea\u6709 $GOMAXPROCS \u4e2a goroutine \u5728\u540c\u65f6\u8fd0\u884c\u3002<\/li>\n<\/ul>\n<p>2\u3001M \u7684\u6570\u91cf:<\/p>\n<ul>\n<li>go \u8bed\u8a00\u672c\u8eab\u7684\u9650\u5236&#xff1a;go \u7a0b\u5e8f\u542f\u52a8\u65f6&#xff0c;\u4f1a\u8bbe\u7f6e M \u7684\u6700\u5927\u6570\u91cf&#xff0c;\u9ed8\u8ba4 10000. \u4f46\u662f\u5185\u6838\u5f88\u96be\u652f\u6301\u8fd9\u4e48\u591a\u7684\u7ebf\u7a0b\u6570&#xff0c;\u6240\u4ee5\u8fd9\u4e2a\u9650\u5236\u53ef\u4ee5\u5ffd\u7565\u3002<\/li>\n<li>runtime\/debug \u4e2d\u7684 SetMaxThreads \u51fd\u6570&#xff0c;\u8bbe\u7f6e M \u7684\u6700\u5927\u6570\u91cf<\/li>\n<li>\u4e00\u4e2a M \u963b\u585e\u4e86&#xff0c;\u4f1a\u521b\u5efa\u65b0\u7684 M\u3002<\/li>\n<\/ul>\n<p>3\u3001M \u4e0e P \u7684\u6570\u91cf\u6ca1\u6709\u7edd\u5bf9\u5173\u7cfb&#xff0c;\u4e00\u4e2a M \u963b\u585e&#xff0c;P \u5c31\u4f1a\u53bb\u521b\u5efa\u6216\u8005\u5207\u6362\u53e6\u4e00\u4e2a M&#xff0c;\u6240\u4ee5&#xff0c;\u5373\u4f7f P \u7684\u9ed8\u8ba4\u6570\u91cf\u662f 1&#xff0c;\u4e5f\u6709\u53ef\u80fd\u4f1a\u521b\u5efa\u5f88\u591a\u4e2a M \u51fa\u6765\u3002<\/p>\n<h3>P \u548c M \u4f55\u65f6\u4f1a\u88ab\u521b\u5efa<\/h3>\n<p>1\u3001P \u4f55\u65f6\u521b\u5efa&#xff1a;\u5728\u786e\u5b9a\u4e86 P \u7684\u6700\u5927\u6570\u91cf n \u540e&#xff0c;\u8fd0\u884c\u65f6\u7cfb\u7edf\u4f1a\u6839\u636e\u8fd9\u4e2a\u6570\u91cf\u521b\u5efa n \u4e2a P\u3002<br \/>\n2\u3001M \u4f55\u65f6\u521b\u5efa&#xff1a;\u6ca1\u6709\u8db3\u591f\u7684 M \u6765\u5173\u8054 P \u5e76\u8fd0\u884c\u5176\u4e2d\u7684\u53ef\u8fd0\u884c\u7684 G\u3002\u6bd4\u5982\u6240\u6709\u7684 M \u6b64\u65f6\u90fd\u963b\u585e\u4f4f\u4e86&#xff0c;\u800c P \u4e2d\u8fd8\u6709\u5f88\u591a\u5c31\u7eea\u4efb\u52a1&#xff0c;\u5c31\u4f1a\u53bb\u5bfb\u627e\u7a7a\u95f2\u7684 M&#xff0c;\u800c\u6ca1\u6709\u7a7a\u95f2\u7684&#xff0c;\u5c31\u4f1a\u53bb\u521b\u5efa\u65b0\u7684 M\u3002<\/p>\n<h2>\u4e09\u3001\u8c03\u5ea6\u5668\u7684\u8bbe\u8ba1\u7b56\u7565<\/h2>\n<p>\u590d\u7528\u7ebf\u7a0b&#xff1a;\u907f\u514d\u9891\u7e41\u7684\u521b\u5efa\u3001\u9500\u6bc1\u7ebf\u7a0b&#xff0c;\u800c\u662f\u5bf9\u7ebf\u7a0b\u7684\u590d\u7528\u3002<\/p>\n<h4>1&#xff09;work stealing \u673a\u5236 \u200b<\/h4>\n<p>\u5f53\u672c\u7ebf\u7a0b\u65e0\u53ef\u8fd0\u884c\u7684 G \u65f6&#xff0c;\u5c1d\u8bd5\u4ece\u5176\u4ed6\u7ebf\u7a0b\u7ed1\u5b9a\u7684 P \u5077\u53d6 G&#xff0c;\u800c\u4e0d\u662f\u9500\u6bc1\u7ebf\u7a0b\u3002<\/p>\n<h4>2&#xff09;hand off \u673a\u5236 \u200b<\/h4>\n<p>\u5f53\u672c\u7ebf\u7a0b\u56e0\u4e3a G \u8fdb\u884c\u7cfb\u7edf\u8c03\u7528\u963b\u585e\u65f6&#xff0c;\u7ebf\u7a0b\u91ca\u653e\u7ed1\u5b9a\u7684 P&#xff0c;\u628a P \u8f6c\u79fb\u7ed9\u5176\u4ed6\u7a7a\u95f2\u7684\u7ebf\u7a0b\u6267\u884c\u3002<\/p>\n<p>\u5229\u7528\u5e76\u884c&#xff1a;GOMAXPROCS \u8bbe\u7f6e P \u7684\u6570\u91cf&#xff0c;\u6700\u591a\u6709 GOMAXPROCS \u4e2a\u7ebf\u7a0b\u5206\u5e03\u5728\u591a\u4e2a CPU \u4e0a\u540c\u65f6\u8fd0\u884c\u3002GOMAXPROCS \u4e5f\u9650\u5236\u4e86\u5e76\u53d1\u7684\u7a0b\u5ea6&#xff0c;\u6bd4\u5982 GOMAXPROCS &#061; \u6838\u6570\/2&#xff0c;\u5219\u6700\u591a\u5229\u7528\u4e86\u4e00\u534a\u7684 CPU \u6838\u8fdb\u884c\u5e76\u884c\u3002<\/p>\n<p>\u62a2\u5360&#xff1a;\u5728 coroutine \u4e2d\u8981\u7b49\u5f85\u4e00\u4e2a\u534f\u7a0b\u4e3b\u52a8\u8ba9\u51fa CPU \u624d\u6267\u884c\u4e0b\u4e00\u4e2a\u534f\u7a0b&#xff0c;\u5728 Go \u4e2d&#xff0c;\u4e00\u4e2a goroutine \u6700\u591a\u5360\u7528 CPU 10ms&#xff0c;\u9632\u6b62\u5176\u4ed6 goroutine \u88ab\u997f\u6b7b&#xff0c;\u8fd9\u5c31\u662f goroutine \u4e0d\u540c\u4e8e coroutine \u7684\u4e00\u4e2a\u5730\u65b9\u3002<\/p>\n<p>\u5168\u5c40 G \u961f\u5217&#xff1a;\u5728\u65b0\u7684\u8c03\u5ea6\u5668\u4e2d\u4f9d\u7136\u6709\u5168\u5c40 G \u961f\u5217&#xff0c;\u4f46\u529f\u80fd\u5df2\u7ecf\u88ab\u5f31\u5316\u4e86&#xff0c;\u5f53 M \u6267\u884c work stealing \u4ece\u5176\u4ed6 P \u5077\u4e0d\u5230 G \u65f6&#xff0c;\u5b83\u53ef\u4ee5\u4ece\u5168\u5c40 G \u961f\u5217\u83b7\u53d6 G\u3002<\/p>\n<h3>go func () \u8c03\u5ea6\u6d41\u7a0b<\/h3>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"496\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061402-6889b82a51a05.png\" width=\"863\" \/><\/p>\n<h4>\u5177\u4f53\u8fc7\u7a0b&#xff1a;<\/h4>\n<p>\u4ece\u4e0a\u56fe\u6211\u4eec\u53ef\u4ee5\u5206\u6790\u51fa\u51e0\u4e2a\u7ed3\u8bba&#xff1a; \u200b<\/p>\n<p>1\u3001\u6211\u4eec\u901a\u8fc7 go func () \u6765\u521b\u5efa\u4e00\u4e2a goroutine&#xff1b; \u200b<\/p>\n<p>2\u3001\u6709\u4e24\u4e2a\u5b58\u50a8 G \u7684\u961f\u5217&#xff0c;\u4e00\u4e2a\u662f\u5c40\u90e8\u8c03\u5ea6\u5668 P \u7684\u672c\u5730\u961f\u5217\u3001\u4e00\u4e2a\u662f\u5168\u5c40 G \u961f\u5217\u3002\u65b0\u521b\u5efa\u7684 G \u4f1a\u5148\u4fdd\u5b58\u5728 P \u7684\u672c\u5730\u961f\u5217\u4e2d&#xff0c;\u5982\u679c P \u7684\u672c\u5730\u961f\u5217\u5df2\u7ecf\u6ee1\u4e86\u5c31\u4f1a\u4fdd\u5b58\u5728\u5168\u5c40\u7684\u961f\u5217\u4e2d&#xff1b; \u200b<\/p>\n<p>3\u3001G \u53ea\u80fd\u8fd0\u884c\u5728 M \u4e2d&#xff0c;\u4e00\u4e2a M \u5fc5\u987b\u6301\u6709\u4e00\u4e2a P&#xff0c;M \u4e0e P \u662f 1&#xff1a;1 \u7684\u5173\u7cfb\u3002M \u4f1a\u4ece P \u7684\u672c\u5730\u961f\u5217\u5f39\u51fa\u4e00\u4e2a\u53ef\u6267\u884c\u72b6\u6001\u7684 G \u6765\u6267\u884c&#xff0c;\u5982\u679c P \u7684\u672c\u5730\u961f\u5217\u4e3a\u7a7a&#xff0c;\u5c31\u4f1a\u60f3\u5176\u4ed6\u7684 MP \u7ec4\u5408\u5077\u53d6\u4e00\u4e2a\u53ef\u6267\u884c\u7684 G \u6765\u6267\u884c&#xff1b; \u200b<\/p>\n<p>4\u3001\u4e00\u4e2a M \u8c03\u5ea6 G \u6267\u884c\u7684\u8fc7\u7a0b\u662f\u4e00\u4e2a\u5faa\u73af\u673a\u5236&#xff1b; \u200b<\/p>\n<p>5\u3001\u5f53 M \u6267\u884c\u67d0\u4e00\u4e2a G \u65f6\u5019\u5982\u679c\u53d1\u751f\u4e86 syscall \u6216\u5219\u5176\u4f59\u963b\u585e\u64cd\u4f5c&#xff0c;M \u4f1a\u963b\u585e&#xff0c;\u5982\u679c\u5f53\u524d\u6709\u4e00\u4e9b G \u5728\u6267\u884c&#xff0c;runtime \u4f1a\u628a\u8fd9\u4e2a\u7ebf\u7a0b M \u4ece P \u4e2d\u6458\u9664 (detach)&#xff0c;\u7136\u540e\u518d\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u64cd\u4f5c\u7cfb\u7edf\u7684\u7ebf\u7a0b (\u5982\u679c\u6709\u7a7a\u95f2\u7684\u7ebf\u7a0b\u53ef\u7528\u5c31\u590d\u7528\u7a7a\u95f2\u7ebf\u7a0b) \u6765\u670d\u52a1\u4e8e\u8fd9\u4e2a P&#xff1b; \u200b<\/p>\n<p>6\u3001\u5f53 M \u7cfb\u7edf\u8c03\u7528\u7ed3\u675f\u65f6\u5019&#xff0c;\u8fd9\u4e2a G \u4f1a\u5c1d\u8bd5\u83b7\u53d6\u4e00\u4e2a\u7a7a\u95f2\u7684 P \u6267\u884c&#xff0c;\u5e76\u653e\u5165\u5230\u8fd9\u4e2a P \u7684\u672c\u5730\u961f\u5217\u3002\u5982\u679c\u83b7\u53d6\u4e0d\u5230 P&#xff0c;\u90a3\u4e48\u8fd9\u4e2a\u7ebf\u7a0b M \u53d8\u6210\u4f11\u7720\u72b6\u6001&#xff0c; \u52a0\u5165\u5230\u7a7a\u95f2\u7ebf\u7a0b\u4e2d&#xff0c;\u7136\u540e\u8fd9\u4e2a G \u4f1a\u88ab\u653e\u5165\u5168\u5c40\u961f\u5217\u4e2d\u3002<\/p>\n<h2>\u56db\u3001Go\u8c03\u5ea6\u5668\u8c03\u5ea6\u573a\u666f\u8fc7\u7a0b\u5168\u89e3\u6790<\/h2>\n<p>\u6211\u4eec\u8fd9\u91cc\u4f1a\u901a\u8fc711\u4e2a\u5c0f\u6848\u4f8b&#xff0c;\u4e3a\u5927\u5bb6\u626b\u76f2\u3002<\/p>\n<p>\u901a\u8fc7\u5b9e\u9645\u573a\u666f&#xff0c;\u52a0\u6df1\u5bf9GMP\u7684\u4e86\u89e3<\/p>\n<h3>(1) \u573a\u666f 1 \u00a0&#8212;\u5c40\u90e8\u6027<\/h3>\n<p>P \u62e5\u6709 G1&#xff0c;M1 \u83b7\u53d6 P \u540e\u5f00\u59cb\u8fd0\u884c G1&#xff0c;G1 \u4f7f\u7528 go func() \u521b\u5efa\u4e86 G2&#xff0c;\u4e3a\u4e86\u5c40\u90e8\u6027 G2 \u4f18\u5148\u52a0\u5165\u5230 P1 \u7684\u672c\u5730\u961f\u5217\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"391\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061402-6889b82a827a7.png\" width=\"459\" \/><\/p>\n<h3>(2) \u573a\u666f 2 \u00a0&#8212; \u7ebf\u7a0bM\u590d\u7528<\/h3>\n<p>G1 \u8fd0\u884c\u5b8c\u6210\u540e (\u51fd\u6570&#xff1a;goexit)&#xff0c;M \u4e0a\u8fd0\u884c\u7684 goroutine \u5207\u6362\u4e3a G0&#xff0c;G0 \u8d1f\u8d23\u8c03\u5ea6\u65f6\u534f\u7a0b\u7684\u5207\u6362&#xff08;\u51fd\u6570&#xff1a;schedule&#xff09;\u3002\u4ece P \u7684\u672c\u5730\u961f\u5217\u53d6 G2&#xff0c;\u4ece G0 \u5207\u6362\u5230 G2&#xff0c;\u5e76\u5f00\u59cb\u8fd0\u884c G2 (\u51fd\u6570&#xff1a;execute)\u3002\u5b9e\u73b0\u4e86\u7ebf\u7a0b M1 \u7684\u590d\u7528\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"347\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061402-6889b82a9a580.png\" width=\"562\" \/><\/p>\n<h3>(3) \u573a\u666f 3 \u00a0&#8212; \u961f\u5217\u6ea2\u51fa\u95ee\u9898<\/h3>\n<p>\u5047\u8bbe\u6bcf\u4e2a P \u7684\u672c\u5730\u961f\u5217\u53ea\u80fd\u5b58 3 \u4e2a G\u3002G2 \u8981\u521b\u5efa\u4e86 6 \u4e2a G&#xff0c;\u524d 3 \u4e2a G&#xff08;G3, G4, G5&#xff09;\u5df2\u7ecf\u52a0\u5165 p1 \u7684\u672c\u5730\u961f\u5217&#xff0c;p1 \u672c\u5730\u961f\u5217\u6ee1\u4e86\u3002&#xff08;\u6ea2\u51fa\u7684&#xff0c;\u76f4\u63a5\u8fdb\u5165\u5168\u5c40\u961f\u5217&#xff09;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"373\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061402-6889b82aae70b.png\" width=\"504\" \/><\/p>\n<h3>(4) \u573a\u666f 4 \u00a0&#8212;\u8d1f\u8f7d\u4e0d\u5747\u8861<\/h3>\n<p>\u7406\u8bba\u4e0a&#xff1a;G2 \u5728\u521b\u5efa G7 \u7684\u65f6\u5019&#xff0c;\u53d1\u73b0 P1 \u7684\u672c\u5730\u961f\u5217\u5df2\u6ee1&#xff0c;\u9700\u8981\u6267\u884c\u8d1f\u8f7d\u5747\u8861 (\u628a P1 \u4e2d\u672c\u5730\u961f\u5217\u4e2d\u524d\u4e00\u534a\u7684 G&#xff0c;\u8fd8\u6709\u65b0\u521b\u5efa G \u8f6c\u79fb\u5230\u5168\u5c40\u961f\u5217)<\/p>\n<p>\u5b9e\u73b0\u4e2d&#xff1a;\u5e76\u4e0d\u4e00\u5b9a\u662f\u65b0\u7684 G&#xff0c;\u5982\u679c G \u662f G2 \u4e4b\u540e\u5c31\u6267\u884c\u7684&#xff0c;\u4f1a\u88ab\u4fdd\u5b58\u5728\u672c\u5730\u961f\u5217&#xff0c;\u5229\u7528\u67d0\u4e2a\u8001\u7684 G \u66ff\u6362\u65b0 G \u52a0\u5165\u5168\u5c40\u961f\u5217<\/p>\n<p>\u6ce8&#xff1a;\u8fd9\u4e9b G \u88ab\u8f6c\u79fb\u5230\u5168\u5c40\u961f\u5217\u65f6&#xff0c;\u4f1a\u88ab\u6253\u4e71\u987a\u5e8f\u3002 \u6240\u4ee5 G3,G4,G7 \u88ab\u8f6c\u79fb\u5230\u5168\u5c40\u961f\u5217\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"535\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061402-6889b82ac7cc1.png\" width=\"556\" \/><\/p>\n<h3>(5) \u573a\u666f 5 \u00a0&#8212;\u5c40\u90e8\u8c03\u5ea6\u6027<\/h3>\n<p>G2 \u521b\u5efa G8 \u65f6&#xff0c;P1 \u7684\u672c\u5730\u961f\u5217\u672a\u6ee1&#xff0c;\u6240\u4ee5 G8 \u4f1a\u88ab\u52a0\u5165\u5230 P1 \u7684\u672c\u5730\u961f\u5217\u3002<\/p>\n<p>G8 \u52a0\u5165\u5230 P1 \u70b9\u672c\u5730\u961f\u5217\u7684\u539f\u56e0\u8fd8\u662f\u56e0\u4e3a P1 \u6b64\u65f6\u5728\u4e0e M1 \u7ed1\u5b9a&#xff0c;<\/p>\n<p>\u800c G2 \u6b64\u65f6\u662f M1 \u5728\u6267\u884c\u3002\u6240\u4ee5 G2 \u521b\u5efa\u7684\u65b0\u7684 G \u4f1a\u4f18\u5148\u653e\u7f6e\u5230\u81ea\u5df1\u7684 M \u7ed1\u5b9a\u7684 P \u4e0a\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"492\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061404-6889b82c7afdc.png\" width=\"493\" \/><\/p>\n<h3>(6) \u573a\u666f 6 \u00a0&#8212;\u5982\u4f55\u63d0\u9ad8\u6548\u7387<\/h3>\n<p>\u89c4\u5b9a&#xff1a;\u5728\u521b\u5efa G \u65f6&#xff0c;\u8fd0\u884c\u7684 G \u4f1a\u5c1d\u8bd5\u5524\u9192\u5176\u4ed6\u7a7a\u95f2\u7684 P \u548c M \u7ec4\u5408\u53bb\u6267\u884c\u3002<\/p>\n<p>\u5047\u5b9a G2 \u5524\u9192\u4e86 M2&#xff0c;M2 \u7ed1\u5b9a\u4e86 P2&#xff0c;\u5e76\u8fd0\u884c G0&#xff0c;\u4f46 P2 \u672c\u5730\u961f\u5217\u6ca1\u6709 G&#xff0c;M2 \u6b64\u65f6\u4e3a\u81ea\u65cb\u7ebf\u7a0b&#xff08;\u6ca1\u6709 G \u4f46\u4e3a\u8fd0\u884c\u72b6\u6001\u7684\u7ebf\u7a0b&#xff0c;\u4e0d\u65ad\u5bfb\u627e G&#xff09;\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"807\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061405-6889b82d04acf.png\" width=\"1508\" \/><\/p>\n<h3>(7) \u573a\u666f 7 \u00a0 &#8212;\u5168\u5c40\u961f\u5217\u8d1f\u8f7d\u5747\u8861<\/h3>\n<p>M2 \u5c1d\u8bd5\u4ece\u5168\u5c40\u961f\u5217 (\u7b80\u79f0 \u201cGQ\u201d) \u53d6\u4e00\u6279 G \u653e\u5230 P2 \u7684\u672c\u5730\u961f\u5217&#xff08;\u51fd\u6570&#xff1a;findrunnable()&#xff09;\u3002M2 \u4ece\u5168\u5c40\u961f\u5217\u53d6\u7684 G \u6570\u91cf\u7b26\u5408\u4e0b\u9762\u7684\u516c\u5f0f&#xff1a;<\/p>\n<ul>\n<li>n &#061; min(len(GQ)\/GOMAXPROCS &#043; 1, len(GQ)\/2)<\/li>\n<\/ul>\n<p>\u81f3\u5c11\u4ece\u5168\u5c40\u961f\u5217\u53d6 1 \u4e2a g&#xff0c;\u4f46\u6bcf\u6b21\u4e0d\u8981\u4ece\u5168\u5c40\u961f\u5217\u79fb\u52a8\u592a\u591a\u7684 g \u5230 p \u672c\u5730\u961f\u5217&#xff0c;\u7ed9\u5176\u4ed6 p \u7559\u70b9\u3002\u8fd9\u662f\u4ece\u5168\u5c40\u961f\u5217\u5230 P \u672c\u5730\u961f\u5217\u7684\u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n<p>\u5047\u5b9a\u6211\u4eec\u573a\u666f\u4e2d\u4e00\u5171\u6709 4 \u4e2a P(GOMAXPROCS \u8bbe\u7f6e\u4e3a 4) \u6700\u591a\u5c31\u80fd\u7528 4 \u4e2a P \u6765\u4f9b M \u4f7f\u7528<br \/>\n\u6240\u4ee5 M2 \u53ea\u4ece\u80fd\u4ece\u5168\u5c40\u961f\u5217\u53d6 1 \u4e2a G&#xff08;\u5373 G3&#xff09; \u79fb\u52a8 P2 \u672c\u5730\u961f\u5217<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"857\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061405-6889b82db8663.png\" width=\"1510\" \/><\/p>\n<h3>(8) \u573a\u666f 8 \u00a0 &#8212;P\u95f4\u8d1f\u8f7d\u4e0d\u5747<\/h3>\n<p>\u5047\u8bbe G2 \u4e00\u76f4\u5728 M1 \u4e0a\u8fd0\u884c&#xff0c;\u7ecf\u8fc7 2 \u8f6e\u540e&#xff0c;M2 \u5df2\u7ecf\u628a G7\u3001G4 \u4ece\u5168\u5c40\u961f\u5217\u83b7\u53d6\u5230\u4e86 P2 \u7684\u672c\u5730\u961f\u5217\u5e76\u5b8c\u6210\u8fd0\u884c&#xff0c;\u5168\u5c40\u961f\u5217\u548c P2 \u7684\u672c\u5730\u961f\u5217\u90fd\u7a7a\u4e86&#xff0c;\u5982\u573a\u666f 8 \u56fe\u7684\u5de6\u534a\u90e8\u5206\u3002<\/p>\n<p>&#xff08;\u5077\u53d6\u4e00\u534astealing&#xff09;<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"427\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061406-6889b82ed9341.png\" width=\"605\" \/><\/p>\n<h3>(9) \u573a\u666f 9 \u00a0 &#8212;\u7ebf\u7a0b\u91cd\u5efa\u5ef6\u65f6\u95ee\u9898<\/h3>\n<p>G1 \u672c\u5730\u961f\u5217 G5\u3001G6 \u5df2\u7ecf\u88ab\u5176\u4ed6 M \u5077\u8d70\u5e76\u8fd0\u884c\u5b8c\u6210&#xff0c;\u5f53\u524d M1 \u548c M2 \u5206\u522b\u5728\u8fd0\u884c G2 \u548c G8&#xff0c;M3 \u548c M4 \u6ca1\u6709 goroutine \u53ef\u4ee5\u8fd0\u884c&#xff0c;M3 \u548c M4 \u5904\u4e8e\u81ea\u65cb\u72b6\u6001&#xff0c;\u5b83\u4eec\u4e0d\u65ad\u5bfb\u627e goroutine\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u8981\u8ba9 m3 \u548c m4 \u81ea\u65cb&#xff0c;\u81ea\u65cb\u672c\u8d28\u662f\u5728\u8fd0\u884c&#xff0c;\u7ebf\u7a0b\u5728\u8fd0\u884c\u5374\u6ca1\u6709\u6267\u884c G&#xff0c;\u5c31\u53d8\u6210\u4e86\u6d6a\u8d39 CPU. \u4e3a\u4ec0\u4e48\u4e0d\u9500\u6bc1\u73b0\u573a&#xff0c;\u6765\u8282\u7ea6 CPU \u8d44\u6e90\u3002\u56e0\u4e3a\u521b\u5efa\u548c\u9500\u6bc1 CPU \u4e5f\u4f1a\u6d6a\u8d39\u65f6\u95f4&#xff0c;\u6211\u4eec\u5e0c\u671b\u5f53\u6709\u65b0 goroutine \u521b\u5efa\u65f6&#xff0c;\u7acb\u523b\u80fd\u6709 M \u8fd0\u884c\u5b83&#xff0c;\u5982\u679c\u9500\u6bc1\u518d\u65b0\u5efa\u5c31\u589e\u52a0\u4e86\u65f6\u5ef6&#xff0c;\u964d\u4f4e\u4e86\u6548\u7387\u3002\u5f53\u7136\u4e5f\u8003\u8651\u4e86\u8fc7\u591a\u7684\u81ea\u65cb\u7ebf\u7a0b\u662f\u6d6a\u8d39 CPU&#xff0c;\u6240\u4ee5\u7cfb\u7edf\u4e2d\u6700\u591a\u6709 GOMAXPROCS \u4e2a\u81ea\u65cb\u7684\u7ebf\u7a0b (\u5f53\u524d\u4f8b\u5b50\u4e2d\u7684 GOMAXPROCS&#061;4&#xff0c;\u6240\u4ee5\u4e00\u5171 4 \u4e2a P)&#xff0c;\u591a\u4f59\u7684\u6ca1\u4e8b\u505a\u7ebf\u7a0b\u4f1a\u8ba9\u4ed6\u4eec\u4f11\u7720\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"391\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061407-6889b82fb0590.png\" width=\"599\" \/><\/p>\n<h3>(10) \u573a\u666f 10 \u00a0 &#8212; G\u963b\u585e\u540e P\u95f2\u7f6e<\/h3>\n<p>\u200b \u5047\u5b9a\u5f53\u524d\u9664\u4e86 M3 \u548c M4 \u4e3a\u81ea\u65cb\u7ebf\u7a0b&#xff0c;\u8fd8\u6709 M5 \u548c M6 \u4e3a\u7a7a\u95f2\u7684\u7ebf\u7a0b (\u6ca1\u6709\u5f97\u5230 P \u7684\u7ed1\u5b9a&#xff0c;\u6ce8\u610f\u6211\u4eec\u8fd9\u91cc\u6700\u591a\u5c31\u53ea\u80fd\u591f\u5b58\u5728 4 \u4e2a P&#xff0c;\u6240\u4ee5 P \u7684\u6570\u91cf\u5e94\u8be5\u6c38\u8fdc\u662f M&gt;&#061;P, \u5927\u90e8\u5206\u90fd\u662f M \u5728\u62a2\u5360\u9700\u8981\u8fd0\u884c\u7684 P)&#xff0c;G8 \u521b\u5efa\u4e86 G9&#xff0c;G8 \u8fdb\u884c\u4e86\u963b\u585e\u7684\u7cfb\u7edf\u8c03\u7528&#xff0c;M2 \u548c P2 \u7acb\u5373\u89e3\u7ed1&#xff0c;P2 \u4f1a\u6267\u884c\u4ee5\u4e0b\u5224\u65ad&#xff1a;\u5982\u679c P2 \u672c\u5730\u961f\u5217\u6709 G\u3001\u5168\u5c40\u961f\u5217\u6709 G \u6216\u6709\u7a7a\u95f2\u7684 M&#xff0c;P2 \u90fd\u4f1a\u7acb\u9a6c\u5524\u9192 1 \u4e2a M \u548c\u5b83\u7ed1\u5b9a&#xff0c;<br \/>\n\u5426\u5219 P2 \u5219\u4f1a\u52a0\u5165\u5230\u7a7a\u95f2 P \u5217\u8868&#xff0c;\u7b49\u5f85 M \u6765\u83b7\u53d6\u53ef\u7528\u7684 p\u3002\u672c\u573a\u666f\u4e2d&#xff0c;P2 \u672c\u5730\u961f\u5217\u6709 G9&#xff0c;\u53ef\u4ee5\u548c\u5176\u4ed6\u7a7a\u95f2\u7684\u7ebf\u7a0b M5 \u7ed1\u5b9a\u3002<\/p>\n<h3>(11) \u573a\u666f 11 \u00a0 &#8212;\u89e3\u51b3\u7cfb\u7edf\u8c03\u7528\u540e\u590d\u7528<\/h3>\n<p>G8 \u521b\u5efa\u4e86 G9&#xff0c;\u5047\u5982 G8 \u8fdb\u884c\u4e86\u975e\u963b\u585e\u7cfb\u7edf\u8c03\u7528\u3002<\/p>\n<p>\u200b M2 \u548c P2 \u4f1a\u89e3\u7ed1&#xff0c;\u4f46 M2 \u4f1a\u8bb0\u4f4f P2&#xff0c;\u7136\u540e G8 \u548c M2 \u8fdb\u5165\u7cfb\u7edf\u8c03\u7528\u72b6\u6001\u3002\u5f53 G8 \u548c M2 \u9000\u51fa\u7cfb\u7edf\u8c03\u7528\u65f6&#xff0c;\u4f1a\u5c1d\u8bd5\u83b7\u53d6 P2&#xff0c;\u5982\u679c\u65e0\u6cd5\u83b7\u53d6&#xff0c;\u5219\u83b7\u53d6\u7a7a\u95f2\u7684 P&#xff0c;\u5982\u679c\u4f9d\u7136\u6ca1\u6709&#xff0c;G8 \u4f1a\u88ab\u8bb0\u4e3a\u53ef\u8fd0\u884c\u72b6\u6001&#xff0c;\u5e76\u52a0\u5165\u5230\u5168\u5c40\u961f\u5217&#xff0c;M2 \u56e0\u4e3a\u6ca1\u6709 P \u7684\u7ed1\u5b9a\u800c\u53d8\u6210\u4f11\u7720\u72b6\u6001 (\u957f\u65f6\u95f4\u4f11\u7720\u7b49\u5f85 GC \u56de\u6536\u9500\u6bc1)\u3002<\/p>\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"343\" src=\"2025-07-30vscdagvrqtd.png\" width=\"612\" \/><\/p>\n<h2>\u62d3\u5c55\u77e5\u8bc6&#xff1a;<\/h2>\n<h3>\u8865\u51451&#xff1a;<\/h3>\n<h4>\u7ebf\u7a0b\u91cd\u5efa\u4e3a\u4ec0\u4e48\u4f1a\u5ef6\u65f6&#xff1f;<\/h4>\n<p>\u7ebf\u7a0b\u91cd\u5efa\u9700\u8981\u64cd\u4f5c\u7cfb\u7edf\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c&#xff1a;<\/p>\n<p>\u8d44\u6e90\u5206\u914d&#xff1a;\u4e3a\u65b0\u7ebf\u7a0b\u5206\u914d\u6808\u5185\u5b58\u3001\u5bc4\u5b58\u5668\u7b49\u8d44\u6e90\u3002<\/p>\n<p>\u4e0a\u4e0b\u6587\u521d\u59cb\u5316&#xff1a;\u8bbe\u7f6e\u7ebf\u7a0b\u7684\u6267\u884c\u73af\u5883&#xff08;\u5982\u7a0b\u5e8f\u8ba1\u6570\u5668\u3001\u6808\u6307\u9488&#xff09;\u3002<\/p>\n<p>\u7cfb\u7edf\u8c03\u7528&#xff1a;\u901a\u8fc7 clone() \u7b49\u7cfb\u7edf\u8c03\u7528\u5411\u64cd\u4f5c\u7cfb\u7edf\u7533\u8bf7\u7ebf\u7a0b\u8d44\u6e90\u3002<\/p>\n<p>\u8fd9\u4e9b\u64cd\u4f5c\u7684\u8017\u65f6\u7ea6\u4e3a\u5fae\u79d2\u7ea7&#xff08;\u5982 Linux \u4e0b\u521b\u5efa\u7ebf\u7a0b\u7684\u5f00\u9500\u7ea6\u4e3a 1-2 \u5fae\u79d2&#xff09;&#xff0c;\u5728\u9ad8\u5e76\u53d1\u573a\u666f\u4e0b\u4f1a\u7d2f\u79ef\u6210\u6027\u80fd\u74f6\u9888\u3002<\/p>\n<h3>\u8865\u51452&#xff1a;<\/h3>\n<p>1\u3001\u7cfb\u7edf\u8c03\u7528&#xff08;\u53bb\u653f\u5e9c\u90e8\u95e8\u529e\u4e8b&#xff09; \u4f60\u7684\u7a0b\u5e8f\u9700\u8981\u64cd\u4f5c\u7cfb\u7edf\u5e2e\u5fd9\u505a\u4e8b&#xff08;\u6bd4\u5982\u8bfb\u6587\u4ef6\u3001\u8054\u7f51&#xff09; \u5c31\u50cf\u4f60\u53bb\u653f\u5e9c\u90e8\u95e8\u529e\u8bc1\u4ef6&#xff0c;\u5fc5\u987b\u4eb2\u81ea\u8dd1\u4e00\u8d9f<\/p>\n<p>2\u3001\u963b\u585e\u7cfb\u7edf\u8c03\u7528&#xff08;\u6392\u961f\u7b49\u53eb\u53f7&#xff09; \u653f\u5e9c\u90e8\u95e8\u544a\u8bc9\u4f60&#xff1a;&#034;\u524d\u9762\u8fd8\u670950\u4eba&#xff0c;\u5750\u7740\u7b49\u5427&#034;<\/p>\n<p>\u4f60\u7684\u7a0b\u5e8f&#xff08;Goroutine&#xff09;\u5361\u4f4f\u4e0d\u80fd\u52a8&#xff0c;CPU\u7a7a\u8f6c\u5e72\u7b49<\/p>\n<p>\u5e38\u89c1\u4f8b\u5b50&#xff1a;<\/p>\n<p>\u8bfb\u53d6\u6162\u901f\u786c\u76d8\u6587\u4ef6 \u7b49\u7f51\u7edc\u6570\u636e\u5305&#xff08;\u6bd4\u5982\u8bbf\u95ee\u6dd8\u5b9dAPI&#xff09;<\/p>\n<h3>\u8865\u51453&#xff1a;<\/h3>\n<h3>GMP\u4e4b P-M<\/h3>\n<p>1\u3001P&#xff08;\u903b\u8f91\u5904\u7406\u5668&#xff09;&#xff1a;\u5b83\u66f4\u50cf\u4e00\u4e2a \u201c\u8d44\u6e90\u5bb9\u5668\u201d \u548c \u201c\u961f\u5217\u7ba1\u7406\u8005\u201d&#xff0c;\u4e3b\u8981\u804c\u8d23\u662f&#xff1a; \u7ef4\u62a4\u4e00\u4e2a\u672c\u5730 G \u961f\u5217&#xff08;\u5b58\u653e\u5c31\u7eea\u7684 G&#xff09;&#xff1b; \u6301\u6709\u8fd0\u884c G \u6240\u9700\u7684\u8d44\u6e90&#xff08;\u5982\u6808\u7a7a\u95f4\u3001\u7ebf\u7a0b\u672c\u5730\u5b58\u50a8\u7b49&#xff09;&#xff1b; \u4f5c\u4e3a M \u7ed1\u5b9a\u7684 \u201c\u8bb8\u53ef\u8bc1\u201d\u2014\u2014M \u5fc5\u987b\u7ed1\u5b9a P \u624d\u80fd\u8fd0\u884c G&#xff08;\u5373 \u201cM \u9700\u8981\u6302\u9760 P \u624d\u80fd\u62e5\u6709\u8c03\u5ea6\u6743\u201d&#xff09;\u3002 \u4f46 P \u672c\u8eab\u4e0d\u5177\u5907\u6267\u884c\u80fd\u529b&#xff08;\u5b83\u4e0d\u662f\u7ebf\u7a0b&#xff0c;\u4e0d\u53c2\u4e0e CPU \u8c03\u5ea6&#xff09;&#xff0c;\u53ea\u662f\u4e00\u4e2a\u903b\u8f91\u4e0a\u7684\u8c03\u5ea6\u5355\u5143\u548c\u8d44\u6e90\u96c6\u5408\u3002<\/p>\n<p>2\u3001M&#xff08;\u64cd\u4f5c\u7cfb\u7edf\u7ebf\u7a0b&#xff09;&#xff1a;\u5b83\u662f\u5b9e\u9645\u7684\u6267\u884c\u8f7d\u4f53&#xff08;\u7531\u64cd\u4f5c\u7cfb\u7edf\u8c03\u5ea6\u7684\u7269\u7406\u7ebf\u7a0b&#xff09;&#xff0c;\u8d1f\u8d23&#xff1a;<br \/>\n\u6267\u884c G \u7684\u4ee3\u7801&#xff08;\u771f\u6b63\u5728 CPU \u4e0a\u8dd1\u6307\u4ee4&#xff09;&#xff1b;<br \/>\n\u5f53 G \u9700\u8981\u8fd0\u884c\u65f6&#xff0c;\u4ece P \u7684\u672c\u5730\u961f\u5217\u4e2d \u201c\u53d6 G\u201d&#xff1b;<br \/>\n\u5f53\u672c\u5730\u961f\u5217\u7a7a\u4e86&#xff0c;\u4e3b\u52a8\u53bb\u5168\u5c40\u961f\u5217\u6216\u5176\u4ed6 P \u7684\u672c\u5730\u961f\u5217 \u201c\u5077 G\u201d&#xff08;\u5de5\u4f5c\u7a83\u53d6&#xff09;\u3002<br \/>\nM \u7684\u6838\u5fc3\u80fd\u529b\u662f \u201c\u6267\u884c\u201d&#xff0c;\u6240\u6709\u9700\u8981\u5b9e\u9645\u64cd\u4f5c&#xff08;\u5982\u53d6 G\u3001\u8fd0\u884c G\u3001\u5207\u6362 G&#xff09;\u7684\u52a8\u4f5c&#xff0c;\u90fd\u5fc5\u987b\u7531 M \u5b8c\u6210\u3002<br \/>\nM \u662f\u552f\u4e00\u5177\u5907\u6267\u884c\u80fd\u529b\u7684\u5b9e\u4f53&#xff08;\u64cd\u4f5c\u7cfb\u7edf\u7ebf\u7a0b&#xff09;&#xff0c;\u800c P \u7684\u89d2\u8272\u662f \u201c\u8d44\u6e90\u7ba1\u7406\u8005\u201d \u548c \u201c\u961f\u5217\u5bb9\u5668\u201d&#xff0c;\u8d1f\u8d23\u63d0\u4f9b G \u7684\u5b58\u653e\u548c\u8fd0\u884c\u73af\u5883\u3002\u8fd9\u79cd\u5206\u5de5\u65e2\u660e\u786e\u4e86\u804c\u8d23&#xff08;P \u7ba1\u8d44\u6e90&#xff0c;M \u7ba1\u6267\u884c&#xff09;&#xff0c;\u53c8\u901a\u8fc7 P \u7684\u672c\u5730\u961f\u5217\u5206\u6563\u4e86\u9501\u7ade\u4e89<\/p>\n<p>\u4f18\u4e8e\u8001\u7248\u672c\u7684\u5730\u65b9\u3002<\/p>\n<h3 style=\"background-color:transparent\">\u8865\u51454&#xff1a;<\/h3>\n<h4 style=\"background-color:transparent\">\u6e90\u7801\u67e5\u627e&#xff1a;<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"358\" src=\"2025-07-30omgob3wwvk2.png\" width=\"802\" \/><\/p>\n<h3>\u8865\u51455&#xff1a;<\/h3>\n<h4>M\u963b\u585e\u7684\u4e09\u79cd\u60c5\u51b5<\/h4>\n<p>1\u3001\u7cfb\u7edf\u8c03\u7528\u963b\u585e (System Call Blocking)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Goroutine \u6267\u884c\u9700\u8981\u5185\u6838\u53c2\u4e0e\u7684\u64cd\u4f5c&#xff08;\u5982\u7f51\u7edc I\/O\u3001\u6587\u4ef6\u8bfb\u5199\u3001sleep \u7b49&#xff09;<\/p>\n<p>2\u3001\u540c\u6b65\u539f\u8bed\u963b\u585e (Synchronization Primitive Blocking)<br \/>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Goroutine \u7b49\u5f85\u540c\u6b65\u64cd\u4f5c&#xff08;\u5982\u901a\u9053\u3001\u9501\u3001\u6761\u4ef6\u53d8\u91cf&#xff09;\u5b8c\u6210&#xff0c;\u5bfc\u81f4 M \u963b\u585e\u3002<\/p>\n<p>3. \u8fd0\u884c\u65f6\u8c03\u5ea6\u963b\u585e (Runtime Scheduling Blocking)<br \/>\n\u00a0 \u00a0 \u00a0 \u00a0 \u5b50\u573a\u666f 1&#xff1a;GC \u7684 STW (Stop The World)<br \/>\n\u00a0 \u00a0 \u00a0 \u00a0 \u5b50\u573a\u666f 2&#xff1a;\u65e0 G \u53ef\u6267\u884c\u65f6\u7684\u4f11\u7720<\/p>\n<h4>\u800c\u5982\u4e0b\u4e24\u79cd\u60c5\u51b5&#xff1a;<\/h4>\n<p>1\u3001\u7ebf\u7a0b\u5206\u914d\u7ed9G\u7684cpu\u7528\u5b8c\u4e86\u3002<\/p>\n<p>2\u3001\u8fdb\u7a0b\u5206\u914d\u7ed9\u7ebf\u7a0b\u7684cpu\u7528\u5b8c\u4e86&#xff0c;\u7ebf\u7a0b\u88ab\u8feb\u963b\u585e\u3002<\/p>\n<h4>\u6ce8\u610f&#xff1a;<\/h4>\n<p>M \u7ebf\u7a0b\u7684\u963b\u585e&#xff08;Go \u8fd0\u884c\u65f6\u5c42\u9762&#xff09;\u548c\u65f6\u95f4\u7247\u963b\u585e&#xff08;OS \u5c42\u9762&#xff09;\u662f\u4e24\u4e2a\u72ec\u7acb\u4e14\u4e0d\u540c\u5c42\u7ea7\u7684\u6982\u5ff5&#xff0c;\u524d\u8005\u662f\u4e3a\u4e86\u8c03\u5ea6\u6548\u7387&#xff0c;\u540e\u8005\u662f\u4e3a\u4e86\u4efb\u52a1\u516c\u5e73\u3002<\/p>\n<\/p>\n<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.5k\u6b21\uff0c\u70b9\u8d5e109\u6b21\uff0c\u6536\u85cf93\u6b21\u3002\u672c\u7bc7\u5c06\u4f1a\u4ece\u8d77\u6e90\u3001\u8bbe\u8ba1\u601d\u60f3\u3001\u8bbe\u8ba1\u7b56\u7565\u3001\u8fd0\u884c\u6a21\u5f0f\u3001\u73b0\u5b9e\u573a\u666f\u591a\u7ef4\u5ea6\u8fdb\u884c\u8bba\u8ff0GMP\u3002\u5e76\u5728\u7ed3\u5c3e\u8865\u5145\u4e86\u4e94\u4e2a\u6613\u6df7\u6613\u9519\u7684\u8981\u70b9<\/p>\n","protected":false},"author":2,"featured_media":48934,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[4741,746,292,43,44],"topic":[],"class_list":["post-48954","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-goweb","tag-golang","tag-292","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>GMP\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/48954.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GMP\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.5k\u6b21\uff0c\u70b9\u8d5e109\u6b21\uff0c\u6536\u85cf93\u6b21\u3002\u672c\u7bc7\u5c06\u4f1a\u4ece\u8d77\u6e90\u3001\u8bbe\u8ba1\u601d\u60f3\u3001\u8bbe\u8ba1\u7b56\u7565\u3001\u8fd0\u884c\u6a21\u5f0f\u3001\u73b0\u5b9e\u573a\u666f\u591a\u7ef4\u5ea6\u8fdb\u884c\u8bba\u8ff0GMP\u3002\u5e76\u5728\u7ed3\u5c3e\u8865\u5145\u4e86\u4e94\u4e2a\u6613\u6df7\u6613\u9519\u7684\u8981\u70b9\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/48954.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-07-30T06:14:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061357-6889b82503dcd.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/48954.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/48954.html\",\"name\":\"GMP\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-07-30T06:14:09+00:00\",\"dateModified\":\"2025-07-30T06:14:09+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/48954.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/48954.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/48954.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GMP\u6a21\u578b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GMP\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/48954.html","og_locale":"zh_CN","og_type":"article","og_title":"GMP\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1.5k\u6b21\uff0c\u70b9\u8d5e109\u6b21\uff0c\u6536\u85cf93\u6b21\u3002\u672c\u7bc7\u5c06\u4f1a\u4ece\u8d77\u6e90\u3001\u8bbe\u8ba1\u601d\u60f3\u3001\u8bbe\u8ba1\u7b56\u7565\u3001\u8fd0\u884c\u6a21\u5f0f\u3001\u73b0\u5b9e\u573a\u666f\u591a\u7ef4\u5ea6\u8fdb\u884c\u8bba\u8ff0GMP\u3002\u5e76\u5728\u7ed3\u5c3e\u8865\u5145\u4e86\u4e94\u4e2a\u6613\u6df7\u6613\u9519\u7684\u8981\u70b9","og_url":"https:\/\/www.wsisp.com\/helps\/48954.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-07-30T06:14:09+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/07\/20250730061357-6889b82503dcd.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/48954.html","url":"https:\/\/www.wsisp.com\/helps\/48954.html","name":"GMP\u6a21\u578b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-07-30T06:14:09+00:00","dateModified":"2025-07-30T06:14:09+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/48954.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/48954.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/48954.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"GMP\u6a21\u578b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/48954","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=48954"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/48954\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/48934"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=48954"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=48954"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=48954"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=48954"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}