{"id":78148,"date":"2026-02-26T10:49:53","date_gmt":"2026-02-26T02:49:53","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/78148.html"},"modified":"2026-02-26T10:49:53","modified_gmt":"2026-02-26T02:49:53","slug":"%e3%80%90linux%e7%b3%bb%e7%bb%9f%e7%bc%96%e7%a8%8b%e3%80%91%ef%bc%88%e4%b8%89%e5%8d%81%e4%ba%94%ef%bc%89%e6%8f%ad%e7%a7%98-linux-%e4%bf%a1%e5%8f%b7%e4%ba%a7%e7%94%9f%ef%bc%9a%e4%bb%8e%e7%bb%88","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/78148.html","title":{"rendered":"\u3010Linux\u7cfb\u7edf\u7f16\u7a0b\u3011\uff08\u4e09\u5341\u4e94\uff09\u63ed\u79d8 Linux \u4fe1\u53f7\u4ea7\u751f\uff1a\u4ece\u7ec8\u7aef\u5230\u5185\u6838\u5168\u89e3\u6790"},"content":{"rendered":"<h2 style=\"text-align:center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260226024951-699fb4cf93734.gif\" \/><\/h2>\n<hr \/>\n<h2>\u524d\u8a00<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5728 Linux \u7cfb\u7edf\u4e2d&#xff0c;\u4fe1\u53f7\u662f\u8fdb\u7a0b\u95f4\u5f02\u6b65\u901a\u4fe1\u7684 \u201c\u4fe1\u4f7f\u201d&#xff0c;\u800c \u201c\u4fe1\u53f7\u4ea7\u751f\u201d \u5219\u662f\u8fd9\u4e2a\u901a\u4fe1\u8fc7\u7a0b\u7684\u8d77\u70b9\u3002\u65e0\u8bba\u662f\u6211\u4eec\u719f\u6089\u7684Ctrl&#043;C\u7ec8\u6b62\u8fdb\u7a0b&#xff0c;\u8fd8\u662f\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u51fa\u73b0\u7684\u6bb5\u9519\u8bef\u3001\u5b9a\u65f6\u5668\u8d85\u65f6&#xff0c;\u672c\u8d28\u4e0a\u90fd\u662f\u4fe1\u53f7\u88ab\u89e6\u53d1\u4ea7\u751f\u7684\u8fc7\u7a0b\u3002\u5f88\u591a\u5f00\u53d1\u8005\u53ea\u77e5\u9053 \u201c\u4fe1\u53f7\u80fd\u7ec8\u6b62\u8fdb\u7a0b\u201d&#xff0c;\u5374\u4e0d\u6e05\u695a\u4fe1\u53f7\u5230\u5e95\u662f\u600e\u4e48\u6765\u7684 \u2014\u2014 \u662f\u7528\u6237\u64cd\u4f5c\u89e6\u53d1\u7684&#xff1f;\u8fd8\u662f\u7cfb\u7edf\u81ea\u52a8\u4ea7\u751f\u7684&#xff1f;\u4e0d\u540c\u573a\u666f\u4e0b\u4fe1\u53f7\u7684\u4ea7\u751f\u673a\u5236\u6709\u4f55\u4e0d\u540c&#xff1f;<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u672c\u6587\u5c06\u57fa\u4e8e Linux \u5185\u6838\u539f\u7406&#xff0c;\u7ed3\u5408 5 \u79cd\u6838\u5fc3\u4fe1\u53f7\u4ea7\u751f\u573a\u666f&#xff08;\u7ec8\u7aef\u6309\u952e\u3001\u7cfb\u7edf\u547d\u4ee4\u3001\u51fd\u6570\u8c03\u7528\u3001\u8f6f\u4ef6\u6761\u4ef6\u3001\u786c\u4ef6\u5f02\u5e38&#xff09;&#xff0c;\u7528\u901a\u4fd7\u7684\u8bed\u8a00&#xff0c;\u5e26\u4f60\u5168\u65b9\u4f4d\u63ed\u79d8\u4fe1\u53f7\u4ea7\u751f\u7684\u5e95\u5c42\u903b\u8f91&#xff0c;\u8ba9\u4f60\u4e0d\u4ec5 \u201c\u77e5\u5176\u7136\u201d&#xff0c;\u66f4 \u201c\u77e5\u5176\u6240\u4ee5\u7136\u201d\u3002\u4e0b\u9762\u5c31\u8ba9\u6211\u4eec\u6b63\u5f0f\u5f00\u59cb\u5427&#xff01;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"464\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260226024952-699fb4d02f004.png\" width=\"725\" \/><\/p>\n<hr \/>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"286\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260226024952-699fb4d059ba8.png\" width=\"1364\" \/><\/p>\n<h2>\u4e00\u3001\u4fe1\u53f7\u4ea7\u751f\u7684\u6838\u5fc3\u672c\u8d28&#xff1a;\u8c01\u5728 \u201c\u53d1\u9001\u201d \u4fe1\u53f7&#xff1f;<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5728\u6df1\u5165\u5177\u4f53\u573a\u666f\u4e4b\u524d&#xff0c;\u6211\u4eec\u5148\u660e\u786e\u4e00\u4e2a\u6838\u5fc3\u95ee\u9898&#xff1a;\u4fe1\u53f7\u662f\u7531\u8c01\u4ea7\u751f\u5e76\u53d1\u9001\u7684&#xff1f;\u7b54\u6848\u662f\u64cd\u4f5c\u7cfb\u7edf&#xff08;OS&#xff09;\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u65e0\u8bba\u4fe1\u53f7\u7684\u89e6\u53d1\u6e90\u5934\u662f\u7528\u6237\u6309\u952e\u3001\u51fd\u6570\u8c03\u7528\u8fd8\u662f\u786c\u4ef6\u5f02\u5e38&#xff0c;\u6700\u7ec8\u90fd\u5fc5\u987b\u7ecf\u8fc7 OS \u7684 \u201c\u4e2d\u8f6c\u201d\u2014\u2014OS \u4f1a\u5c06\u8fd9\u4e9b\u89e6\u53d1\u4e8b\u4ef6\u89e3\u91ca\u4e3a\u5bf9\u5e94\u7684\u4fe1\u53f7&#xff0c;\u518d\u53d1\u9001\u7ed9\u76ee\u6807\u8fdb\u7a0b\u3002\u8fd9\u662f\u56e0\u4e3a OS \u662f\u8fdb\u7a0b\u7684 \u201c\u7ba1\u7406\u8005\u201d&#xff0c;\u53ea\u6709 OS \u62e5\u6709\u64cd\u4f5c\u8fdb\u7a0b PCB&#xff08;\u8fdb\u7a0b\u63a7\u5236\u5757&#xff09;\u7684\u6743\u9650&#xff0c;\u80fd\u591f\u4fee\u6539\u8fdb\u7a0b\u7684\u672a\u51b3\u4fe1\u53f7\u96c6&#xff0c;\u5b8c\u6210\u4fe1\u53f7\u7684 \u201c\u6295\u9012\u201d\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4e3e\u4e2a\u901a\u4fd7\u7684\u4f8b\u5b50&#xff1a;\u4fe1\u53f7\u5c31\u50cf\u5feb\u9012&#xff0c;\u89e6\u53d1\u4fe1\u53f7\u7684\u6e90\u5934&#xff08;\u7528\u6237\u3001\u51fd\u6570\u3001\u786c\u4ef6&#xff09;\u662f \u201c\u5bc4\u4ef6\u4eba\u201d&#xff0c;OS \u662f \u201c\u5feb\u9012\u5458\u201d&#xff0c;\u76ee\u6807\u8fdb\u7a0b\u662f \u201c\u6536\u4ef6\u4eba\u201d\u3002\u5bc4\u4ef6\u4eba\u4e0d\u4f1a\u76f4\u63a5\u628a\u5feb\u9012\u4ea4\u7ed9\u6536\u4ef6\u4eba&#xff0c;\u800c\u662f\u4ea4\u7ed9\u5feb\u9012\u5458&#xff0c;\u7531\u5feb\u9012\u5458\u8d1f\u8d23\u6295\u9012\u5230\u6536\u4ef6\u4eba\u624b\u4e2d&#xff0c;\u4fe1\u53f7\u7684\u4ea7\u751f\u4e0e\u53d1\u9001\u4e5f\u662f\u5982\u6b64\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4fe1\u53f7\u4ea7\u751f\u7684\u5b8c\u6574\u94fe\u8def\u53ef\u4ee5\u603b\u7ed3\u4e3a&#xff1a;<\/p>\n<p>\u89e6\u53d1\u4e8b\u4ef6&#xff08;\u7528\u6237\/\u51fd\u6570\/\u786c\u4ef6\u7b49&#xff09;\u2192 OS\u8bc6\u522b\u4e8b\u4ef6 \u2192 OS\u5c06\u4e8b\u4ef6\u6620\u5c04\u4e3a\u5bf9\u5e94\u4fe1\u53f7 \u2192 OS\u4fee\u6539\u76ee\u6807\u8fdb\u7a0bPCB\u7684\u672a\u51b3\u4fe1\u53f7\u96c6 \u2192 \u4fe1\u53f7\u4ea7\u751f\u5e76\u7b49\u5f85\u9012\u8fbe<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8fd9\u4e00\u94fe\u8def\u662f\u6240\u6709\u4fe1\u53f7\u4ea7\u751f\u573a\u666f\u7684\u5171\u540c\u5e95\u5c42\u903b\u8f91&#xff0c;\u63a5\u4e0b\u6765\u6211\u4eec\u5c06\u9488\u5bf9\u4e0d\u540c\u7684 \u201c\u89e6\u53d1\u4e8b\u4ef6\u201d&#xff0c;\u9010\u4e00\u62c6\u89e3\u5177\u4f53\u573a\u666f\u3002<\/p>\n<\/p>\n<h2 style=\"background-color:transparent\">\u4e8c\u3001\u573a\u666f 1&#xff1a;\u7ec8\u7aef\u6309\u952e\u89e6\u53d1 \u2014\u2014 \u6700\u76f4\u89c2\u7684\u4fe1\u53f7\u4ea7\u751f\u65b9\u5f0f<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef&#xff08;Terminal&#xff09;\u662f\u7528\u6237\u4e0e Linux \u7cfb\u7edf\u4ea4\u4e92\u7684\u4e3b\u8981\u754c\u9762&#xff0c;\u6211\u4eec\u65e5\u5e38\u4f7f\u7528\u7684Ctrl&#043;C\u3001Ctrl&#043;\\\\\u3001Ctrl&#043;Z\u7b49\u7ec4\u5408\u952e&#xff0c;\u672c\u8d28\u4e0a\u90fd\u662f\u901a\u8fc7\u7ec8\u7aef\u89e6\u53d1\u4fe1\u53f7\u4ea7\u751f\u7684\u3002\u8fd9\u79cd\u65b9\u5f0f\u6700\u76f4\u89c2&#xff0c;\u4e5f\u662f\u6211\u4eec\u63a5\u89e6\u6700\u591a\u7684\u4fe1\u53f7\u4ea7\u751f\u573a\u666f\u3002<\/p>\n<h3>2.1 \u6838\u5fc3\u539f\u7406&#xff1a;\u7ec8\u7aef\u6309\u952e\u5982\u4f55\u89e6\u53d1\u4fe1\u53f7&#xff1f;<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5f53\u6211\u4eec\u5728\u7ec8\u7aef\u4e2d\u6309\u4e0b\u7ec4\u5408\u952e\u65f6&#xff0c;\u4f1a\u53d1\u751f\u4ee5\u4e0b\u4e00\u7cfb\u5217\u52a8\u4f5c&#xff1a;<\/p>\n<li>\u952e\u76d8\u6309\u952e\u4ea7\u751f\u786c\u4ef6\u4e2d\u65ad&#xff0c;\u7ec8\u7aef\u9a71\u52a8\u7a0b\u5e8f\u6355\u83b7\u8be5\u4e2d\u65ad&#xff1b;<\/li>\n<li>\u7ec8\u7aef\u9a71\u52a8\u7a0b\u5e8f\u5c06\u6309\u952e\u4e8b\u4ef6\u8f6c\u6362\u4e3a\u5bf9\u5e94\u7684\u4fe1\u53f7&#xff08;\u5982Ctrl&#043;C\u5bf9\u5e94SIGINT\u4fe1\u53f7&#xff09;&#xff1b;<\/li>\n<li>\u7ec8\u7aef\u5c06\u4fe1\u53f7\u53d1\u9001\u7ed9 OS&#xff0c;\u544a\u77e5 OS \u201c\u9700\u8981\u5411\u5f53\u524d\u524d\u53f0\u8fdb\u7a0b\u53d1\u9001\u67d0\u4e2a\u4fe1\u53f7\u201d&#xff1b;<\/li>\n<li>OS \u63a5\u6536\u8bf7\u6c42\u540e&#xff0c;\u627e\u5230\u5f53\u524d\u524d\u53f0\u8fdb\u7a0b&#xff0c;\u4fee\u6539\u5176 PCB \u4e2d\u7684\u672a\u51b3\u4fe1\u53f7\u96c6&#xff0c;\u5b8c\u6210\u4fe1\u53f7\u4ea7\u751f\u3002<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"719\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260226024952-699fb4d08af29.png\" width=\"1280\" \/><\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8fd9\u91cc\u6709\u4e00\u4e2a\u5173\u952e\u89c4\u5219&#xff1a;\u7ec8\u7aef\u7ec4\u5408\u952e\u4ea7\u751f\u7684\u4fe1\u53f7&#xff0c;\u53ea\u80fd\u53d1\u9001\u7ed9\u5f53\u524d\u524d\u53f0\u8fdb\u7a0b\u3002\u540e\u53f0\u8fdb\u7a0b&#xff08;\u901a\u8fc7&amp;\u542f\u52a8\u7684\u8fdb\u7a0b&#xff09;\u65e0\u6cd5\u63a5\u6536\u7ec8\u7aef\u7ec4\u5408\u952e\u4ea7\u751f\u7684\u4fe1\u53f7&#xff0c;\u8fd9\u662f\u4e3a\u4e86\u907f\u514d\u540e\u53f0\u8fdb\u7a0b\u88ab\u7528\u6237\u8bef\u64cd\u4f5c\u4e2d\u65ad\u3002<\/p>\n<h3>2.2 \u4e09\u5927\u5e38\u7528\u7ec8\u7aef\u4fe1\u53f7&#xff1a;\u5b9e\u6218\u9a8c\u8bc1<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Linux \u7ec8\u7aef\u4e2d\u6700\u5e38\u7528\u7684\u4e09\u4e2a\u7ec4\u5408\u952e\u5bf9\u5e94\u7684\u4fe1\u53f7\u5206\u522b\u662f&#xff1a;<span style=\"color:#956fe7\">Ctrl&#043;C&#xff08;SIGINT&#xff09;<\/span>\u3001<span style=\"color:#956fe7\">Ctrl&#043;\\\\&#xff08;SIGQUIT&#xff09;<\/span>\u3001<span style=\"color:#956fe7\">Ctrl&#043;Z&#xff08;SIGTSTP&#xff09;<\/span>&#xff0c;\u6211\u4eec\u901a\u8fc7\u5b9e\u6218\u4ee3\u7801\u9010\u4e00\u9a8c\u8bc1\u5b83\u4eec\u7684\u4ea7\u751f\u4e0e\u4f5c\u7528\u3002<\/p>\n<h4>2.2.1 Ctrl&#043;C&#xff1a;SIGINT \u4fe1\u53f7&#xff08;2 \u53f7&#xff09;\u2014\u2014 \u7ec8\u6b62\u8fdb\u7a0b<\/h4>\n<p>\u00a0 \u00a0 <span style=\"color:#956fe7\">SIGINT<\/span>\u4fe1\u53f7\u7684\u9ed8\u8ba4\u5904\u7406\u52a8\u4f5c\u662f \u201c\u7ec8\u6b62\u8fdb\u7a0b\u201d&#xff0c;\u8fd9\u662f\u6211\u4eec\u6700\u5e38\u7528\u7684 \u201c\u5f3a\u5236\u7ec8\u6b62\u8fdb\u7a0b\u201d \u7684\u65b9\u5f0f\u3002<\/p>\n<h5>\u4ee3\u7801\u9a8c\u8bc1 1&#xff1a;\u9ed8\u8ba4\u52a8\u4f5c \u2014\u2014 \u7ec8\u6b62\u8fdb\u7a0b<\/h5>\n<p>\/\/ sig_int_default.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u6b63\u5728\u8fd0\u884c&#8230;&#xff08;\u6309\u4e0bCtrl&#043;C\u7ec8\u6b62&#xff09;&#034; &lt;&lt; endl;<br \/>\n    while (true)<br \/>\n    {<br \/>\n        sleep(1);<br \/>\n        cout &lt;&lt; &#034;\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;&#034; &lt;&lt; endl;<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<h5>\u7f16\u8bd1\u8fd0\u884c<\/h5>\n<p>g&#043;&#043; sig_int_default.cpp -o sig_int_default<br \/>\n.\/sig_int_default<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8fd0\u884c\u540e&#xff0c;\u7ec8\u7aef\u4f1a\u6301\u7eed\u6253\u5370 \u201c\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;\u201d&#xff0c;\u6b64\u65f6\u6309\u4e0bCtrl&#043;C&#xff0c;\u8fdb\u7a0b\u4f1a\u7acb\u5373\u7ec8\u6b62&#xff0c;\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12345&#xff0c;\u6b63\u5728\u8fd0\u884c&#8230;&#xff08;\u6309\u4e0bCtrl&#043;C\u7ec8\u6b62&#xff09;<br \/>\n\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;<br \/>\n\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;<br \/>\n^C  # \u6309\u4e0bCtrl&#043;C<\/p>\n<h5>\u4ee3\u7801\u9a8c\u8bc1 2&#xff1a;\u81ea\u5b9a\u4e49\u4fe1\u53f7\u5904\u7406 \u2014\u2014 \u8ba9Ctrl&#043;C\u4e0d\u7ec8\u6b62\u8fdb\u7a0b<\/h5>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7<span style=\"color:#956fe7\">signal<\/span>\u51fd\u6570\u81ea\u5b9a\u4e49<span style=\"color:#956fe7\">SIGINT<\/span>\u4fe1\u53f7\u7684\u5904\u7406\u52a8\u4f5c&#xff0c;\u8ba9\u6309\u4e0bCtrl&#043;C\u540e\u8fdb\u7a0b\u4e0d\u7ec8\u6b62&#xff0c;\u800c\u662f\u6267\u884c\u6211\u4eec\u5b9a\u4e49\u7684\u903b\u8f91\u3002<\/p>\n<p>\/\/ sig_int_catch.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sigint_handler(int signum)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\\\\n\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; &#034;&#xff08;SIGINT&#xff09;&#xff0c;Ctrl&#043;C\u65e0\u6548&#xff01;&#034; &lt;&lt; endl;<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0b\u7ee7\u7eed\u8fd0\u884c&#8230;&#034; &lt;&lt; endl;<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u6b63\u5728\u8fd0\u884c&#8230;&#xff08;\u6309\u4e0bCtrl&#043;C\u6d4b\u8bd5&#xff09;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u6ce8\u518cSIGINT\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGINT, sigint_handler);<\/p>\n<p>    while (true)<br \/>\n    {<br \/>\n        sleep(1);<br \/>\n        cout &lt;&lt; &#034;\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;&#034; &lt;&lt; endl;<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<h5>\u7f16\u8bd1\u8fd0\u884c<\/h5>\n<p>g&#043;&#043; sig_int_catch.cpp -o sig_int_catch<br \/>\n.\/sig_int_catch<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8fd0\u884c\u540e\u6309\u4e0bCtrl&#043;C&#xff0c;\u8fdb\u7a0b\u4e0d\u4f1a\u7ec8\u6b62&#xff0c;\u800c\u662f\u6253\u5370\u81ea\u5b9a\u4e49\u4fe1\u606f&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12346&#xff0c;\u6b63\u5728\u8fd0\u884c&#8230;&#xff08;\u6309\u4e0bCtrl&#043;C\u6d4b\u8bd5&#xff09;<br \/>\n\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;<br \/>\n\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;<br \/>\n^C<br \/>\n\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;2&#xff08;SIGINT&#xff09;&#xff0c;Ctrl&#043;C\u65e0\u6548&#xff01;<br \/>\n\u8fdb\u7a0b\u7ee7\u7eed\u8fd0\u884c&#8230;<br \/>\n\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;<\/p>\n<h4>2.2.2 Ctrl&#043;\\\\&#xff1a;SIGQUIT \u4fe1\u53f7&#xff08;3 \u53f7&#xff09;\u2014\u2014 \u7ec8\u6b62\u8fdb\u7a0b\u5e76\u751f\u6210 Core Dump<\/h4>\n<p>\u00a0 \u00a0 <span style=\"color:#956fe7\">SIGQUIT<\/span>\u4fe1\u53f7\u7684\u9ed8\u8ba4\u5904\u7406\u52a8\u4f5c\u662f \u201c\u7ec8\u6b62\u8fdb\u7a0b\u5e76\u751f\u6210 Core Dump \u6587\u4ef6\u201d\u3002Core Dump \u6587\u4ef6\u662f\u8fdb\u7a0b\u5f02\u5e38\u7ec8\u6b62\u65f6\u7684\u5185\u5b58\u955c\u50cf\u6587\u4ef6&#xff0c;\u5305\u542b\u8fdb\u7a0b\u7ec8\u6b62\u65f6\u7684\u5185\u5b58\u6570\u636e\u3001\u5bc4\u5b58\u5668\u72b6\u6001\u7b49\u4fe1\u606f&#xff0c;\u7528\u4e8e\u4e8b\u540e\u8c03\u8bd5&#xff08;Post-mortem Debug&#xff09;\u3002<\/p>\n<h5>\u6838\u5fc3\u77e5\u8bc6\u70b9&#xff1a;Core Dump \u6587\u4ef6<\/h5>\n<ul>\n<li>\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;Linux \u7cfb\u7edf\u4f1a\u7981\u7528 Core Dump \u529f\u80fd&#xff08;\u907f\u514d\u6cc4\u9732\u654f\u611f\u4fe1\u606f&#xff09;&#xff0c;\u53ef\u4ee5\u901a\u8fc7ulimit -c 1024\u547d\u4ee4\u4e34\u65f6\u5f00\u542f&#xff08;\u5141\u8bb8\u751f\u6210\u6700\u5927 1024KB \u7684 Core \u6587\u4ef6&#xff09;&#xff1b;<\/li>\n<li>Core \u6587\u4ef6\u7684\u9ed8\u8ba4\u540d\u79f0\u4e3acore.\u8fdb\u7a0bPID&#xff0c;\u5b58\u50a8\u5728\u8fdb\u7a0b\u8fd0\u884c\u76ee\u5f55\u4e0b&#xff1b;<\/li>\n<li>\u53ef\u4ee5\u901a\u8fc7gdb \u7a0b\u5e8f\u540d core\u6587\u4ef6\u540d\u547d\u4ee4\u8c03\u8bd5 Core \u6587\u4ef6&#xff0c;\u5b9a\u4f4d\u8fdb\u7a0b\u5d29\u6e83\u539f\u56e0\u3002<\/li>\n<\/ul>\n<h5>\u4ee3\u7801\u9a8c\u8bc1&#xff1a;SIGQUIT \u4fe1\u53f7\u7684\u9ed8\u8ba4\u52a8\u4f5c<\/h5>\n<p>\/\/ sig_quit_core.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u6b63\u5728\u8fd0\u884c&#8230;&#xff08;\u6309\u4e0bCtrl&#043;\\\\\\\\\u751f\u6210Core\u6587\u4ef6&#xff09;&#034; &lt;&lt; endl;<br \/>\n    while (true)<br \/>\n    {<br \/>\n        sleep(1);<br \/>\n        cout &lt;&lt; &#034;\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;&#034; &lt;&lt; endl;<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<h5>\u7f16\u8bd1\u8fd0\u884c\u4e0e\u8c03\u8bd5<\/h5>\n<p># \u5f00\u542fCore Dump\u529f\u80fd&#xff08;\u4e34\u65f6\u751f\u6548&#xff09;<br \/>\nulimit -c 1024<br \/>\n# \u7f16\u8bd1<br \/>\ng&#043;&#043; sig_quit_core.cpp -o sig_quit_core<br \/>\n# \u8fd0\u884c<br \/>\n.\/sig_quit_core<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8fd0\u884c\u540e\u6309\u4e0b<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">Ctrl&#043;\\\\<\/span><\/span>&#xff0c;\u8fdb\u7a0b\u7ec8\u6b62\u5e76\u751f\u6210 Core \u6587\u4ef6&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12347&#xff0c;\u6b63\u5728\u8fd0\u884c&#8230;&#xff08;\u6309\u4e0bCtrl&#043;\\\\\u751f\u6210Core\u6587\u4ef6&#xff09;<br \/>\n\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;<br \/>\n\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;<br \/>\n^\\\\Quit (core dumped)  # \u6309\u4e0bCtrl&#043;\\\\<br \/>\n# \u67e5\u770b\u751f\u6210\u7684Core\u6587\u4ef6<br \/>\nls -l core*<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u4f1a\u663e\u793a\u7c7b\u4f3ccore.12347\u7684\u6587\u4ef6&#xff0c;\u4f7f\u7528 gdb \u8c03\u8bd5&#xff1a;<\/p>\n<p>gdb sig_quit_core core.12347<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8c03\u8bd5\u8f93\u51fa\u4f1a\u663e\u793a\u8fdb\u7a0b\u7ec8\u6b62\u7684\u539f\u56e0&#xff08;\u6536\u5230 SIGQUIT \u4fe1\u53f7&#xff09;&#xff0c;\u9a8c\u8bc1\u4e86\u4fe1\u53f7\u7684\u4ea7\u751f\u4e0e\u4f5c\u7528\u3002<\/p>\n<h4>2.2.3 Ctrl&#043;Z&#xff1a;SIGTSTP \u4fe1\u53f7&#xff08;20 \u53f7&#xff09;\u2014\u2014 \u6682\u505c\u524d\u53f0\u8fdb\u7a0b<\/h4>\n<p>\u00a0 \u00a0 <span style=\"color:#956fe7\">SIGTSTP<\/span>\u4fe1\u53f7\u7684\u9ed8\u8ba4\u5904\u7406\u52a8\u4f5c\u662f \u201c\u6682\u505c\u524d\u53f0\u8fdb\u7a0b\u201d&#xff0c;\u5c06\u8fdb\u7a0b\u4ece \u201c\u8fd0\u884c\u6001\u201d \u5207\u6362\u4e3a \u201c\u505c\u6b62\u6001&#xff08;Stopped&#xff09;\u201d&#xff0c;\u5e76\u5c06\u5176\u8f6c\u5165\u540e\u53f0\u3002\u6682\u505c\u7684\u8fdb\u7a0b\u53ef\u4ee5\u901a\u8fc7fg\u547d\u4ee4\u6062\u590d\u5230\u524d\u53f0&#xff0c;\u6216\u901a\u8fc7bg\u547d\u4ee4\u8ba9\u5176\u5728\u540e\u53f0\u7ee7\u7eed\u8fd0\u884c\u3002<\/p>\n<h5>\u4ee3\u7801\u9a8c\u8bc1&#xff1a;SIGTSTP \u4fe1\u53f7\u7684\u9ed8\u8ba4\u52a8\u4f5c<\/h5>\n<p>\/\/ sig_tstp_stop.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u6b63\u5728\u8fd0\u884c&#8230;&#xff08;\u6309\u4e0bCtrl&#043;Z\u6682\u505c&#xff09;&#034; &lt;&lt; endl;<br \/>\n    while (true)<br \/>\n    {<br \/>\n        sleep(1);<br \/>\n        cout &lt;&lt; &#034;\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;&#034; &lt;&lt; endl;<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<h5>\u7f16\u8bd1\u8fd0\u884c\u4e0e\u64cd\u4f5c<\/h5>\n<p>g&#043;&#043; sig_tstp_stop.cpp -o sig_tstp_stop<br \/>\n.\/sig_tstp_stop<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8fd0\u884c\u540e\u6309\u4e0b<span style=\"color:#ff9900\"><span style=\"background-color:#fbd4d0\">Ctrl&#043;Z<\/span><\/span>&#xff0c;\u8fdb\u7a0b\u88ab\u6682\u505c\u5e76\u8f6c\u5165\u540e\u53f0&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12348&#xff0c;\u6b63\u5728\u8fd0\u884c&#8230;&#xff08;\u6309\u4e0bCtrl&#043;Z\u6682\u505c&#xff09;<br \/>\n\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;<br \/>\n\u8fdb\u7a0b\u6b63\u5e38\u8fd0\u884c\u4e2d&#8230;<br \/>\n^Z[1]&#043;  Stopped                 .\/sig_tstp_stop  # \u8fdb\u7a0b\u88ab\u6682\u505c<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u540e\u7eed\u64cd\u4f5c\u547d\u4ee4&#xff1a;<\/p>\n<p># \u67e5\u770b\u540e\u53f0\u6682\u505c\u7684\u8fdb\u7a0b<br \/>\njobs<br \/>\n# \u5c06\u6682\u505c\u7684\u8fdb\u7a0b\u6062\u590d\u5230\u524d\u53f0\u8fd0\u884c<br \/>\nfg %1<br \/>\n# \u5c06\u6682\u505c\u7684\u8fdb\u7a0b\u5728\u540e\u53f0\u7ee7\u7eed\u8fd0\u884c<br \/>\nbg %1<br \/>\n# \u7ec8\u6b62\u540e\u53f0\u8fdb\u7a0b<br \/>\nkill -9 12348<\/p>\n<h3>2.3 \u7ec8\u7aef\u4fe1\u53f7\u7684\u6838\u5fc3\u603b\u7ed3<\/h3>\n<table>\n<tr>\u7ec4\u5408\u952e\u5bf9\u5e94\u4fe1\u53f7\u4fe1\u53f7\u7f16\u53f7\u9ed8\u8ba4\u52a8\u4f5c\u6838\u5fc3\u7528\u9014<\/tr>\n<tbody>\n<tr>\n<td><span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">Ctrl&#043;C<\/span><\/span><\/td>\n<td><span style=\"color:#956fe7\">SIGINT<\/span><\/td>\n<td>2<\/td>\n<td>\u7ec8\u6b62\u8fdb\u7a0b<\/td>\n<td>\u5feb\u901f\u7ec8\u6b62\u524d\u53f0\u8fdb\u7a0b<\/td>\n<\/tr>\n<tr>\n<td><span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">Ctrl&#043;\\\\<\/span><\/span><\/td>\n<td><span style=\"color:#956fe7\">SIGQUIT<\/span><\/td>\n<td>3<\/td>\n<td>\u7ec8\u6b62\u8fdb\u7a0b &#043; Core Dump<\/td>\n<td>\u8c03\u8bd5\u65f6\u751f\u6210\u5185\u5b58\u955c\u50cf<\/td>\n<\/tr>\n<tr>\n<td><span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">Ctrl&#043;Z<\/span><\/span><\/td>\n<td><span style=\"color:#956fe7\">SIGTSTP<\/span><\/td>\n<td>20<\/td>\n<td>\u6682\u505c\u8fdb\u7a0b<\/td>\n<td>\u4e34\u65f6\u6682\u505c\u524d\u53f0\u8fdb\u7a0b<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5173\u952e\u89c4\u5219&#xff1a;\u7ec8\u7aef\u4fe1\u53f7\u4ec5\u53d1\u9001\u7ed9\u524d\u53f0\u8fdb\u7a0b&#xff0c;\u540e\u53f0\u8fdb\u7a0b&#xff08;&amp;\u542f\u52a8&#xff09;\u4e0d\u53d7\u7ec8\u7aef\u7ec4\u5408\u952e\u5f71\u54cd\u3002<\/p>\n<\/p>\n<h2>\u4e09\u3001\u573a\u666f 2&#xff1a;\u7cfb\u7edf\u547d\u4ee4\u89e6\u53d1 \u2014\u2014 \u901a\u8fc7 Shell \u547d\u4ee4\u53d1\u9001\u4fe1\u53f7<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u9664\u4e86\u7ec8\u7aef\u7ec4\u5408\u952e&#xff0c;\u6211\u4eec\u8fd8\u53ef\u4ee5\u901a\u8fc7 Linux \u7cfb\u7edf\u63d0\u4f9b\u7684\u547d\u4ee4\u4e3b\u52a8\u5411\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7&#xff0c;\u6700\u5e38\u7528\u7684\u547d\u4ee4\u662f<span style=\"color:#956fe7\">kill<\/span>\u548c<span style=\"color:#956fe7\">pkill<\/span>\u3002\u8fd9\u79cd\u65b9\u5f0f\u7684\u6838\u5fc3\u662f&#xff1a;\u901a\u8fc7\u547d\u4ee4\u544a\u77e5 OS \u201c\u5411\u6307\u5b9a\u8fdb\u7a0b\u53d1\u9001\u67d0\u4e2a\u4fe1\u53f7\u201d&#xff0c;\u7531 OS \u5b8c\u6210\u4fe1\u53f7\u7684\u4ea7\u751f\u4e0e\u6295\u9012\u3002<\/p>\n<h3>3.1 \u6838\u5fc3\u547d\u4ee4&#xff1a;kill \u547d\u4ee4\u7684\u7528\u6cd5<\/h3>\n<p>\u00a0 \u00a0 <span style=\"color:#956fe7\">kill<\/span>\u547d\u4ee4\u7684\u672c\u8d28\u662f\u8c03\u7528\u7cfb\u7edf\u8c03\u7528<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">kill()<\/span><\/span>\u51fd\u6570&#xff0c;\u5411\u6307\u5b9a\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7\u3002\u5176\u57fa\u672c\u8bed\u6cd5\u5982\u4e0b&#xff1a;<\/p>\n<p># \u683c\u5f0f1&#xff1a;\u901a\u8fc7\u4fe1\u53f7\u540d\u79f0\u53d1\u9001<br \/>\nkill -\u4fe1\u53f7\u540d \u8fdb\u7a0bPID<br \/>\n# \u683c\u5f0f2&#xff1a;\u901a\u8fc7\u4fe1\u53f7\u7f16\u53f7\u53d1\u9001<br \/>\nkill -\u4fe1\u53f7\u7f16\u53f7 \u8fdb\u7a0bPID<br \/>\n# \u683c\u5f0f3&#xff1a;\u5217\u51fa\u6240\u6709\u4fe1\u53f7<br \/>\nkill -l<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5e38\u7528\u4fe1\u53f7\u4e0e kill \u547d\u4ee4\u7ec4\u5408&#xff1a;<\/p>\n<ul>\n<li><span style=\"color:#956fe7\">kill -SIGINT \u8fdb\u7a0bPID<\/span>&#xff1a;\u7b49\u4ef7\u4e8eCtrl&#043;C&#xff0c;\u7ec8\u6b62\u8fdb\u7a0b&#xff1b;<\/li>\n<li><span style=\"color:#956fe7\">kill -SIGQUIT \u8fdb\u7a0bPID<\/span>&#xff1a;\u7ec8\u6b62\u8fdb\u7a0b\u5e76\u751f\u6210 Core Dump&#xff1b;<\/li>\n<li><span style=\"color:#956fe7\">kill -SIGKILL \u8fdb\u7a0bPID<\/span>&#xff1a;\u5f3a\u5236\u7ec8\u6b62\u8fdb\u7a0b&#xff08;9 \u53f7\u4fe1\u53f7&#xff0c;\u4e0d\u53ef\u6355\u6349\u3001\u4e0d\u53ef\u5ffd\u7565&#xff09;&#xff1b;<\/li>\n<li><span style=\"color:#956fe7\">kill -SIGSTOP \u8fdb\u7a0bPID<\/span>&#xff1a;\u6682\u505c\u8fdb\u7a0b&#xff08;19 \u53f7\u4fe1\u53f7&#xff0c;\u4e0d\u53ef\u6355\u6349\u3001\u4e0d\u53ef\u5ffd\u7565&#xff09;&#xff1b;<\/li>\n<li><span style=\"color:#956fe7\">kill -SIGCONT \u8fdb\u7a0bPID<\/span>&#xff1a;\u6062\u590d\u6682\u505c\u7684\u8fdb\u7a0b\u3002<\/li>\n<\/ul>\n<h3>3.2 \u5b9e\u6218\u9a8c\u8bc1&#xff1a;\u7528 kill \u547d\u4ee4\u53d1\u9001\u4fe1\u53f7<\/h3>\n<h4>\u6b65\u9aa4 1&#xff1a;\u7f16\u5199\u4e00\u4e2a\u540e\u53f0\u8fd0\u884c\u7684\u6b7b\u5faa\u73af\u7a0b\u5e8f<\/h4>\n<p>\/\/ sig_backend.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u540e\u53f0\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u6b63\u5728\u8fd0\u884c&#8230;&#034; &lt;&lt; endl;<br \/>\n    while (true)<br \/>\n    {<br \/>\n        sleep(1);<br \/>\n        \/\/ \u540e\u53f0\u8fd0\u884c&#xff0c;\u4e0d\u8f93\u51fa\u8fc7\u591a\u4fe1\u606f<br \/>\n    }<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>\u6b65\u9aa4 2&#xff1a;\u7f16\u8bd1\u8fd0\u884c\u5e76\u67e5\u770b\u8fdb\u7a0b PID<\/h4>\n<p># \u7f16\u8bd1<br \/>\ng&#043;&#043; sig_backend.cpp -o sig_backend<br \/>\n# \u540e\u53f0\u8fd0\u884c<br \/>\n.\/sig_backend &amp;<br \/>\n# \u67e5\u770b\u8fdb\u7a0bPID&#xff08;\u786e\u8ba4\u8fdb\u7a0b\u6b63\u5728\u8fd0\u884c&#xff09;<br \/>\nps aux | grep sig_backend<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u7c7b\u4f3c\u5982\u4e0b&#xff08;PID \u4e3a 12349&#xff09;&#xff1a;<\/p>\n<p>user      12349  0.0  0.0   4384   820 pts\/0    S    10:00   0:00 .\/sig_backend<\/p>\n<h4>\u6b65\u9aa4 3&#xff1a;\u7528 kill \u547d\u4ee4\u53d1\u9001\u4e0d\u540c\u4fe1\u53f7<\/h4>\n<h5>\u9a8c\u8bc1 1&#xff1a;\u53d1\u9001 SIGINT \u4fe1\u53f7&#xff08;2 \u53f7&#xff09;<\/h5>\n<p>kill -SIGINT 12349<br \/>\n# \u6216 kill -2 12349<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7531\u4e8e\u540e\u53f0\u8fdb\u7a0b\u9ed8\u8ba4\u4e0d\u4f1a\u5904\u7406 <span style=\"color:#956fe7\">SIGINT <\/span>\u4fe1\u53f7&#xff08;\u9664\u975e\u81ea\u5b9a\u4e49&#xff09;&#xff0c;\u8fdb\u7a0b\u4f1a\u7ee7\u7eed\u8fd0\u884c&#xff0c;\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7jobs\u547d\u4ee4\u67e5\u770b&#xff1a;<\/p>\n<p>jobs<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8f93\u51fa\u663e\u793a\u8fdb\u7a0b\u4ecd\u5728\u8fd0\u884c&#xff1a;<\/p>\n<p>[1]&#043;  Running                 .\/sig_backend &amp;<\/p>\n<h5>\u9a8c\u8bc1 2&#xff1a;\u53d1\u9001 SIGKILL \u4fe1\u53f7&#xff08;9 \u53f7&#xff09;\u2014\u2014 \u5f3a\u5236\u7ec8\u6b62\u8fdb\u7a0b<\/h5>\n<p>kill -SIGKILL 12349<br \/>\n# \u6216 kill -9 12349<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u518d\u6b21\u67e5\u770b\u8fdb\u7a0b&#xff0c;\u53d1\u73b0\u8fdb\u7a0b\u5df2\u88ab\u7ec8\u6b62&#xff1a;<\/p>\n<p>ps aux | grep sig_backend<br \/>\n# \u65e0\u76f8\u5173\u8fdb\u7a0b\u8f93\u51fa&#xff08;\u6216\u663e\u793a&lt;defunct&gt;&#xff0c;\u8868\u793a\u50f5\u5c38\u8fdb\u7a0b&#xff0c;\u540e\u7eed\u4f1a\u88ab\u7cfb\u7edf\u6e05\u7406&#xff09;<\/p>\n<h5>\u9a8c\u8bc1 3&#xff1a;\u53d1\u9001 SIGSEGV \u4fe1\u53f7&#xff08;11 \u53f7&#xff09;\u2014\u2014 \u89e6\u53d1\u6bb5\u9519\u8bef<\/h5>\n<p>\u00a0 \u00a0 <span style=\"color:#956fe7\">SIGSEGV <\/span>\u4fe1\u53f7\u7684\u9ed8\u8ba4\u52a8\u4f5c\u662f \u201c\u7ec8\u6b62\u8fdb\u7a0b\u5e76\u751f\u6210 Core Dump\u201d&#xff0c;\u901a\u5e38\u7531\u975e\u6cd5\u5185\u5b58\u8bbf\u95ee\u89e6\u53d1&#xff0c;\u4f46\u6211\u4eec\u4e5f\u53ef\u4ee5\u901a\u8fc7 kill \u547d\u4ee4\u4e3b\u52a8\u53d1\u9001&#xff1a;<\/p>\n<p># \u5148\u5f00\u542fCore Dump\u529f\u80fd<br \/>\nulimit -c 1024<br \/>\n# \u91cd\u65b0\u542f\u52a8\u540e\u53f0\u8fdb\u7a0b<br \/>\n.\/sig_backend &amp;<br \/>\n# \u53d1\u9001SIGSEGV\u4fe1\u53f7<br \/>\nkill -SIGSEGV 12350<br \/>\n# \u6216 kill -11 12350<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u8fdb\u7a0b\u88ab\u7ec8\u6b62\u5e76\u751f\u6210 Core \u6587\u4ef6&#xff1a;<\/p>\n<p>[1]&#043;  Segmentation fault (core dumped) .\/sig_backend<\/p>\n<h3>3.3 \u6269\u5c55\u547d\u4ee4&#xff1a;pkill \u547d\u4ee4 \u2014\u2014 \u6309\u8fdb\u7a0b\u540d\u53d1\u9001\u4fe1\u53f7<\/h3>\n<p>\u00a0 \u00a0 <span style=\"color:#956fe7\">pkill<\/span>\u547d\u4ee4\u53ef\u4ee5\u6839\u636e\u8fdb\u7a0b\u540d\u53d1\u9001\u4fe1\u53f7&#xff0c;\u65e0\u9700\u624b\u52a8\u67e5\u8be2 PID&#xff0c;\u66f4\u65b9\u4fbf\u5feb\u6377&#xff1a;<\/p>\n<p># \u7ec8\u6b62\u6240\u6709\u540d\u4e3asig_backend\u7684\u8fdb\u7a0b<br \/>\npkill -f sig_backend<br \/>\n# \u5411\u6240\u6709\u540d\u4e3asig_backend\u7684\u8fdb\u7a0b\u53d1\u9001SIGINT\u4fe1\u53f7<br \/>\npkill -SIGINT -f sig_backend<\/p>\n<h3>3.4 \u7cfb\u7edf\u547d\u4ee4\u89e6\u53d1\u4fe1\u53f7\u7684\u6838\u5fc3\u603b\u7ed3<\/h3>\n<ul>\n<li>\u7cfb\u7edf\u547d\u4ee4&#xff08;kill\/pkill&#xff09;\u662f\u7528\u6237\u4e3b\u52a8\u53d1\u9001\u4fe1\u53f7\u7684\u624b\u6bb5&#xff0c;\u672c\u8d28\u662f\u901a\u8fc7\u547d\u4ee4\u8c03\u7528<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">kill()<\/span><\/span>\u7cfb\u7edf\u8c03\u7528&#xff1b;<\/li>\n<li>\u4fe1\u53f7\u7684\u4ea7\u751f\u4ecd\u7531 OS \u5b8c\u6210&#xff0c;\u547d\u4ee4\u4ec5\u8d1f\u8d23\u4f20\u9012 \u201c\u53d1\u9001\u4fe1\u53f7\u201d \u7684\u8bf7\u6c42&#xff1b;<\/li>\n<li>9 \u53f7\u4fe1\u53f7&#xff08;SIGKILL&#xff09;\u548c 19 \u53f7\u4fe1\u53f7&#xff08;SIGSTOP&#xff09;\u4e0d\u53ef\u6355\u6349\u3001\u4e0d\u53ef\u5ffd\u7565&#xff0c;\u662f OS \u5f3a\u5236\u63a7\u5236\u8fdb\u7a0b\u7684\u7ec8\u6781\u624b\u6bb5\u3002<\/li>\n<\/ul>\n<h2 style=\"background-color:transparent\">\u56db\u3001\u573a\u666f 3&#xff1a;\u51fd\u6570\u8c03\u7528\u89e6\u53d1 \u2014\u2014 \u5728\u4ee3\u7801\u4e2d\u4e3b\u52a8\u4ea7\u751f\u4fe1\u53f7<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u9664\u4e86\u901a\u8fc7\u7ec8\u7aef\u548c\u547d\u4ee4&#xff0c;\u6211\u4eec\u8fd8\u53ef\u4ee5\u5728 C\/C&#043;&#043; \u4ee3\u7801\u4e2d\u8c03\u7528\u7279\u5b9a\u51fd\u6570&#xff0c;\u4e3b\u52a8\u4ea7\u751f\u4fe1\u53f7\u5e76\u53d1\u9001\u7ed9\u8fdb\u7a0b\u3002Linux \u7cfb\u7edf\u63d0\u4f9b\u4e86\u4e09\u4e2a\u6838\u5fc3\u51fd\u6570&#xff1a;<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">kill()<\/span><span style=\"background-color:#fbd4d0\">\u3001<\/span><span style=\"background-color:#fbd4d0\">raise()<\/span><span style=\"background-color:#fbd4d0\">\u3001<\/span><span style=\"background-color:#fbd4d0\">abort()<\/span><\/span>&#xff0c;\u5206\u522b\u7528\u4e8e \u201c\u5411\u6307\u5b9a\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7\u201d\u3001\u201c\u5411\u5f53\u524d\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7\u201d\u3001\u201c\u5f3a\u5236\u5f53\u524d\u8fdb\u7a0b\u5f02\u5e38\u7ec8\u6b62\u201d\u3002<\/p>\n<h3>4.1 kill () \u51fd\u6570&#xff1a;\u5411\u6307\u5b9a\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7<\/h3>\n<p>\u00a0 \u00a0 <span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">kill()<\/span><\/span>\u51fd\u6570\u662f<span style=\"color:#956fe7\">kill<\/span>\u547d\u4ee4\u7684\u5e95\u5c42\u5b9e\u73b0&#xff0c;\u5141\u8bb8\u8fdb\u7a0b\u5411\u53e6\u4e00\u4e2a\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7&#xff0c;\u5176\u51fd\u6570\u539f\u578b\u5982\u4e0b&#xff1a;<\/p>\n<p>#include &lt;sys\/types.h&gt;<br \/>\n#include &lt;signal.h&gt;<\/p>\n<p>int kill(pid_t pid, int sig);<\/p>\n<h4>\u53c2\u6570\u8bf4\u660e<\/h4>\n<ul>\n<li><span style=\"color:#956fe7\">pid<\/span>&#xff1a;\u76ee\u6807\u8fdb\u7a0b\u7684 PID&#xff0c;\u6709\u4e09\u79cd\u53d6\u503c&#xff1a;\n<ul>\n<li>pid &gt; 0&#xff1a;\u53d1\u9001\u4fe1\u53f7\u7ed9 PID \u4e3apid\u7684\u8fdb\u7a0b&#xff1b;<\/li>\n<li>pid &#061; 0&#xff1a;\u53d1\u9001\u4fe1\u53f7\u7ed9\u5f53\u524d\u8fdb\u7a0b\u6240\u5728\u8fdb\u7a0b\u7ec4\u7684\u6240\u6709\u8fdb\u7a0b&#xff1b;<\/li>\n<li>pid &#061; -1&#xff1a;\u53d1\u9001\u4fe1\u53f7\u7ed9\u5f53\u524d\u7528\u6237\u6709\u6743\u9650\u53d1\u9001\u7684\u6240\u6709\u8fdb\u7a0b&#xff08;\u9664\u4e86 init \u8fdb\u7a0b&#xff09;&#xff1b;<\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color:#956fe7\">sig<\/span>&#xff1a;\u8981\u53d1\u9001\u7684\u4fe1\u53f7\u7f16\u53f7\u6216\u5b8f\u5b9a\u4e49&#xff08;\u5982 SIGINT\u3001SIGKILL&#xff09;&#xff1b;<\/li>\n<li><span style=\"color:#956fe7\">\u8fd4\u56de\u503c<\/span>&#xff1a;\u6210\u529f\u8fd4\u56de 0&#xff0c;\u5931\u8d25\u8fd4\u56de &#8211; 1&#xff0c;\u5e76\u8bbe\u7f6eerrno\u3002<\/li>\n<\/ul>\n<h4>\u5b9e\u6218&#xff1a;\u5b9e\u73b0\u81ea\u5df1\u7684 \u201ckill \u547d\u4ee4\u201d<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6211\u4eec\u53ef\u4ee5\u7528<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">kill()<\/span><\/span>\u51fd\u6570\u5b9e\u73b0\u4e00\u4e2a\u7b80\u5355\u7684\u81ea\u5b9a\u4e49 kill \u547d\u4ee4&#xff0c;\u652f\u6301\u901a\u8fc7 \u201c- \u4fe1\u53f7\u7f16\u53f7 \u8fdb\u7a0b PID\u201d \u7684\u683c\u5f0f\u53d1\u9001\u4fe1\u53f7&#xff1a;<\/p>\n<p>\/\/ mykill.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;sys\/types.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\n#include &lt;cstdlib&gt;<br \/>\nusing namespace std;<\/p>\n<p>int main(int argc, char *argv[])<br \/>\n{<br \/>\n    \/\/ \u68c0\u67e5\u53c2\u6570\u4e2a\u6570&#xff1a;.\/mykill -signumber pid<br \/>\n    if (argc !&#061; 3)<br \/>\n    {<br \/>\n        cerr &lt;&lt; &#034;\u7528\u6cd5\u9519\u8bef&#xff01;\u6b63\u786e\u683c\u5f0f&#xff1a;&#034; &lt;&lt; argv[0] &lt;&lt; &#034; -signumber pid&#034; &lt;&lt; endl;<br \/>\n        cerr &lt;&lt; &#034;\u793a\u4f8b&#xff1a;&#034; &lt;&lt; argv[0] &lt;&lt; &#034; -2 12345&#xff08;\u53d1\u9001SIGINT\u4fe1\u53f7\u7ed9PID\u4e3a12345\u7684\u8fdb\u7a0b&#xff09;&#034; &lt;&lt; endl;<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    \/\/ \u89e3\u6790\u4fe1\u53f7\u7f16\u53f7&#xff08;\u53bb\u6389argv[1]\u7684 &#039;-&#039; \u524d\u7f00&#xff09;<br \/>\n    int sig &#061; stoi(argv[1] &#043; 1);<br \/>\n    \/\/ \u89e3\u6790\u76ee\u6807\u8fdb\u7a0bPID<br \/>\n    pid_t pid &#061; stoi(argv[2]);<\/p>\n<p>    \/\/ \u8c03\u7528kill()\u51fd\u6570\u53d1\u9001\u4fe1\u53f7<br \/>\n    int ret &#061; kill(pid, sig);<br \/>\n    if (ret &#061;&#061; 0)<br \/>\n    {<br \/>\n        cout &lt;&lt; &#034;\u6210\u529f\u5411\u8fdb\u7a0bPID&#061;&#034; &lt;&lt; pid &lt;&lt; &#034;\u53d1\u9001\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; sig &lt;&lt; endl;<br \/>\n    }<br \/>\n    else<br \/>\n    {<br \/>\n        cerr &lt;&lt; &#034;\u53d1\u9001\u4fe1\u53f7\u5931\u8d25&#xff01;\u53ef\u80fd\u539f\u56e0&#xff1a;\u8fdb\u7a0b\u4e0d\u5b58\u5728\u3001\u65e0\u6743\u9650\u53d1\u9001\u4fe1\u53f7&#034; &lt;&lt; endl;<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c\u4e0e\u6d4b\u8bd5<\/h4>\n<p># \u7f16\u8bd1<br \/>\ng&#043;&#043; mykill.cpp -o mykill<br \/>\n# \u5148\u542f\u52a8\u4e00\u4e2a\u540e\u53f0\u8fdb\u7a0b&#xff08;\u5982\u4e4b\u524d\u7684sig_backend&#xff09;<br \/>\n.\/sig_backend &amp;<br \/>\n# \u7528\u81ea\u5b9a\u4e49mykill\u53d1\u9001SIGINT\u4fe1\u53f7&#xff08;2\u53f7&#xff09;<br \/>\n.\/mykill -2 12351<br \/>\n# \u7528\u81ea\u5b9a\u4e49mykill\u53d1\u9001SIGKILL\u4fe1\u53f7&#xff08;9\u53f7&#xff09;&#xff0c;\u5f3a\u5236\u7ec8\u6b62\u8fdb\u7a0b<br \/>\n.\/mykill -9 12351<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u9a8c\u8bc1\u4e86<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">kill()<\/span><\/span>\u51fd\u6570\u7684\u529f\u80fd&#xff1a;<\/p>\n<p>\u6210\u529f\u5411\u8fdb\u7a0bPID&#061;12351\u53d1\u9001\u4fe1\u53f7&#xff1a;2<br \/>\n\u6210\u529f\u5411\u8fdb\u7a0bPID&#061;12351\u53d1\u9001\u4fe1\u53f7&#xff1a;9<\/p>\n<h3 style=\"background-color:transparent\">4.2 raise () \u51fd\u6570&#xff1a;\u5411\u5f53\u524d\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7<\/h3>\n<p>\u00a0 \u00a0 <span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">raise()<\/span><\/span>\u51fd\u6570\u7528\u4e8e\u5411\u5f53\u524d\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7&#xff0c;\u7b49\u4ef7\u4e8e<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">kill(getpid(), sig)<\/span><\/span>&#xff0c;\u51fd\u6570\u539f\u578b\u5982\u4e0b&#xff1a;<\/p>\n<p>#include &lt;signal.h&gt;<\/p>\n<p>int raise(int sig);<\/p>\n<h4>\u53c2\u6570\u8bf4\u660e<\/h4>\n<ul>\n<li><span style=\"color:#956fe7\">sig<\/span>&#xff1a;\u8981\u53d1\u9001\u7684\u4fe1\u53f7\u7f16\u53f7\u6216\u5b8f\u5b9a\u4e49&#xff1b;<\/li>\n<li><span style=\"color:#956fe7\">\u8fd4\u56de\u503c<\/span>&#xff1a;\u6210\u529f\u8fd4\u56de 0&#xff0c;\u5931\u8d25\u8fd4\u56de\u975e 0\u3002<\/li>\n<\/ul>\n<h4>\u5b9e\u6218&#xff1a;\u6bcf\u9694 1 \u79d2\u5411\u81ea\u5df1\u53d1\u9001 SIGINT \u4fe1\u53f7<\/h4>\n<p>\/\/ sig_raise.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sig_handler(int signum)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u5f53\u524d\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; endl;<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u5f00\u59cb\u8fd0\u884c&#8230;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u6ce8\u518cSIGINT\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGINT, sig_handler);<\/p>\n<p>    \/\/ \u6bcf\u96941\u79d2&#xff0c;\u5411\u5f53\u524d\u8fdb\u7a0b\u53d1\u9001SIGINT\u4fe1\u53f7<br \/>\n    while (true)<br \/>\n    {<br \/>\n        sleep(1);<br \/>\n        \/\/ \u8c03\u7528raise()\u51fd\u6570\u53d1\u9001\u4fe1\u53f7<br \/>\n        raise(SIGINT);<br \/>\n    }<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c<\/h4>\n<p>g&#043;&#043; sig_raise.cpp -o sig_raise<br \/>\n.\/sig_raise<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u8fdb\u7a0b\u6bcf\u9694 1 \u79d2\u6355\u83b7\u5230\u4e00\u6b21 SIGINT \u4fe1\u53f7&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12352&#xff0c;\u5f00\u59cb\u8fd0\u884c&#8230;<br \/>\n\u5f53\u524d\u8fdb\u7a0bPID&#xff1a;12352&#xff0c;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;2<br \/>\n\u5f53\u524d\u8fdb\u7a0bPID&#xff1a;12352&#xff0c;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;2<br \/>\n\u5f53\u524d\u8fdb\u7a0bPID&#xff1a;12352&#xff0c;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;2<br \/>\n&#8230;<\/p>\n<h3>4.3 abort () \u51fd\u6570&#xff1a;\u5f3a\u5236\u5f53\u524d\u8fdb\u7a0b\u5f02\u5e38\u7ec8\u6b62<\/h3>\n<p>\u00a0 \u00a0 <span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">abort()<\/span><\/span>\u51fd\u6570\u7528\u4e8e\u5f3a\u5236\u5f53\u524d\u8fdb\u7a0b\u5f02\u5e38\u7ec8\u6b62&#xff0c;\u5176\u672c\u8d28\u662f\u5411\u5f53\u524d\u8fdb\u7a0b\u53d1\u9001<span style=\"color:#956fe7\">SIGABRT<\/span>\u4fe1\u53f7&#xff08;6 \u53f7&#xff09;&#xff0c;\u51fd\u6570\u539f\u578b\u5982\u4e0b&#xff1a;<\/p>\n<p>#include &lt;stdlib.h&gt;<\/p>\n<p>void abort(void);<\/p>\n<h4>\u6838\u5fc3\u7279\u70b9<\/h4>\n<ul>\n<li><span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">abort()<\/span><\/span>\u51fd\u6570\u6c38\u8fdc\u4e0d\u4f1a\u8fd4\u56de&#xff0c;\u8c03\u7528\u540e\u8fdb\u7a0b\u5fc5\u7136\u7ec8\u6b62&#xff1b;<\/li>\n<li>\u5373\u4f7f\u8fdb\u7a0b\u81ea\u5b9a\u4e49\u4e86<span style=\"color:#956fe7\">SIGABRT<\/span>\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570&#xff0c;<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">abort()<\/span><\/span>\u51fd\u6570\u4ecd\u4f1a\u5f3a\u5236\u7ec8\u6b62\u8fdb\u7a0b&#xff08;\u5904\u7406\u51fd\u6570\u4f1a\u6267\u884c&#xff0c;\u4f46\u6267\u884c\u5b8c\u6bd5\u540e\u8fdb\u7a0b\u4ecd\u4f1a\u9000\u51fa&#xff09;&#xff1b;<\/li>\n<li>\u9ed8\u8ba4\u52a8\u4f5c\u662f \u201c\u7ec8\u6b62\u8fdb\u7a0b\u5e76\u751f\u6210 Core Dump \u6587\u4ef6\u201d\u3002<\/li>\n<\/ul>\n<h4>\u5b9e\u6218&#xff1a;\u9a8c\u8bc1 abort () \u51fd\u6570\u7684\u4f5c\u7528<\/h4>\n<p>\/\/ sig_abort.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;stdlib.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49SIGABRT\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sigabrt_handler(int signum)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; &#034;&#xff08;SIGABRT&#xff09;&#xff0c;abort()\u51fd\u6570\u88ab\u8c03\u7528&#xff01;&#034; &lt;&lt; endl;<br \/>\n    cout &lt;&lt; &#034;\u5904\u7406\u51fd\u6570\u6267\u884c\u5b8c\u6bd5&#xff0c;\u8fdb\u7a0b\u5373\u5c06\u7ec8\u6b62&#8230;&#034; &lt;&lt; endl;<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u5f00\u59cb\u8fd0\u884c&#8230;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u6ce8\u518cSIGABRT\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGABRT, sigabrt_handler);<\/p>\n<p>    cout &lt;&lt; &#034;3\u79d2\u540e\u8c03\u7528abort()\u51fd\u6570&#8230;&#034; &lt;&lt; endl;<br \/>\n    sleep(3);<\/p>\n<p>    \/\/ \u8c03\u7528abort()\u51fd\u6570&#xff0c;\u5f3a\u5236\u7ec8\u6b62\u8fdb\u7a0b<br \/>\n    abort();<\/p>\n<p>    \/\/ \u4ee5\u4e0b\u4ee3\u7801\u6c38\u8fdc\u4e0d\u4f1a\u6267\u884c<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0b\u7ee7\u7eed\u8fd0\u884c&#8230;&#034; &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c<\/h4>\n<p>g&#043;&#043; sig_abort.cpp -o sig_abort<br \/>\n.\/sig_abort<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u9a8c\u8bc1\u4e86<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">abort()<\/span><\/span>\u51fd\u6570\u7684\u5f3a\u5236\u7ec8\u6b62\u7279\u6027&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12353&#xff0c;\u5f00\u59cb\u8fd0\u884c&#8230;<br \/>\n3\u79d2\u540e\u8c03\u7528abort()\u51fd\u6570&#8230;<br \/>\n\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;6&#xff08;SIGABRT&#xff09;&#xff0c;abort()\u51fd\u6570\u88ab\u8c03\u7528&#xff01;<br \/>\n\u5904\u7406\u51fd\u6570\u6267\u884c\u5b8c\u6bd5&#xff0c;\u8fdb\u7a0b\u5373\u5c06\u7ec8\u6b62&#8230;<br \/>\nAborted (core dumped)<\/p>\n<h3 style=\"background-color:transparent\">4.4 \u51fd\u6570\u8c03\u7528\u89e6\u53d1\u4fe1\u53f7\u7684\u6838\u5fc3\u603b\u7ed3<\/h3>\n<table>\n<tr>\u51fd\u6570\u529f\u80fd\u6838\u5fc3\u7279\u70b9\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td><span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">kill()<\/span><\/span><\/td>\n<td>\u5411\u6307\u5b9a\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7<\/td>\n<td>\u652f\u6301\u8de8\u8fdb\u7a0b\u53d1\u9001&#xff0c;\u9700\u8981\u76ee\u6807 PID<\/td>\n<td>\u8fdb\u7a0b\u95f4\u4fe1\u53f7\u901a\u4fe1<\/td>\n<\/tr>\n<tr>\n<td><span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">raise()<\/span><\/span><\/td>\n<td>\u5411\u5f53\u524d\u8fdb\u7a0b\u53d1\u9001\u4fe1\u53f7<\/td>\n<td>\u4ec5\u80fd\u5411\u81ea\u8eab\u53d1\u9001&#xff0c;\u7b49\u4ef7\u4e8e kill (getpid (), sig)<\/td>\n<td>\u8fdb\u7a0b\u81ea\u6211\u89e6\u53d1\u4fe1\u53f7<\/td>\n<\/tr>\n<tr>\n<td><span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">abort()<\/span><\/span><\/td>\n<td>\u5f3a\u5236\u5f53\u524d\u8fdb\u7a0b\u5f02\u5e38\u7ec8\u6b62<\/td>\n<td>\u53d1\u9001 SIGABRT \u4fe1\u53f7&#xff0c;\u4e0d\u53ef\u907f\u514d\u7ec8\u6b62<\/td>\n<td>\u7a0b\u5e8f\u5f02\u5e38\u65f6\u4e3b\u52a8\u9000\u51fa<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u4e94\u3001\u573a\u666f 4&#xff1a;\u8f6f\u4ef6\u6761\u4ef6\u89e6\u53d1 \u2014\u2014 \u7531\u7a0b\u5e8f\u8fd0\u884c\u72b6\u6001\u4ea7\u751f\u4fe1\u53f7<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8f6f\u4ef6\u6761\u4ef6\u89e6\u53d1\u662f\u6307&#xff1a;\u4fe1\u53f7\u7684\u4ea7\u751f\u6e90\u4e8e\u7a0b\u5e8f\u7684\u8fd0\u884c\u72b6\u6001\u6216\u8f6f\u4ef6\u903b\u8f91&#xff0c;\u800c\u975e\u7528\u6237\u64cd\u4f5c\u6216\u786c\u4ef6\u5f02\u5e38\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6700\u5178\u578b\u7684\u4f8b\u5b50\u662f<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">alarm()<\/span><\/span>\u51fd\u6570\u8bbe\u7f6e\u7684\u5b9a\u65f6\u5668\u8d85\u65f6&#xff08;\u89e6\u53d1SIGALRM\u4fe1\u53f7&#xff09;&#xff0c;\u4ee5\u53ca\u5411\u5df2\u5173\u95ed\u7684\u7ba1\u9053\u5199\u6570\u636e&#xff08;\u89e6\u53d1SIGPIPE\u4fe1\u53f7&#xff09;\u3002<\/p>\n<h3>5.1 \u6838\u5fc3\u6848\u4f8b 1&#xff1a;alarm () \u51fd\u6570 \u2014\u2014 \u5b9a\u65f6\u5668\u8d85\u65f6\u89e6\u53d1 SIGALRM \u4fe1\u53f7<\/h3>\n<p>\u00a0 \u00a0 <span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">alarm()<\/span><\/span>\u51fd\u6570\u7528\u4e8e\u8bbe\u7f6e\u4e00\u4e2a\u5b9a\u65f6\u5668&#xff0c;\u5f53\u5b9a\u65f6\u5668\u8d85\u65f6\u540e&#xff0c;OS \u4f1a\u5411\u5f53\u524d\u8fdb\u7a0b\u53d1\u9001<span style=\"color:#956fe7\">SIGALRM<\/span>\u4fe1\u53f7&#xff08;14 \u53f7&#xff09;&#xff0c;\u5176\u9ed8\u8ba4\u5904\u7406\u52a8\u4f5c\u662f \u201c\u7ec8\u6b62\u8fdb\u7a0b\u201d\u3002\u51fd\u6570\u539f\u578b\u5982\u4e0b&#xff1a;<\/p>\n<p>#include &lt;unistd.h&gt;<\/p>\n<p>unsigned int alarm(unsigned int seconds);<\/p>\n<h4>\u53c2\u6570\u4e0e\u8fd4\u56de\u503c<\/h4>\n<ul>\n<li><span style=\"color:#956fe7\">seconds<\/span>&#xff1a;\u5b9a\u65f6\u5668\u8d85\u65f6\u65f6\u95f4&#xff08;\u79d2&#xff09;&#xff0c;\u82e5\u4e3a 0 \u5219\u53d6\u6d88\u4e4b\u524d\u8bbe\u7f6e\u7684\u5b9a\u65f6\u5668&#xff1b;<\/li>\n<li><span style=\"color:#956fe7\">\u8fd4\u56de\u503c<\/span>&#xff1a;\u82e5\u4e4b\u524d\u5df2\u8bbe\u7f6e\u5b9a\u65f6\u5668&#xff0c;\u8fd4\u56de\u5269\u4f59\u8d85\u65f6\u65f6\u95f4&#xff1b;\u82e5\u4e4b\u524d\u65e0\u5b9a\u65f6\u5668&#xff0c;\u8fd4\u56de 0\u3002<\/li>\n<\/ul>\n<h4>\u901a\u4fd7\u7406\u89e3 alarm () \u51fd\u6570<\/h4>\n<p>\u00a0 \u00a0 <span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">alarm()<\/span><\/span>\u51fd\u6570\u5c31\u50cf\u4e00\u4e2a \u201c\u95f9\u949f\u201d&#xff1a;\u4f60\u8bbe\u5b9a\u4e00\u4e2a\u65f6\u95f4&#xff08;seconds&#xff09;&#xff0c;\u65f6\u95f4\u5230\u540e\u95f9\u949f\u54cd\u8d77&#xff08;OS \u53d1\u9001 SIGALRM \u4fe1\u53f7&#xff09;\u3002\u5982\u679c\u5728\u95f9\u949f\u54cd\u4e4b\u524d\u4f60\u91cd\u65b0\u8bbe\u5b9a\u4e86\u4e00\u4e2a\u65b0\u65f6\u95f4&#xff0c;\u90a3\u4e48\u65e7\u7684\u95f9\u949f\u4f1a\u88ab\u53d6\u6d88&#xff0c;\u8fd4\u56de\u503c\u662f\u65e7\u95f9\u949f\u5269\u4f59\u7684\u65f6\u95f4\u3002<\/p>\n<h4>\u5b9e\u6218 1&#xff1a;\u57fa\u672c\u7528\u6cd5 \u2014\u20141 \u79d2\u540e\u7ec8\u6b62\u8fdb\u7a0b<\/h4>\n<p>\/\/ sig_alarm_basic.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u8bbe\u7f6e1\u79d2\u540e\u89e6\u53d1\u95f9\u949f&#8230;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u8bbe\u7f6e\u5b9a\u65f6\u5668&#xff1a;1\u79d2\u540e\u53d1\u9001SIGALRM\u4fe1\u53f7<br \/>\n    alarm(1);<\/p>\n<p>    \/\/ \u6b7b\u5faa\u73af&#xff0c;\u7b49\u5f85\u4fe1\u53f7\u89e6\u53d1<br \/>\n    int count &#061; 0;<br \/>\n    while (true)<br \/>\n    {<br \/>\n        count&#043;&#043;;<br \/>\n        \/\/ \u4e0d\u8f93\u51fa\u8fc7\u591a\u4fe1\u606f&#xff0c;\u907f\u514dIO\u5f71\u54cd\u8ba1\u6570<br \/>\n    }<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c<\/h4>\n<p>g&#043;&#043; sig_alarm_basic.cpp -o sig_alarm_basic<br \/>\n.\/sig_alarm_basic<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a01 \u79d2\u540e&#xff0c;\u8fdb\u7a0b\u88ab <span style=\"color:#956fe7\">SIGALRM <\/span>\u4fe1\u53f7\u7ec8\u6b62&#xff0c;\u7ec8\u7aef\u8f93\u51fa&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12354&#xff0c;\u8bbe\u7f6e1\u79d2\u540e\u89e6\u53d1\u95f9\u949f&#8230;<br \/>\nAlarm clock  # SIGALRM\u4fe1\u53f7\u7684\u9ed8\u8ba4\u7ec8\u6b62\u4fe1\u606f<\/p>\n<h4>\u5b9e\u6218 2&#xff1a;\u6355\u6349 SIGALRM \u4fe1\u53f7 \u2014\u2014 \u7edf\u8ba1 1 \u79d2\u5185\u7684\u5faa\u73af\u6b21\u6570<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6211\u4eec\u53ef\u4ee5\u81ea\u5b9a\u4e49 <span style=\"color:#956fe7\">SIGALRM <\/span>\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570&#xff0c;\u8ba9\u5b9a\u65f6\u5668\u8d85\u65f6\u540e\u4e0d\u7ec8\u6b62\u8fdb\u7a0b&#xff0c;\u800c\u662f\u6267\u884c\u7edf\u8ba1\u903b\u8f91&#xff1a;<\/p>\n<p>\/\/ sig_alarm_catch.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>int count &#061; 0;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49SIGALRM\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sigalrm_handler(int signum)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;1\u79d2\u65f6\u95f4\u5230&#xff01;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; &#034;&#xff08;SIGALRM&#xff09;&#034; &lt;&lt; endl;<br \/>\n    cout &lt;&lt; &#034;1\u79d2\u5185\u5faa\u73af\u6267\u884c\u6b21\u6570&#xff1a;&#034; &lt;&lt; count &lt;&lt; endl;<br \/>\n    \/\/ \u9000\u51fa\u8fdb\u7a0b<br \/>\n    exit(0);<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u8bbe\u7f6e1\u79d2\u540e\u89e6\u53d1\u95f9\u949f&#8230;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u6ce8\u518cSIGALRM\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGALRM, sigalrm_handler);<br \/>\n    \/\/ \u8bbe\u7f6e\u5b9a\u65f6\u5668&#xff1a;1\u79d2\u540e\u53d1\u9001SIGALRM\u4fe1\u53f7<br \/>\n    alarm(1);<\/p>\n<p>    \/\/ \u6b7b\u5faa\u73af\u8ba1\u6570<br \/>\n    while (true)<br \/>\n    {<br \/>\n        count&#043;&#043;;<br \/>\n    }<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c<\/h4>\n<p>g&#043;&#043; sig_alarm_catch.cpp -o sig_alarm_catch<br \/>\n.\/sig_alarm_catch<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;1 \u79d2\u540e\u8fdb\u7a0b\u6253\u5370\u7edf\u8ba1\u7ed3\u679c\u5e76\u9000\u51fa&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12355&#xff0c;\u8bbe\u7f6e1\u79d2\u540e\u89e6\u53d1\u95f9\u949f&#8230;<br \/>\n1\u79d2\u65f6\u95f4\u5230&#xff01;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;14&#xff08;SIGALRM&#xff09;<br \/>\n1\u79d2\u5185\u5faa\u73af\u6267\u884c\u6b21\u6570&#xff1a;492333713  # \u6570\u503c\u56e0CPU\u6027\u80fd\u800c\u5f02<\/p>\n<h4>\u5b9e\u6218 3&#xff1a;\u91cd\u590d\u95f9\u949f \u2014\u2014 \u6bcf\u9694 1 \u79d2\u89e6\u53d1\u4e00\u6b21 SIGALRM \u4fe1\u53f7<\/h4>\n<p>\u00a0 \u00a0 <span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">alarm()<\/span><\/span>\u51fd\u6570\u662f \u201c\u4e00\u6b21\u6027\u95f9\u949f\u201d&#xff0c;\u89e6\u53d1\u540e\u4f1a\u81ea\u52a8\u53d6\u6d88\u3002\u5982\u679c\u60f3\u8981\u5b9e\u73b0\u91cd\u590d\u89e6\u53d1&#xff0c;\u53ef\u4ee5\u5728\u4fe1\u53f7\u5904\u7406\u51fd\u6570\u4e2d\u91cd\u65b0\u8c03\u7528<span style=\"color:#fe2c24\"><span style=\"background-color:#fbd4d0\">alarm()<\/span><\/span>&#xff1a;<\/p>\n<p>\/\/ sig_alarm_repeat.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>int g_count &#061; 0;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49SIGALRM\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sigalrm_handler(int signum)<br \/>\n{<br \/>\n    g_count&#043;&#043;;<br \/>\n    cout &lt;&lt; &#034;\u7b2c&#034; &lt;&lt; g_count &lt;&lt; &#034;\u6b21\u89e6\u53d1\u95f9\u949f&#xff0c;\u4fe1\u53f7\u7f16\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; endl;<br \/>\n    \/\/ \u91cd\u65b0\u8bbe\u7f6e\u95f9\u949f&#xff1a;1\u79d2\u540e\u518d\u6b21\u89e6\u53d1<br \/>\n    alarm(1);<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u8bbe\u7f6e\u91cd\u590d\u95f9\u949f&#xff08;\u6bcf\u96941\u79d2\u89e6\u53d1&#xff09;&#8230;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u6ce8\u518cSIGALRM\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGALRM, sigalrm_handler);<br \/>\n    \/\/ \u7b2c\u4e00\u6b21\u8bbe\u7f6e\u95f9\u949f&#xff1a;1\u79d2\u540e\u89e6\u53d1<br \/>\n    alarm(1);<\/p>\n<p>    \/\/ \u6682\u505c\u8fdb\u7a0b&#xff0c;\u7b49\u5f85\u4fe1\u53f7\u89e6\u53d1&#xff08;\u907f\u514d\u6b7b\u5faa\u73af\u5360\u7528CPU&#xff09;<br \/>\n    while (true)<br \/>\n    {<br \/>\n        pause();  \/\/ pause()\u51fd\u6570\u4f1a\u8ba9\u8fdb\u7a0b\u7761\u7720&#xff0c;\u76f4\u5230\u6536\u5230\u4e00\u4e2a\u4fe1\u53f7<br \/>\n    }<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c<\/h4>\n<p>g&#043;&#043; sig_alarm_repeat.cpp -o sig_alarm_repeat<br \/>\n.\/sig_alarm_repeat<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u6bcf\u9694 1 \u79d2\u89e6\u53d1\u4e00\u6b21 SIGALRM \u4fe1\u53f7&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12356&#xff0c;\u8bbe\u7f6e\u91cd\u590d\u95f9\u949f&#xff08;\u6bcf\u96941\u79d2\u89e6\u53d1&#xff09;&#8230;<br \/>\n\u7b2c1\u6b21\u89e6\u53d1\u95f9\u949f&#xff0c;\u4fe1\u53f7\u7f16\u53f7&#xff1a;14<br \/>\n\u7b2c2\u6b21\u89e6\u53d1\u95f9\u949f&#xff0c;\u4fe1\u53f7\u7f16\u53f7&#xff1a;14<br \/>\n\u7b2c3\u6b21\u89e6\u53d1\u95f9\u949f&#xff0c;\u4fe1\u53f7\u7f16\u53f7&#xff1a;14<br \/>\n&#8230;<\/p>\n<h3>5.2 \u6838\u5fc3\u6848\u4f8b 2&#xff1a;SIGPIPE \u4fe1\u53f7 \u2014\u2014 \u5411\u5df2\u5173\u95ed\u7684\u7ba1\u9053\u5199\u6570\u636e<\/h3>\n<p>\u00a0 \u00a0 <span style=\"color:#956fe7\">SIGPIPE<\/span>\u4fe1\u53f7&#xff08;13 \u53f7&#xff09;\u7684\u4ea7\u751f\u6761\u4ef6\u662f&#xff1a;\u5f53\u8fdb\u7a0b\u5411\u4e00\u4e2a \u201c\u8bfb\u7aef\u5df2\u5173\u95ed\u201d \u7684\u7ba1\u9053&#xff08;pipe&#xff09;\u5199\u5165\u6570\u636e\u65f6&#xff0c;OS \u4f1a\u5411\u8be5\u8fdb\u7a0b\u53d1\u9001 SIGPIPE \u4fe1\u53f7&#xff0c;\u9ed8\u8ba4\u5904\u7406\u52a8\u4f5c\u662f \u201c\u7ec8\u6b62\u8fdb\u7a0b\u201d\u3002<\/p>\n<h4>\u7ba1\u9053\u7684\u6838\u5fc3\u7279\u6027<\/h4>\n<ul>\n<li>\u7ba1\u9053\u662f\u534a\u53cc\u5de5\u7684&#xff0c;\u5206\u4e3a\u8bfb\u7aef&#xff08;r&#xff09;\u548c\u5199\u7aef&#xff08;w&#xff09;&#xff1b;<\/li>\n<li>\u5f53\u6240\u6709\u8bfb\u7aef\u5173\u95ed\u540e&#xff0c;\u5199\u7aef\u8fdb\u7a0b\u5411\u7ba1\u9053\u5199\u5165\u6570\u636e\u65f6&#xff0c;OS \u4f1a\u53d1\u9001 SIGPIPE \u4fe1\u53f7\u7ec8\u6b62\u5199\u7aef\u8fdb\u7a0b&#xff1b;<\/li>\n<li>\u8fd9\u662f\u4e3a\u4e86\u907f\u514d\u5199\u7aef\u8fdb\u7a0b\u65e0\u610f\u4e49\u5730\u5199\u5165\u6570\u636e&#xff08;\u6ca1\u6709\u8fdb\u7a0b\u8bfb\u53d6&#xff0c;\u6570\u636e\u4f1a\u4e22\u5931&#xff09;\u3002<\/li>\n<\/ul>\n<h4>\u5b9e\u6218&#xff1a;\u89e6\u53d1 SIGPIPE \u4fe1\u53f7<\/h4>\n<p>\/\/ sig_pipe.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\n#include &lt;cstring&gt;<br \/>\nusing namespace std;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49SIGPIPE\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sigpipe_handler(int signum)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; &#034;&#xff08;SIGPIPE&#xff09;&#xff0c;\u5411\u5df2\u5173\u95ed\u7684\u7ba1\u9053\u5199\u6570\u636e&#xff01;&#034; &lt;&lt; endl;<br \/>\n    exit(1);<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    int pipefd[2];  \/\/ pipefd[0]&#xff1a;\u8bfb\u7aef&#xff0c;pipefd[1]&#xff1a;\u5199\u7aef<br \/>\n    \/\/ \u521b\u5efa\u7ba1\u9053<br \/>\n    if (pipe(pipefd) &#061;&#061; -1)<br \/>\n    {<br \/>\n        perror(&#034;pipe\u521b\u5efa\u5931\u8d25&#034;);<br \/>\n        return 1;<br \/>\n    }<\/p>\n<p>    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u7ba1\u9053\u521b\u5efa\u6210\u529f&#xff08;\u8bfb\u7aef&#xff1a;&#034; &lt;&lt; pipefd[0] &lt;&lt; &#034;&#xff0c;\u5199\u7aef&#xff1a;&#034; &lt;&lt; pipefd[1] &lt;&lt; &#034;&#xff09;&#034; &lt;&lt; endl;<\/p>\n<p>    \/\/ \u6ce8\u518cSIGPIPE\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGPIPE, sigpipe_handler);<\/p>\n<p>    \/\/ \u5173\u95ed\u8bfb\u7aef&#xff08;\u6a21\u62df\u8bfb\u7aef\u5df2\u5173\u95ed\u7684\u573a\u666f&#xff09;<br \/>\n    close(pipefd[0]);<br \/>\n    cout &lt;&lt; &#034;\u5df2\u5173\u95ed\u7ba1\u9053\u8bfb\u7aef&#xff0c;\u5c1d\u8bd5\u5411\u5199\u7aef\u5199\u5165\u6570\u636e&#8230;&#034; &lt;&lt; endl;<\/p>\n<p>    \/\/ \u5411\u7ba1\u9053\u5199\u7aef\u5199\u5165\u6570\u636e&#xff08;\u6b64\u65f6\u8bfb\u7aef\u5df2\u5173\u95ed&#xff0c;\u4f1a\u89e6\u53d1SIGPIPE\u4fe1\u53f7&#xff09;<br \/>\n    const char *msg &#061; &#034;Hello, Pipe!&#034;;<br \/>\n    while (true)<br \/>\n    {<br \/>\n        ssize_t ret &#061; write(pipefd[1], msg, strlen(msg));<br \/>\n        if (ret &#061;&#061; -1)<br \/>\n        {<br \/>\n            perror(&#034;write\u5931\u8d25&#034;);<br \/>\n            sleep(1);<br \/>\n        }<br \/>\n        else<br \/>\n        {<br \/>\n            cout &lt;&lt; &#034;\u6210\u529f\u5199\u5165&#034; &lt;&lt; ret &lt;&lt; &#034;\u5b57\u8282\u6570\u636e&#xff1a;&#034; &lt;&lt; msg &lt;&lt; endl;<br \/>\n        }<br \/>\n        sleep(1);<br \/>\n    }<\/p>\n<p>    \/\/ \u5173\u95ed\u5199\u7aef&#xff08;\u4e0d\u4f1a\u6267\u884c\u5230\u8fd9\u91cc&#xff09;<br \/>\n    close(pipefd[1]);<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c<\/h4>\n<p>g&#043;&#043; sig_pipe.cpp -o sig_pipe<br \/>\n.\/sig_pipe<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u89e6\u53d1\u4e86 SIGPIPE \u4fe1\u53f7&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12357&#xff0c;\u7ba1\u9053\u521b\u5efa\u6210\u529f&#xff08;\u8bfb\u7aef&#xff1a;3&#xff0c;\u5199\u7aef&#xff1a;4&#xff09;<br \/>\n\u5df2\u5173\u95ed\u7ba1\u9053\u8bfb\u7aef&#xff0c;\u5c1d\u8bd5\u5411\u5199\u7aef\u5199\u5165\u6570\u636e&#8230;<br \/>\n\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;13&#xff08;SIGPIPE&#xff09;&#xff0c;\u5411\u5df2\u5173\u95ed\u7684\u7ba1\u9053\u5199\u6570\u636e&#xff01;<\/p>\n<h3>5.3 \u8f6f\u4ef6\u6761\u4ef6\u89e6\u53d1\u4fe1\u53f7\u7684\u6838\u5fc3\u603b\u7ed3<\/h3>\n<ul>\n<li>\u8f6f\u4ef6\u6761\u4ef6\u4fe1\u53f7\u7684\u4ea7\u751f\u6e90\u4e8e\u7a0b\u5e8f\u7684\u8fd0\u884c\u72b6\u6001&#xff08;\u5982\u5b9a\u65f6\u5668\u8d85\u65f6\u3001\u7ba1\u9053\u8bfb\u5199\u5f02\u5e38&#xff09;&#xff1b;<\/li>\n<li>\u8fd9\u7c7b\u4fe1\u53f7\u662f OS \u5bf9\u7a0b\u5e8f\u8fd0\u884c\u903b\u8f91\u7684 \u201c\u53cd\u9988\u201d&#xff0c;\u7528\u4e8e\u544a\u77e5\u7a0b\u5e8f \u201c\u67d0\u4e2a\u8f6f\u4ef6\u4e8b\u4ef6\u5df2\u53d1\u751f\u201d&#xff1b;<\/li>\n<li>\u5e38\u89c1\u7684\u8f6f\u4ef6\u6761\u4ef6\u4fe1\u53f7\u5305\u62ec <span style=\"color:#956fe7\">SIGALRM<\/span>&#xff08;\u5b9a\u65f6\u5668\u8d85\u65f6&#xff09;\u3001<span style=\"color:#956fe7\">SIGPIPE<\/span>&#xff08;\u7ba1\u9053\u5199\u5931\u8d25&#xff09;\u3001<span style=\"color:#956fe7\">SIGCHLD<\/span>&#xff08;\u5b50\u8fdb\u7a0b\u7ec8\u6b62&#xff09;\u7b49\u3002<\/li>\n<\/ul>\n<h2>\u516d\u3001\u573a\u666f 5&#xff1a;\u786c\u4ef6\u5f02\u5e38\u89e6\u53d1 \u2014\u2014 \u7531\u786c\u4ef6\u9519\u8bef\u4ea7\u751f\u4fe1\u53f7<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u786c\u4ef6\u5f02\u5e38\u89e6\u53d1\u662f\u6307&#xff1a;\u4fe1\u53f7\u7684\u4ea7\u751f\u6e90\u4e8e CPU \u6216\u5176\u4ed6\u786c\u4ef6\u8bbe\u5907\u7684\u9519\u8bef&#xff0c;\u5982\u9664\u96f6\u64cd\u4f5c\u3001\u975e\u6cd5\u5185\u5b58\u8bbf\u95ee\u3001\u603b\u7ebf\u9519\u8bef\u7b49\u3002\u786c\u4ef6\u68c0\u6d4b\u5230\u9519\u8bef\u540e&#xff0c;\u4f1a\u901a\u77e5 OS&#xff0c;OS \u5c06\u5176\u6620\u5c04\u4e3a\u5bf9\u5e94\u7684\u4fe1\u53f7&#xff0c;\u53d1\u9001\u7ed9\u5f53\u524d\u8fdb\u7a0b\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8fd9\u7c7b\u4fe1\u53f7\u7684\u672c\u8d28\u662f&#xff1a;\u786c\u4ef6\u9519\u8bef\u901a\u8fc7 OS \u8f6c\u6362\u4e3a\u8f6f\u4ef6\u5c42\u9762\u7684\u4fe1\u53f7&#xff0c;\u8ba9\u8fdb\u7a0b\u6709\u673a\u4f1a\u5904\u7406\u9519\u8bef&#xff08;\u5982\u6253\u5370\u65e5\u5fd7\u3001\u4fdd\u5b58\u6570\u636e&#xff09;&#xff0c;\u82e5\u4e0d\u5904\u7406\u5219\u6267\u884c\u9ed8\u8ba4\u52a8\u4f5c&#xff08;\u901a\u5e38\u662f\u7ec8\u6b62\u8fdb\u7a0b\u5e76\u751f\u6210 Core Dump&#xff09;\u3002<\/p>\n<h3>6.1 \u6838\u5fc3\u6848\u4f8b 1&#xff1a;\u9664\u96f6\u64cd\u4f5c \u2014\u2014 \u89e6\u53d1 SIGFPE \u4fe1\u53f7&#xff08;8 \u53f7&#xff09;<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5f53\u8fdb\u7a0b\u6267\u884c \u201c\u9664\u4ee5\u96f6\u201d \u7684\u7b97\u672f\u8fd0\u7b97\u65f6&#xff0c;CPU \u7684\u8fd0\u7b97\u5355\u5143\u4f1a\u68c0\u6d4b\u5230\u8be5\u9519\u8bef&#xff0c;\u901a\u77e5 OS&#xff0c;OS \u5c06\u5176\u6620\u5c04\u4e3a<span style=\"color:#956fe7\">SIGFPE<\/span>\u4fe1\u53f7&#xff08;Floating-point exception&#xff0c;\u6d6e\u70b9\u5f02\u5e38&#xff09;&#xff0c;\u9ed8\u8ba4\u5904\u7406\u52a8\u4f5c\u662f \u201c\u7ec8\u6b62\u8fdb\u7a0b\u5e76\u751f\u6210 Core Dump\u201d\u3002<\/p>\n<h4>\u5b9e\u6218&#xff1a;\u6a21\u62df\u9664\u96f6\u64cd\u4f5c\u89e6\u53d1 SIGFPE \u4fe1\u53f7<\/h4>\n<p>\/\/ sig_fpe_divzero.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49SIGFPE\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sigfpe_handler(int signum)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; &#034;&#xff08;SIGFPE&#xff09;&#xff0c;\u53d1\u751f\u9664\u96f6\u9519\u8bef&#xff01;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u9000\u51fa\u8fdb\u7a0b&#xff08;\u907f\u514d\u65e0\u9650\u5faa\u73af\u89e6\u53d1\u4fe1\u53f7&#xff09;<br \/>\n    exit(1);<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u5c1d\u8bd5\u6267\u884c\u9664\u96f6\u64cd\u4f5c&#8230;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u6ce8\u518cSIGFPE\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGFPE, sigfpe_handler);<\/p>\n<p>    sleep(1);  \/\/ \u5ef6\u8fdf1\u79d2&#xff0c;\u4fbf\u4e8e\u89c2\u5bdf<\/p>\n<p>    \/\/ \u6267\u884c\u9664\u96f6\u64cd\u4f5c<br \/>\n    int a &#061; 10;<br \/>\n    int b &#061; 0;<br \/>\n    int c &#061; a \/ b;  \/\/ \u9664\u96f6\u9519\u8bef&#xff0c;\u89e6\u53d1SIGFPE\u4fe1\u53f7<\/p>\n<p>    \/\/ \u4ee5\u4e0b\u4ee3\u7801\u4e0d\u4f1a\u6267\u884c<br \/>\n    cout &lt;&lt; &#034;\u8ba1\u7b97\u7ed3\u679c&#xff1a;&#034; &lt;&lt; c &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c<\/h4>\n<p>g&#043;&#043; sig_fpe_divzero.cpp -o sig_fpe_divzero<br \/>\n.\/sig_fpe_divzero<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u89e6\u53d1\u4e86 SIGFPE \u4fe1\u53f7&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12358&#xff0c;\u5c1d\u8bd5\u6267\u884c\u9664\u96f6\u64cd\u4f5c&#8230;<br \/>\n\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;8&#xff08;SIGFPE&#xff09;&#xff0c;\u53d1\u751f\u9664\u96f6\u9519\u8bef&#xff01;<\/p>\n<h4>\u5173\u952e\u6ce8\u610f&#xff1a;\u4e3a\u4ec0\u4e48\u4f1a\u65e0\u9650\u89e6\u53d1\u4fe1\u53f7&#xff1f;<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5982\u679c\u6211\u4eec\u4e0d\u5728\u5904\u7406\u51fd\u6570\u4e2d\u9000\u51fa\u8fdb\u7a0b&#xff0c;\u4f1a\u53d1\u73b0 SIGFPE \u4fe1\u53f7\u4f1a\u88ab\u65e0\u9650\u89e6\u53d1\u3002\u539f\u56e0\u662f&#xff1a;\u9664\u96f6\u9519\u8bef\u53d1\u751f\u540e&#xff0c;CPU \u7684\u72b6\u6001\u5bc4\u5b58\u5668\u4f1a\u8bb0\u5f55\u8be5\u9519\u8bef\u72b6\u6001&#xff0c;\u82e5\u4e0d\u6e05\u7406\u8be5\u72b6\u6001&#xff0c;OS \u4f1a\u6301\u7eed\u68c0\u6d4b\u5230\u9519\u8bef&#xff0c;\u4e0d\u65ad\u53d1\u9001 SIGFPE \u4fe1\u53f7\u3002<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u56e0\u6b64&#xff0c;\u5728\u5904\u7406 SIGFPE \u4fe1\u53f7\u65f6&#xff0c;\u901a\u5e38\u9700\u8981\u5728\u5904\u7406\u51fd\u6570\u4e2d\u8c03\u7528exit()\u6216_exit()\u7ec8\u6b62\u8fdb\u7a0b&#xff0c;\u907f\u514d\u65e0\u9650\u5faa\u73af\u3002<\/p>\n<h3>6.2 \u6838\u5fc3\u6848\u4f8b 2&#xff1a;\u975e\u6cd5\u5185\u5b58\u8bbf\u95ee \u2014\u2014 \u89e6\u53d1 SIGSEGV \u4fe1\u53f7&#xff08;11 \u53f7&#xff09;<\/h3>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5f53\u8fdb\u7a0b\u8bbf\u95ee\u975e\u6cd5\u5185\u5b58\u5730\u5740&#xff08;\u5982\u7a7a\u6307\u9488\u3001\u6570\u7ec4\u8d8a\u754c&#xff09;\u65f6&#xff0c;MMU&#xff08;\u5185\u5b58\u7ba1\u7406\u5355\u5143&#xff09;\u4f1a\u68c0\u6d4b\u5230\u8be5\u9519\u8bef&#xff0c;\u901a\u77e5 OS&#xff0c;OS \u5c06\u5176\u6620\u5c04\u4e3a<span style=\"color:#956fe7\">SIGSEGV<\/span>\u4fe1\u53f7&#xff08;Segmentation fault&#xff0c;\u6bb5\u9519\u8bef&#xff09;&#xff0c;\u9ed8\u8ba4\u5904\u7406\u52a8\u4f5c\u662f \u201c\u7ec8\u6b62\u8fdb\u7a0b\u5e76\u751f\u6210 Core Dump\u201d\u3002<\/p>\n<h4>\u5b9e\u6218 1&#xff1a;\u7a7a\u6307\u9488\u8bbf\u95ee\u89e6\u53d1 SIGSEGV \u4fe1\u53f7<\/h4>\n<p>\/\/ sig_segv_nullptr.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49SIGSEGV\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sigsegv_handler(int signum)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; &#034;&#xff08;SIGSEGV&#xff09;&#xff0c;\u975e\u6cd5\u5185\u5b58\u8bbf\u95ee&#xff01;&#034; &lt;&lt; endl;<br \/>\n    exit(1);<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u5c1d\u8bd5\u8bbf\u95ee\u7a7a\u6307\u9488&#8230;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u6ce8\u518cSIGSEGV\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGSEGV, sigsegv_handler);<\/p>\n<p>    sleep(1);<\/p>\n<p>    \/\/ \u8bbf\u95ee\u7a7a\u6307\u9488&#xff08;\u975e\u6cd5\u5185\u5b58\u8bbf\u95ee&#xff09;<br \/>\n    int *p &#061; nullptr;<br \/>\n    *p &#061; 100;  \/\/ \u89e6\u53d1SIGSEGV\u4fe1\u53f7<\/p>\n<p>    \/\/ \u4ee5\u4e0b\u4ee3\u7801\u4e0d\u4f1a\u6267\u884c<br \/>\n    cout &lt;&lt; &#034;\u8d4b\u503c\u6210\u529f&#xff1a;&#034; &lt;&lt; *p &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c<\/h4>\n<p>g&#043;&#043; sig_segv_nullptr.cpp -o sig_segv_nullptr<br \/>\n.\/sig_segv_nullptr<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u89e6\u53d1\u4e86 SIGSEGV \u4fe1\u53f7&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12359&#xff0c;\u5c1d\u8bd5\u8bbf\u95ee\u7a7a\u6307\u9488&#8230;<br \/>\n\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;11&#xff08;SIGSEGV&#xff09;&#xff0c;\u975e\u6cd5\u5185\u5b58\u8bbf\u95ee&#xff01;<\/p>\n<h4>\u5b9e\u6218 2&#xff1a;\u6570\u7ec4\u8d8a\u754c\u8bbf\u95ee\u89e6\u53d1 SIGSEGV \u4fe1\u53f7<\/h4>\n<p>\/\/ sig_segv_array.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\nusing namespace std;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49SIGSEGV\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sigsegv_handler(int signum)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; &#034;&#xff08;SIGSEGV&#xff09;&#xff0c;\u6570\u7ec4\u8d8a\u754c\u8bbf\u95ee&#xff01;&#034; &lt;&lt; endl;<br \/>\n    exit(1);<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u5c1d\u8bd5\u6570\u7ec4\u8d8a\u754c\u8bbf\u95ee&#8230;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u6ce8\u518cSIGSEGV\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGSEGV, sigsegv_handler);<\/p>\n<p>    sleep(1);<\/p>\n<p>    \/\/ \u6570\u7ec4\u8d8a\u754c\u8bbf\u95ee&#xff08;\u975e\u6cd5\u5185\u5b58\u8bbf\u95ee&#xff09;<br \/>\n    int arr[5] &#061; {1, 2, 3, 4, 5};<br \/>\n    cout &lt;&lt; &#034;arr[10] &#061; &#034; &lt;&lt; arr[10] &lt;&lt; endl;  \/\/ \u89e6\u53d1SIGSEGV\u4fe1\u53f7<\/p>\n<p>    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c<\/h4>\n<p>g&#043;&#043; sig_segv_array.cpp -o sig_segv_array<br \/>\n.\/sig_segv_array<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u89e6\u53d1\u4e86 <span style=\"color:#956fe7\">SIGSEGV <\/span>\u4fe1\u53f7&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12360&#xff0c;\u5c1d\u8bd5\u6570\u7ec4\u8d8a\u754c\u8bbf\u95ee&#8230;<br \/>\n\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;11&#xff08;SIGSEGV&#xff09;&#xff0c;\u6570\u7ec4\u8d8a\u754c\u8bbf\u95ee&#xff01;<\/p>\n<h3>6.3 \u6838\u5fc3\u6848\u4f8b 3&#xff1a;\u603b\u7ebf\u9519\u8bef \u2014\u2014 \u89e6\u53d1 SIGBUS \u4fe1\u53f7&#xff08;10 \u53f7&#xff09;<\/h3>\n<p>\u00a0 \u00a0 <span style=\"color:#956fe7\">SIGBUS<\/span>\u4fe1\u53f7&#xff08;Bus error&#xff09;\u7684\u4ea7\u751f\u6761\u4ef6\u662f&#xff1a;\u8fdb\u7a0b\u8bbf\u95ee\u7684\u5185\u5b58\u5730\u5740\u662f\u6709\u6548\u7684&#xff0c;\u4f46\u8bbf\u95ee\u65b9\u5f0f\u4e0d\u6b63\u786e&#xff08;\u5982\u5bf9\u9f50\u9519\u8bef\u3001\u5185\u5b58\u6620\u5c04\u5931\u8d25&#xff09;\u3002\u4e0e <span style=\"color:#956fe7\">SIGSEGV <\/span>\u4fe1\u53f7&#xff08;\u975e\u6cd5\u5730\u5740&#xff09;\u7684\u533a\u522b\u5728\u4e8e&#xff1a;<span style=\"color:#956fe7\">SIGBUS <\/span>\u662f \u201c\u5730\u5740\u6709\u6548\u4f46\u8bbf\u95ee\u65b9\u5f0f\u9519\u8bef\u201d&#xff0c;<span style=\"color:#956fe7\">SIGSEGV <\/span>\u662f \u201c\u5730\u5740\u672c\u8eab\u65e0\u6548\u201d\u3002<\/p>\n<h4>\u5b9e\u6218&#xff1a;\u5185\u5b58\u5bf9\u9f50\u9519\u8bef\u89e6\u53d1 SIGBUS \u4fe1\u53f7<\/h4>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5728\u67d0\u4e9b CPU \u67b6\u6784&#xff08;\u5982 ARM&#xff09;\u4e2d&#xff0c;\u8bbf\u95ee\u672a\u5bf9\u9f50\u7684\u5185\u5b58\u5730\u5740\u4f1a\u89e6\u53d1 <span style=\"color:#956fe7\">SIGBUS <\/span>\u4fe1\u53f7\u3002\u4ee5\u4e0b\u4ee3\u7801\u5728 x86 \u67b6\u6784\u4e2d\u53ef\u80fd\u4e0d\u4f1a\u89e6\u53d1&#xff0c;\u4f46\u5728 ARM \u67b6\u6784\u4e2d\u4f1a\u89e6\u53d1&#xff1a;<\/p>\n<p>\/\/ sig_bus_align.cpp<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &lt;unistd.h&gt;<br \/>\n#include &lt;signal.h&gt;<br \/>\n#include &lt;cstring&gt;<br \/>\nusing namespace std;<\/p>\n<p>\/\/ \u81ea\u5b9a\u4e49SIGBUS\u4fe1\u53f7\u5904\u7406\u51fd\u6570<br \/>\nvoid sigbus_handler(int signum)<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;&#034; &lt;&lt; signum &lt;&lt; &#034;&#xff08;SIGBUS&#xff09;&#xff0c;\u603b\u7ebf\u9519\u8bef&#xff08;\u5185\u5b58\u5bf9\u9f50\u9519\u8bef&#xff09;&#xff01;&#034; &lt;&lt; endl;<br \/>\n    exit(1);<br \/>\n}<\/p>\n<p>int main()<br \/>\n{<br \/>\n    cout &lt;&lt; &#034;\u8fdb\u7a0bPID&#xff1a;&#034; &lt;&lt; getpid() &lt;&lt; &#034;&#xff0c;\u5c1d\u8bd5\u8bbf\u95ee\u672a\u5bf9\u9f50\u7684\u5185\u5b58\u5730\u5740&#8230;&#034; &lt;&lt; endl;<br \/>\n    \/\/ \u6ce8\u518cSIGBUS\u4fe1\u53f7\u7684\u5904\u7406\u51fd\u6570<br \/>\n    signal(SIGBUS, sigbus_handler);<\/p>\n<p>    sleep(1);<\/p>\n<p>    \/\/ \u5185\u5b58\u5bf9\u9f50\u9519\u8bef&#xff1a;char\u6570\u7ec4\u7684\u5730\u5740\u662f1\u5b57\u8282\u5bf9\u9f50&#xff0c;\u5f3a\u5236\u8f6c\u6362\u4e3aint*&#xff08;4\u5b57\u8282\u5bf9\u9f50&#xff09;<br \/>\n    char buf[10];<br \/>\n    int *p &#061; (int *)(buf &#043; 1);  \/\/ buf&#043;1\u7684\u5730\u5740\u4e0d\u662f4\u7684\u500d\u6570&#xff0c;\u672a\u5bf9\u9f50<br \/>\n    *p &#061; 0x12345678;  \/\/ \u89e6\u53d1SIGBUS\u4fe1\u53f7<\/p>\n<p>    \/\/ \u4ee5\u4e0b\u4ee3\u7801\u4e0d\u4f1a\u6267\u884c<br \/>\n    cout &lt;&lt; &#034;\u8d4b\u503c\u6210\u529f&#xff1a;&#034; &lt;&lt; *p &lt;&lt; endl;<br \/>\n    return 0;<br \/>\n}<\/p>\n<h4>\u7f16\u8bd1\u8fd0\u884c&#xff08;ARM \u67b6\u6784&#xff09;<\/h4>\n<p># \u5728ARM\u67b6\u6784\u7684Linux\u7cfb\u7edf\u4e2d\u7f16\u8bd1\u8fd0\u884c<br \/>\ng&#043;&#043; sig_bus_align.cpp -o sig_bus_align<br \/>\n.\/sig_bus_align<\/p>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u7ec8\u7aef\u8f93\u51fa\u5982\u4e0b&#xff0c;\u89e6\u53d1\u4e86 SIGBUS \u4fe1\u53f7&#xff1a;<\/p>\n<p>\u8fdb\u7a0bPID&#xff1a;12361&#xff0c;\u5c1d\u8bd5\u8bbf\u95ee\u672a\u5bf9\u9f50\u7684\u5185\u5b58\u5730\u5740&#8230;<br \/>\n\u6355\u83b7\u5230\u4fe1\u53f7&#xff1a;10&#xff08;SIGBUS&#xff09;&#xff0c;\u603b\u7ebf\u9519\u8bef&#xff08;\u5185\u5b58\u5bf9\u9f50\u9519\u8bef&#xff09;&#xff01;<\/p>\n<h3>6.4 \u786c\u4ef6\u5f02\u5e38\u89e6\u53d1\u4fe1\u53f7\u7684\u6838\u5fc3\u603b\u7ed3<\/h3>\n<table>\n<tr>\u786c\u4ef6\u5f02\u5e38\u5bf9\u5e94\u4fe1\u53f7\u4fe1\u53f7\u7f16\u53f7\u89e6\u53d1\u539f\u56e0\u9ed8\u8ba4\u52a8\u4f5c<\/tr>\n<tbody>\n<tr>\n<td style=\"width:101px\">\u9664\u96f6\u64cd\u4f5c<\/td>\n<td style=\"width:82px\"><span style=\"color:#956fe7\">SIGFPE<\/span><\/td>\n<td>8<\/td>\n<td>\u7b97\u672f\u8fd0\u7b97\u9519\u8bef&#xff08;\u9664\u4ee5\u96f6\u3001\u6d6e\u70b9\u6ea2\u51fa&#xff09;<\/td>\n<td>\u7ec8\u6b62 &#043; Core Dump<\/td>\n<\/tr>\n<tr>\n<td style=\"width:101px\">\u975e\u6cd5\u5185\u5b58\u8bbf\u95ee<\/td>\n<td style=\"width:82px\"><span style=\"color:#956fe7\">SIGSEGV<\/span><\/td>\n<td>11<\/td>\n<td>\u8bbf\u95ee\u65e0\u6548\u5185\u5b58\u5730\u5740&#xff08;\u7a7a\u6307\u9488\u3001\u6570\u7ec4\u8d8a\u754c&#xff09;<\/td>\n<td>\u7ec8\u6b62 &#043; Core Dump<\/td>\n<\/tr>\n<tr>\n<td style=\"width:101px\">\u603b\u7ebf\u9519\u8bef<\/td>\n<td style=\"width:82px\"><span style=\"color:#956fe7\">SIGBUS<\/span><\/td>\n<td>10<\/td>\n<td>\u8bbf\u95ee\u65b9\u5f0f\u9519\u8bef&#xff08;\u5185\u5b58\u5bf9\u9f50\u9519\u8bef\u3001\u6620\u5c04\u5931\u8d25&#xff09;<\/td>\n<td>\u7ec8\u6b62 &#043; Core Dump<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5173\u952e\u533a\u522b&#xff1a;<\/p>\n<ul>\n<li><span style=\"color:#956fe7\">SIGSEGV<\/span>&#xff1a;\u5730\u5740\u65e0\u6548&#xff08;\u201c\u5730\u5740\u4e0d\u5b58\u5728\u201d&#xff09;&#xff1b;<\/li>\n<li><span style=\"color:#956fe7\">SIGBUS<\/span>&#xff1a;\u5730\u5740\u6709\u6548&#xff0c;\u4f46\u8bbf\u95ee\u65b9\u5f0f\u9519\u8bef&#xff08;\u201c\u5730\u5740\u5b58\u5728\u4f46\u8fdb\u4e0d\u53bb\u201d&#xff09;\u3002<\/li>\n<\/ul>\n<hr \/>\n<h2>\u603b\u7ed3<\/h2>\n<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4fe1\u53f7\u4ea7\u751f\u662f Linux \u4fe1\u53f7\u673a\u5236\u7684\u57fa\u7840&#xff0c;\u7406\u89e3\u4e86\u4e0d\u540c\u573a\u666f\u4e0b\u4fe1\u53f7\u7684\u4ea7\u751f\u903b\u8f91&#xff0c;\u624d\u80fd\u66f4\u597d\u5730\u638c\u63e1\u4fe1\u53f7\u7684\u5904\u7406\u4e0e\u5e94\u7528\u3002\u672c\u6587\u7684\u6240\u6709\u4ee3\u7801\u90fd\u7ecf\u8fc7\u5b9e\u6218\u9a8c\u8bc1&#xff0c;\u5efa\u8bae\u5927\u5bb6\u4eb2\u624b\u7f16\u8bd1\u8fd0\u884c&#xff0c;\u611f\u53d7\u4fe1\u53f7\u4ea7\u751f\u7684\u8fc7\u7a0b\u3002\u5982\u679c\u5728\u5b66\u4e60\u8fc7\u7a0b\u4e2d\u9047\u5230\u95ee\u9898&#xff0c;\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u7559\u8a00\u8ba8\u8bba&#xff01;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00\u5728 Linux \u7cfb\u7edf\u4e2d&#xff0c;\u4fe1\u53f7\u662f\u8fdb\u7a0b\u95f4\u5f02\u6b65\u901a\u4fe1\u7684 \u201c\u4fe1\u4f7f\u201d&#xff0c;\u800c \u201c\u4fe1\u53f7\u4ea7\u751f\u201d \u5219\u662f\u8fd9\u4e2a\u901a\u4fe1\u8fc7\u7a0b\u7684\u8d77\u70b9\u3002\u65e0\u8bba\u662f\u6211\u4eec\u719f\u6089\u7684CtrlC\u7ec8\u6b62\u8fdb\u7a0b&#xff0c;\u8fd8\u662f\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u51fa\u73b0\u7684\u6bb5\u9519\u8bef\u3001\u5b9a\u65f6\u5668\u8d85\u65f6&#xff0c;\u672c\u8d28\u4e0a\u90fd\u662f\u4fe1\u53f7\u88ab\u89e6\u53d1\u4ea7\u751f\u7684\u8fc7\u7a0b\u3002\u5f88\u591a\u5f00\u53d1\u8005\u53ea\u77e5\u9053 \u201c\u4fe1\u53f7\u80fd\u7ec8\u6b62\u8fdb\u7a0b\u201d&#xff0c;\u5374\u4e0d\u6e05\u695a\u4fe1\u53f7\u5230\u5e95\u662f\u600e\u4e48\u6765\u7684 \u2014\u2014 \u662f\u7528\u6237\u64cd\u4f5c\u89e6\u53d1\u7684&#xff1f;\u8fd8\u662f\u7cfb\u7edf\u81ea\u52a8\u4ea7\u751f\u7684&#xff1f;\u4e0d\u540c\u573a\u666f\u4e0b\u4fe1\u53f7\u7684\u4ea7\u751f\u673a\u5236\u6709\u4f55\u4e0d\u540c&#xff1f;\u672c\u6587\u5c06\u57fa\u4e8e <\/p>\n","protected":false},"author":2,"featured_media":78144,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[8606,8607,1054,58,16,44,1714],"topic":[],"class_list":["post-78148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-8606","tag-8607","tag-c-c","tag-linux","tag-16","tag-44","tag-1714"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010Linux\u7cfb\u7edf\u7f16\u7a0b\u3011\uff08\u4e09\u5341\u4e94\uff09\u63ed\u79d8 Linux \u4fe1\u53f7\u4ea7\u751f\uff1a\u4ece\u7ec8\u7aef\u5230\u5185\u6838\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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.wsisp.com\/helps\/78148.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Linux\u7cfb\u7edf\u7f16\u7a0b\u3011\uff08\u4e09\u5341\u4e94\uff09\u63ed\u79d8 Linux \u4fe1\u53f7\u4ea7\u751f\uff1a\u4ece\u7ec8\u7aef\u5230\u5185\u6838\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u524d\u8a00\u5728 Linux \u7cfb\u7edf\u4e2d&#xff0c;\u4fe1\u53f7\u662f\u8fdb\u7a0b\u95f4\u5f02\u6b65\u901a\u4fe1\u7684 \u201c\u4fe1\u4f7f\u201d&#xff0c;\u800c \u201c\u4fe1\u53f7\u4ea7\u751f\u201d \u5219\u662f\u8fd9\u4e2a\u901a\u4fe1\u8fc7\u7a0b\u7684\u8d77\u70b9\u3002\u65e0\u8bba\u662f\u6211\u4eec\u719f\u6089\u7684CtrlC\u7ec8\u6b62\u8fdb\u7a0b&#xff0c;\u8fd8\u662f\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u51fa\u73b0\u7684\u6bb5\u9519\u8bef\u3001\u5b9a\u65f6\u5668\u8d85\u65f6&#xff0c;\u672c\u8d28\u4e0a\u90fd\u662f\u4fe1\u53f7\u88ab\u89e6\u53d1\u4ea7\u751f\u7684\u8fc7\u7a0b\u3002\u5f88\u591a\u5f00\u53d1\u8005\u53ea\u77e5\u9053 \u201c\u4fe1\u53f7\u80fd\u7ec8\u6b62\u8fdb\u7a0b\u201d&#xff0c;\u5374\u4e0d\u6e05\u695a\u4fe1\u53f7\u5230\u5e95\u662f\u600e\u4e48\u6765\u7684 \u2014\u2014 \u662f\u7528\u6237\u64cd\u4f5c\u89e6\u53d1\u7684&#xff1f;\u8fd8\u662f\u7cfb\u7edf\u81ea\u52a8\u4ea7\u751f\u7684&#xff1f;\u4e0d\u540c\u573a\u666f\u4e0b\u4fe1\u53f7\u7684\u4ea7\u751f\u673a\u5236\u6709\u4f55\u4e0d\u540c&#xff1f;\u672c\u6587\u5c06\u57fa\u4e8e\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/78148.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-26T02:49:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260226024951-699fb4cf93734.gif\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"15 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/78148.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/78148.html\",\"name\":\"\u3010Linux\u7cfb\u7edf\u7f16\u7a0b\u3011\uff08\u4e09\u5341\u4e94\uff09\u63ed\u79d8 Linux \u4fe1\u53f7\u4ea7\u751f\uff1a\u4ece\u7ec8\u7aef\u5230\u5185\u6838\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-26T02:49:53+00:00\",\"dateModified\":\"2026-02-26T02:49:53+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/78148.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/78148.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/78148.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Linux\u7cfb\u7edf\u7f16\u7a0b\u3011\uff08\u4e09\u5341\u4e94\uff09\u63ed\u79d8 Linux \u4fe1\u53f7\u4ea7\u751f\uff1a\u4ece\u7ec8\u7aef\u5230\u5185\u6838\u5168\u89e3\u6790\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010Linux\u7cfb\u7edf\u7f16\u7a0b\u3011\uff08\u4e09\u5341\u4e94\uff09\u63ed\u79d8 Linux \u4fe1\u53f7\u4ea7\u751f\uff1a\u4ece\u7ec8\u7aef\u5230\u5185\u6838\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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.wsisp.com\/helps\/78148.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010Linux\u7cfb\u7edf\u7f16\u7a0b\u3011\uff08\u4e09\u5341\u4e94\uff09\u63ed\u79d8 Linux \u4fe1\u53f7\u4ea7\u751f\uff1a\u4ece\u7ec8\u7aef\u5230\u5185\u6838\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u524d\u8a00\u5728 Linux \u7cfb\u7edf\u4e2d&#xff0c;\u4fe1\u53f7\u662f\u8fdb\u7a0b\u95f4\u5f02\u6b65\u901a\u4fe1\u7684 \u201c\u4fe1\u4f7f\u201d&#xff0c;\u800c \u201c\u4fe1\u53f7\u4ea7\u751f\u201d \u5219\u662f\u8fd9\u4e2a\u901a\u4fe1\u8fc7\u7a0b\u7684\u8d77\u70b9\u3002\u65e0\u8bba\u662f\u6211\u4eec\u719f\u6089\u7684CtrlC\u7ec8\u6b62\u8fdb\u7a0b&#xff0c;\u8fd8\u662f\u7a0b\u5e8f\u8fd0\u884c\u4e2d\u51fa\u73b0\u7684\u6bb5\u9519\u8bef\u3001\u5b9a\u65f6\u5668\u8d85\u65f6&#xff0c;\u672c\u8d28\u4e0a\u90fd\u662f\u4fe1\u53f7\u88ab\u89e6\u53d1\u4ea7\u751f\u7684\u8fc7\u7a0b\u3002\u5f88\u591a\u5f00\u53d1\u8005\u53ea\u77e5\u9053 \u201c\u4fe1\u53f7\u80fd\u7ec8\u6b62\u8fdb\u7a0b\u201d&#xff0c;\u5374\u4e0d\u6e05\u695a\u4fe1\u53f7\u5230\u5e95\u662f\u600e\u4e48\u6765\u7684 \u2014\u2014 \u662f\u7528\u6237\u64cd\u4f5c\u89e6\u53d1\u7684&#xff1f;\u8fd8\u662f\u7cfb\u7edf\u81ea\u52a8\u4ea7\u751f\u7684&#xff1f;\u4e0d\u540c\u573a\u666f\u4e0b\u4fe1\u53f7\u7684\u4ea7\u751f\u673a\u5236\u6709\u4f55\u4e0d\u540c&#xff1f;\u672c\u6587\u5c06\u57fa\u4e8e","og_url":"https:\/\/www.wsisp.com\/helps\/78148.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-26T02:49:53+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260226024951-699fb4cf93734.gif"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"15 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/78148.html","url":"https:\/\/www.wsisp.com\/helps\/78148.html","name":"\u3010Linux\u7cfb\u7edf\u7f16\u7a0b\u3011\uff08\u4e09\u5341\u4e94\uff09\u63ed\u79d8 Linux \u4fe1\u53f7\u4ea7\u751f\uff1a\u4ece\u7ec8\u7aef\u5230\u5185\u6838\u5168\u89e3\u6790 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-26T02:49:53+00:00","dateModified":"2026-02-26T02:49:53+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/78148.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/78148.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/78148.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010Linux\u7cfb\u7edf\u7f16\u7a0b\u3011\uff08\u4e09\u5341\u4e94\uff09\u63ed\u79d8 Linux \u4fe1\u53f7\u4ea7\u751f\uff1a\u4ece\u7ec8\u7aef\u5230\u5185\u6838\u5168\u89e3\u6790"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/78148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=78148"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/78148\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/78144"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=78148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=78148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=78148"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=78148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}