{"id":5848,"date":"2022-05-28T22:51:35","date_gmt":"2022-05-28T14:51:35","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=5848"},"modified":"2022-05-28T22:51:35","modified_gmt":"2022-05-28T14:51:35","slug":"go%e8%af%ad%e8%a8%80%e5%b9%b6%e5%8f%91%e4%b9%8bmpg%e6%a8%a1%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/5848","title":{"rendered":"go\u8bed\u8a00\u5e76\u53d1\u4e4bMPG\u6a21\u578b"},"content":{"rendered":"<div class=\"article-header-box\">\n<div class=\"article-header\">\n<div class=\"article-title-box\">\n<p id=\"articleContentId\" class=\"title-article\"><a href=\"https:\/\/blog.csdn.net\/august5291\/article\/details\/120994695\">\u539f\u6587\u5730\u5740<\/a><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"article-info-box\">\n<div class=\"article-bar-top\">\n<div class=\"bar-content\"><a class=\"follow-nickName \" href=\"https:\/\/blog.csdn.net\/august5291\" target=\"_blank\" rel=\"noopener\">\u6e38\u620f\u5927\u7237\u541b<\/a><img decoding=\"async\" class=\"article-time-img article-heard-img\" src=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCurrentTime2.png\" alt=\"\" \/><span class=\"time\">\u4e8e\u00a02021-10-27 15:50:17\u00a0\u53d1\u5e03<\/span><img decoding=\"async\" class=\"article-read-img article-heard-img\" src=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/articleReadEyes2.png\" alt=\"\" \/><span class=\"read-count\">71<\/span><a id=\"blog_detail_zk_collection\" class=\"un-collection\" data-report-click=\"{&quot;mod&quot;:&quot;popu_823&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4232&quot;,&quot;ab&quot;:&quot;new&quot;}\"><\/a><img decoding=\"async\" class=\"article-collect-img article-heard-img un-collect-status isdefault\" src=\"https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/tobarCollect2.png\" alt=\"\" \/>\u00a0<span class=\"name\">\u6536\u85cf<\/span><\/div>\n<\/div>\n<div class=\"blog-tags-box\">\n<div class=\"tags-box artic-tag-box\"><span class=\"label\">\u6587\u7ae0\u6807\u7b7e\uff1a<\/span>\u00a0<a class=\"tag-link\" href=\"https:\/\/so.csdn.net\/so\/search\/s.do?q=golang&amp;t=blog&amp;o=vip&amp;s=&amp;l=&amp;f=&amp;viparticle=\" target=\"_blank\" rel=\"noopener\" data-report-click=\"{&quot;mod&quot;:&quot;popu_626&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4223&quot;,&quot;strategy&quot;:&quot;golang&quot;,&quot;ab&quot;:&quot;new&quot;}\">golang<\/a>\u00a0<a class=\"tag-link\" href=\"https:\/\/so.csdn.net\/so\/search\/s.do?q=%E5%8C%BA%E5%9D%97%E9%93%BE&amp;t=blog&amp;o=vip&amp;s=&amp;l=&amp;f=&amp;viparticle=\" target=\"_blank\" rel=\"noopener\" data-report-click=\"{&quot;mod&quot;:&quot;popu_626&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4223&quot;,&quot;strategy&quot;:&quot;\u533a\u5757\u94fe&quot;,&quot;ab&quot;:&quot;new&quot;}\">\u533a\u5757\u94fe<\/a>\u00a0<a class=\"tag-link\" href=\"https:\/\/so.csdn.net\/so\/search\/s.do?q=%E6%AF%94%E7%89%B9%E5%B8%81&amp;t=blog&amp;o=vip&amp;s=&amp;l=&amp;f=&amp;viparticle=\" target=\"_blank\" rel=\"noopener\" data-report-click=\"{&quot;mod&quot;:&quot;popu_626&quot;,&quot;spm&quot;:&quot;1001.2101.3001.4223&quot;,&quot;strategy&quot;:&quot;\u6bd4\u7279\u5e01&quot;,&quot;ab&quot;:&quot;new&quot;}\">\u6bd4\u7279\u5e01<\/a><\/div>\n<\/div>\n<div class=\"operating\"><a class=\"href-article-edit slide-toggle\">\u7248\u6743<\/a><\/div>\n<\/div>\n<\/div>\n<\/div>\n<article class=\"baidu_pl\">\n<div id=\"article_content\" class=\"article_content clearfix\">\n<div id=\"content_views\" class=\"htmledit_views\">\n<p><a class=\"hl hl-1\" href=\"https:\/\/so.csdn.net\/so\/search?q=go%E8%AF%AD%E8%A8%80&amp;spm=1001.2101.3001.7020\" target=\"_blank\" rel=\"noopener\" data-report-click=\"{&quot;spm&quot;:&quot;1001.2101.3001.7020&quot;,&quot;dest&quot;:&quot;https:\/\/so.csdn.net\/so\/search?q=go%E8%AF%AD%E8%A8%80&amp;spm=1001.2101.3001.7020&quot;}\" data-tit=\"go\u8bed\u8a00\" data-pretit=\"go\u8bed\u8a00\">go\u8bed\u8a00<\/a>\u5929\u751f\u7684\u5e76\u53d1\u5927\u5bb6\u90fd\u77e5\u9053\uff0c\u53ef\u662fgo\u662f\u5982\u4f55\u5b9e\u73b0\u8f7b\u677e\u7684\u6784\u9020\u4e0a\u4e07\u7684\u534f\u7a0b\u5462\uff1f\u4eca\u5929\u6211\u4eec\u5c31\u8bf4\u4e00\u4e0bgo\u5e76\u53d1\u7684MPG\u6a21\u578b\u3002<\/p>\n<blockquote><p>\u540e\u7eed\u4f1a\u6709\u66f4\u591a\u7684\u6a21\u5f0f\u548c\u7b97\u6cd5\u4ee5\u53ca\u533a\u5757\u94fe\u76f8\u5173\u7684\uff0c\u5982\u679c\u4f60\u662f\u60f3\u5b66\u4e60go\u8bed\u8a00\u6216\u8005\u662f\u5bf9\u8bbe\u8ba1\u6a21\u5f0f\u6216\u8005\u7b97\u6cd5\u611f\u5174\u8da3\u4ea6\u6216\u662f\u533a\u5757\u94fe\u5f00\u53d1\u5de5\u4f5c\u8005\uff0c\u90fd\u53ef\u4ee5\u5173\u6ce8\u4e00\u4e0b\u3002\uff08\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u00a0<strong>Go\u8bed\u8a00\u4e4b\u7f8e<\/strong>\uff0c\u66f4\u591ago\u8bed\u8a00\u77e5\u8bc6\u4fe1\u606f\u7b49\uff09\u3002\u516c\u4f17\u53f7\u4f1a\u6301\u7eed\u4e3a\u5927\u5bb6\u5206\u4eab\u66f4\u591a\u5e72\u8d27\u3002<\/p><\/blockquote>\n<ol>\n<li>M \u4ee3\u8868\u7740\u4e00\u4e2a\u5185\u6838\u7ebf\u7a0b\uff0c\u4e5f\u53ef\u4ee5\u79f0\u4e3a\u4e00\u4e2a\u5de5\u4f5c\u7ebf\u7a0b\u3002goroutine\u5c31\u662f\u8dd1\u5728M\u4e4b\u4e0a\u7684<\/li>\n<li>P \u4ee3\u8868\u7740(Processor)\u5904\u7406\u5668 \u5b83\u7684\u4e3b\u8981\u7528\u9014\u5c31\u662f\u7528\u6765\u6267\u884cgoroutine\u7684\uff0c\u4e00\u4e2aP\u4ee3\u8868\u6267\u884c\u4e00\u4e2aGo\u4ee3\u7801\u7247\u6bb5\u7684\u57fa\u7840\uff08\u53ef\u4ee5\u7406\u89e3\u4e3a\u4e0a\u4e0b\u6587\u73af\u5883\uff09\uff0c\u6240\u4ee5\u5b83\u4e5f\u7ef4\u62a4\u4e86\u4e00\u4e2a\u53ef\u8fd0\u884c\u7684goroutine\u961f\u5217\uff0c\u548c\u81ea\u7531\u7684goroutine\u961f\u5217\uff0c\u91cc\u9762\u5b58\u50a8\u4e86\u6240\u6709\u9700\u8981\u5b83\u6765\u6267\u884c\u7684goroutine\u3002<\/li>\n<li>G \u4ee3\u8868\u7740goroutine \u5b9e\u9645\u7684\u6570\u636e\u7ed3\u6784(\u5c31\u662f\u4f60\u5c01\u88c5\u7684\u90a3\u4e2a\u65b9\u6cd5)\uff0c\u5e76\u7ef4\u62a4\u8005goroutine \u9700\u8981\u7684\u6808\u3001\u7a0b\u5e8f\u8ba1\u6570\u5668\u4ee5\u53ca\u5b83\u6240\u5728\u7684M\u7b49\u4fe1\u606f\u3002<\/li>\n<li>Seched \u4ee3\u8868\u7740\u4e00\u4e2a\u8c03\u5ea6\u5668 \u5b83\u7ef4\u62a4\u6709\u5b58\u50a8\u7a7a\u95f2\u7684M\u961f\u5217\u548c\u7a7a\u95f2\u7684P\u961f\u5217\uff0c\u53ef\u8fd0\u884c\u7684G\u961f\u5217\uff0c\u81ea\u7531\u7684G\u961f\u5217\u4ee5\u53ca\u8c03\u5ea6\u5668\u7684\u4e00\u4e9b\u72b6\u6001\u4fe1\u606f\u7b49\u3002<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/img_convert\/11d543e62782e408ddf4c763e849cbe7.png\" alt=\"\" width=\"1200\" \/><\/p>\n<p>\u591a\u4e2agoroutine<a class=\"hl hl-1\" href=\"https:\/\/so.csdn.net\/so\/search?q=%E5%B9%B6%E5%8F%91&amp;spm=1001.2101.3001.7020\" target=\"_blank\" rel=\"noopener\" data-report-click=\"{&quot;spm&quot;:&quot;1001.2101.3001.7020&quot;,&quot;dest&quot;:&quot;https:\/\/so.csdn.net\/so\/search?q=%E5%B9%B6%E5%8F%91&amp;spm=1001.2101.3001.7020&quot;}\" data-tit=\"\u5e76\u53d1\" data-pretit=\"\u5e76\u53d1\">\u5e76\u53d1<\/a>\u5408\u4f5c<\/p>\n<p>\u4e0a\u9762\u8fd9\u4e2a\u56fe\u751f\u52a8\u7684\u8bf4\u660e\u591a\u4e2a<a class=\"hl hl-1\" href=\"https:\/\/so.csdn.net\/so\/search?q=%E5%8D%8F%E7%A8%8B&amp;spm=1001.2101.3001.7020\" target=\"_blank\" rel=\"noopener\" data-report-click=\"{&quot;spm&quot;:&quot;1001.2101.3001.7020&quot;,&quot;dest&quot;:&quot;https:\/\/so.csdn.net\/so\/search?q=%E5%8D%8F%E7%A8%8B&amp;spm=1001.2101.3001.7020&quot;}\" data-tit=\"\u534f\u7a0b\" data-pretit=\"\u534f\u7a0b\">\u534f\u7a0b<\/a>\u5de5\u4f5c\u5f62\u5f0f\uff0c\u5176\u4e2d\u6bcf\u4e00\u4e2agopher\uff08\u571f\u62e8\u9f20\uff09\u53ef\u4ee5\u770b\u4f5c\u4e00\u4e2a\u534f\u7a0b\uff08G\uff09\uff0c\u5176\u5b9e\u5bf9\u4e8e\u8fd9\u4e9bgopher\uff0c\u8fd8\u6709\u4e00\u4e2a\u5305\u5de5\u5934\u7684gopher\uff0c\u4ed6\u6765\u7ba1\u7406\u8fd9\u4e9b\u5de5\u4f5c\u7684gopher\uff0c\u8fd9\u4e2a\u5305\u5de5\u5934\u5c31\u53ef\u4ee5\u770b\u4f5c\u4e00\u4e2a Seched\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/img_convert\/2c31266bdf636226b917752cc7c49054.png\" alt=\"\" width=\"640\" \/><\/p>\n<p>MPG<\/p>\n<p>\u6211\u4eec\u5728\u770b\u4e0a\u9762\u8fd9\u4e2a\u56fe\uff0c\u56fe\u4e2dP\u6b63\u5728\u6267\u884c\u7684Goroutine\u4e3a\u84dd\u8272\u7684\uff0c\u5904\u4e8e\u5f85\u6267\u884c\u72b6\u6001\u7684Goroutine\u4e3a\u7070\u8272\u7684\uff0c\u7070\u8272\u7684Goroutine\u5f62\u6210\u4e86\u4e00\u4e2a\u961f\u5217runqueues\u3002<\/p>\n<p>\u6211\u4eec\u518d\u770b\u4e00\u4e0b\u4e09\u8005\u7684\u5b8f\u89c2\u56fe\uff1a<\/p>\n<p>&nbsp;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/img_convert\/6b8efedd7f8b3b4f6fc7787ae7a1a11b.png\" alt=\"\" width=\"640\" \/><\/p>\n<p>MPG\u5b8f\u89c2\u56fe<\/p>\n<p>\u5728\u8fd9\u91cc\uff0c\u5f53\u4e00\u4e2aP\u5173\u8054\u591a\u4e2aG\u65f6\uff0c\u5c31\u4f1a\u5904\u7406G\u7684\u6267\u884c\u987a\u5e8f\uff0c\u5c31\u662f\u5e76\u53d1\uff0c\u5f53\u4e00\u4e2aP\u5728\u6267\u884c\u4e00\u4e2a\u534f\u7a0b\u5de5\u4f5c\u65f6\uff0c\u5176\u4ed6\u7684\u4f1a\u5728\u7b49\u5f85\uff0c\u5f53\u6b63\u5728\u6267\u884c\u7684\u534f\u7a0b\u9047\u5230\u963b\u585e\u60c5\u51b5\uff0c\u4f8b\u5982<a title=\"\u624b\u6e38\u5356\u53f7\u5e73\u53f0\" href=\"https:\/\/www.fgba.net\/\" target=\"_blank\" rel=\"noopener\">\u624b\u6e38\u5356\u53f7\u5e73\u53f0<\/a>IO\u64cd\u4f5c\u7b49\uff0cgo\u7684\u5904\u7406\u5668\u5c31\u4f1a\u53bb\u6267\u884c\u5176\u4ed6\u7684\u534f\u7a0b\uff0c\u56e0\u4e3a\u5bf9\u4e8e\u7c7b\u4f3cIO\u7684\u64cd\u4f5c\uff0c\u5904\u7406\u5668\u4e0d\u77e5\u9053\u4f60\u9700\u8981\u591a\u4e45\u624d\u80fd\u6267\u884c\u7ed3\u675f\uff0c\u6240\u4ee5\u4ed6\u4e0d\u56de\u53bb\u7b49\u4f60\u6267\u884c\u5b8c\u3002<\/p>\n<p>\u4e0a\u9762\u6211\u4eec\u770b\u7740go\u7684\u5e76\u53d1\u597d\u50cf\u662f\u62a2\u5360\u5f0f\u7684\uff0c\u4e8b\u5b9e\u4e0ago\u7684\u534f\u7a0b\u662f\u975e\u62a2\u5360\u5f0f\u7684\uff0c\u7531\u534f\u7a0b\u4e3b\u52a8\u4ea4\u51fa\u63a7\u5236\u6743\uff0c\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e0a\u9762\u5728\u53d1\u751fIO\u64cd\u4f5c\u65f6\uff0c\u5e76\u4e0d\u662f\u8c03\u5ea6\u5668\u5f3a\u5236\u5207\u6362\u6267\u884c\u5176\u4ed6\u7684\u534f\u7a0b\uff0c\u800c\u662f\u5f53\u524d\u534f\u7a0b\u4ea4\u51fa\u4e86\u63a7\u5236\u6743\uff0c\u8c03\u5ea6\u5668\u624d\u53bb\u6267\u884c\u5176\u4ed6\u534f\u7a0b\u3002\u6211\u4eec\u5217\u4e3e\u4e00\u4e0bgoroutine\u53ef\u80fd\u5207\u6362\u7684\u70b9\uff1a<\/p>\n<ul>\n<li>I\/O\uff0cselect<\/li>\n<li>channel<\/li>\n<li>\u7b49\u5f85\u9501<\/li>\n<li>runtime.Gosched()<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u70b9\u662fgo\u534f\u7a0b\u53ef\u80fd\u5207\u6362\u7684\u5730\u65b9\uff0c\u4f46\u662f\u5e76\u4e0d\u662f\u4e00\u5b9a\u5207\u6362\u7684\u3002<\/p>\n<p>\u6b63\u662f\u56e0\u4e3a\u662f\u975e\u62a2\u5360\u5f0f\u7684\uff0c\u6240\u4ee5\u624d\u8f7b\u677e\u7684\u6784\u9020\u4e0a\u4e07\u7684\u534f\u7a0b\uff0c\u5982\u679c\u662f\u62a2\u5360\u5f0f\uff0c\u90a3\u4e48\u5c31\u4f1a\u5728\u5207\u6362\u4efb\u52a1\u65f6\uff0c\u4fdd\u5b58\u5f53\u524d\u7684\u4e0a\u4e0b\u6587\u73af\u5883\uff0c\u56e0\u4e3a\u5f53\u524d\u7ebf\u7a0b\u5982\u679c\u6b63\u5728\u505a\u4e00\u4ef6\u4e8b\uff0c\u505a\u5230\u4e00\u534a\uff0c\u6211\u4eec\u5c31\u5f3a\u5236\u505c\u6b62\uff0c\u8fd9\u65f6\u6211\u4eec\u5c31\u5fc5\u987b\u591a\u4fdd\u5b58\u5f88\u591a\u4fe1\u606f\uff0c\u907f\u514d\u518d\u6b21\u5207\u6362\u56de\u6765\u65f6\u4efb\u52a1\u51fa\u9519\u3002<\/p>\n<p>\u7ebf\u7a0b\u662f\u64cd\u4f5c\u7cfb\u7edf\u5c42\u9762\u7684\u591a\u4efb\u52a1\uff0c\u800cgo\u7684\u534f\u7a0b\u5c5e\u4e8e\u7f16\u8bd1\u5668\u5c42\u9762\u7684\u591a\u4efb\u52a1\uff0cgo\u6709\u81ea\u5df1\u7684\u8c03\u5ea6\u5668\u6765\u8c03\u5ea6\u3002\u4e00\u4e2a\u534f\u7a0b\u5728\u54ea\u4e2a\u7ebf\u7a0b\u4e0a\u662f\u4e0d\u786e\u5b9a\u7684\uff0c\u8fd9\u4e2a\u662f\u7531\u8c03\u5ea6\u5668\u6765\u51b3\u5b9a\u7684\uff0c\u591a\u4e2a\u534f\u7a0b\u53ef\u80fd\u5728\u4e00\u4e2a\u6216\u591a\u4e2a\u7ebf\u7a0b\u4e0a\u8fd0\u884c\u3002<\/p>\n<p>go\u7684\u5e76\u53d1\u662f\u5f88\u91cd\u8981\u7684\uff0c\u8fd9\u91cc\u53ea\u662f\u7b80\u5355\u8bf4\u4e00\u4e0bMPG\u6a21\u578b\u7684\u4e2a\u4eba\u7406\u89e3\uff0c\u5982\u679c\u5927\u5bb6\u6709\u4e0d\u540c\u610f\u89c1\uff0c\u53ef\u4ee5\u4e00\u8d77\u8ba8\u8bba\u5b66\u4e60\uff0c\u4e09\u4eba\u884c\u5fc5\u6709\u6211\u5e08\u3002\u5982\u679c\u89c9\u5f97\u8fd9\u7bc7\u6587\u7ae0\u4e0d\u9519\u53ef\u4ee5\u8f6c\u53d1\uff08\u5fae\u4fe1\u516c\u4f17\u53f7\/\u4eca\u65e5\u5934\u6761\uff1a<strong>Go\u8bed\u8a00\u4e4b\u7f8e<\/strong>\uff0c\u66f4\u591ago\u8bed\u8a00\u77e5\u8bc6\u4fe1\u606f\u7b49\uff09\u3002<\/p>\n<\/div>\n<div>\n<div><\/div>\n<\/div>\n<\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740 &nbsp; \u6e38\u620f\u5927\u7237\u541b\u4e8e\u00a02<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[24],"tags":[121],"class_list":["post-5848","post","type-post","status-publish","format-standard","hentry","category-value_docs","tag-05-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/5848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=5848"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/5848\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=5848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=5848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=5848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}