{"id":392,"date":"2023-07-26T13:52:55","date_gmt":"2023-07-26T05:52:55","guid":{"rendered":"https:\/\/blog.taiyang.space\/?p=392"},"modified":"2023-07-26T13:52:55","modified_gmt":"2023-07-26T05:52:55","slug":"l4-%e5%a4%9a%e8%bf%9b%e7%a8%8b%e5%9b%be%e5%83%8f","status":"publish","type":"post","link":"https:\/\/blog.taiyang.space\/?p=392","title":{"rendered":"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf"},"content":{"rendered":"<h2 id=\"1\u591a\u8fdb\u7a0b\u8bbe\u8ba1\">1\u3001\u591a\u8fdb\u7a0b\u8bbe\u8ba1<\/h2>\n<p>CPU \u4f5c\u4e3a\u8ba1\u7b97\u673a\u6700\u5173\u952e\u7684\u8bbe\u5907\uff0c\u4f7f\u7528\u597d CPU \u81ea\u7136\u800c\u7136\u6210\u4e3a\u4e86\u64cd\u4f5c\u7cfb\u7edf\u7684\u91cd\u4e2d\u4e4b\u91cd\u3002CPU \u662f\u4e00\u4e2a\u201c\u53d6\u6307\u6267\u884c\u201d\u7684\u8bbe\u5907\uff08<strong>\u8bbe\u7f6e\u597d PC \u6307\u9488\u7684\u521d\u503c\uff0c\u7136\u540e\u6bcf\u6b21\u6267\u884c\u4e00\u6761\u6307\u4ee4CPU\u4f1a\u8ba9\u201cPC\u52a01\u201d<\/strong>\uff09\u3002\u5982\u679cCPU\u53ea\u9700\u8981\u5904\u7406\u5355\u4e2a\u4efb\u52a1\uff08\u5355\u8fdb\u7a0b\uff09\uff0c\u90a3\u4e48\u4e00\u6761\u4e00\u6761\u7684\u201c\u53d6\u6307\u6267\u884c\u201d\u662f\u6beb\u65e0\u95ee\u9898\u7684\uff0c\u56e0\u4e3a\u5c31\u7b97\u9047\u5230\u4e86 IO \u6307\u4ee4\uff0c\u90a3\u4e5f\u6ca1\u529e\u6cd5\uff0c\u53ea\u80fd\u7b49\u7740\uff0c\u4e0d\u80fd\u8df3\u8fc7\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248669.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>\u90a3\u5982\u679c\u6709\u591a\u4e2a\u4efb\u52a1\u9700\u8981\u5904\u7406\u5462\uff1f\u5f53\u4e00\u4e2a\u8fdb\u7a0b\u9700\u8981\u7b49\u5f85\u8d44\u6e90\uff08\u5982\u7b49\u5f85\u78c1\u76d8\u6570\u636e\uff09\uff0c\u53ef\u4e0d\u53ef\u4ee5\u5207\u6362\u5230\u5176\u4ed6\u8fdb\u7a0b\u5462\uff1f\u8fd9\u6837\u624d\u80fd\u63d0\u9ad8CPU\u7684\u4f7f\u7528\u7387\u3002\u64cd\u4f5c\u7cfb\u7edf\u652f\u6301\u591a\u8fdb\u7a0b\u56fe\u50cf\u7684\u8bbe\u8ba1\u7531\u6b64\u5f00\u59cb\u3002<\/p>\n<h2 id=\"2\u4e00\u4e2a\u5927\u6982\u7684\u601d\u8def\">2\u3001\u4e00\u4e2a\u5927\u6982\u7684\u601d\u8def<\/h2>\n<p>\u8ba9 CPU \u5207\u6362\u5230\u53e6\u4e00\u4e2a\u8fdb\u7a0b\u53bb\u6267\u884c\uff0c\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539 PC \u6307\u9488\u5b9e\u73b0\u3002\u53ef\u662f\u600e\u4e48\u5207\u56de\u6765\u5462\uff1f\u4e3a\u4e86\u4fdd\u8bc1\u5207\u56de\u6765\u65f6\u662f\u63a5\u7740\u4e0a\u6b21\u7684\u72b6\u6001\u7ee7\u7eed\u6267\u884c\uff0c\u56e0\u6b64\u5207\u6362\u524d\uff0c\u5e94\u8be5\u5148\u8bb0\u5f55\u597d\u5207\u6362\u524d\u8fdb\u7a0b\u7684\u201c\u6837\u5b50\u201d\uff08\u5305\u62ec\u5207\u6362\u524d\u5404\u4e2a\u5bc4\u5b58\u5668\u7684\u503c\uff0c\u8fdb\u7a0b\u6267\u884c\u7684\u72b6\u6001\u7b49\uff09\uff0c\u7136\u540e\u518d\u4fee\u6539PC \u6307\u9488\u3002Linux0.11 \u8bbe\u8ba1\u4e86\u4e00\u4e2a\u7ed3\u6784\u4f53\uff1a<code>struct task_struct{...}<\/code>\uff0c\u7528\u4e8e\u8bb0\u5f55\u8fdb\u7a0b\u7684\u201c\u6837\u5b50\u201d\uff0c\u6bcf\u4e2a\u8fdb\u7a0b\u90fd\u6709\u4e00\u4e2a\u8be5\u7ed3\u6784\u4f53\u7684\u5bf9\u8c61\u2014\u2014PCB\uff08\u8fdb\u7a0b\u63a7\u5236\u5757\uff09\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248634.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p><strong>\u5982\u4f55\u9009\u62e9\u4e0b\u4e00\u4e2a\u8981\u8fd0\u884c\u7684\u8fdb\u7a0b\u5462\uff1f<\/strong>\u4e00\u4e2a\u7b80\u5355\u53c8\u5b9e\u7528\u7684\u529e\u6cd5\u5c31\u662f\u5229\u7528\u961f\u5217\uff0c\u5c06\u6240\u6709\u8fdb\u7a0b\u7684PCB\u6307\u9488\u5b58\u653e\u5728\u961f\u5217\u4e2d\uff0c\u7136\u540e\u7528\u5148\u8fdb\u5148\u51fa\u7684\u65b9\u5f0f\u5b89\u6392\u4e0b\u4e00\u4e2a\u8981\u8fd0\u884c\u7684\u8fdb\u7a0b\u3002Linux0.11 \u4e2d\u8bbe\u8ba1\u4e86\u4e00\u4e2a\u8fd9\u6837\u7684\u961f\u5217 task \uff1a<\/p>\n<pre><code class=\"language-c\" lang=\"c\">struct task_struct * task[NR_TASKS] = {&amp;(init_task.task), };    \/\/ \u5b9a\u4e49\u4efb\u52a1\u6307\u9488\u6570\u7ec4\n<\/code><\/pre>\n<p>Linux0.11\u4e2d\u7f16\u5199\u4e86 <code>schedule<\/code> \u51fd\u6570\u7528\u6765\u9009\u62e9\u4e0b\u4e00\u4e2a\u8981\u8fd0\u884c\u7684\u8fdb\u7a0b\uff0c\u5e76\u4e14\u5728schedule\u4e2d\u8c03\u7528\u4e86 <code>switch_to<\/code> \u51fd\u6570<strong>\u5b9e\u73b0\u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u8fdb\u7a0b\u7684\u529f\u80fd<\/strong>\u3002task \u961f\u5217\u4e2d\u6709\u5404\u79cd\u72b6\u6001\u7684\u8fdb\u7a0b\u7684PCB\uff0c\u6240\u4ee5\u5728switch_to \u51fd\u6570\u5207\u6362\u524d\u53ef\u4ee5\u5148\u5224\u65ad\u4e00\u4e0b\uff0c\u4e0b\u4e00\u4e2a\u8981\u5207\u6362\u5230\u7684\u8fdb\u7a0b\u662f\u4e0d\u662f\u963b\u585e\u6001\u7684\uff0c\u5982\u679c\u662f\u7684\u8bdd\u5c31\u5148\u8df3\u8fc7\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u8c01\u6765\u6267\u884c\u5207\u6362\u7684\u5de5\u4f5c\u5462\uff1f<\/strong>\u5176\u5b9e\u4e5f\u5f88\u597d\u731c\uff0c\u56e0\u4e3a\u8fdb\u7a0b\u8981\u4e0d\u65ad\u4e14\u5feb\u901f\u7684\u5207\u6765\u5207\u53bb\uff0c\u624d\u80fd\u8ba9\u7528\u6237\u611f\u89c9\u6240\u6709\u4efb\u52a1\u90fd\u4e0d\u5361\uff0c\u56e0\u6b64\u7528<strong>\u5b9a\u65f6\u5668<\/strong>\u4e2d\u65ad\u6765\u5207\u6362\u518d\u5408\u9002\u4e0d\u8fc7\uff0c\u6b64\u5916\u4e5f\u53ef\u4ee5\u5728\u5f53\u8fdb\u7a0b\u963b\u585e\u7684\u65f6\u5019\u5c31\u76f4\u63a5\u5207\u51fa\u53bb\u3002\u5728 Linux0.11 \u4e2d\u5b9a\u4e49\u4e86\u4e00\u4e2a do_time \u51fd\u6570\uff0c\u8be5\u51fd\u6570\u5728 timer_interrupt\uff08\u7cfb\u7edf\u65f6\u949f\u4e2d\u65ad\uff0c\u6bcf10ms\u53d1\u751f\u4e00\u6b21\u65f6\u949f\u4e2d\u65ad\uff09\u4e2d \u88ab\u8c03\u7528\u7684\u3002do_time \u51fd\u6570\u6700\u540e\u8c03\u7528\u4e86 schedule\u51fd\u6570\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u524d\u9762\u63d0\u5230\u4e86\u963b\u585e\u6001\u3002\u4e00\u4e2a\u8fdb\u7a0b\u5728\u5176\u751f\u547d\u5468\u671f\u5185\uff0c\u53ef\u4ee5\u5b58\u5728\u591a\u4e2a\u72b6\u6001\uff0c\u5f53\u8fdb\u7a0b\u5728\u5185\u6838\u6267\u884c\u65f6\u9700\u8981\u8bfb\u78c1\u76d8\uff0c\u6b64\u65f6\u8fdb\u7a0b\u4f1a\u8981\u8fdb\u5165\u963b\u585e\u6001\uff0c\u7b49\u5f85\u8d44\u6e90\uff1b\u5f53\u8fdb\u7a0b\u7b49\u5230\u8d44\u6e90\u65f6\uff0c\u5c31\u53ef\u4ee5\u8fdb\u5165\u5c31\u7eea\u6001\u4e86\uff1b\u5982\u679c\u4e4b\u540e\u8fdb\u7a0b\u62a2\u5230\u4e86CPU\uff0c\u90a3\u4e48\u8fdb\u7a0b\u53c8\u8fdb\u5165\u4e86\u8fd0\u884c\u6001\u3002\u56e0\u6b64\u53ef\u4ee5\u8bbe\u8ba1\u4e00\u4e2a\u8fdb\u7a0b\u72b6\u6001\u56fe\uff0c\u7528\u6765\u63cf\u8ff0\u8fdb\u7a0b\u7684\u5404\u79cd\u72b6\u6001\u4e4b\u95f4\u7684\u8f6c\u6362\u5173\u7cfb\u3002\u5728<code>struct task_struct<\/code>\u4e2d\u5c31\u6709\u4e00\u4e2a\u6210\u5458\u53d8\u91cf <code>state<\/code>\uff0c\u7528\u4e8e\u8bb0\u5f55\u8fdb\u7a0b\u5f53\u524d\u7684\u8fd0\u884c\u72b6\u6001\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u6700\u540e\u8fd8\u6709\u4e00\u4e2a\u95ee\u9898\uff0c<strong>\u5e76\u53d1\u65f6\u5982\u4f55\u4fdd\u8bc1\u5404\u4e2a\u8fdb\u7a0b\u4e0d\u76f8\u4e92\u5e72\u6270\uff1f<\/strong>\u6bd4\u5982\u8bf4\u8fdb\u7a0b1\u6267\u884c\u4e86 mov [100], ax \uff0c\u800c\u5185\u5b58\u5730\u5740[100]\u5904\u6070\u597d\u6709\u8fdb\u7a0b2\u5b58\u653e\u7684\u91cd\u8981\u6570\u636e\uff0c\u5982\u679c\u8ba9\u8fdb\u7a0b1\u6267\u884c\u4e86\u8be5\u6307\u4ee4\uff0c\u90a3\u8fdb\u7a0b2\u7684\u91cd\u8981\u6570\u636e\u5c31\u88ab\u7834\u574f\u4e86\u3002\u4e00\u79cd\u529e\u6cd5\u662f\u5c06\u5404\u4e2a\u8fdb\u7a0b\u7684\u5730\u5740\u7a7a\u95f4\u5206\u79bb\u5f00\u6765\uff0c\u6bd4\u5982\u8fdb\u7a0b3\u3001\u8fdb\u7a0b4\u90fd\u8c03\u7528\u4e86mov [200], ax\uff0c\u90a3\u5c31\u628a\u8fdb\u7a0b3\u7684[200]\u6620\u5c04\u5230\u7269\u7406\u5185\u5b58\u7684 7000H \u5904\uff0c\u800c\u5c06\u8fdb\u7a0b4\u7684[200]\u6620\u5c04\u5230\u7269\u7406\u5185\u5b58\u7684 8000H \u5904\u3002<strong>\u5229\u7528\u6620\u5c04\u8868\uff08\u5b9e\u9645\u4e0a\u4e5f\u5c31\u662fMMU\uff09\u5c06\u5404\u4e2a\u8fdb\u7a0b\u7684\u5730\u5740\u7a7a\u95f4\u5206\u79bb<\/strong>\u3002\u8fd9\u90e8\u5206\u5c5e\u4e8e\u64cd\u4f5c\u7cfb\u7edf\u5185\u5b58\u7ba1\u7406\u7684\u90e8\u5206\uff0c\u4e4b\u540e\u518d\u5206\u6790\u3002<\/p>\n<h2 id=\"3\u4e00\u4e2a\u5b9e\u9645\u7684\u8fdb\u7a0b\u5207\u6362\u6848\u4f8b\">3\u3001\u4e00\u4e2a\u5b9e\u9645\u7684\u8fdb\u7a0b\u5207\u6362\u6848\u4f8b<\/h2>\n<p>\u672c\u8282\u4e3b\u8981\u5206\u6790Linux0.11\u4e2d\u8fdb\u7a0b\u5207\u6362\u7684\u8fc7\u7a0b\u3002Linux\u4e2d\u4f7f\u7528PCB\u6765\u63cf\u8ff0\u4e00\u4e2a\u8fdb\u7a0b\uff0c\u5b9e\u9645\u4e0aPCB\u5c31\u662f\u4e00\u4e2a\u7ed3\u6784\u4f53\u5bf9\u8c61\uff0c\u4e0b\u9762\u5217\u51fa\u4e86\u672c\u8282\u4f1a\u7528\u7684\u7684\u8be5\u7ed3\u6784\u4f53\u7684\u51e0\u4e2a\u91cd\u8981\u5b57\u6bb5\uff1a<\/p>\n<pre><code class=\"language-c\" lang=\"c\">struct task_struct {\n\tlong state;   \/\/ \u8fdb\u7a0b\u5f53\u524d\u8fd0\u884c\u72b6\u6001\uff0c\u6709TASK_RUNNING\uff08\u5c31\u7eea\u6001\uff09\u3001TASK_INTERRUPTIBLE\u7b49\u51e0\u79cd\u53d6\u503c\n\tlong counter; \/\/ \u4efb\u52a1\u8fd0\u884c\u65f6\u95f4\u8ba1\u6570\uff0c\u5373\u8fd0\u884c\u65f6\u95f4\u7247\u3002\u91c7\u7528\u9012\u51cf\u65b9\u5f0f\uff0ccounter\u8d8a\u5927\u8868\u660e\u4efb\u52a1\u5df2\u7ecf\u8fd0\u884c\u7684\u65f6\u95f4\u8d8a\u77ed\n\tlong priority;\/\/ \u8fd0\u884c\u4f18\u5148\u7ea7\uff0c\u7528\u4e8e\u7ed9counter\u8d4b\u521d\u503c\u3002\u4e00\u4e2a\u8fdb\u7a0b\u521a\u88ab\u521b\u5efa\u65f6counter = priority\u3002\n...\n}\n<\/code><\/pre>\n<h3 id=\"31-counter\u7684\u4f5c\u7528\">3.1 counter\u7684\u4f5c\u7528<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248656.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248663.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248722.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<h3 id=\"32-\u8fdb\u7a0b\u7684\u521b\u5efa-fork\u51fd\u6570\">3.2 \u8fdb\u7a0b\u7684\u521b\u5efa-fork\u51fd\u6570<\/h3>\n<p>\u8c03\u7528 fork() \u65f6\u4f1a\u521b\u5efa\u4e00\u4e2a\u5b50\u8fdb\u7a0b\uff0c\u56e0\u6b64\u5206\u6790\u8fdb\u7a0b\u5207\u6362\u5e94\u8be5\u4ece fork() \u5f00\u59cb\u3002 fork() \u7684\u6267\u884c\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n<ol start=\"\">\n<li>fork()\u5185\u6267\u884c<code>int 0x80<\/code>\u6307\u4ee4\uff0c\u8fdb\u5165\u5185\u6838<\/li>\n<li>\u6267\u884c<code>system_call<\/code>:\u7a0b\u5e8f\uff08\u6c47\u7f16\u7a0b\u5e8f\uff09<\/li>\n<li>\u6267\u884c<code>sys_fork<\/code>:\u7a0b\u5e8f\uff08\u6c47\u7f16\u7a0b\u5e8f\uff09<\/li>\n<li>\u6267\u884c<code>copy_process()<\/code>\u51fd\u6570\uff08C\u7a0b\u5e8f\uff09<\/li>\n<\/ol>\n<p><code>copy_process()<\/code>\u624d\u662f\u771f\u6b63\u521b\u5efa\u5b50\u8fdb\u7a0b\u7684\u5730\u65b9\u3002&#8221;sys_fork:&#8221;\u7a0b\u5e8f\u8c03\u7528&#8221;copy_process()&#8221;\u662f\u6c47\u7f16\u8c03\u7528C\u51fd\u6570\u7684\u8fc7\u7a0b\uff0ccopy_process()\u4e2d\u7684\u90a3\u4e00\u5927\u5806\u5f62\u53c2\u90fd\u662f\u901a\u8fc7\u5728\u6c47\u7f16\u7a0b\u5e8f\u4e2d\u538b\u6808\u4f20\u9012\u7684\uff0c\u53ef\u4ee5\u770b\u51fa\u5728copy_process()\u524d\u9762\u7684\u6c47\u7f16\u7a0b\u5e8f\u5c06\u8bb8\u591a\u5bc4\u5b58\u5668\u8fdb\u884c\u4e86\u538b\u6808\u3002copy_process()\u7684\u5de5\u4f5c\u5185\u5bb9\u5982\u4e0b\uff08\u7a0b\u5e8f\u5185\u5bb9\u8fdb\u884c\u4e86\u88c1\u526a\uff09\uff1a<\/p>\n<pre><code class=\"language-c\" lang=\"c\">int copy_process(int nr,long ebp,long edi,long esi,long gs,long none,\n\t\tlong ebx,long ecx,long edx,\n\t\tlong fs,long es,long ds,\n\t\tlong eip,long cs,long eflags,long esp,long ss)\n{\n\tstruct task_struct *p;\n\tint i;\n\tstruct file *f;\n\/\/ 1\u3001\u4e3a\u5b50\u8fdb\u7a0b\u7684PCB\u5206\u914d\u7a7a\u95f4\uff0c\u6ce8\u610f\u8fd9\u91cc\u5206\u914d\u4e86\u4e00\u9875\u5185\u5b58\uff084KB\uff09\uff0c\n\/\/\u5176\u5b9e\u8fd9\u91cc\u8fde\u540c\u5185\u6838\u6808\u7684\u7a7a\u95f4\u4e00\u8d77\u5206\u914d\u4e86\n\tp = (struct task_struct *) get_free_page();\n\tif (!p)\n\t\treturn -EAGAIN;\n\/\/ 2\u3001\u5c06\u5b50\u8fdb\u7a0b\u52a0\u5165\u5230\u603b\u8c03\u5ea6\u961f\u5217\u4e2d\u3002nr\u6307\u5411\u4e86task[]\u4e2d\u7684\u4e00\u4e2a\u7a7a\u4f4d\u7f6e\n\ttask[nr] = p;\n\/\/ 3\u3001\u5c06\u7236\u8fdb\u7a0b\uff08current\uff1a\u5f53\u524d\u8fdb\u7a0b\uff09\u7684PCB\u590d\u5236\u7ed9\u5b50\u8fdb\u7a0b\uff0c\u7136\u540e\u4fee\u6539\u5b50\u8fdb\u7a0bPCB\u7684\u90e8\u5206\u5b57\u6bb5\n\t*p = *current;\t\/* NOTE! this doesn't copy the supervisor stack *\/\n\t                \/\/\u8fd9\u6837\u505a\u4e0d\u4f1a\u590d\u5236\u5806\u6808\u90e8\u5206\uff0c\u53ea\u590d\u5236\u7ed3\u6784\u4f53\n\tp-&gt;state = TASK_UNINTERRUPTIBLE;\n\tp-&gt;pid = last_pid;\/* last_pid\u662f\u6700\u65b0\u8fdb\u7a0b\u53f7\uff0c\u4e5f\u5c31\u662f\u5b50\u8fdb\u7a0b\u7684pid *\/\n\tp-&gt;father = current-&gt;pid;\n\tp-&gt;counter = p-&gt;priority;\n...\n\/\/ 4\u3001\u8bbe\u7f6e\u5b50\u8fdb\u7a0b\u5185\u6838\u6808\u7684\u6808\u9876\u6307\u9488\u6307\u5411\"p\"\u8fd9\u4e00\u9875\u5185\u5b58\u7684\u6700\u9ad8\u5904\uff08\u5730\u5740\u6700\u5927\u5904\uff09\n\tp-&gt;tss.esp0 = PAGE_SIZE + (long) p;\n\tp-&gt;tss.ss0 = 0x10;  \/\/0x10\u4e3a\u5185\u6838\u6570\u636e\u6bb5\u7684\u9009\u62e9\u7b26\n\tp-&gt;tss.eip = eip;\/* \u8ba9\u5b50\u8fdb\u7a0b\u548c\u7236\u8fdb\u7a0b\u6267\u884c\u76f8\u540c\u7684\u7a0b\u5e8f\u3002\u6ce8\u610f\u8fd9\u91cc\u7684eip\u662f\u5728\u6267\u884c int 0x80 \u538b\u5165\u7684eip,\u4e5f\u5c31\u662f\u8bf4\n                        \u5b50\u8fdb\u7a0b\u5728\u4e0b\u6b21\u88ab\u8c03\u5ea6\u6267\u884c\u7684\u7684\u65f6\u5019(\u4e5f\u5c31\u662f\u7b2c\u4e00\u6b21\u88ab\u8c03\u5ea6\u7684\u65f6\u5019)\uff0c\u662f\u4ece int 0x80 \n                        \u540e\u9762\u4e00\u53e5\u6307\u4ee4\u5f00\u59cb\u6267\u884c\u7684\uff0c\u800c\u4e0d\u662f\u4ececopy_process()\u5f00\u59cb\u6267\u884c*\/\n\tp-&gt;tss.eflags = eflags;\n\tp-&gt;tss.eax = 0;\/* \u5b50\u8fdb\u7a0bfork()\u5b8c\u540e\u8fd4\u56de0\u7684\u539f\u56e0\u6240\u5728*\/\n...\n\/\/ 5\u3001\u8bbe\u7f6e\u5b50\u8fdb\u7a0b\u7684\u7528\u6237\u6808\uff0c\u8ba9\u5b50\u8fdb\u7a0b\u4e0e\u7236\u8fdb\u7a0b\u5171\u7528\u4e00\u4e2a\u7528\u6237\u6808\n\tp-&gt;tss.esp = esp;\n\tp-&gt;tss.ss = ss &amp; 0xffff;\n...\n\/\/ 6\u3001\u5c06\u5b50\u8fdb\u7a0b\u8bbe\u7f6e\u4e3a\u5c31\u7eea\u6001\uff0c\u7136\u540e\u7236\u8fdb\u7a0b\u8fd4\u56de\n\tp-&gt;state = TASK_RUNNING;\t\/* do this last, just in case *\/\n\treturn last_pid;\/* return\u4f1a\u8ba9\u8fd4\u56de\u503c(last_pid)\u4fdd\u5b58\u5728eax\u4e2d\u3002\u8fd9\u91cc\u662f\u7236\u8fdb\u7a0b\u5728fork()\u5b8c\u540e\u8981\u8fd4\u56de\u7684\u5b50\u8fdb\u7a0b\u7684pid\u3002\n                       \u90a3\u4e48\u5b50\u8fdb\u7a0bfork()\u5b8c\u540e\u8981\u8fd4\u56de\u76840\u5728\u54ea\u91cc\u8fd4\u56de\u7684\u5462\uff1f\u5728 _syscall0(int,fork) \u51fd\u6570\u7684\u90a3\u4e2areturn\u8fd4\u56de\u3002*\/\n}\n<\/code><\/pre>\n<p>\u5728\u6267\u884c\u5b8c<code>copy_process()<\/code>\u540e\uff0c\u5b50\u8fdb\u7a0b\u7684\u5185\u6838\u6808\u5c31\u88ab\u521b\u5efa\u6210\u4e86\u5982\u4e0b\u6a21\u6837\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248490.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<h3 id=\"33-\u8fdb\u7a0b\u7684\u5207\u6362-schedule\">3.3 \u8fdb\u7a0b\u7684\u5207\u6362-schedule()<\/h3>\n<p>\u672c\u8282\u4e3b\u8981\u5206\u6790\u5b9a\u65f6\u5668\u4e2d\u7684\u8fdb\u7a0b\u5207\u6362\uff0c\u5373do_time()\u4e2d\u7684\u8fdb\u7a0b\u5207\u6362\u3002\u5176\u5b9eschedule()\u9664\u4e86\u5728do_time()\u4e2d\u88ab\u8c03\u7528\u5916\uff0c\u5728\u5176\u4ed6\u5730\u65b9\u4e5f\u6709\u88ab\u8c03\u7528\u3002<br \/>\nLinux0.11\u4e2d\u6709\u4e00\u4e2a\u5b9a\u65f6\u5668\u4e2d\u65ad\uff0c\u6bcf10ms\u8fdb\u5165\u4e00\u6b21\uff0c\u5728\u8fd9\u4e2a\u4e2d\u65ad\u4e2d\u8c03\u7528\u4e86do_time()\u3002\u8fd9\u4e2a\u5b9a\u65f6\u5668\u4e2d\u65ad\u4e3b\u8981\u505a\u4e86\u5982\u4e0b\u5de5\u4f5c\uff1a<\/p>\n<pre><code class=\"language-shell\" lang=\"shell\">timer_interrupt:\n...\n#1\u3001\u8ba9jiffies\u52a01\u3002jiffies\u4e3a\u5168\u5c40\u53d8\u91cf\uff0c\u8868\u793a\u4ece\u5f00\u673a\u65f6\u5230\u73b0\u5728\u53d1\u751f\u7684\u65f6\u949f\u4e2d\u65ad\u6b21\u6570\uff0c\u8fd9\u4e2a\u6570\u4e5f\u88ab\u79f0\u4e3a\u201c\u6ef4\u7b54\u6570\u201d\u3002\n\tincl jiffies\n...\n#2\u3001\u8c03\u7528do_timer(), \u5176\u4e2deax\u4e3ado_timer()\u7684\u4f20\u5165\u53c2\u6570\uff0c\u5f53\u524d\u7279\u6743\u7ea7\u3002\n\tmovl CS(%esp),%eax\n\tandl $3,%eax\t\t# %eax is CPL (0 or 3, 0=supervisor)\n\tpushl %eax\n\tcall do_timer\t\t# 'do_timer(long CPL)' does everything from\n...\n<\/code><\/pre>\n<p>do_timer()\u4e3b\u8981\u5de5\u4f5c\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-c\" lang=\"c\">void do_timer(long cpl){\n...\n\/\/ 1\u3001\u5f53\u524d\u4efb\u52a1\u8fd0\u884c\u8ba1\u6570\u503c\u51cf1\uff0c\u82e5\u8ba1\u6570\u503c\u4e0d\u4e3a0\uff08\u5373\u65f6\u95f4\u7247\u8fd8\u672a\u7528\u5b8c\uff09\uff0c\u5219\u7ee7\u7eed\u8fd0\u884c\u5f53\u524d\u7ebf\u7a0b\u3002\n\tif ((--current-&gt;counter)&gt;0) \n        return;\n\tcurrent-&gt;counter=0;\n\tif (!cpl) \n        return;\t\/\/ \u82e5\u662f\u5185\u6838\u4ee3\u7801\u5219\u4e0d\u8fdb\u884c\u8c03\u5ea6\uff0c\u56e0\u4e3a\u5185\u6838\u4ee3\u7801\u4e0d\u53c2\u4e0e\u8c03\u5ea6\u3002\n\/\/ 2\u3001\u82e5\u65f6\u95f4\u7247\u7528\u5b8c\u4e86\uff0c\u5219\u8fdb\u884c\u8c03\u5ea6\uff0c\u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u4efb\u52a1\n\tschedule();\n}\n<\/code><\/pre>\n<p>\u4ecedo_timer()\u53ef\u4ee5\u770b\u51fa\uff0cLinux0.11\u4e2d\u91c7\u7528\u4e86\u65f6\u95f4\u7247\u7684\u673a\u5236\u6765\u5207\u6362\u8fdb\u7a0b\uff0c\u5373\uff1a\u7ed9\u6bcf\u4e2a\u8fdb\u7a0b\u5206\u914d\u4e00\u4e2a\u65f6\u95f4\u7247\uff0c\u82e5\u65f6\u95f4\u7247\u7528\u5b8c\u4e86\u5219\u8c03\u7528schedule()\u51fd\u6570\u3002schedule()\u4f1a\u91cd\u65b0\u5206\u914d\u5404\u4e2a\u8fdb\u7a0b\u7684\u65f6\u95f4\u7247\uff0c\u5e76\u5728 task \u961f\u5217\u4e2d\u627e\u5230\u4e0b\u4e00\u4e2a\u9700\u8981\u8fd0\u884c\u7684\u8fdb\u7a0b\uff0c\u7136\u540e\u8c03\u7528switch_to\u3002switch_to\u5c06\u5f53\u524d\u8fdb\u7a0b\u7684\u5bc4\u5b58\u5668\u72b6\u6001\u4fdd\u5b58\u8d77\u6765\uff08\u4fdd\u5b58\u5728\u5f53\u524d\u8fdb\u7a0b\u7684 tss \u4e2d\uff09\uff0c\u7136\u540e\u5c06\u4e0b\u4e00\u4e2a\u8fdb\u7a0b\u7684tss\u4e2d\u7684\u5185\u5bb9\u6263\u5728CPU\u7684\u5bc4\u5b58\u5668\u4e2d\uff08\u5305\u62ecPC\u6307\u9488\uff09\u4ece\u800c\u5b9e\u73b0\u4e86\u8fdb\u7a0b\u7684\u5207\u6362\u3002<\/p>\n<h3 id=\"34-\u8fdb\u7a0b\u72b6\u6001\u8f6c\u6362\u56fe\">3.4 \u8fdb\u7a0b\u72b6\u6001\u8f6c\u6362\u56fe<\/h3>\n<p>\u672c\u8282\u4e3b\u8981\u4ecb\u7ecd\u51e0\u4e2a\u4e0e\u72b6\u6001\u5207\u6362\u76f8\u5173\u7684\u51fd\u6570\u3002\u8fdb\u7a0b\u72b6\u6001\u56fe\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248802.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p>\u987a\u4fbf\u8d34\u4e0a\u4e00\u4e2a\u8fdb\u7a0b\u72b6\u6001\u8868\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th><strong>\u5185\u6838\u8868\u793a<\/strong><\/th>\n<th><strong>\u542b\u4e49<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>TASK_RUNNING<\/td>\n<td>\u53ef\u8fd0\u884c\uff08\u5c31\u7eea\u6001\u6216\u8fd0\u884c\u6001\uff09<\/td>\n<\/tr>\n<tr>\n<td>TASK_INTERRUPTIBLE<\/td>\n<td>\u53ef\u4e2d\u65ad\u7684\u7b49\u5f85\u72b6\u6001\uff0c\u662f\u963b\u585e\u6001\u7684\u4e00\u79cd<\/td>\n<\/tr>\n<tr>\n<td>TASK_UNINTERRUPTIBLE<\/td>\n<td>\u4e0d\u53ef\u4e2d\u65ad\u7684\u7b49\u5f85\u72b6\u6001\uff0c\u662f\u963b\u585e\u6001\u7684\u4e00\u79cd<\/td>\n<\/tr>\n<tr>\n<td>TASK_ZOMBIE<\/td>\n<td>\u50f5\u5c38\u6001\uff08\u56fe\u4e2d\u7684\u7ec8\u6b62\u6001\uff09<\/td>\n<\/tr>\n<tr>\n<td>TASK_STOPPED<\/td>\n<td>\u6682\u505c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e0b\u9762\u5217\u51fa\u51e0\u4e2a\u6709\u6539\u53d8\u8fdb\u7a0b\u72b6\u6001\u529f\u80fd\u7684\u51fd\u6570\uff0c\u5e2e\u52a9\u7406\u89e3\u8fdb\u7a0b\u72b6\u6001\u8f6c\u6362\u56fe\uff1a<\/p>\n<ul>\n<li><code>do_exit()<\/code>\uff1a\u7531sys_exit()\u51fd\u6570\u8c03\u7528\u3002\u4f1a\u5c06\u5f53\u524d\u8fdb\u7a0b\u7f6e\u4e3a\u50f5\u5c38\u6001\uff0c\u7136\u540e\u8c03\u7528schedule()\u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u8fdb\u7a0b\uff1b<\/li>\n<li><code>sys_waitpid()<\/code>\uff1a\u56de\u6536\u5b50\u8fdb\u7a0b\uff0c\u82e5\u5b50\u8fdb\u7a0b\u8fd8\u672a\u53d8\u4e3a\u50f5\u5c38\u6001\uff0c\u5219\u8be5\u51fd\u6570\u4f1a\u5c06\u5f53\u524d\u8fdb\u7a0b\u53d8\u4e3a\u963b\u585e\u6001(TASK_INTERRUPTIBLE)\uff0c\u7136\u540e\u8c03\u7528schedule()\u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u8fdb\u7a0b\uff1b<\/li>\n<li><code>copy_process()<\/code>\uff1a\u521b\u5efa\u5b50\u8fdb\u7a0b\uff0c\u521b\u5efa\u524d\u5b50\u8fdb\u7a0b\u4e3a\u65b0\u5efa\u6001\uff0c\u521b\u5efa\u7ed3\u675f\u540e\u4f1a\u5c06\u5b50\u8fdb\u7a0b\u8bbe\u7f6e\u4e3a\u5c31\u7eea\u6001\uff1b<\/li>\n<li><code>schedule()<\/code>\uff1a\u8c03\u5ea6\u51fd\u6570\u3002\u9996\u5148\u8fdb\u884c\u4fe1\u53f7\u5904\u7406\uff0c\u53ef\u80fd\u4f1a\u5c06\u4e00\u4e9b\u963b\u585e\u6001\u7684\u8fdb\u7a0b\u53d8\u4e3a\u5c31\u7eea\u6001\u3002\u7136\u540e\u627e\u5230\u4e0b\u4e00\u4e2a\u9700\u8981\u8fd0\u884c\u7684\u8fdb\u7a0b\uff0c\u5e76\u6267\u884c\u5b83\uff08\u6b64\u65f6\u8be5\u8fdb\u7a0b\u5c31\u53d8\u4e3a\u8fd0\u884c\u6001\u4e86\uff09\uff1b<\/li>\n<li><code>sys_pause()<\/code>\uff1a\u5c06\u5f53\u524d\u8fdb\u7a0b\u53d8\u4e3a\u963b\u585e\u6001\uff08TASK_INTERRUPTIBLE\uff09\uff0c\u7136\u540e\u8c03\u7528schedule()\u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u8fdb\u7a0b\uff1b<\/li>\n<li><code>wake_up()<\/code>\uff1a\u5c06\u8fdb\u7a0b\u7f6e\u4e3a\u5c31\u7eea\u6001\uff1b<\/li>\n<\/ul>\n<h3 id=\"35-\u5982\u4f55\u6267\u884c\u6211\u4eec\u81ea\u5df1\u7684\u4ee3\u7801\">3.5 \u5982\u4f55\u6267\u884c\u6211\u4eec\u81ea\u5df1\u7684\u4ee3\u7801<\/h3>\n<p>\u5b50\u8fdb\u7a0b\u5728\u88ab\u521b\u5efa\u4e4b\u540e\u9ed8\u8ba4\u6267\u884c\u7684\u662f\u7236\u8fdb\u7a0b\u7684\u4ee3\u7801\uff0c\u901a\u5e38\u5b50\u8fdb\u7a0b\u53ef\u4ee5\u8c03\u7528execve()\u6765\u52a0\u8f7d\u6267\u884c\u81ea\u5df1\u7684\u4ee3\u7801\u3002execve()\u662f\u4e00\u4e2a\u7cfb\u7edf\u8c03\u7528\uff0c\u771f\u6b63\u5b9e\u73b0\u5176\u529f\u80fd\u7684\u662fdo_execve()\u51fd\u6570\uff0c\u8fd9\u4e24\u4e2a\u51fd\u6570\u7684\u539f\u578b\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-c\" lang=\"c\">int execve(const char * filename, char ** argv, char ** envp);\nint do_execve(unsigned long * eip,long tmp,char * filename,char ** argv, char ** envp)\n<\/code><\/pre>\n<p>\u5e94\u7528\u7a0b\u5e8f\u8c03\u7528 execve() \u51fd\u6570\uff0c\u53ef\u4ee5\u8fdb\u5165\u5185\u6838\u3002\u5f53\u4e00\u4e2a\u4efb\u52a1\u8fdb\u5165\u5185\u6838\u6001\u8fd0\u884c\u65f6\uff0c\u5c31\u4f1a\u4f7f\u7528\u5176 TSS \u6bb5\u7ed9\u51fa\u7684\u7279\u6743\u7ea70\u7684\u5806\u6808\u6307\u9488\uff1atss.ss0\u3001tss.esp0\uff0c\u5373\u5185\u6838\u6808\u3002 <strong>\u4e5f\u5c31\u662f\u8bf4\u8fdb\u7a0b\u8fdb\u5165\u5185\u6838\u6001\u540e\uff0c\u786c\u4ef6\u81ea\u52a8\u5e2e\u8fdb\u7a0b\u7531\u7528\u6237\u6808\u5207\u6362\u5230\u5185\u6838\u6808\u3002<\/strong><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248043.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248167.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/picture.chentaiyang.space\/202307261248259.png\" referrerpolicy=\"no-referrer\" alt=\"img\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u591a\u8fdb\u7a0b\u8bbe\u8ba1 CPU \u4f5c\u4e3a\u8ba1\u7b97\u673a\u6700\u5173\u952e\u7684\u8bbe\u5907\uff0c\u4f7f\u7528\u597d CPU \u81ea\u7136\u800c\u7136\u6210\u4e3a\u4e86\u64cd\u4f5c\u7cfb\u7edf\u7684\u91cd\u4e2d\u4e4b\u91cd\u3002CPU \u662f\u4e00 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[128,127,126],"class_list":["post-392","post","type-post","status-publish","format-standard","hentry","category-10","tag-128","tag-127","tag-126"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>L4-\u591a\u8fdb\u7a0b\u56fe\u50cf - #\u762b\u7537\u65e5\u8bb0<\/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:\/\/blog.taiyang.space\/?p=392\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf - #\u762b\u7537\u65e5\u8bb0\" \/>\n<meta property=\"og:description\" content=\"1\u3001\u591a\u8fdb\u7a0b\u8bbe\u8ba1 CPU \u4f5c\u4e3a\u8ba1\u7b97\u673a\u6700\u5173\u952e\u7684\u8bbe\u5907\uff0c\u4f7f\u7528\u597d CPU \u81ea\u7136\u800c\u7136\u6210\u4e3a\u4e86\u64cd\u4f5c\u7cfb\u7edf\u7684\u91cd\u4e2d\u4e4b\u91cd\u3002CPU \u662f\u4e00 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.taiyang.space\/?p=392\" \/>\n<meta property=\"og:site_name\" content=\"#\u762b\u7537\u65e5\u8bb0\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-26T05:52:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/picture.chentaiyang.space\/202307261248669.png\" \/>\n<meta name=\"author\" content=\"taiyang\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"taiyang\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/blog.taiyang.space\/?p=392#article\",\"isPartOf\":{\"@id\":\"https:\/\/blog.taiyang.space\/?p=392\"},\"author\":{\"name\":\"taiyang\",\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\"},\"headline\":\"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf\",\"datePublished\":\"2023-07-26T05:52:55+00:00\",\"dateModified\":\"2023-07-26T05:52:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/blog.taiyang.space\/?p=392\"},\"wordCount\":122,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\"},\"keywords\":[\"\u4fe1\u53f7\u91cf\",\"\u7ebf\u7a0b\",\"\u8fdb\u7a0b\"],\"articleSection\":[\"\u64cd\u4f5c\u7cfb\u7edf\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/blog.taiyang.space\/?p=392#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/blog.taiyang.space\/?p=392\",\"url\":\"https:\/\/blog.taiyang.space\/?p=392\",\"name\":\"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf - #\u762b\u7537\u65e5\u8bb0\",\"isPartOf\":{\"@id\":\"https:\/\/blog.taiyang.space\/#website\"},\"datePublished\":\"2023-07-26T05:52:55+00:00\",\"dateModified\":\"2023-07-26T05:52:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/blog.taiyang.space\/?p=392#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/blog.taiyang.space\/?p=392\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/blog.taiyang.space\/?p=392#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/blog.taiyang.space\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/blog.taiyang.space\/#website\",\"url\":\"https:\/\/blog.taiyang.space\/\",\"name\":\"#\u762b\u7537\u65e5\u8bb0\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/blog.taiyang.space\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c\",\"name\":\"taiyang\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg\",\"contentUrl\":\"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg\",\"width\":612,\"height\":640,\"caption\":\"taiyang\"},\"logo\":{\"@id\":\"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/blog.taiyang.space\"],\"url\":\"https:\/\/blog.taiyang.space\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf - #\u762b\u7537\u65e5\u8bb0","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:\/\/blog.taiyang.space\/?p=392","og_locale":"zh_CN","og_type":"article","og_title":"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf - #\u762b\u7537\u65e5\u8bb0","og_description":"1\u3001\u591a\u8fdb\u7a0b\u8bbe\u8ba1 CPU \u4f5c\u4e3a\u8ba1\u7b97\u673a\u6700\u5173\u952e\u7684\u8bbe\u5907\uff0c\u4f7f\u7528\u597d CPU \u81ea\u7136\u800c\u7136\u6210\u4e3a\u4e86\u64cd\u4f5c\u7cfb\u7edf\u7684\u91cd\u4e2d\u4e4b\u91cd\u3002CPU \u662f\u4e00 [&hellip;]","og_url":"https:\/\/blog.taiyang.space\/?p=392","og_site_name":"#\u762b\u7537\u65e5\u8bb0","article_published_time":"2023-07-26T05:52:55+00:00","og_image":[{"url":"https:\/\/picture.chentaiyang.space\/202307261248669.png"}],"author":"taiyang","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"taiyang","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.taiyang.space\/?p=392#article","isPartOf":{"@id":"https:\/\/blog.taiyang.space\/?p=392"},"author":{"name":"taiyang","@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c"},"headline":"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf","datePublished":"2023-07-26T05:52:55+00:00","dateModified":"2023-07-26T05:52:55+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.taiyang.space\/?p=392"},"wordCount":122,"commentCount":0,"publisher":{"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c"},"keywords":["\u4fe1\u53f7\u91cf","\u7ebf\u7a0b","\u8fdb\u7a0b"],"articleSection":["\u64cd\u4f5c\u7cfb\u7edf"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.taiyang.space\/?p=392#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.taiyang.space\/?p=392","url":"https:\/\/blog.taiyang.space\/?p=392","name":"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf - #\u762b\u7537\u65e5\u8bb0","isPartOf":{"@id":"https:\/\/blog.taiyang.space\/#website"},"datePublished":"2023-07-26T05:52:55+00:00","dateModified":"2023-07-26T05:52:55+00:00","breadcrumb":{"@id":"https:\/\/blog.taiyang.space\/?p=392#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.taiyang.space\/?p=392"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/blog.taiyang.space\/?p=392#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/blog.taiyang.space\/"},{"@type":"ListItem","position":2,"name":"L4-\u591a\u8fdb\u7a0b\u56fe\u50cf"}]},{"@type":"WebSite","@id":"https:\/\/blog.taiyang.space\/#website","url":"https:\/\/blog.taiyang.space\/","name":"#\u762b\u7537\u65e5\u8bb0","description":"","publisher":{"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.taiyang.space\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/5e3b9567310d4c4a328573992325178c","name":"taiyang","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/","url":"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg","contentUrl":"https:\/\/blog.taiyang.space\/wp-content\/uploads\/2022\/10\/touxiang.jpg","width":612,"height":640,"caption":"taiyang"},"logo":{"@id":"https:\/\/blog.taiyang.space\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/blog.taiyang.space"],"url":"https:\/\/blog.taiyang.space\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts\/392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=392"}],"version-history":[{"count":2,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts\/392\/revisions"}],"predecessor-version":[{"id":394,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=\/wp\/v2\/posts\/392\/revisions\/394"}],"wp:attachment":[{"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.taiyang.space\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}