{"id":44656,"date":"2023-02-27T12:39:05","date_gmt":"2023-08-21T22:13:13","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/"},"modified":"2024-04-29T16:32:46","modified_gmt":"2024-04-29T08:32:46","slug":"%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/","title":{"rendered":"\u5173\u4e8eGolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898"},"content":{"rendered":"<h1>\u9996\u5148<\/h1>\n<p>\u6211\u4eca\u5e74\u5f00\u59cb\u5728\u5de5\u4f5c\u4e2d\u4f7f\u7528Golang\u7f16\u5199\u4ee3\u7801\uff0c\u6240\u4ee5\u7814\u7a76\u4e86\u4e00\u4e0b\u8c03\u5ea6\u5668\u3002\u67e5\u4e86\u4e00\u4e0b\u8d44\u6599\uff0c\u53d1\u73b0\u4e0d\u592a\u591a\uff0c\u6240\u4ee5\u6211\u603b\u7ed3\u4e86\u4e00\u4e0b\u3002\u5728\u67e5\u770b\u6e90\u4ee3\u7801\u65f6\uff0c\u6211\u53c2\u8003\u4e86Go 1.9.3\u7248\u672c\u3002\u4e3a\u4e86\u6613\u7406\u89e3\uff0c\u6211\u6709\u610f\u5730\u8fdb\u884c\u4e86\u4e00\u4e9b\u7c97\u7565\u7684\u89e3\u91ca\uff0c\u8bf7\u89c1\u8c05\u3002\u5982\u679c\u6709\u9519\u8bef\uff0c\u8bf7\u6e29\u67d4\u5730\u6307\u6b63\u3002<\/p>\n<h1>\u6bcf\u4e2agoroutine\u7684\u57fa\u672c\u8ba8\u8bba<\/h1>\n<p>goroutine\u662f\u7eff\u8272\u7ebf\u7a0b\uff0c\u4e5f\u5c31\u662f\u4e0d\u76f4\u63a5\u4f7f\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684\u7ebf\u7a0b\u3002\u56e0\u6b64\uff0c\u521b\u5efagoroutine\u6bd4\u521b\u5efa\u539f\u751f\u7ebf\u7a0b\u7684\u64cd\u4f5c\u6210\u672c\u8981\u4f4e\u5f97\u591a\u3002\u5f53\u521b\u5efa\u591a\u4e2agoroutine\u65f6\uff0c\u8fd0\u884c\u65f6\u4f1a\u81ea\u52a8\u4ee5\u591a\u7ebf\u7a0b\u7684\u65b9\u5f0f\u6267\u884c\u3002\u8be6\u7ec6\u5185\u5bb9\u5c06\u5728\u540e\u6587\u4e2d\u8ba8\u8bba\u3002<br \/>\n\u6b64\u5916\uff0c\u4e3b\u7a0b\u5e8f\u4e5f\u88ab\u7ba1\u7406\u4e3a\u4e00\u4e2agoroutine\u3002<\/p>\n<h1>\u65e5\u7a0b\u5b89\u6392\u4e2d\u7684\u89d2\u8272<\/h1>\n<p>\u91cd\u8981\u7684\u89d2\u8272\u6709M\u3001G\u548cP\u8fd9\u4e09\u4e2a\u4eba\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">M(Machine)<\/ul>\n<\/li>\n<\/ul>\n<p>OS\u306e\u30b9\u30ec\u30c3\u30c9\u306b\u5bfe\u5fdc\u3059\u308b\u3002<\/p>\n<p>G(Goroutine)<\/p>\n<p>\u305d\u306e\u307e\u307e\u3002<\/p>\n<p>P(Processor)<\/p>\n<p>G\u3092\u8caf\u3081\u3066\u304a\u304fdeque\u3068\u547c\u3070\u308c\u308b\u7279\u6b8a\u306a\u30ad\u30e5\u30fc\u3092\u6301\u3061\u3001G\u3092M\u306b\u5272\u308a\u3042\u3066\u308b\u5f79\u5272\u3092\u6301\u3064\u3002<br \/>\nGOMAXPROCS\u74b0\u5883\u5909\u6570\u306f\u3053\u308c\u306b\u5bfe\u5fdc\u3059\u308b\u3002<\/p>\n<p>\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u5b9f\u884c\u74b0\u5883\u306e\u30b3\u30a2\u306e\u6570\u304c\u8a2d\u5b9a\u3055\u308c\u308b1<\/p>\n<p>\u8fd9\u4e9b\u662f\u5728\u6e90\u4ee3\u7801\u4e0a\u4f7f\u7528m\u3001g\u3001p\u8fdb\u884c\u5b9a\u4e49\u7684\u3002<\/p>\n<h1>\u65e5\u7a0b\u5b89\u6392\u7684\u57fa\u672c\u673a\u5236<\/h1>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/9-0.png\" alt=\"undefined\" \/><\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/10-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2018-02-16 1.35.19.png\" \/><\/div>\n<p>\u8fd9\u4e2a\u8c03\u5ea6\u7b97\u6cd5\u88ab\u79f0\u4e3awork stealing\u7b97\u6cd5\u3002\u8fd9\u4e2awork stealing\u7b97\u6cd5\u5bf9\u4e8eCPU\u5bc6\u96c6\u578b\u5904\u7406\u975e\u5e38\u9ad8\u6548\uff0c\u4f46\u5bf9\u4e8e\u4f1a\u5bfc\u81f4IO\u7b49\u5f85\u7b49\u4e0d\u5fc5\u8981\u7684\u963b\u585e\u5904\u7406\u4e0d\u592a\u9002\u7528\u3002\u56e0\u6b64\uff0c\u8fdb\u884c\u4e86\u4e00\u4e9b\u6539\u8fdb\uff0c\u6211\u5c06\u5728\u63a5\u4e0b\u6765\u8fdb\u884c\u8bf4\u660e\u3002<\/p>\n<h1>\u5728\u8fdb\u5165\u7ec6\u8282\u4e4b\u524d\u7684\u51c6\u5907\u5de5\u4f5c<\/h1>\n<p>\u5728\u8be6\u7ec6\u8bf4\u660e\u4e4b\u524d\uff0c\u7b80\u8981\u4ecb\u7ecd\u5fc5\u8981\u7684\u5148\u524d\u77e5\u8bc6\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30b0\u30ed\u30fc\u30d0\u30eb\u30ad\u30e5\u30fc<\/ul>\n<\/li>\n<\/ul>\n<p>P\u304c\u6301\u3064G\u306e\u30ad\u30e5\u30fc\u3068\u306f\u5225\u306b\u30b0\u30ed\u30fc\u30d0\u30eb\u30ad\u30e5\u30fc\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308b\u3002<br \/>\n\u901a\u5e38G\u304c\u5b9f\u884c\u5f85\u3061\u72b6\u614b\u306b\u306a\u308b\u3068P\u306e\u6301\u3064\u30ad\u30e5\u30fc\u306b\u5165\u308b\u304c\u3001\u3044\u304f\u3064\u304b\u306e\u72b6\u6cc1\u3067\u306f\u30b0\u30ed\u30fc\u30d0\u30eb\u30ad\u30e5\u30fc\u306b\u5165\u308b\u3002<br \/>\n\u3053\u306e\u30b0\u30ed\u30fc\u30d0\u30eb\u30ad\u30e5\u30fc\u306f\u3001\u4ee5\u4e0b\u306e\u6642\u306b\u53d6\u308a\u51fa\u3055\u308c\u308b\u3002<\/p>\n<p>M\u306e\u81ea\u5206\u306e\u30ad\u30e5\u30fc\u304c\u7a7a\u306e\u6642\u306b\u53d6\u308a\u51fa\u3059<br \/>\nM\u306e\u81ea\u5206\u306e\u30ad\u30e5\u30fc\u304c\u307e\u3060\u3042\u3063\u305f\u3068\u3057\u3066\u308261\u56de\u306b1\u5ea6\u53d6\u308a\u51fa\u3059\uff08\u305d\u3046\u3084\u3063\u3066\u30b0\u30ed\u30fc\u30d0\u30eb\u30ad\u30e5\u30fc\u304c\u305a\u3063\u3068\u5b9f\u884c\u3055\u308c\u306a\u3044\u3053\u3068\u3092\u9632\u3050\uff09<\/p>\n<p>sysmon<\/p>\n<p>\u57fa\u672c\u7684\u306bGOMAXPROCS\u306e\u6570\u3060\u3051\u306eM\u3068P\u306e\u30bb\u30c3\u30c8\u304c\u52d5\u3044\u3066\u308b\u3001\u3068\u3044\u3046\u8aac\u660e\u3092\u3057\u3066\u304d\u305f\u304c\u3001\u305d\u308c\u3068\u306f\u5225\u306bsysmon\u3068\u3044\u3046\u95a2\u6570\u3092\u5b9f\u884c\u3057\u7d9a\u3051\u308b\u7279\u5225\u306aM\u304c\u5b58\u5728\u3059\u308b\u3002\u3053\u308c\u306fP\u7121\u3057\u3067\u5b9f\u884c\u3055\u308c\u308b\u3002<br \/>\n\u3053\u306esysmon\u306f\u51e6\u7406\u672c\u4f53\u306f\u7121\u9650\u30eb\u30fc\u30d7\u306b\u306a\u3063\u3066\u304a\u308a\u3001\u305d\u306e\u30eb\u30fc\u30d7\u306e\u4e2d\u3067\u5f8c\u8ff0\u3059\u308bnetpoll\u306e\u30c1\u30a7\u30c3\u30af\u3084\u3001\u5b9f\u884c\u6642\u9593\u306e\u9577\u3044G\u306e\u30d7\u30ea\u30a8\u30f3\u30d7\u30c8\u3001\u5fc5\u8981\u304c\u3042\u308c\u3070GC\u7528\u306eG\u3092\u30b0\u30ed\u30fc\u30d0\u30eb\u30ad\u30e5\u30fc\u306b\u8ffd\u52a0\u3001\u306a\u3069\u3092\u884c\u3063\u3066\u3044\u308b\u3002<\/p>\n<p>P idle list<\/p>\n<p>P\u306f\u4ed6\u306b\u3084\u308b\u3053\u3068\u304c\u306a\u3051\u308c\u3070P idle list\u306b\u5165\u308c\u3089\u308c\u308b\u3002<\/p>\n<p>M idle list<\/p>\n<p>M\u3082\u4ed6\u306b\u3084\u308b\u3053\u3068\u304c\u306a\u3051\u308c\u3070M idle list\u306b\u5165\u308c\u3089\u308c\u308b\u3002<\/p>\n<h1>\u5f53\u6267\u884csyscall\u65f6<\/h1>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/16-1.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2018-02-16 1.35.34.png\" \/><\/div>\n<p>\u5f53syscall\u7ed3\u675f\u540e\uff0c\u9996\u5148\u4f1a\u68c0\u67e5\u662f\u5426\u6709\u7a7a\u95f2\u7684\u8fdb\u7a0b\uff0c\u5982\u679c\u6709\uff0c\u5219\u5c06\u5176\u53d6\u51fa\u5e76\u7ee7\u7eed\u5904\u7406\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/18-1.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2018-02-19 1.41.58.png\" \/><\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/19-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2018-02-16 1.35.53.png\" \/><\/div>\n<h1>\u5f53\u7f51\u7edc\u5904\u7406\u540e<\/h1>\n<p>\u7f51\u7edc\u5904\u7406\u4e2d\u5f15\u5165\u4e86\u4e00\u4e2a\u79f0\u4e3anetpoller\u7684\u673a\u5236\u3002Go\u8bed\u8a00\u5e93\u63d0\u4f9b\u7684\u7f51\u7edc\u5904\u7406API\u5728\u64cd\u4f5c\u4e0a\u662f\u963b\u585e\u7684\uff0c\u4f46\u662fnetpoller\u5728\u8fd0\u884c\u65f6\u5c06\u5176\u8f6c\u5316\u4e3a\u975e\u963b\u585e\u7684\u5904\u7406\u3002\u8fd9\u79cd\u975e\u963b\u585e\u7684\u5904\u7406\u5b9e\u9645\u4e0a\u5229\u7528\u4e86\u64cd\u4f5c\u7cfb\u7edf\u63d0\u4f9b\u7684\u529f\u80fd\uff0c\u6bd4\u5982\u5728Linux\u4e2d\u4f7f\u7528epoll\uff0c\u5728BSD\u4e2d\u4f7f\u7528kqueue\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/22-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2018-02-17 23.08.46.png\" \/><\/div>\n<p>\u5728\u4f7f\u7528epoll\u7684\u5b9e\u73b0\u4e2d\uff0c\u8fd9\u4e9b\u90e8\u5206\u4f7f\u7528epoll_ctl\u8fdb\u884c\u6ce8\u518c\uff0c\u4f7f\u7528epoll_wait\u8fdb\u884c\u53d6\u5f97\u3002<\/p>\n<h1>\u5f53G\u7684\u6267\u884c\u65f6\u95f4\u5f88\u957f\u65f6<\/h1>\n<p>\u5982\u679cM\u6301\u7eed\u6267\u884c\u76f8\u540c\u7684G\uff08\u81f3\u5c1110\u6beb\u79d2\uff09\uff0c\u90a3\u4e48\u4e5f\u6709\u80fd\u529b\u62a2\u5360\u8be5G\u3002<br \/>\n\u5f53sysmon\u53d1\u73b0\u6b63\u5728\u6267\u884c\u7684G\u82b1\u8d39\u8d85\u8fc710\u6beb\u79d2\u65f6\uff0c\u5c06\u628a\u8be5G\u7684preempt\u6807\u5fd7\u8bbe\u4e3atrue\u3002\u4f46\u5728\u8fd9\u4e2a\u65f6\u5019\u8fd8\u4e0d\u4f1a\u8fdb\u884c\u62a2\u5360\u3002<br \/>\n\u5b9e\u9645\u4e0a\u62a2\u5360\u7684\u662f\u88ab\u6807\u8bb0\u7684\u4e00\u65b9\u3002\u5f53\u88ab\u6807\u8bb0\u7684G\u8fdb\u884c\u51fd\u6570\u8c03\u7528\u65f6\uff0c\u4f1a\u68c0\u67e5\u81ea\u5df1\u7684preempt\u6807\u5fd7\uff0c\u5982\u679c\u4e3atrue\uff0c\u5219\u5c06\u5176\u5165\u961f\u5230\u5168\u5c40\u961f\u5217\u4e2d\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/26-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2018-02-18 1.29.44.png\" \/><\/div>\n<h1>\u6536\u5230\/\u53d1\u9001 channel \u65f6<\/h1>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/28-0.png\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2018-02-18 1.39.40.png\" \/><\/div>\n<h1>Golang\u6e90\u4ee3\u7801\u7684\u904d\u5386\u65b9\u6cd5<\/h1>\n<p>\u5230\u6b64\u4e3a\u6b62\uff0c\u5173\u4e8e\u8fd0\u884c\u65f6\u7684\u52a8\u4f5c\u8c08\u8bba\u7ed3\u675f\u4e86\u3002<br \/>\n\u5f53\u9605\u8bfbGo\u5e93\u7684\u6e90\u4ee3\u7801\u65f6\uff0c\u6709\u65f6\u4f1a\u9047\u5230\u58f0\u660e\u4f46\u6ca1\u6709\u5b9e\u73b0\u7684\u51fd\u6570\u3002\u8fd9\u53ef\u80fd\u662f\u7531\u4e8e\u4f7f\u7528\u4e86go:linkname\u6307\u4ee4\u6216\u8005\u662f\u5728\u6c47\u7f16\u8bed\u8a00\u4e2d\u5b9a\u4e49\u7684\u60c5\u51b5\u3002<br \/>\n\u5bf9\u4e8ego:linkname\u6307\u4ee4\u7684\u60c5\u51b5\uff0c\u53ef\u4ee5\u901a\u8fc7\u641c\u7d22^\/\/go:linkname \\S* importpath\\.name\u627e\u5230\u5bf9\u5e94\u7684\u51fd\u6570\u3002\u4f8b\u5982\uff0cpoll.runtime_pollWait\u5c31\u662f\u4e00\u4e2a\u4f8b\u5b50\uff0c\u53ef\u4ee5\u901a\u8fc7\u641c\u7d22^\/\/go:linkname \\S+ internal\/poll\\.runtime_pollWait\u627e\u5230\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n<pre class=\"post-pre\"><code>$ grep -P -r '^\/\/go:linkname \\S+ internal\/poll\\.runtime_pollWait' .\r\n.\/runtime\/netpoll.go:\/\/go:linkname poll_runtime_pollWait internal\/poll.runtime_pollWait\r\n.\/runtime\/netpoll.go:\/\/go:linkname poll_runtime_pollWaitCanceled internal\/poll.runtime_pollWaitCanceled\r\n<\/code><\/pre>\n<p>\u6362\u53e5\u8bdd\u8bf4\uff0c\u5b9e\u65bd\u5c31\u662f\u8fd9\u4e2a\u3002<\/p>\n<ul class=\"post-ul\">https:\/\/github.com\/golang\/go\/blob\/go1.9.3\/src\/runtime\/netpoll.go#L164<\/ul>\n<p>\u53c2\u8003: https:\/\/golang.org\/cmd\/compile\/#hdr-\u7f16\u8bd1\u5668\u6307\u4ee4<\/p>\n<p>\u5982\u679c\u5728\u6c47\u7f16\u8bed\u8a00\u4e2d\u5b9a\u4e49\uff0c\u53ef\u4ee5\u901a\u8fc7^TEXT.*\u00b7Name\\\u8fdb\u884c\u641c\u7d22\u5f97\u5230\uff08\u8bf7\u6ce8\u610f\uff0c\u5728Name\u4e4b\u524d\u4f7f\u7528\u7684\u4e0d\u662f.\u800c\u662f\u00b7(U+00B7)\uff09\u3002\u4f8b\u5982\uff0csyscall.Syscall\u5c31\u662f\u8fd9\u6837\u3002<\/p>\n<pre class=\"post-pre\"><code>$ grep -P -r '^TEXT.*\u00b7Syscall\\('\r\nsyscall\/asm_darwin_386.s:TEXT   \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_darwin_amd64.s:TEXT \u00b7Syscall(SB),NOSPLIT,$0-56\r\nsyscall\/asm_darwin_arm.s:TEXT   \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_darwin_arm64.s:TEXT \u00b7Syscall(SB),NOSPLIT,$0-56\r\nsyscall\/asm_freebsd_arm.s:TEXT  \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_linux_386.s:TEXT    \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_linux_amd64.s:TEXT  \u00b7Syscall(SB),NOSPLIT,$0-56\r\nsyscall\/asm_linux_arm.s:TEXT    \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_linux_arm64.s:TEXT  \u00b7Syscall(SB),NOSPLIT,$0-56\r\nsyscall\/asm_linux_mips64x.s:TEXT    \u00b7Syscall(SB),NOSPLIT,$0-56\r\nsyscall\/asm_linux_mipsx.s:TEXT  \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_linux_ppc64x.s:TEXT \u00b7Syscall(SB),NOSPLIT,$0-56\r\nsyscall\/asm_linux_s390x.s:TEXT \u00b7Syscall(SB),NOSPLIT,$0-56\r\nsyscall\/asm_nacl_386.s:TEXT \u00b7Syscall(SB),NOSPLIT,$12-28\r\nsyscall\/asm_nacl_amd64p32.s:TEXT \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_nacl_arm.s:TEXT \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_netbsd_arm.s:TEXT   \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_openbsd_arm.s:TEXT  \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_plan9_386.s:TEXT    \u00b7Syscall(SB),NOSPLIT,$0-32\r\nsyscall\/asm_plan9_amd64.s:TEXT  \u00b7Syscall(SB),NOSPLIT,$0-64\r\nsyscall\/asm_plan9_arm.s:TEXT    \u00b7Syscall(SB),NOSPLIT,$0-32\r\nsyscall\/asm_solaris_amd64.s:TEXT \u00b7Syscall(SB),NOSPLIT,$0\r\nsyscall\/asm_unix_386.s:TEXT \u00b7Syscall(SB),NOSPLIT,$0-28\r\nsyscall\/asm_unix_amd64.s:TEXT   \u00b7Syscall(SB),NOSPLIT,$0-56\r\n<\/code><\/pre>\n<p>\u53c2\u8003\uff1ahttps:\/\/golang.org\/doc\/asm#directives\u3002<\/p>\n<p>\u53e6\u5916\uff0c\u5728\u6587\u4ef6\u540d\u4e2d\u53ef\u4ee5\u6307\u5b9a\u64cd\u4f5c\u7cfb\u7edf\u548c\u67b6\u6784\uff0c\u8bed\u6cd5\u4e3aname_GOOS_GOARCH\u3002<br \/>\n\u53c2\u8003\u94fe\u63a5\uff1ahttps:\/\/golang.org\/pkg\/go\/build\/#hdr-Build_Constraints<\/p>\n<h1>\u8bf7\u53c2\u8003<\/h1>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">The Go scheduler &#8211; Morsing&#8217;s blog<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">The Go netpoller &#8211; Morsing&#8217;s blog<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GOMAXPROCS | Dave Cheney<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Golang\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u7814\u7a76\u3059\u308b(\u4e8c) goroutine\u306e\u52d5\u4f5c\u539f\u7406 &#8211; Qiita<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">channel &#8211; go routine blocking the others one &#8211; Stack Overflow<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">100\u4e07\u56de\u306eWebSocket\u63a5\u7d9a\u3068Go | \u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 | POSTD<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Golang \u5783\u573e\u56de\u6536\u5256\u6790 | Legendtkl<\/ul>\n<h1>\u4e3b\u8981\u53c2\u8003\u7684\u6e90\u4ee3\u7801<\/h1>\n<p>https:\/\/github.com\/golang\/go\/blob\/go1.9.3\/src\/runtime\/proc.go<\/p>\n<p>sysmon, entersyscall, exitsyscall, schedule\u3089\u3078\u3093<\/p>\n<p>https:\/\/github.com\/golang\/go\/blob\/go1.9.3\/src\/runtime\/runtime2.go<\/p>\n<p>G, M, P\u306e\u5b9a\u7fa9<\/p>\n<p>https:\/\/github.com\/golang\/go\/blob\/go1.9.3\/src\/runtime\/chan.go<\/p>\n<p>channel<\/p>\n<p>https:\/\/github.com\/golang\/go\/blob\/go1.9.3\/src\/runtime\/netpoll.go<\/p>\n<p>https:\/\/github.com\/golang\/go\/blob\/go1.9.3\/src\/runtime\/netpoll_epoll.go<\/p>\n<p>netpoll<\/p>\n<p>https:\/\/github.com\/golang\/go\/blob\/master\/src\/runtime\/stack.go<\/p>\n<p>newstack(preempt\u306e\u8a71\u306e\u3068\u3053\u308d)<\/p>\n<div>\n<p>\u4eceGo1.5\u5f00\u59cb\u3002\u5728\u6b64\u4e4b\u524d\u9ed8\u8ba4\u503c\u4e3a1\u3002\u6b64\u5916\uff0c\u8fd8\u4e0e\u903b\u8f91\u6838\u5fc3\u6570\u91cf\u6709\u5173\uff0c\u5982\u679c\u6709\u8d85\u7ebf\u7a0b\u6280\u672f\u5219\u4e3a\u4e24\u500d\u3002<\/p>\n<p>\u6211\u5e0c\u671b\u5728\u9605\u8bfb\u6e90\u4ee3\u7801\u65f6\u53ef\u4ee5\u66f4\u5bb9\u6613\u5730\u8fdb\u884c\u641c\u7d22\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5373\u4f7fGOMAXPROCS\u8bbe\u7f6e\u4e3a2\uff0cM\uff08\u4e0esysmon\u76f8\u7ed3\u5408\uff09\u4e5f\u5fc5\u987b\u662f4\u6216\u66f4\u591a\u3002<\/p>\n<p>\u53ef\u80fd\u8fd8\u6709\u5176\u4ed6\u60c5\u51b5\uff0c\u4f46\u6211\u9047\u5230\u4e86\u8fd9\u4e24\u79cd\u60c5\u51b5\u3002<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u6211\u4eca\u5e74\u5f00\u59cb\u5728\u5de5\u4f5c\u4e2d\u4f7f\u7528Golang\u7f16\u5199\u4ee3\u7801\uff0c\u6240\u4ee5\u7814\u7a76\u4e86\u4e00\u4e0b\u8c03\u5ea6\u5668\u3002\u67e5\u4e86\u4e00\u4e0b\u8d44\u6599\uff0c\u53d1\u73b0\u4e0d\u592a\u591a\uff0c\u6240\u4ee5\u6211\u603b\u7ed3\u4e86 [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-44656","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5173\u4e8eGolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898 - Blog - Silicon Cloud<\/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.silicloud.com\/zh\/blog\/\u5173\u4e8egolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5173\u4e8eGolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148 \u6211\u4eca\u5e74\u5f00\u59cb\u5728\u5de5\u4f5c\u4e2d\u4f7f\u7528Golang\u7f16\u5199\u4ee3\u7801\uff0c\u6240\u4ee5\u7814\u7a76\u4e86\u4e00\u4e0b\u8c03\u5ea6\u5668\u3002\u67e5\u4e86\u4e00\u4e0b\u8d44\u6599\uff0c\u53d1\u73b0\u4e0d\u592a\u591a\uff0c\u6240\u4ee5\u6211\u603b\u7ed3\u4e86 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u5173\u4e8egolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-21T22:13:13+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-29T08:32:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/9-0.png\" \/>\n<meta name=\"author\" content=\"\u9038, \u79d1\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u9038, \u79d1\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/\",\"name\":\"\u5173\u4e8eGolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-08-21T22:13:13+00:00\",\"dateModified\":\"2024-04-29T08:32:46+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5173\u4e8eGolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487\",\"name\":\"\u9038, \u79d1\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g\",\"caption\":\"\u9038, \u79d1\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keyi\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u5173\u4e8eGolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898 - Blog - Silicon Cloud","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.silicloud.com\/zh\/blog\/\u5173\u4e8egolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u5173\u4e8eGolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898","og_description":"\u9996\u5148 \u6211\u4eca\u5e74\u5f00\u59cb\u5728\u5de5\u4f5c\u4e2d\u4f7f\u7528Golang\u7f16\u5199\u4ee3\u7801\uff0c\u6240\u4ee5\u7814\u7a76\u4e86\u4e00\u4e0b\u8c03\u5ea6\u5668\u3002\u67e5\u4e86\u4e00\u4e0b\u8d44\u6599\uff0c\u53d1\u73b0\u4e0d\u592a\u591a\uff0c\u6240\u4ee5\u6211\u603b\u7ed3\u4e86 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u5173\u4e8egolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-08-21T22:13:13+00:00","article_modified_time":"2024-04-29T08:32:46+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d5a1537434c4406ce532c\/9-0.png"}],"author":"\u9038, \u79d1","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u9038, \u79d1","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/","name":"\u5173\u4e8eGolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-08-21T22:13:13+00:00","dateModified":"2024-04-29T08:32:46+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u5173\u4e8eGolang\u8c03\u5ea6\u5668\u4e00\u7c7b\u7684\u8bdd\u9898"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/85c1dae56e6ea1e695c73d33c684d487","name":"\u9038, \u79d1","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c94f6d9cbbfbca863fab309840bd690c153c95f8490c290ad2ed54dd693dad16?s=96&d=mm&r=g","caption":"\u9038, \u79d1"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keyi\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e5%85%b3%e4%ba%8egolang%e8%b0%83%e5%ba%a6%e5%99%a8%e4%b8%80%e7%b1%bb%e7%9a%84%e8%af%9d%e9%a2%98%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/44656","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=44656"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/44656\/revisions"}],"predecessor-version":[{"id":86386,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/44656\/revisions\/86386"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=44656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=44656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=44656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}