{"id":200435,"date":"2024-05-10T01:47:38","date_gmt":"2024-05-09T17:47:38","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/200435.html"},"modified":"2024-05-10T01:47:41","modified_gmt":"2024-05-09T17:47:41","slug":"linux%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%bb%9f%e9%87%87%e7%94%a8%e7%9a%84%e8%bf%9b%e7%a8%8b%e8%b0%83%e5%ba%a6%e7%ae%97%e6%b3%95%e6%98%af%e4%bb%80%e4%b9%88","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/200435.html","title":{"rendered":"Linux\u64cd\u4f5c\u7cfb\u7edf\u91c7\u7528\u7684\u8fdb\u7a0b\u8c03\u5ea6\u7b97\u6cd5\u662f\u4ec0\u4e48"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24141154\/aadc043e-e023-495c-9b89-6458f4346d79.webp\" alt=\"Linux\u64cd\u4f5c\u7cfb\u7edf\u91c7\u7528\u7684\u8fdb\u7a0b\u8c03\u5ea6\u7b97\u6cd5\u662f\u4ec0\u4e48\" \/><\/p>\n<p><p>Linux\u64cd\u4f5c\u7cfb\u7edf\u4e3b\u8981\u91c7\u7528\u7684\u8fdb\u7a0b\u8c03\u5ea6\u7b97\u6cd5\u662f<strong>\u57fa\u4e8e\u65f6\u95f4\u7247\u7684\u591a\u7ea7\u53cd\u9988\u961f\u5217\u8c03\u5ea6\u7b97\u6cd5\uff08CFS &#8211; Completely F<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>r Scheduler\uff09<\/strong>\u3002\u8fd9\u4e00\u7b97\u6cd5\u7684\u6838\u5fc3\u4eae\u70b9<strong>\u5728\u4e8e\u5b83\u5c1d\u8bd5\u4e3a\u6bcf\u4e2a\u8fd0\u884c\u8fdb\u7a0b\u63d0\u4f9b\u5c3d\u53ef\u80fd\u516c\u5e73\u7684\u5904\u7406\u5668\u65f6\u95f4\u5206\u914d<\/strong>\uff0c\u4fdd\u969c\u4e86\u7cfb\u7edf\u7684\u54cd\u5e94\u65f6\u95f4\u548c\u4f5c\u4e1a\u7684\u5904\u7406\u6548\u7387\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u591a\u7ea7\u53cd\u9988\u961f\u5217\u8c03\u5ea6\u7b97\u6cd5\u7b80\u4ecb<\/h3>\n<\/p>\n<p><p>\u591a\u7ea7\u53cd\u9988\u961f\u5217\u8c03\u5ea6\uff08MFQ\uff09\u7b97\u6cd5\u662f\u4e00\u4e2a\u7ecf\u5178\u7684\u8fdb\u7a0b\u8c03\u5ea6\u65b9\u5f0f\uff0c\u5b83\u65e2\u8003\u91cf\u4e86\u8fdb\u7a0b\u7684\u4f18\u5148\u7ea7\uff0c\u4e5f\u517c\u987e\u5230\u4e86\u8fdb\u7a0b\u7684\u8fd0\u884c\u65f6\u95f4\uff0c\u5c3d\u91cf\u505a\u5230\u65e2\u516c\u5e73\u53c8\u9ad8\u6548\u3002<strong>\u8fdb\u7a0b\u88ab\u5206\u914d\u5230\u4e0d\u540c\u7684\u961f\u5217\u4e2d<\/strong>\uff0c\u6bcf\u4e2a\u961f\u5217\u5177\u6709\u4e0d\u540c\u7684\u4f18\u5148\u7ea7\u548c\u65f6\u95f4\u7247\u914d\u989d\uff1b\u901a\u5e38\u60c5\u51b5\u4e0b\uff0c\u65b0\u8fdb\u7a0b\u88ab\u653e\u7f6e\u5728\u4f18\u5148\u7ea7\u6700\u9ad8\u7684\u961f\u5217\u3002\u5982\u679c\u5728\u5206\u914d\u7684\u65f6\u95f4\u7247\u5185\u6ca1\u6709\u5b8c\u6210\u4efb\u52a1\uff0c\u8fdb\u7a0b\u5c31\u4f1a\u88ab\u964d\u7ea7\u5230\u4e0b\u4e00\u7ea7\u961f\u5217\u3002\u8fd9\u79cd\u65b9\u6cd5\u53ef\u4ee5\u52a8\u6001\u8c03\u6574\u8d44\u6e90\u5206\u914d\uff0c\u4f18\u5148\u4fdd\u8bc1\u91cd\u8981\u4e14\u77ed\u65f6\u4efb\u52a1\u7684\u54cd\u5e94\u6027\u3002<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u591a\u7ea7\u53cd\u9988\u961f\u5217\u8c03\u5ea6\u7b97\u6cd5\u901a\u8fc7\u8bbe\u7f6e\u591a\u4e2a\u961f\u5217\uff0c\u4e0d\u540c\u961f\u5217\u5177\u6709\u4e0d\u540c\u7684\u65f6\u95f4\u7247\u957f\u5ea6\uff0c\u6765\u533a\u5206\u8fdb\u7a0b\u7684\u4f18\u5148\u7ea7\u3002\u65b0\u5230\u7684\u4efb\u52a1\u9996\u5148\u88ab\u653e\u5728\u5177\u6709\u6700\u5c0f\u65f6\u95f4\u7247\u7684\u961f\u5217\uff0c\u8fd9\u6837\u80fd\u8fc5\u901f\u54cd\u5e94\u3002\u5982\u679c\u4efb\u52a1\u5728\u8be5\u65f6\u95f4\u7247\u5185\u5b8c\u6210\u5219\u9000\u51fa\u7cfb\u7edf\uff0c\u5426\u5219\u88ab\u79fb\u5230\u4e0b\u4e00\u4e2a\u961f\u5217\uff0c\u5176\u65f6\u95f4\u7247\u66f4\u957f\uff0c\u4f46\u4f18\u5148\u7ea7\u8f83\u4f4e\u3002\u8fd9\u6837\u786e\u4fdd\u4e86\u5bf9\u4e8e\u4e0d\u540c\u7c7b\u578b\u7684\u4efb\u52a1\u90fd\u80fd\u76f8\u5bf9\u516c\u5e73\u5730\u5206\u914d\u5904\u7406\u5668\u8d44\u6e90\u3002<\/p>\n<\/p>\n<p><h3>\u4e8c\u3001CFS\u8c03\u5ea6\u5668\u7684\u5de5\u4f5c\u539f\u7406<\/h3>\n<\/p>\n<p><p>CFS\uff08Completely Fair Scheduler\uff09\u8c03\u5ea6\u7b97\u6cd5\u4f5c\u4e3aLinux\u7cfb\u7edf\u4e2d\u7684\u9ed8\u8ba4\u8c03\u5ea6\u7b97\u6cd5\uff0c\u65e8\u5728\u63d0\u4f9b\u5c3d\u53ef\u80fd\u5b8c\u7f8e\u7684\u516c\u5e73\u6027\u3002\u5b83\u4f7f\u7528\u7ea2\u9ed1\u6811\u7ba1\u7406\u6240\u6709\u53ef\u8fd0\u884c\u7684\u4efb\u52a1\uff0c\u6bcf\u4e2a\u8282\u70b9\u4ee3\u8868\u4e00\u4e2a\u8fdb\u7a0b\uff0c\u5176\u952e\u503c\u662f\u4efb\u52a1\u7684\u865a\u62df\u8fd0\u884c\u65f6\u95f4\u3002<strong>CFS\u7684\u76ee\u6807\u662f\u4f7f\u7cfb\u7edf\u4e2d\u6bcf\u4e2a\u4efb\u52a1\u7684\u865a\u62df\u8fd0\u884c\u65f6\u95f4\u5c3d\u53ef\u80fd\u63a5\u8fd1<\/strong>\u3002<\/p>\n<\/p>\n<p><p>CFS\u8c03\u5ea6\u5668\u4e0d\u5c06\u65f6\u95f4\u5206\u6210\u56fa\u5b9a\u7684\u65f6\u95f4\u7247\uff0c\u800c\u662f\u52a8\u6001\u5730\u4e3a\u8fdb\u7a0b\u5206\u914d\u6267\u884c\u65f6\u95f4\u3002\u6bcf\u5f53\u4efb\u52a1\u9700\u8981\u8fdb\u884c\u8c03\u5ea6\u65f6\uff0cCFS\u90fd\u4f1a\u9009\u62e9\u865a\u62df\u8fd0\u884c\u65f6\u95f4\u6700\u5c11\u7684\u8fdb\u7a0b\uff0c\u786e\u4fdd\u6240\u6709\u8fdb\u7a0b\u5f97\u5230\u516c\u5e73\u7684CPU\u65f6\u95f4\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\uff0c\u4efb\u52a1\u7684\u4f18\u5148\u7ea7\u4f9d\u7136\u8d77\u4f5c\u7528\uff0c\u4f46\u4ee5\u4e0d\u540c\u7684\u65b9\u5f0f\uff1a\u4f18\u5148\u7ea7\u8f83\u9ad8\u7684\u8fdb\u7a0b\u5176\u865a\u62df\u8fd0\u884c\u65f6\u95f4\u4f1a\u589e\u957f\u5f97\u6162\u4e00\u4e9b\uff0c\u4ece\u800c\u66f4\u5bb9\u6613\u88ab\u8c03\u5ea6\u3002<\/p>\n<\/p>\n<p><h3>\u4e09\u3001CFS\u8c03\u5ea6\u5668\u7684\u4f18\u5316\u4e0e\u6539\u8fdb<\/h3>\n<\/p>\n<p><p>CFS\u8c03\u5ea6\u7b97\u6cd5\u7684\u5b9e\u73b0\u91c7\u53d6\u4e86\u8bb8\u591a\u4f18\u5316\u63aa\u65bd\u6765\u63d0\u5347\u7cfb\u7edf\u6027\u80fd\u548c\u8c03\u5ea6\u6548\u7387\u3002\u4f8b\u5982\uff0cCFS\u5229\u7528\u7ea2\u9ed1\u6811\u7684\u6570\u636e\u7ed3\u6784\u4f7f\u5f97\u67e5\u627e\u3001\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4fdd\u6301\u5728\u5bf9\u6570\u7ea7\u522b\uff0c\u786e\u4fdd\u4e86\u5373\u4f7f\u5728\u5904\u7406\u5927\u91cf\u8fdb\u7a0b\u65f6\u4e5f\u80fd\u4fdd\u6301\u8f83\u9ad8\u7684\u6548\u7387\u3002<\/p>\n<\/p>\n<p><p><strong>\u66f4\u7ec6\u7c92\u5ea6\u7684\u65f6\u95f4\u6d4b\u91cf<\/strong>\u4e5f\u662fCFS\u6240\u91c7\u7528\u7684\u4e00\u4e2a\u91cd\u8981\u4f18\u5316\u624b\u6bb5\u3002CFS\u901a\u8fc7\u9ad8\u7cbe\u5ea6\u7684\u65f6\u95f4\u8ddf\u8e2a\u6765\u7ef4\u62a4\u6bcf\u4e2a\u8fdb\u7a0b\u7684\u865a\u62df\u8fd0\u884c\u65f6\u95f4\uff0c\u4f7f\u5f97\u8c03\u5ea6\u51b3\u7b56\u66f4\u52a0\u7cbe\u786e\u3002\u6b64\u5916\uff0cCFS\u5bf9\u591a\u5904\u7406\u5668\u7cfb\u7edf\u8fdb\u884c\u4e86\u4f18\u5316\uff0c\u901a\u8fc7\u201c\u8d1f\u8f7d\u5747\u8861\u201d\u673a\u5236\uff0c\u5408\u7406\u5206\u914d\u5404\u4e2aCPU\u6838\u5fc3\u7684\u5de5\u4f5c\u8d1f\u8377\uff0c\u63d0\u5347\u4e86\u7cfb\u7edf\u7684\u6574\u4f53\u6027\u80fd\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u4e0e\u5176\u4ed6\u8fdb\u7a0b\u8c03\u5ea6\u7b97\u6cd5\u7684\u6bd4\u8f83<\/h3>\n<\/p>\n<p><p>\u5c06CFS\u4e0e\u5176\u4ed6\u8fdb\u7a0b\u8c03\u5ea6\u7b97\u6cd5\uff0c\u5982\u65e9\u671fLinux\u7248\u672c\u4e2d\u7684O(1)\u8c03\u5ea6\u5668\u6216\u5b9e\u65f6\u8c03\u5ea6\u5668\uff08RT Scheduler\uff09\u8fdb\u884c\u6bd4\u8f83\uff0cCFS\u7684\u6700\u5927\u4f18\u52bf\u5728\u4e8e\u5b83\u7684\u516c\u5e73\u6027\u548c\u5bf9\u7cfb\u7edf\u54cd\u5e94\u65f6\u95f4\u7684\u6539\u8fdb\u3002O(1)\u8c03\u5ea6\u5668\u867d\u7136\u5728\u5f53\u65f6\u80fd\u63d0\u4f9b\u826f\u597d\u7684\u6027\u80fd\uff0c\u4f46\u5728\u591a\u6838\u5904\u7406\u5668\u548c\u590d\u6742\u5de5\u4f5c\u8d1f\u8f7d\u9762\u524d\u663e\u5f97\u4e0d\u591f\u7075\u6d3b\u3002\u5b9e\u65f6\u8c03\u5ea6\u5668\u867d\u7136\u80fd\u4fdd\u8bc1\u5173\u952e\u4efb\u52a1\u7684\u6267\u884c\u65f6\u95f4\uff0c\u4f46\u5bf9\u4e8e\u4e00\u822c\u8fdb\u7a0b\u5219\u7f3a\u4e4f\u8db3\u591f\u7684\u5173\u7167\u3002<\/p>\n<\/p>\n<p><p>\u603b\u4e4b\uff0cLinux\u64cd\u4f5c\u7cfb\u7edf\u91c7\u7528\u7684\u57fa\u4e8e\u65f6\u95f4\u7247\u7684\u591a\u7ea7\u53cd\u9988\u961f\u5217\u8c03\u5ea6\u7b97\u6cd5\uff0c\u7279\u522b\u662fCFS\u8c03\u5ea6\u5668\uff0c\u901a\u8fc7\u5176\u5148\u8fdb\u7684\u8bbe\u8ba1\u548c\u591a\u9879\u4f18\u5316\u63aa\u65bd\uff0c\u4e3a\u73b0\u4ee3\u591a\u4efb\u52a1\u3001\u591a\u6838\u5fc3\u7684\u8ba1\u7b97\u73af\u5883\u63d0\u4f9b\u4e86\u9ad8\u6548\u3001\u516c\u5e73\u7684\u8fdb\u7a0b\u8c03\u5ea6\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1.  Linux\u64cd\u4f5c\u7cfb\u7edf\u662f\u5982\u4f55\u8fdb\u884c\u8fdb\u7a0b\u8c03\u5ea6\u7684\u5462\uff1f<\/strong><br \/>\nLinux\u64cd\u4f5c\u7cfb\u7edf\u91c7\u7528\u4e86\u4e00\u79cd\u79f0\u4e3aCFS\uff08Completely Fair Scheduler\uff0c\u5b8c\u5168\u516c\u5e73\u8c03\u5ea6\u5668\uff09\u7684\u8fdb\u7a0b\u8c03\u5ea6\u7b97\u6cd5\u3002CFS\u7b97\u6cd5\u7684\u6838\u5fc3\u601d\u60f3\u662f\u4ee5\u516c\u5e73\u6027\u4e3a\u76ee\u6807\uff0c\u5c3d\u91cf\u4fdd\u8bc1\u6bcf\u4e2a\u8fdb\u7a0b\u5728\u7ed9\u5b9a\u65f6\u95f4\u5185\u90fd\u80fd\u516c\u5e73\u5730\u4f7f\u7528CPU\u8d44\u6e90\u3002<\/p>\n<p><strong>2. CFS\u8fdb\u7a0b\u8c03\u5ea6\u7b97\u6cd5\u7684\u5177\u4f53\u5b9e\u73b0\u65b9\u5f0f\u662f\u600e\u6837\u7684\uff1f<\/strong><br \/>\nCFS\u901a\u8fc7\u7ef4\u62a4\u4e00\u4e2a\u7ea2\u9ed1\u6811\u6570\u636e\u7ed3\u6784\u6765\u8ddf\u8e2a\u6240\u6709\u5c31\u7eea\u6001\u8fdb\u7a0b\u3002\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u6709\u4e00\u4e2a\u8c03\u5ea6\u5b9e\u4f53\uff08sched_entity\uff09\u6765\u8868\u793a\u5176\u8c03\u5ea6\u4fe1\u606f\uff0c\u5176\u4e2d\u5305\u62ec\u8fd0\u884c\u65f6\u95f4\u3001\u865a\u62df\u8fd0\u884c\u65f6\u95f4\u4ee5\u53ca\u4f18\u5148\u7ea7\u7b49\u53c2\u6570\u3002CFS\u6839\u636e\u8c03\u5ea6\u5b9e\u4f53\u7684\u865a\u62df\u8fd0\u884c\u65f6\u95f4\u6765\u786e\u5b9a\u4e0b\u4e00\u4e2a\u88ab\u8c03\u5ea6\u7684\u8fdb\u7a0b\uff0c\u5373\u865a\u62df\u8fd0\u884c\u65f6\u95f4\u6700\u5c0f\u7684\u8fdb\u7a0b\u3002<\/p>\n<p><strong>3. \u4e3a\u4ec0\u4e48CFS\u7b97\u6cd5\u80fd\u591f\u4fdd\u8bc1\u516c\u5e73\u6027\u5462\uff1f<\/strong><br \/>\nCFS\u7b97\u6cd5\u901a\u8fc7\u52a8\u6001\u5730\u8c03\u6574\u8fdb\u7a0b\u7684\u65f6\u95f4\u7247\u5927\u5c0f\uff0c\u4ee5\u91cd\u70b9\u5173\u6ce8\u90a3\u4e9b\u4f7f\u7528CPU\u65f6\u95f4\u8f83\u5c11\u7684\u8fdb\u7a0b\uff0c\u5728\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u907f\u514d\u4e86\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u8fdb\u7a0b\u9738\u5360CPU\u8d44\u6e90\u7684\u60c5\u51b5\u3002CFS\u901a\u8fc7\u4e0d\u65ad\u8c03\u6574\u65f6\u95f4\u7247\u7684\u5927\u5c0f\uff0c\u4f7f\u5f97\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u80fd\u591f\u5728\u4e00\u5b9a\u65f6\u95f4\u6bb5\u5185\u72ec\u5360CPU\u8d44\u6e90\uff0c\u4ece\u800c\u5b9e\u73b0\u4e86\u8fdb\u7a0b\u8c03\u5ea6\u4e0a\u7684\u516c\u5e73\u6027\u3002\u8fd9\u4e5f\u662fCFS\u7b97\u6cd5\u5728\u5404\u79cd\u8d1f\u8f7d\u60c5\u51b5\u4e0b\u90fd\u80fd\u591f\u8868\u73b0\u51fa\u8f83\u597d\u6027\u80fd\u7684\u539f\u56e0\u4e4b\u4e00\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Linux\u64cd\u4f5c\u7cfb\u7edf\u4e3b\u8981\u91c7\u7528\u7684\u8fdb\u7a0b\u8c03\u5ea6\u7b97\u6cd5\u662f\u57fa\u4e8e\u65f6\u95f4\u7247\u7684\u591a\u7ea7\u53cd\u9988\u961f\u5217\u8c03\u5ea6\u7b97\u6cd5\uff08CFS &#8211; Compl [&hellip;]","protected":false},"author":3,"featured_media":200441,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/200435"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=200435"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/200435\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/200441"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=200435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=200435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=200435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}