{"id":318598,"date":"2021-02-05T03:31:45","date_gmt":"2021-02-04T19:31:45","guid":{"rendered":"http:\/\/4563.org\/?p=318598"},"modified":"2021-02-05T03:31:45","modified_gmt":"2021-02-04T19:31:45","slug":"%e6%ad%a3%e5%b8%b8%e7%9a%84-while-true-%e4%b8%ba%e4%bb%80%e4%b9%88%e4%b8%8d%e5%8a%a0-sleep-%e4%b9%9f%e4%b8%8d%e4%bc%9a%e8%80%97%e5%b0%bd-cpu%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=318598","title":{"rendered":"\u6b63\u5e38\u7684 while true \u4e3a\u4ec0\u4e48\u4e0d\u52a0 sleep \u4e5f\u4e0d\u4f1a\u8017\u5c3d cpu\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6b63\u5e38\u7684 while true \u4e3a\u4ec0\u4e48\u4e0d\u52a0 sleep \u4e5f\u4e0d\u4f1a\u8017\u5c3d cpu\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : pinews <\/span>  <span><i><\/i> 10<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u5355\u7ebf\u7a0b\u554a\u5927\u54e5      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>15<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5009964\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : YouLMAO <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5355\u8fdb\u7a0b,\u6bcf\u4e2a\u8fdb\u7a0b\u7684\u8d44\u6e90\u662f\u6709\u9650\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009965\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : linksNoFound <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f1a\u8017\u5c3d\u5355 CPU \u7684\u8d44\u6e90                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009966\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wakzz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u8981\u770b\u603b\u6570\uff0c\u770b\u5355\u4e2a CPU \u7684\u5360\u7528\uff0c\u80af\u5b9a\u662f 100%\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009967\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jackmod <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8865\u5145\uff1a\u5982\u679c\u5355\u6838\u5360\u6ee1\u4e86\uff0cCPU \u540c\u6837\u4f1a\u8fc7\u70ed\uff0c\u7136\u540e\u98ce\u6247\u72c2\u8f6c\u3002\u8fd9\u79cd\u6d6a\u8d39\u662f\u6211\u96be\u4ee5\u5fcd\u53d7\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009968\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jackmod <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u64cd\u4f5c\u7cfb\u7edf\u8fd8\u662f\u5927 boss\uff0c\u5b83\u968f\u65f6\u80fd\u4e2d\u6b62\u7a0b\u5e8f\u7684\u6267\u884c\u3002<br \/>\u6240\u6709\u7a0b\u5e8f\u90fd\u662f\u5206\u65f6\u95f4\u7247\u6267\u884c\uff0c\u603b\u4f1a\u8fd4\u56de\u5185\u6838\uff0c\u5b83\u6c38\u8fdc\u4e0d\u4f1a\u5360\u7528 100%\u7684\u65f6\u95f4\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009969\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wangxn <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u80fd\u8017\u5c3d\u4e00\u4e2a\u6838<\/p>\n<p>\u5982\u679c\u662f 8 \u6838\u7684\u673a\u5668\u641e\u4e00\u4e2a\u6b7b\u5faa\u73af\u7136\u540e\u53bb\u770b cpu.busy \u7684\u76d1\u63a7\u4f1a\u53d1\u73b0\u4e00\u6761 12.5% \u5de6\u53f3\u7684\u7ebf                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009970\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jooooooooo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6240\u8c13\u6b63\u5e38 while \u90a3\u5c31\u662f\u91cc\u8fb9\u8fd8\u591a\u5c11\u6267\u884c\u4e86\u70b9\u513f\u6b63\u7ecf\u5185\u5bb9\u7684\u5457<br \/>\u6b63\u7ecf\u5185\u5bb9\u5f88\u96be\u8dd1\u6ee1 cpu \u7684\uff0c\u591a\u5c11\u4f1a\u6709\u70b9 iowait \u5565\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009971\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u8bf4\u6b63\u5e38\u7684 while true \u662f\u6b63\u5e38\u4f7f\u7528\u7684\u3002\u6bd4\u5982 kafka \u7684 php \u793a\u4f8b\u5c31\u662f while true \u6211\u770b cpu \u4e5f\u6ca1\u4ec0\u4e48\u53d8\u5316\uff0c\u5982\u679c\u8dd1\u6ee1 4 \u6838\u4e0d\u662f\u8981\u5360\u5230 25 33 \uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009972\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : pinews <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u81ea\u5df1\u53bb\u590d\u4e60\u591a\u4efb\u52a1<br \/>\u6b63\u5e38\u7684 while\uff0c\u7528\u4e2d\u65ad\u53ef\u4ee5\u8df3\u51fa\u53bb\u6267\u884c\u522b\u7684\uff0c\u4e0d\u4f1a\u5361\u6b7b\u3002\u7cfb\u7edf\u6709\u4e2a\u4e2d\u65ad\u5411\u91cf\u8868\uff0c\u800c\u4e14\u4f1a\u7ba1\u7406\u591a\u4efb\u52a1\uff0c\u6b63\u5e38\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u8ba9\u4e00\u4e2a\u8fdb\u7a0b\u72ec\u5360\u6240\u6709\u7684\u8d44\u6e90                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009973\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : systemcall <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @wangxn \u5982\u679c while(true){};\u90a3\u662f\u4e0d\u662f\u4ed6\u628a\u6240\u6709\u65f6\u95f4\u7247\u90fd\u5360\u7528\u4e86\uff0c\u6240\u4ee5\u4f1a 100%<br \/>@julyclyde iowait \u662f\u5565\uff1f\u5927\u6982\u4e86\u89e3\u4e86\u4e00\u4e0b\uff0c\u5982\u679c cpu \u867d\u7136\u4e0d\u7528\u5e72\u6d3b\uff0c\u4f46\u662f\u4e5f\u4e0d\u80fd\u5e72\u522b\u7684\uff0c\u90a3\u6709\u4ec0\u4e48\u533a\u522b?<br \/>@systemcall \u7a0b\u5e8f\u662f\u600e\u4e48\u8c03\u7528\u4e2d\u65ad\u7684\uff1f\u6bd4\u5982\u6d88\u606f\u961f\u5217\uff0c\u6211\u5230 github \u4e0a\u641c\u6e90\u4ee3\u7801\uff0c\u770b\u4e0d\u61c2\uff0c\u4e5f\u6ca1\u627e\u5230\u4ec0\u4e48\u60f3\u8981\u4e86\u89e3\u7684\u4fe1\u606f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009974\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : pinews <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @pinews IO \u7684\u65f6\u5019\u8fd9\u4e2a\u7a0b\u5e8f\u662f\u6ca1\u529e\u6cd5\u6267\u884c\u4e0b\u53bb\u7684\uff0c\u53ea\u80fd\u7b49<br \/>cpu \u53ef\u4ee5\u53bb\u5e72\u522b\u7684\uff0c\u5982\u679c\u6709\u522b\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009975\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : julyclyde <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8c03\u5ea6\u7b56\u7565\u662f\u5145\u5206\u5229\u7528 cpu \u8d44\u6e90\uff0c\u9632\u6b62\u6709\u8fdb\u7a0b\u60f3\u8981\u8d44\u6e90\u5374\u5f97\u4e0d\u5230\u6ee1\u8db3\uff0c\u5f53\u4f60\u53ea\u6709\u4e00\u4e2a\u6b7b\u5faa\u73af\u7684\u65f6\u5019\uff0c\u8c03\u5ea6\u7684\u8d44\u6e90\u5c31\u90fd\u7ed9\u90a3\u4e2a\u8fdb\u7a0b\u4e86\uff0c\u6240\u4ee5\u5c31\u8868\u73b0\u4e3a 100%\u4e86\uff0c\u56e0\u4e3a\u5b83\u4e0d\u65ad\u7684\u60f3\u8981 cpu\uff0c\u6ca1\u6709\u5176\u5b83\u4efb\u52a1\u548c\u5b83\u62a2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009976\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sryanyuan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @pinews <br \/>\u91cc\u9762\u7684\u6267\u884c\u4efb\u52a1\u91cc\u6709\u540c\u6b65\u963b\u585e                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009977\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ben1024 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @ben1024 \u963b\u585e\u5c31\u662f\u8d85\u65f6\u7b49\u5f85\u5427\uff1f<\/p>\n<p>\u6211\u501f\u4e4b\u524d\u4e00\u4e2a\u7f51\u53cb\u53bb\u5feb\u9012\u70b9\u53d6\u5feb\u9012\u7684\u4f8b\u5b50\u603b\u7ed3\u4e0b\u3002<\/p>\n<p>\u7b2c\u4e00\u4e2a\u662f\uff0c\u53bb\u4e86\u53d1\u73b0\u6ca1\u6709\u5c31\u56de\u6765\uff0c\u7136\u540e\u9a6c\u4e0a\u518d\u63a5\u7740\u53bb\uff08\u5f88\u7d2f\u5f88\u8822\uff0c\u56e0\u4e3a\u672c\u6765\u662f\u9884\u8ba1\u5df2\u7ecf\u5230\u4e86\uff0c\u53ea\u53d6\u4e00\u6b21\u7684\uff09<br \/>\u7b2c\u4e8c\u4e2a\u662f\uff0c\u53bb\u4e86\u53d1\u73b0\u6ca1\u6709\u5c31\u56de\u6765\uff0c\u8fc7\u4e00\u4f1a\uff08 sleep \uff09\u518d\u53bb\uff08\u4e0d\u7d2f\u4e86\uff0c\u4f46\u662f\u4f1a\u4e0d\u53ca\u65f6\uff09<br \/>\u7b2c\u4e09\u4e2a\u662f\uff0c\u53bb\u4e86\u8fd4\u73b0\u6ca1\u6709\uff0c\u5c31\u5728\u90a3\u91cc\u7b49\uff0c\u5982\u679c\u5728\u8fd9\u4e2a\u65f6\u95f4\u91cc\u6ca1\u7b49\u5230\u5c31\u56de\u6765\uff0c\u7136\u540e\u63a5\u7740\u53bb\uff0c\u4f46\u662f\u5f88\u6709\u53ef\u80fd\u7b49\u5230\uff0c\u6216\u8005\u5e72\u8106\u7b49\u4e0d\u5230\u5c31\u4e0d\u56de\u6765\uff0c\u76f4\u5230\u7b49\u5230\u624d\u56de\u53bb\uff08\u4e0d\u7d2f\u4e5f\u5f88\u53ca\u65f6\uff0c\u4f46\u662f\u8981\u5feb\u70b9\u9012\u652f\u6301\u5728\u91cc\u9762\u7b49\uff09<\/p>\n<p>\u4f8b\u5b50\u4e0d\u662f\u5f88\u6070\u5f53\uff0c\u5927\u6982\u662f\u8fd9\u4e2a\u610f\u601d\u5427\uff0c\u90a3\u4e2a iowait \u5e94\u8be5\u662f\u7b2c\u4e09\u79cd\u5427\uff0c\u6240\u4ee5 while true \u6ca1 sleep \u80fd\u53c8\u5feb\u53c8\u8f7b\u677e\u5b8c\u6210\u4efb\u52a1\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5009978\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : pinews <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @pinews <br \/>\u53ef\u80fd\u662f\u7b2c\u4e8c\u79cd\uff0csleep \u7684\u65f6\u95f4\u77ed\uff0c\u7136\u540e\u5728\u9a8c\u8bc1\u4e0b\u961f\u5217\u6d88\u606f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6b63\u5e38\u7684 while true \u4e3a\u4ec0&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/318598"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=318598"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/318598\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=318598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=318598"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=318598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}