{"id":102131,"date":"2026-09-08T07:52:32","date_gmt":"2026-09-07T23:52:32","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/102131.html"},"modified":"2026-09-08T07:52:32","modified_gmt":"2026-09-07T23:52:32","slug":"linux%e7%b3%bb%e7%bb%9f%e7%af%8728-%e9%80%9a%e4%bf%a1%ef%bc%88%e4%ba%94%ef%bc%89%ef%bc%9a%e4%bf%a1%e5%8f%b7%e9%87%8f%e4%b8%93%e7%af%87%ef%bc%9a%e4%bb%8e%e7%94%b5%e5%bd%b1%e9%99%a2","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/102131.html","title":{"rendered":"Linux\u7cfb\u7edf\u7bc728\u2014\u2014\u901a\u4fe1\uff08\u4e94\uff09\uff1a\u4fe1\u53f7\u91cf\u4e13\u7bc7\uff1a\u4ece\u7535\u5f71\u9662\u8ba2\u7968\u5230\u5185\u6838\u4e00\u5f20\u5927\u8868\uff0c\u628a\u4fe1\u53f7\u91cf\u4e00\u6b21\u8bb2\u900f"},"content":{"rendered":"<h2 id=\"\" style=\"text-align:center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"200\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260907235226-6a9f4e3a7c262.jpg\" width=\"200\" \/><\/h2>\n<p>\u524d\u8a00&#xff1a;\u7bc727 \u7ed9\u4fe1\u53f7\u91cf\u53ea\u7559\u4e86\u4e24\u53e5\u8bdd\u2014\u2014\u672c\u8d28\u662f\u8ba1\u6570\u5668&#xff0c;P \u52a0\u9501 V \u89e3\u9501&#xff0c;\u4e09\u4e2a\u63a5\u53e3\u4e5f\u53ea\u70b9\u4e86\u540d\u3002\u8fd9\u7bc7\u8865\u4e0a\u6574\u5757\u62fc\u56fe&#xff1a;\u7528\u7535\u5f71\u9662\u8ba2\u7968\u8bb2\u900f&#034;\u9884\u8ba2&#034;\u672c\u8d28&#xff0c;\u62c6\u5f00 P\/V \u7684\u4e09\u79cd\u8bed\u4e49\u548c\u6574\u5957\u7528\u6cd5&#xff0c;\u518d\u5f80\u5185\u6838\u8d70\u4e00\u6b65&#xff0c;\u770b OS \u600e\u4e48\u7528\u4e00\u5f20\u5927\u8868\u7edf\u4e00\u7ba1\u7406\u4e09\u4ef6\u5957\u3002<\/p>\n<hr \/>\n<p>\u76ee\u5f55<\/p>\n<p id=\"-toc\" style=\"margin-left:0px\">\u200b\u7f16\u8f91<\/p>\n<p id=\"%E4%B8%80%E3%80%81%E4%BF%A1%E5%8F%B7%E9%87%8F%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9A%E6%9C%AC%E8%B4%A8%E6%98%AF%E4%B8%80%E4%B8%AA%E8%AE%A1%E6%95%B0%E5%99%A8-toc\" style=\"margin-left:40px\">\u4e00\u3001\u4fe1\u53f7\u91cf\u662f\u4ec0\u4e48&#xff1a;\u672c\u8d28\u662f\u4e00\u4e2a\u8ba1\u6570\u5668<\/p>\n<p id=\"%E4%BA%8C%E3%80%81%E7%94%B5%E5%BD%B1%E9%99%A2%E8%AE%A2%E7%A5%A8%EF%BC%9A%E7%90%86%E8%A7%A3%E4%BF%A1%E5%8F%B7%E9%87%8F%E7%9A%84%E6%9C%80%E4%BD%B3%E7%B1%BB%E6%AF%94-toc\" style=\"margin-left:40px\">\u4e8c\u3001\u7535\u5f71\u9662\u8ba2\u7968&#xff1a;\u7406\u89e3\u4fe1\u53f7\u91cf\u7684\u6700\u4f73\u7c7b\u6bd4<\/p>\n<p id=\"2.1%20%E4%B9%B0%E7%A5%A8%E5%B0%B1%E6%98%AF%E9%A2%84%E8%AE%A2%EF%BC%9A%E5%85%88%E5%8D%A0%E5%BA%A7%EF%BC%8C%E5%86%8D%E4%BD%BF%E7%94%A8%EF%BC%8C%E7%94%A8%E5%AE%8C%E5%BD%92%E8%BF%98-toc\" style=\"margin-left:80px\">2.1 \u4e70\u7968\u5c31\u662f\u9884\u8ba2&#xff1a;\u5148\u5360\u5ea7&#xff0c;\u518d\u4f7f\u7528&#xff0c;\u7528\u5b8c\u5f52\u8fd8<\/p>\n<p id=\"2.2%20%E4%B8%8D%E4%B9%B0%E7%A5%A8%E5%B0%B1%E6%8A%A2%E5%BA%A7%E7%9A%84%E5%90%8E%E6%9E%9C%EF%BC%9A%E6%95%B0%E6%8D%AE%E4%BA%92%E7%9B%B8%E8%A6%86%E7%9B%96-toc\" style=\"margin-left:80px\">2.2 \u4e0d\u4e70\u7968\u5c31\u62a2\u5ea7\u7684\u540e\u679c&#xff1a;\u6570\u636e\u4e92\u76f8\u8986\u76d6<\/p>\n<p id=\"2.3%20%E8%AE%B0%E4%BD%8F%E8%BF%99%E5%A5%97%E7%B1%BB%E6%AF%94%EF%BC%9A%E5%90%8E%E9%9D%A2%E6%AF%8F%E4%B8%AA%E6%A6%82%E5%BF%B5%E9%83%BD%E9%9D%A0%E5%AE%83%E8%A7%A3%E9%87%8A-toc\" style=\"margin-left:80px\">2.3 \u8bb0\u4f4f\u8fd9\u5957\u7c7b\u6bd4&#xff1a;\u540e\u9762\u6bcf\u4e2a\u6982\u5ff5\u90fd\u9760\u5b83\u89e3\u91ca<\/p>\n<p id=\"%E4%B8%89%E3%80%81%E5%85%B1%E4%BA%AB%E5%86%85%E5%AD%98%E4%B8%BA%E4%BB%80%E4%B9%88%E9%9D%9E%E9%85%8D%E5%AE%83%E4%B8%8D%E5%8F%AF-toc\" style=\"margin-left:40px\">\u4e09\u3001\u5171\u4eab\u5185\u5b58\u4e3a\u4ec0\u4e48\u975e\u914d\u5b83\u4e0d\u53ef<\/p>\n<p id=\"3.1%20%E5%8D%B1%E9%99%A9%E5%9C%A8%E5%93%AA%EF%BC%9A%E5%A4%AA%E5%A4%9A%E8%BF%9B%E7%A8%8B%E5%90%8C%E6%97%B6%E4%B9%B1%E5%86%99%E5%90%8C%E4%B8%80%E5%9D%97%E5%86%85%E5%AD%98-toc\" style=\"margin-left:80px\">3.1 \u5371\u9669\u5728\u54ea&#xff1a;\u592a\u591a\u8fdb\u7a0b\u540c\u65f6\u4e71\u5199\u540c\u4e00\u5757\u5185\u5b58<\/p>\n<p id=\"3.2%20%E8%A7%A3%E5%86%B3%E6%80%9D%E8%B7%AF%EF%BC%9A%E6%8A%8A%E5%85%B1%E4%BA%AB%E5%86%85%E5%AD%98%E5%88%92%E5%88%86%E6%88%90%E5%9B%BA%E5%AE%9A%E5%8C%BA%E5%9F%9F-toc\" style=\"margin-left:80px\">3.2 \u89e3\u51b3\u601d\u8def&#xff1a;\u628a\u5171\u4eab\u5185\u5b58\u5212\u5206\u6210\u56fa\u5b9a\u533a\u57df<\/p>\n<p id=\"3.3%20%E6%A0%B8%E5%BF%83%E8%A7%84%E5%88%99%EF%BC%9A%E8%AE%BF%E9%97%AE%E4%BB%BB%E4%BD%95%E4%B8%80%E5%9D%97%E4%B9%8B%E5%89%8D%EF%BC%8C%E5%85%88%E7%94%B3%E8%AF%B7-toc\" style=\"margin-left:80px\">3.3 \u6838\u5fc3\u89c4\u5219&#xff1a;\u8bbf\u95ee\u4efb\u4f55\u4e00\u5757\u4e4b\u524d&#xff0c;\u5148\u7533\u8bf7<\/p>\n<p id=\"3.4%20%E5%AE%8C%E6%95%B4%E6%B5%81%E7%A8%8B%EF%BC%9A%E4%B8%80%E6%AC%A1%E8%A7%84%E8%8C%83%E4%BD%BF%E7%94%A8%E8%A6%81%E8%B5%B0%E5%85%AD%E6%AD%A5-toc\" style=\"margin-left:80px\">3.4 \u5b8c\u6574\u6d41\u7a0b&#xff1a;\u4e00\u6b21\u89c4\u8303\u4f7f\u7528\u8981\u8d70\u516d\u6b65<\/p>\n<p id=\"3.5%20%E8%B5%84%E6%BA%90%E7%94%A8%E5%AE%8C%E4%BA%86%E6%80%8E%E4%B9%88%E5%8A%9E%EF%BC%9A%E9%98%BB%E5%A1%9E%E7%AD%89%E5%BE%85%EF%BC%8C%E4%B8%8D%E7%A9%BA%E8%BD%AC-toc\" style=\"margin-left:80px\">3.5 \u8d44\u6e90\u7528\u5b8c\u4e86\u600e\u4e48\u529e&#xff1a;\u963b\u585e\u7b49\u5f85&#xff0c;\u4e0d\u7a7a\u8f6c<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E7%94%B3%E8%AF%B7%EF%BC%88P%EF%BC%89%E5%92%8C%E9%87%8A%E6%94%BE%EF%BC%88V%EF%BC%89%E5%85%B7%E4%BD%93%E5%81%9A%E4%BA%86%E4%BB%80%E4%B9%88-toc\" style=\"margin-left:40px\">\u56db\u3001\u7533\u8bf7&#xff08;P&#xff09;\u548c\u91ca\u653e&#xff08;V&#xff09;\u5177\u4f53\u505a\u4e86\u4ec0\u4e48<\/p>\n<p id=\"4.1%20%E5%86%85%E6%A0%B8%E7%BB%99%E6%AF%8F%E4%B8%AA%E4%BF%A1%E5%8F%B7%E9%87%8F%E8%AE%B0%E7%9A%84%E5%9B%9B%E7%AC%94%E8%B4%A6-toc\" style=\"margin-left:80px\">4.1 \u5185\u6838\u7ed9\u6bcf\u4e2a\u4fe1\u53f7\u91cf\u8bb0\u7684\u56db\u7b14\u8d26<\/p>\n<p id=\"4.2%20%E4%B8%80%E6%AC%A1%E6%93%8D%E4%BD%9C%E6%80%8E%E4%B9%88%E5%A1%AB%EF%BC%9A%E5%86%99%E4%B8%80%E5%BC%A0%22%E6%93%8D%E4%BD%9C%E5%8D%95%22%E4%BA%A4%E7%BB%99%E5%86%85%E6%A0%B8-toc\" style=\"margin-left:80px\">4.2 \u4e00\u6b21\u64cd\u4f5c\u600e\u4e48\u586b&#xff1a;\u5199\u4e00\u5f20&#034;\u64cd\u4f5c\u5355&#034;\u4ea4\u7ed9\u5185\u6838<\/p>\n<p id=\"4.3%20%E6%93%8D%E4%BD%9C%E5%80%BC%E7%9A%84%E4%B8%89%E7%A7%8D%E8%AF%AD%E4%B9%89%EF%BC%9A%E7%94%B3%E8%AF%B7%20%2F%20%E9%87%8A%E6%94%BE%20%2F%20%E7%AD%89%E5%BD%92%E9%9B%B6-toc\" style=\"margin-left:80px\">4.3 \u64cd\u4f5c\u503c\u7684\u4e09\u79cd\u8bed\u4e49&#xff1a;\u7533\u8bf7 \/ \u91ca\u653e \/ \u7b49\u5f52\u96f6<\/p>\n<p id=\"4.4%20%E4%B8%A4%E4%B8%AA%E9%87%8D%E8%A6%81%E6%A0%87%E5%BF%97%EF%BC%9A%E4%B8%8D%E7%AD%89%E5%BE%85%20%2F%20%E8%87%AA%E5%8A%A8%E5%9B%9E%E6%BB%9A-toc\" style=\"margin-left:80px\">4.4 \u4e24\u4e2a\u91cd\u8981\u6807\u5fd7&#xff1a;\u4e0d\u7b49\u5f85 \/ \u81ea\u52a8\u56de\u6eda<\/p>\n<p id=\"4.5%20%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E5%8E%9F%E5%AD%90%E6%89%A7%E8%A1%8C%EF%BC%9A%E8%A6%81%E4%B9%88%E5%85%A8%E5%81%9A%EF%BC%8C%E8%A6%81%E4%B9%88%E5%85%A8%E4%B8%8D%E5%81%9A-toc\" style=\"margin-left:80px\">4.5 \u4e3a\u4ec0\u4e48\u8981\u539f\u5b50\u6267\u884c&#xff1a;\u8981\u4e48\u5168\u505a&#xff0c;\u8981\u4e48\u5168\u4e0d\u505a<\/p>\n<p id=\"%E4%BA%94%E3%80%81%E6%80%8E%E4%B9%88%E7%94%A8%EF%BC%9A%E5%88%9B%E5%BB%BA%E3%80%81%E5%88%9D%E5%A7%8B%E5%8C%96%E3%80%81%E5%8A%A0%E5%87%8F%E3%80%81%E5%88%A0%E9%99%A4-toc\" style=\"margin-left:40px\">\u4e94\u3001\u600e\u4e48\u7528&#xff1a;\u521b\u5efa\u3001\u521d\u59cb\u5316\u3001\u52a0\u51cf\u3001\u5220\u9664<\/p>\n<p id=\"5.1%20%E5%88%9B%E5%BB%BA%EF%BC%9A%E6%80%8E%E4%B9%88%E6%8B%BF%E5%88%B0%E4%B8%80%E4%B8%AA%E4%BF%A1%E5%8F%B7%E9%87%8F%E9%9B%86%EF%BC%88semget%EF%BC%89-toc\" style=\"margin-left:80px\">5.1 \u521b\u5efa&#xff1a;\u600e\u4e48\u62ff\u5230\u4e00\u4e2a\u4fe1\u53f7\u91cf\u96c6&#xff08;semget&#xff09;<\/p>\n<p id=\"5.2%20%E6%8E%A7%E5%88%B6%EF%BC%9A%E5%88%9D%E5%A7%8B%E5%8C%96%E3%80%81%E6%9F%A5%E7%8A%B6%E6%80%81%E3%80%81%E5%88%A0%E9%99%A4%E9%83%BD%E9%9D%A0%E5%AE%83%EF%BC%88semctl%EF%BC%89-toc\" style=\"margin-left:80px\">5.2 \u63a7\u5236&#xff1a;\u521d\u59cb\u5316\u3001\u67e5\u72b6\u6001\u3001\u5220\u9664\u90fd\u9760\u5b83&#xff08;semctl&#xff09;<\/p>\n<p id=\"5.3%20%E4%BC%A0%E5%8F%82%E7%94%A8%E7%9A%84%E8%81%94%E5%90%88%E4%BD%93%EF%BC%9A%E4%B8%BA%E4%BB%80%E4%B9%88%E5%BF%85%E9%A1%BB%E8%87%AA%E5%B7%B1%E5%AE%9A%E4%B9%89%EF%BC%88semun%EF%BC%89-toc\" style=\"margin-left:80px\">5.3 \u4f20\u53c2\u7528\u7684\u8054\u5408\u4f53&#xff1a;\u4e3a\u4ec0\u4e48\u5fc5\u987b\u81ea\u5df1\u5b9a\u4e49&#xff08;semun&#xff09;<\/p>\n<p id=\"5.4%20%E7%9C%9F%E6%AD%A3%E7%9A%84%20P%2FV%EF%BC%9A%E4%B8%80%E6%AC%A1%E8%83%BD%E5%90%8C%E6%97%B6%E6%93%8D%E4%BD%9C%E4%B8%80%E6%89%B9%E4%BF%A1%E5%8F%B7%E9%87%8F%EF%BC%88semop%EF%BC%89-toc\" style=\"margin-left:80px\">5.4 \u771f\u6b63\u7684 P\/V&#xff1a;\u4e00\u6b21\u80fd\u540c\u65f6\u64cd\u4f5c\u4e00\u6279\u4fe1\u53f7\u91cf&#xff08;semop&#xff09;<\/p>\n<p id=\"%E5%85%AD%E3%80%81%E4%B8%80%E6%AC%A1%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E7%AE%A1%E5%A4%9A%E4%B8%AA%E4%BF%A1%E5%8F%B7%E9%87%8F-toc\" style=\"margin-left:40px\">\u516d\u3001\u4e00\u6b21\u4e3a\u4ec0\u4e48\u8981\u7ba1\u591a\u4e2a\u4fe1\u53f7\u91cf<\/p>\n<p id=\"6.1%20%E4%B8%A4%E4%B8%AA%E5%8F%82%E6%95%B0%E5%88%AB%E6%90%9E%E6%B7%B7%EF%BC%9A%E5%BB%BA%E5%87%A0%E4%B8%AA%20vs%20%E5%8A%A8%E7%AC%AC%E5%87%A0%E4%B8%AA-toc\" style=\"margin-left:80px\">6.1 \u4e24\u4e2a\u53c2\u6570\u522b\u641e\u6df7&#xff1a;\u5efa\u51e0\u4e2a vs \u52a8\u7b2c\u51e0\u4e2a<\/p>\n<p id=\"6.2%20%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E6%89%93%E5%8C%85%E6%88%90%22%E9%9B%86%22%EF%BC%9A%E5%A4%9A%E4%B8%AA%E9%94%81%E4%B8%80%E6%AC%A1%E5%8E%9F%E5%AD%90%E6%93%8D%E4%BD%9C-toc\" style=\"margin-left:80px\">6.2 \u4e3a\u4ec0\u4e48\u8981\u6253\u5305\u6210&#034;\u96c6&#034;&#xff1a;\u591a\u4e2a\u9501\u4e00\u6b21\u539f\u5b50\u64cd\u4f5c<\/p>\n<p id=\"6.3%20%E7%B3%BB%E7%BB%9F%E4%B8%8A%E9%99%90%EF%BC%9A%E4%B8%80%E4%B8%AA%E9%9B%86%E6%9C%80%E5%A4%9A%E8%83%BD%E6%94%BE%E5%A4%9A%E5%B0%91%E4%BF%A1%E5%8F%B7%E9%87%8F-toc\" style=\"margin-left:80px\">6.3 \u7cfb\u7edf\u4e0a\u9650&#xff1a;\u4e00\u4e2a\u96c6\u6700\u591a\u80fd\u653e\u591a\u5c11\u4fe1\u53f7\u91cf<\/p>\n<p id=\"%E4%B8%83%E3%80%81%E8%BF%9B%E7%A8%8B%E9%80%80%E5%87%BA%E5%AE%83%E8%BF%98%E5%9C%A8%EF%BC%9A%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E4%B8%8E%E6%B8%85%E7%90%86-toc\" style=\"margin-left:40px\">\u4e03\u3001\u8fdb\u7a0b\u9000\u51fa\u5b83\u8fd8\u5728&#xff1a;\u751f\u547d\u5468\u671f\u4e0e\u6e05\u7406<\/p>\n<p id=\"7.1%20%E6%80%8E%E4%B9%88%E6%9F%A5%E7%9C%8B%E5%92%8C%E5%88%A0%E9%99%A4%EF%BC%9A%E5%91%BD%E4%BB%A4%E8%A1%8C%20%2B%20%E4%BB%A3%E7%A0%81%E8%B0%83%E7%94%A8-toc\" style=\"margin-left:80px\">7.1 \u600e\u4e48\u67e5\u770b\u548c\u5220\u9664&#xff1a;\u547d\u4ee4\u884c &#043; \u4ee3\u7801\u8c03\u7528<\/p>\n<p id=\"7.2%20%E8%BF%9B%E7%A8%8B%E9%80%80%E5%87%BA%E5%AE%83%E8%BF%98%E5%9C%A8%EF%BC%9A%E7%94%A8%E5%AE%8C%E5%BF%85%E9%A1%BB%E8%87%AA%E5%B7%B1%E5%88%A0-toc\" style=\"margin-left:80px\">7.2 \u8fdb\u7a0b\u9000\u51fa\u5b83\u8fd8\u5728&#xff1a;\u7528\u5b8c\u5fc5\u987b\u81ea\u5df1\u5220<\/p>\n<p id=\"7.3%20%E5%88%A0%E9%99%A4%E7%9A%84%E5%89%AF%E4%BD%9C%E7%94%A8%EF%BC%9A%E9%98%BB%E5%A1%9E%E4%B8%AD%E7%9A%84%E8%BF%9B%E7%A8%8B%E4%BC%9A%E8%A2%AB%E4%B8%80%E5%B9%B6%E5%94%A4%E9%86%92-toc\" style=\"margin-left:80px\">7.3 \u5220\u9664\u7684\u526f\u4f5c\u7528&#xff1a;\u963b\u585e\u4e2d\u7684\u8fdb\u7a0b\u4f1a\u88ab\u4e00\u5e76\u5524\u9192<\/p>\n<p id=\"%E5%85%AB%E3%80%81%E5%86%85%E6%A0%B8%E6%80%8E%E4%B9%88%E5%AD%98%E6%94%BE%E3%80%81%E5%8F%88%E6%80%8E%E4%B9%88%E7%BB%9F%E4%B8%80%E7%AE%A1%E7%90%86%E4%B8%89%E4%BB%B6%E5%A5%97-toc\" style=\"margin-left:40px\">\u516b\u3001\u5185\u6838\u600e\u4e48\u5b58\u653e\u3001\u53c8\u600e\u4e48\u7edf\u4e00\u7ba1\u7406\u4e09\u4ef6\u5957<\/p>\n<p id=\"8.1%20%E5%86%85%E6%A0%B8%E6%80%8E%E4%B9%88%22%E6%8F%8F%E8%BF%B0%22%E4%BF%A1%E5%8F%B7%E9%87%8F%EF%BC%9A%E4%B8%80%E5%BC%A0%E6%A1%A3%E6%A1%88%E8%A1%A8%EF%BC%88semid_ds%EF%BC%89-toc\" style=\"margin-left:80px\">8.1 \u5185\u6838\u600e\u4e48&#034;\u63cf\u8ff0&#034;\u4fe1\u53f7\u91cf&#xff1a;\u4e00\u5f20\u6863\u6848\u8868&#xff08;semid_ds&#xff09;<\/p>\n<p id=\"8.2%20%E6%A1%A3%E6%A1%88%E5%BC%80%E5%A4%B4%E7%9A%84%E6%9D%83%E9%99%90%E5%A4%B4%EF%BC%9A%E8%B0%81%E5%BB%BA%E7%9A%84%E3%80%81%E6%9D%83%E9%99%90%E5%A4%9A%E5%A4%A7%EF%BC%88ipc_perm%EF%BC%89-toc\" style=\"margin-left:80px\">8.2 \u6863\u6848\u5f00\u5934\u7684\u6743\u9650\u5934&#xff1a;\u8c01\u5efa\u7684\u3001\u6743\u9650\u591a\u5927&#xff08;ipc_perm&#xff09;<\/p>\n<p id=\"8.3%20%E5%AE%B9%E6%98%93%E8%B8%A9%E5%9D%91%EF%BC%9A%E5%90%8C%E5%90%8D%E7%BB%93%E6%9E%84%EF%BC%8C%E7%94%A8%E6%88%B7%E6%80%81%E5%BF%AB%E7%85%A7%20%E2%89%A0%20%E5%86%85%E6%A0%B8%E5%AE%9E%E4%BD%93-toc\" style=\"margin-left:80px\">8.3 \u5bb9\u6613\u8e29\u5751&#xff1a;\u540c\u540d\u7ed3\u6784&#xff0c;\u7528\u6237\u6001\u5feb\u7167 \u2260 \u5185\u6838\u5b9e\u4f53<\/p>\n<p id=\"8.4%20%E4%B8%89%E7%B1%BB%E8%B5%84%E6%BA%90%E5%85%B1%E7%94%A8%E7%9A%84%22%E6%A1%A5%E6%8E%A5%E5%A4%B4%22%EF%BC%88kern_ipc_perm%EF%BC%89-toc\" style=\"margin-left:80px\">8.4 \u4e09\u7c7b\u8d44\u6e90\u5171\u7528\u7684&#034;\u6865\u63a5\u5934&#034;&#xff08;kern_ipc_perm&#xff09;<\/p>\n<p id=\"8.5%20%E7%BB%84%E7%BB%87%E6%96%B9%E5%BC%8F%EF%BC%9A%E6%8A%8A%E6%8F%8F%E8%BF%B0%E7%BB%93%E6%9E%84%E7%BB%9F%E4%B8%80%E6%8C%82%E8%BF%9B%E4%B8%80%E5%BC%A0%E8%A1%A8-toc\" style=\"margin-left:80px\">8.5 \u7ec4\u7ec7\u65b9\u5f0f&#xff1a;\u628a\u63cf\u8ff0\u7ed3\u6784\u7edf\u4e00\u6302\u8fdb\u4e00\u5f20\u8868<\/p>\n<p id=\"8.6%20%E6%9B%B4%E6%AD%A3%EF%BC%9A%E7%8E%B0%E4%BB%A3%E5%86%85%E6%A0%B8%E5%B7%B2%E4%B8%8D%E7%94%A8%E6%95%B0%E7%BB%84%EF%BC%8C%E6%8D%A2%E6%88%90%20IDR%20%E5%9F%BA%E6%95%B0%E6%A0%91-toc\" style=\"margin-left:80px\">8.6 \u66f4\u6b63&#xff1a;\u73b0\u4ee3\u5185\u6838\u5df2\u4e0d\u7528\u6570\u7ec4&#xff0c;\u6362\u6210 IDR \u57fa\u6570\u6811<\/p>\n<p id=\"8.7%20%E4%B8%89%E4%B8%AA%E5%AE%B9%E6%98%93%E5%BF%BD%E7%95%A5%E7%9A%84%E7%BB%86%E8%8A%82-toc\" style=\"margin-left:80px\">8.7 \u4e09\u4e2a\u5bb9\u6613\u5ffd\u7565\u7684\u7ec6\u8282<\/p>\n<p id=\"8.8%20%E4%B8%80%E5%BC%A0%E5%9B%BE%E7%9C%8B%E6%87%82%E5%85%A8%E5%B1%80%EF%BC%9A%E4%BB%8E%E5%86%85%E6%A0%B8%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4%E5%88%B0%E5%AE%9E%E9%99%85%E8%B5%84%E6%BA%90-toc\" style=\"margin-left:80px\">8.8 \u4e00\u5f20\u56fe\u770b\u61c2\u5168\u5c40&#xff1a;\u4ece\u5185\u6838\u547d\u540d\u7a7a\u95f4\u5230\u5b9e\u9645\u8d44\u6e90<\/p>\n<p id=\"%E4%B9%9D%E3%80%81%E4%BF%A1%E5%8F%B7%20%2F%20%E4%BF%A1%E5%8F%B7%E9%87%8F%20%2F%20%E4%BA%92%E6%96%A5%E9%94%81%EF%BC%9A%E6%98%93%E6%B7%B7%E6%A6%82%E5%BF%B5%E4%B8%80%E6%AC%A1%E5%88%86%E6%B8%85-toc\" style=\"margin-left:40px\">\u4e5d\u3001\u4fe1\u53f7 \/ \u4fe1\u53f7\u91cf \/ \u4e92\u65a5\u9501&#xff1a;\u6613\u6df7\u6982\u5ff5\u4e00\u6b21\u5206\u6e05<\/p>\n<p id=\"9.1%20%E4%BF%A1%E5%8F%B7%20vs%20%E4%BF%A1%E5%8F%B7%E9%87%8F%EF%BC%9A%E4%B8%80%E4%B8%AA%22%E5%8F%AB%E4%BD%A0%E4%B8%80%E4%B8%8B%22%EF%BC%8C%E4%B8%80%E4%B8%AA%22%E6%95%B0%E4%BD%A0%E4%B8%80%E4%B8%8B%22-toc\" style=\"margin-left:80px\">9.1 \u4fe1\u53f7 vs \u4fe1\u53f7\u91cf&#xff1a;\u4e00\u4e2a&#034;\u53eb\u4f60\u4e00\u4e0b&#034;&#xff0c;\u4e00\u4e2a&#034;\u6570\u4f60\u4e00\u4e0b&#034;<\/p>\n<p id=\"9.2%20%E4%BF%A1%E5%8F%B7%E9%87%8F%20vs%20%E4%BA%92%E6%96%A5%E9%94%81%EF%BC%9A%E8%B0%81%E9%83%BD%E8%83%BD%E8%A7%A3%20vs%20%E5%8F%AA%E6%9C%89%E4%B8%BB%E4%BA%BA%E8%83%BD%E8%A7%A3-toc\" style=\"margin-left:80px\">9.2 \u4fe1\u53f7\u91cf vs \u4e92\u65a5\u9501&#xff1a;\u8c01\u90fd\u80fd\u89e3 vs \u53ea\u6709\u4e3b\u4eba\u80fd\u89e3<\/p>\n<p id=\"9.3%20%E4%BA%8C%E5%85%83%20vs%20%E5%A4%9A%E5%85%83%EF%BC%9A%E4%B8%80%E6%AC%A1%E6%94%BE%E4%B8%80%E4%B8%AA%EF%BC%8C%E8%BF%98%E6%98%AF%E6%94%BE%20N%20%E4%B8%AA-toc\" style=\"margin-left:80px\">9.3 \u4e8c\u5143 vs \u591a\u5143&#xff1a;\u4e00\u6b21\u653e\u4e00\u4e2a&#xff0c;\u8fd8\u662f\u653e N \u4e2a<\/p>\n<p id=\"9.4%20%E4%B8%89%E7%A7%8D%E6%A1%A3%E6%A1%88%E7%BB%93%E6%9E%84%E5%AF%B9%E6%AF%94%EF%BC%9A%E5%88%86%E5%88%AB%E7%AE%A1%E4%BB%80%E4%B9%88%E3%80%81%E5%B7%AE%E5%9C%A8%E5%93%AA-toc\" style=\"margin-left:80px\">9.4 \u4e09\u79cd\u6863\u6848\u7ed3\u6784\u5bf9\u6bd4&#xff1a;\u5206\u522b\u7ba1\u4ec0\u4e48\u3001\u5dee\u5728\u54ea<\/p>\n<p id=\"%E5%8D%81%E3%80%81%E9%9D%A2%E8%AF%95%E5%AE%98%E9%AB%98%E9%A2%91%E8%BF%BD%E9%97%AE%E4%B8%8E%E5%8F%82%E8%80%83%E7%AD%94%E6%A1%88-toc\" style=\"margin-left:40px\">\u5341\u3001\u9762\u8bd5\u5b98\u9ad8\u9891\u8ffd\u95ee\u4e0e\u53c2\u8003\u7b54\u6848<\/p>\n<p id=\"%E5%8D%81%E4%B8%80%E3%80%81%E5%B0%8F%E7%BB%93-toc\" style=\"margin-left:40px\">\u5341\u4e00\u3001\u5c0f\u7ed3<\/p>\n<hr \/>\n<h3 id=\"%E4%B8%80%E3%80%81%E4%BF%A1%E5%8F%B7%E9%87%8F%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9A%E6%9C%AC%E8%B4%A8%E6%98%AF%E4%B8%80%E4%B8%AA%E8%AE%A1%E6%95%B0%E5%99%A8\">\u4e00\u3001\u4fe1\u53f7\u91cf\u662f\u4ec0\u4e48&#xff1a;\u672c\u8d28\u662f\u4e00\u4e2a\u8ba1\u6570\u5668<\/h3>\n<p>\u7bc727 \u7b2c\u4e03\u8282\u5df2\u7ecf\u628a\u94fa\u57ab\u505a\u5b8c\u4e86&#xff1a;\u5171\u4eab\u5185\u5b58\u5feb\u662f\u5feb&#xff0c;\u4f46\u6ca1\u6709\u540c\u6b65\u4e92\u65a5&#xff0c;\u591a\u4e2a\u8fdb\u7a0b\u4e00\u8d77\u5199&#xff0c;\u6570\u636e\u5f53\u573a\u5c31\u4e0d\u4e00\u81f4\u3002\u4e34\u754c\u8d44\u6e90\u3001\u4e34\u754c\u533a\u3001\u4e92\u65a5\u3001\u540c\u6b65\u8fd9\u4e9b\u8bcd\u5f53\u65f6\u90fd\u62c6\u8fc7&#xff0c;\u8fd9\u91cc\u4e0d\u518d\u91cd\u590d\u3002<\/p>\n<p>\u73b0\u5728\u6b63\u9762\u56de\u7b54\u90a3\u4e2a\u88ab\u8df3\u8fc7\u7684\u95ee\u9898&#xff1a;\u4fe1\u53f7\u91cf\u5230\u5e95\u662f\u4ec0\u4e48&#xff1f;<\/p>\n<p>\u4fe1\u53f7\u91cf&#xff08;semaphore&#xff09;\u7ffb\u8bd1\u8fc7\u6765\u5c31\u662f&#034;\u4fe1\u53f7\u706f&#034;\u3002<span style=\"color:#fe2c24\">\u5b83\u7684\u672c\u8d28&#xff0c;\u662f\u4e00\u4e2a\u8ba1\u6570\u5668\u3002<\/span><\/p>\n<p>\u8fd9\u4e2a\u8ba1\u6570\u5668\u8ba1\u7684\u4e0d\u662f\u522b\u7684&#xff0c;\u5c31\u662f\u4e34\u754c\u8d44\u6e90\u91cc\u8fd8\u5269\u51e0\u4efd\u8d44\u6e90\u53ef\u7528\u3002\u4fe1\u53f7\u91cf\u4fdd\u62a4\u7684\u4e0d\u662f\u6570\u636e\u672c\u8eab&#xff0c;\u662f&#034;\u8d44\u6e90\u8fd8\u6709\u51e0\u4efd&#034;\u8fd9\u4e2a\u6570\u2014\u2014\u8c01\u60f3\u7528\u4e00\u4efd\u8d44\u6e90&#xff0c;\u5148\u8fc7\u8ba1\u6570\u5668\u8fd9\u4e00\u5173\u3002<\/p>\n<p>\u7528\u4fe1\u53f7\u706f\u6765\u60f3&#xff1a;<\/p>\n<ul>\n<li>\u706f\u4eae&#xff08;\u8ba1\u6570 &gt; 0&#xff09;&#xff1a;\u8fd8\u6709\u8d44\u6e90&#xff0c;\u53ef\u4ee5\u8fdb<\/li>\n<li>\u706f\u706d&#xff08;\u8ba1\u6570 &#061; 0&#xff09;&#xff1a;\u8d44\u6e90\u7528\u5b8c\u4e86&#xff0c;\u7b49\u7740<\/li>\n<\/ul>\n<p>\u6709\u79cd\u5e38\u89c1\u8bf4\u6cd5\u662f&#034;\u4fe1\u53f7\u91cf\u672c\u8eab\u4e0d\u662f\u5171\u4eab\u8d44\u6e90&#034;\u3002\u8fd9\u53e5\u8bdd\u5f97\u6309\u8bed\u5883\u7406\u89e3\u2014\u2014\u5b83\u60f3\u5f3a\u8c03\u7684\u662f&#034;\u4fe1\u53f7\u91cf\u4e0d\u662f\u88ab\u4fdd\u62a4\u7684\u90a3\u4e2a\u4e34\u754c\u8d44\u6e90&#034;&#xff0c;\u800c\u4e0d\u662f\u8bf4\u5b83\u4e0d\u88ab\u5171\u4eab\u3002<\/p>\n<p>\u4e8b\u5b9e\u6b63\u597d\u76f8\u53cd&#xff1a;\u4fe1\u53f7\u91cf\u672c\u8eab\u5fc5\u987b\u7531\u591a\u4e2a\u8fdb\u7a0b\u5171\u4eab\u8bbf\u95ee&#xff0c;\u5426\u5219\u540c\u6b65\u6839\u672c\u4e0d\u6210\u7acb\u3002<\/p>\n<p>semval \u662f\u5185\u6838\u91cc\u7684\u4e00\u4efd\u6570\u636e&#xff0c;\u6240\u6709\u8fdb\u7a0b\u901a\u8fc7\u540c\u4e00\u4e2a semid \u64cd\u4f5c\u7684\u662f\u540c\u4e00\u4e2a\u503c\u3002A \u8fdb\u7a0b P \u5b8c\u51cf 1&#xff0c;B \u8fdb\u7a0b\u5fc5\u987b\u770b\u5230\u8fd9\u4e2a\u51cf\u8fc7\u7684\u503c\u2014\u2014\u5982\u679c\u4e24\u4e2a\u8fdb\u7a0b\u5404\u770b\u5404\u7684\u79c1\u6709\u8ba1\u6570\u5668&#xff0c;\u90a3 P\/V \u5c31\u7eaf\u7cb9\u662f\u81ea\u6211\u5b89\u6170&#xff0c;\u8c01\u4e5f\u62e6\u4e0d\u4f4f\u8c01\u3002<\/p>\n<p>\u8fd8\u6709\u4e2a\u66f4\u786c\u7684\u8bc1\u636e&#xff1a;\u5185\u6838\u4e13\u95e8\u7ed9\u4fe1\u53f7\u91cf\u52a0\u4e86\u81ea\u65cb\u9501\u3001\u628a semop \u505a\u6210\u539f\u5b50\u64cd\u4f5c\u3002\u5982\u679c\u5b83\u4e0d\u88ab\u5e76\u53d1\u8bbf\u95ee&#xff0c;\u8fd9\u4e9b\u4fdd\u62a4\u6839\u672c\u6ca1\u5fc5\u8981\u5b58\u5728\u3002\u9700\u8981\u4fdd\u62a4&#xff0c;\u672c\u8eab\u5c31\u662f&#034;\u5b83\u662f\u5171\u4eab\u7684&#034;\u7684\u8bc1\u660e\u3002<\/p>\n<p>\u6240\u4ee5\u51c6\u786e\u7684\u5206\u6cd5\u662f\u4e24\u5c42&#xff1a;<\/p>\n<ul>\n<li>\u4fe1\u53f7\u91cf\u662f\u5171\u4eab\u5bf9\u8c61&#xff08;\u5185\u6838\u91cc\u591a\u8fdb\u7a0b\u53ef\u89c1\u53ef\u6539&#xff0c;\u5b89\u5168\u7531\u5185\u6838\u9501\u515c\u5e95&#xff09;<\/li>\n<li>\u4f46\u5b83\u4e0d\u662f\u5b83\u4fdd\u62a4\u7684\u90a3\u4efd\u5171\u4eab\u8d44\u6e90\u2014\u2014\u88ab\u4fdd\u62a4\u7684\u4e34\u754c\u8d44\u6e90\u662f\u5171\u4eab\u5185\u5b58\u90a3\u5757\u6570\u636e&#xff0c;\u4fe1\u53f7\u91cf\u662f\u7ba1\u5b83\u7684\u4eba<\/li>\n<\/ul>\n<p>\u9762\u8bd5\u95ee&#034;\u4fe1\u53f7\u91cf\u662f\u5171\u4eab\u8d44\u6e90\u5417&#034;&#xff0c;\u53ea\u7b54\u4e00\u4e2a&#034;\u4e0d\u662f&#034;\u4f1a\u9732\u602f&#xff1b;\u628a\u8fd9\u4e24\u5c42\u90fd\u8bb2\u51fa\u6765\u624d\u7ad9\u5f97\u4f4f\u811a\u3002<\/p>\n<p>\u90a3\u591a\u4e2a\u8fdb\u7a0b\u600e\u4e48\u627e\u5230\u540c\u4e00\u4e2a\u4fe1\u53f7\u91cf&#xff1f;System V \u7684\u505a\u6cd5\u5f88\u76f4\u63a5&#xff1a;\u8ba9\u591a\u4e2a\u8fdb\u7a0b\u901a\u8fc7\u540c\u4e00\u4e2a key \u770b\u5230\u540c\u4e00\u4e2a\u4fe1\u53f7\u91cf\u3002key \u673a\u5236\u7bc725\u3001\u7bc727 \u90fd\u8bb2\u8fc7&#xff08;ftok \u751f\u6210\u3001semget \u62ff\u5b83\u6362 semid&#xff09;&#xff0c;\u4e09\u4ef6\u5957\u5728\u8fd9\u4e00\u5c42\u662f\u540c\u4e00\u5957\u903b\u8f91\u3002<\/p>\n<p>\u987a\u5e26\u57cb\u4e2a\u4f0f\u7b14&#xff1a;\u4fe1\u53f7\u91cf\u6309\u53d6\u503c\u5206\u4e24\u79cd\u2014\u2014<\/p>\n<ul>\n<li>\u4e8c\u5143\u4fe1\u53f7\u91cf&#xff1a;\u53ea\u6709 0 \u548c 1&#xff0c;\u4e00\u6b21\u53ea\u653e\u4e00\u4e2a\u8fdb\u7a0b\u8fdb&#xff08;\u4e92\u65a5\u7684\u6781\u81f4&#xff09;<\/li>\n<li>\u591a\u5143\u4fe1\u53f7\u91cf&#xff1a;\u521d\u503c N&#xff0c;\u4e00\u6b21\u6700\u591a\u653e N \u4e2a&#xff08;\u8d44\u6e90\u6c60&#xff09;<\/li>\n<\/ul>\n<p>\u8fd9\u4e24\u79cd\u7684\u5dee\u522b\u540e\u9762\u6613\u6df7\u70b9\u5bf9\u6bd4\u91cc\u7ec6\u8bf4\u3002<\/p>\n<hr \/>\n<h3 id=\"%E4%BA%8C%E3%80%81%E7%94%B5%E5%BD%B1%E9%99%A2%E8%AE%A2%E7%A5%A8%EF%BC%9A%E7%90%86%E8%A7%A3%E4%BF%A1%E5%8F%B7%E9%87%8F%E7%9A%84%E6%9C%80%E4%BD%B3%E7%B1%BB%E6%AF%94\">\u4e8c\u3001\u7535\u5f71\u9662\u8ba2\u7968&#xff1a;\u7406\u89e3\u4fe1\u53f7\u91cf\u7684\u6700\u4f73\u7c7b\u6bd4<\/h3>\n<p>\u8bb2\u4fe1\u53f7\u91cf\u6700\u597d\u7528\u7684\u4f8b\u5b50\u662f\u7535\u5f71\u9662\u8ba2\u7968\u3002\u628a\u5b83\u8bb2\u900f&#xff0c;\u540e\u9762\u7684\u63a5\u53e3\u5168\u662f\u5b83\u7684\u7ffb\u8bd1\u3002<\/p>\n<p>\u628a\u4fe1\u53f7\u91cf\u60f3\u6210\u4e00\u4e2a\u7535\u5f71\u9662\u7684\u7968\u6c60&#xff1a;<\/p>\n<table>\n<tr>\u7535\u5f71\u9662\u4fe1\u53f7\u91cf<\/tr>\n<tbody>\n<tr>\n<td><span style=\"color:#a2e043\">\u653e\u6620\u5385\u7684\u5ea7\u4f4d<\/span><\/td>\n<td><span style=\"color:#ff9900\">\u4e34\u754c\u8d44\u6e90\u91cc\u7684\u4e00\u4efd\u4efd\u8d44\u6e90<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color:#a2e043\">\u5ea7\u4f4d\u603b\u6570<\/span><\/td>\n<td><span style=\"color:#ff9900\">\u4fe1\u53f7\u91cf\u521d\u503c N<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color:#a2e043\">\u4e70\u7968<\/span><\/td>\n<td><span style=\"color:#ff9900\">P \u64cd\u4f5c&#xff08;\u7533\u8bf7&#xff0c;\u8ba1\u6570 -1&#xff09;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color:#a2e043\">\u770b\u5b8c\u9000\u573a<\/span><\/td>\n<td><span style=\"color:#ff9900\">V \u64cd\u4f5c&#xff08;\u91ca\u653e&#xff0c;\u8ba1\u6570 &#043;1&#xff09;<\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color:#a2e043\">\u7968\u5356\u5149\u4e86<\/span><\/td>\n<td><span style=\"color:#ff9900\">\u8ba1\u6570\u5f52\u96f6&#xff0c;\u540e\u6765\u7684\u4eba\u7b49\u7740<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"2.1%20%E4%B9%B0%E7%A5%A8%E5%B0%B1%E6%98%AF%E9%A2%84%E8%AE%A2%EF%BC%9A%E5%85%88%E5%8D%A0%E5%BA%A7%EF%BC%8C%E5%86%8D%E4%BD%BF%E7%94%A8%EF%BC%8C%E7%94%A8%E5%AE%8C%E5%BD%92%E8%BF%98\">2.1 \u4e70\u7968\u5c31\u662f\u9884\u8ba2&#xff1a;\u5148\u5360\u5ea7&#xff0c;\u518d\u4f7f\u7528&#xff0c;\u7528\u5b8c\u5f52\u8fd8<\/h4>\n<p>\u4e70\u7968\u8fd9\u4e2a\u52a8\u4f5c&#xff0c;\u672c\u8d28\u662f\u5148\u5360\u53f7&#xff0c;\u518d\u4f7f\u7528&#xff0c;\u7528\u5b8c\u5f52\u8fd8&#xff1a;<\/p>\n<ul>\n<li>\u4f60\u4e70\u5230\u7968&#xff0c;\u5ea7\u4f4d\u5c31\u88ab\u4f60\u9884\u8ba2\u4e86\u2014\u2014\u54ea\u6015\u4f60\u8fd8\u6ca1\u8fdb\u573a\u5750<\/li>\n<li>\u4f60\u770b\u5b8c\u79bb\u573a&#xff0c;\u8fd9\u4e2a\u5ea7\u4f4d\u91cd\u65b0\u56de\u5230\u7968\u6c60&#xff0c;\u522b\u4eba\u624d\u80fd\u4e70<\/li>\n<li>\u5168\u7a0b\u5ea7\u4f4d\u603b\u6570\u4e0d\u53d8&#xff0c;\u53d8\u7684\u53ea\u662f&#034;\u8fd8\u5269\u51e0\u5f20\u7968&#034;\u8fd9\u4e2a\u6570<\/li>\n<\/ul>\n<p>\u4fe1\u53f7\u91cf\u5e72\u7684\u5c31\u662f\u8fd9\u4ef6\u4e8b&#xff1a;P \u4e00\u6b21&#xff0c;\u7b49\u4e8e\u4ece\u8d44\u6e90\u6c60\u91cc\u9884\u8ba2\u4e00\u4efd&#xff1b;V \u4e00\u6b21&#xff0c;\u7b49\u4e8e\u5f52\u8fd8\u4e00\u4efd\u3002<\/p>\n<h4 id=\"2.2%20%E4%B8%8D%E4%B9%B0%E7%A5%A8%E5%B0%B1%E6%8A%A2%E5%BA%A7%E7%9A%84%E5%90%8E%E6%9E%9C%EF%BC%9A%E6%95%B0%E6%8D%AE%E4%BA%92%E7%9B%B8%E8%A6%86%E7%9B%96\">2.2 \u4e0d\u4e70\u7968\u5c31\u62a2\u5ea7\u7684\u540e\u679c&#xff1a;\u6570\u636e\u4e92\u76f8\u8986\u76d6<\/h4>\n<p>\u5982\u679c\u6ca1\u6709\u7968&#xff0c;\u4eba\u4eba\u90fd\u76f4\u63a5\u51b2\u8fdb\u653e\u6620\u5385\u627e\u5ea7\u2014\u2014\u4e24\u4e2a\u4eba\u540c\u65f6\u770b\u4e0a\u540c\u4e00\u4e2a\u5ea7&#xff0c;\u90fd\u5750\u4e0b&#xff0c;\u8fd9\u5c31\u649e\u4e86\u3002<\/p>\n<p>\u653e\u5230\u8fdb\u7a0b\u4e16\u754c&#xff1a;\u6ca1\u6709\u4fe1\u53f7\u91cf&#xff0c;\u591a\u4e2a\u8fdb\u7a0b\u540c\u65f6\u6251\u5411\u540c\u4e00\u5757\u5171\u4eab\u5185\u5b58&#xff0c;\u4f60\u5199\u4f60\u7684\u6211\u5199\u6211\u7684&#xff0c;\u4e92\u76f8\u8986\u76d6&#xff0c;\u6570\u636e\u4e0d\u4e00\u81f4\u3002\u8fd9\u5c31\u662f\u7bc727 \u8bf4\u7684\u5171\u4eab\u5185\u5b58&#034;\u88f8\u5954&#034;\u95ee\u9898\u3002<\/p>\n<p>\u7535\u5f71\u9662\u4e0d\u8ba9\u4f60\u62a2\u5ea7&#xff0c;\u9760\u7684\u662f&#034;\u5fc5\u987b\u5148\u4e70\u7968&#034;&#xff1b;OS \u4e0d\u8ba9\u8fdb\u7a0b\u4e71\u62a2\u8d44\u6e90&#xff0c;\u9760\u7684\u662f&#034;\u5fc5\u987b\u5148\u7533\u8bf7\u4fe1\u53f7\u91cf&#034;\u3002<\/p>\n<h4 id=\"2.3%20%E8%AE%B0%E4%BD%8F%E8%BF%99%E5%A5%97%E7%B1%BB%E6%AF%94%EF%BC%9A%E5%90%8E%E9%9D%A2%E6%AF%8F%E4%B8%AA%E6%A6%82%E5%BF%B5%E9%83%BD%E9%9D%A0%E5%AE%83%E8%A7%A3%E9%87%8A\">2.3 \u8bb0\u4f4f\u8fd9\u5957\u7c7b\u6bd4&#xff1a;\u540e\u9762\u6bcf\u4e2a\u6982\u5ff5\u90fd\u9760\u5b83\u89e3\u91ca<\/h4>\n<p>\u8bb0\u4f4f\u8fd9\u4e2a\u7535\u5f71\u9662&#xff0c;\u5b83\u4e0d\u6b62\u7ba1\u8fd9\u4e00\u8282&#xff1a;<\/p>\n<ul>\n<li>sem_op \u4e3a\u4ec0\u4e48\u5206\u6b63\u8d1f \u2192 \u4e70\u7968\u662f -1&#xff0c;\u9000\u7968\u662f &#043;1<\/li>\n<li>SEM_UNDO \u662f\u5e72\u561b\u7684 \u2192 \u4eba\u8dd1\u4e86&#xff08;\u8fdb\u7a0b\u5d29\u4e86&#xff09;&#xff0c;\u7968\u81ea\u52a8\u9000\u56de<\/li>\n<li>\u4fe1\u53f7\u91cf\u96c6\u662f\u4ec0\u4e48 \u2192 \u591a\u4e2a\u5f71\u5385&#xff0c;\u6bcf\u5385\u4e00\u5957\u7968<\/li>\n<\/ul>\n<p>\u540e\u9762\u6bcf\u8282\u90fd\u4f1a\u56de\u6765\u5bf9\u4e00\u6b21\u8868\u3002<\/p>\n<hr \/>\n<h3 id=\"%E4%B8%89%E3%80%81%E5%85%B1%E4%BA%AB%E5%86%85%E5%AD%98%E4%B8%BA%E4%BB%80%E4%B9%88%E9%9D%9E%E9%85%8D%E5%AE%83%E4%B8%8D%E5%8F%AF\">\u4e09\u3001\u5171\u4eab\u5185\u5b58\u4e3a\u4ec0\u4e48\u975e\u914d\u5b83\u4e0d\u53ef<\/h3>\n<p>\u6709\u4e86&#034;\u9884\u8ba2&#034;\u8fd9\u4e2a\u6982\u5ff5&#xff0c;\u73b0\u5728\u770b\u5b83\u5177\u4f53\u600e\u4e48\u843d\u5230\u5171\u4eab\u5185\u5b58\u4e0a\u3002<\/p>\n<h4 id=\"3.1%20%E5%8D%B1%E9%99%A9%E5%9C%A8%E5%93%AA%EF%BC%9A%E5%A4%AA%E5%A4%9A%E8%BF%9B%E7%A8%8B%E5%90%8C%E6%97%B6%E4%B9%B1%E5%86%99%E5%90%8C%E4%B8%80%E5%9D%97%E5%86%85%E5%AD%98\">3.1 \u5371\u9669\u5728\u54ea&#xff1a;\u592a\u591a\u8fdb\u7a0b\u540c\u65f6\u4e71\u5199\u540c\u4e00\u5757\u5185\u5b58<\/h4>\n<p>\u95ee\u9898\u8d77\u70b9\u5f88\u660e\u786e&#xff1a;\u6700\u6015\u8fc7\u591a\u8fdb\u7a0b\u8bbf\u95ee\u540c\u4e00\u5757\u5185\u5b58\u3002<\/p>\n<p>\u5171\u4eab\u5185\u5b58\u5feb&#xff0c;\u5c31\u5feb\u5728\u6570\u636e\u4e0d\u7528\u5728\u5185\u6838\u548c\u7528\u6237\u6001\u4e4b\u95f4\u5012\u624b\u3002\u4f46\u5b83\u6ca1\u6709\u4efb\u4f55\u8bbf\u95ee\u63a7\u5236\u2014\u2014\u8c01\u90fd\u80fd\u5f80\u540c\u4e00\u5757\u4e0a\u5199&#xff0c;\u5199\u5f97\u8d8a\u591a&#xff0c;\u8986\u76d6\u5f97\u8d8a\u72e0\u3002\u6240\u4ee5\u6709\u4e24\u4e2a&#034;\u4e0d\u8981&#034;&#xff1a;<\/p>\n<ul>\n<li>\u4e0d\u8981\u591a\u4e2a\u8fdb\u7a0b\u8bbf\u95ee\u540c\u4e00\u4e2a\u4f4d\u7f6e<\/li>\n<li>\u4e0d\u8981\u8fc7\u591a\u8fdb\u7a0b\u540c\u65f6\u538b\u4e0a\u6765<\/li>\n<\/ul>\n<h4 id=\"3.2%20%E8%A7%A3%E5%86%B3%E6%80%9D%E8%B7%AF%EF%BC%9A%E6%8A%8A%E5%85%B1%E4%BA%AB%E5%86%85%E5%AD%98%E5%88%92%E5%88%86%E6%88%90%E5%9B%BA%E5%AE%9A%E5%8C%BA%E5%9F%9F\">3.2 \u89e3\u51b3\u601d\u8def&#xff1a;\u628a\u5171\u4eab\u5185\u5b58\u5212\u5206\u6210\u56fa\u5b9a\u533a\u57df<\/h4>\n<p>\u4fe1\u53f7\u91cf\u4ecb\u5165\u7684\u601d\u8def&#xff0c;\u662f\u628a\u5171\u4eab\u5185\u5b58\u5212\u5206\u6210\u4e0d\u540c\u533a\u57df&#xff0c;\u6bcf\u5757\u533a\u57df\u4e00\u6b21\u53ea\u7ed9\u4e00\u4e2a\u8fdb\u7a0b\u7528\u3002\u5212\u5206\u4e4b\u540e\u6bcf\u5757\u7684\u5927\u5c0f\u662f\u56fa\u5b9a\u7684\u2014\u2014\u56fa\u5b9a&#xff0c;\u624d\u597d\u914d\u4e00\u5f20\u7968&#xff08;\u4e00\u4e2a\u4fe1\u53f7\u91cf\u5355\u4f4d&#xff09;\u7ba1\u4e00\u5757\u3002<\/p>\n<h4 id=\"3.3%20%E6%A0%B8%E5%BF%83%E8%A7%84%E5%88%99%EF%BC%9A%E8%AE%BF%E9%97%AE%E4%BB%BB%E4%BD%95%E4%B8%80%E5%9D%97%E4%B9%8B%E5%89%8D%EF%BC%8C%E5%85%88%E7%94%B3%E8%AF%B7\">3.3 \u6838\u5fc3\u89c4\u5219&#xff1a;\u8bbf\u95ee\u4efb\u4f55\u4e00\u5757\u4e4b\u524d&#xff0c;\u5148\u7533\u8bf7<\/h4>\n<p>\u6838\u5fc3\u89c4\u5219\u4e00\u53e5\u8bdd&#xff1a;\u6240\u6709\u8fdb\u7a0b\u8bbf\u95ee\u4e34\u754c\u8d44\u6e90\u7684\u4e00\u5c0f\u5757&#xff0c;\u5fc5\u987b\u5148\u7533\u8bf7\u4fe1\u53f7\u91cf\u3002<\/p>\n<p>\u7ffb\u8bd1\u6210\u7535\u5f71\u9662&#xff1a;\u60f3\u5750\u5ea7\u4f4d&#xff0c;\u5148\u4e70\u7968\u3002\u6ca1\u6709\u4f8b\u5916\u3002<\/p>\n<h4 id=\"3.4%20%E5%AE%8C%E6%95%B4%E6%B5%81%E7%A8%8B%EF%BC%9A%E4%B8%80%E6%AC%A1%E8%A7%84%E8%8C%83%E4%BD%BF%E7%94%A8%E8%A6%81%E8%B5%B0%E5%85%AD%E6%AD%A5\">3.4 \u5b8c\u6574\u6d41\u7a0b&#xff1a;\u4e00\u6b21\u89c4\u8303\u4f7f\u7528\u8981\u8d70\u516d\u6b65<\/h4>\n<p>\u4e00\u6b21\u89c4\u77e9\u7684\u4fe1\u53f7\u91cf\u4f7f\u7528&#xff0c;\u5168\u6d41\u7a0b\u516d\u6b65&#xff1a;<\/p>\n<li>\u521b\u5efa\/\u83b7\u53d6\u4fe1\u53f7\u91cf\u96c6&#xff08;semget&#xff09;<\/li>\n<li>\u521d\u59cb\u5316&#xff1a;\u8bbe\u521d\u503c &#061; \u5ea7\u4f4d\u603b\u6570&#xff08;semctl SETVAL&#xff09;<\/li>\n<li>\u7533\u8bf7\u8d44\u6e90&#xff0c;\u8ba1\u6570 -1&#xff08;semop \u505a P&#xff09;<\/li>\n<li>\u4f7f\u7528\u5171\u4eab\u8d44\u6e90<\/li>\n<li>\u91ca\u653e\u8d44\u6e90&#xff0c;\u8ba1\u6570 &#043;1&#xff08;semop \u505a V&#xff09;<\/li>\n<li>\u5220\u9664\u4fe1\u53f7\u91cf\u96c6&#xff08;semctl IPC_RMID&#xff09;<\/li>\n<h4 id=\"3.5%20%E8%B5%84%E6%BA%90%E7%94%A8%E5%AE%8C%E4%BA%86%E6%80%8E%E4%B9%88%E5%8A%9E%EF%BC%9A%E9%98%BB%E5%A1%9E%E7%AD%89%E5%BE%85%EF%BC%8C%E4%B8%8D%E7%A9%BA%E8%BD%AC\">3.5 \u8d44\u6e90\u7528\u5b8c\u4e86\u600e\u4e48\u529e&#xff1a;\u963b\u585e\u7b49\u5f85&#xff0c;\u4e0d\u7a7a\u8f6c<\/h4>\n<p>\u8ba1\u6570\u5f52\u96f6\u65f6\u518d\u6765\u8fdb\u7a0b&#xff0c;P \u64cd\u4f5c\u4f1a\u8ba9\u5b83\u963b\u585e\u7b49\u5f85\u2014\u2014\u6ce8\u610f\u662f\u7761\u7720\u90a3\u79cd\u7b49&#xff0c;\u4e0d\u662f\u539f\u5730\u8f6c\u5708\u7684\u5fd9\u7b49&#xff08;\u5fd9\u7b49\u5c31\u662f while \u6b7b\u5faa\u73af\u767d\u767d\u70e7 CPU&#xff09;\u3002\u7b49\u5230\u6709\u4eba V&#xff08;\u9000\u7968&#xff09;&#xff0c;\u5185\u6838\u628a\u5b83\u5524\u9192\u63a5\u7740\u5e72\u3002<\/p>\n<p>\u8fd9\u4e5f\u89e3\u91ca\u4e86\u4e3a\u4ec0\u4e48\u4fe1\u53f7\u91cf\u53eb&#034;\u540c\u6b65&#034;\u5de5\u5177&#xff1a;\u5b83\u4e0d\u5149\u62e6\u4eba&#xff0c;\u8fd8\u8d1f\u8d23\u6392\u961f\u53eb\u53f7\u3002<\/p>\n<hr \/>\n<h3 id=\"%E5%9B%9B%E3%80%81%E7%94%B3%E8%AF%B7%EF%BC%88P%EF%BC%89%E5%92%8C%E9%87%8A%E6%94%BE%EF%BC%88V%EF%BC%89%E5%85%B7%E4%BD%93%E5%81%9A%E4%BA%86%E4%BB%80%E4%B9%88\">\u56db\u3001\u7533\u8bf7&#xff08;P&#xff09;\u548c\u91ca\u653e&#xff08;V&#xff09;\u5177\u4f53\u505a\u4e86\u4ec0\u4e48<\/h3>\n<p>\u524d\u9762\u4e00\u76f4\u8bf4&#034;P \u51cf 1\u3001V \u52a0 1&#034;&#xff0c;\u4f46\u5185\u6838\u91cc\u8fd9\u5957\u64cd\u4f5c\u5230\u5e95\u957f\u4ec0\u4e48\u6837&#xff1f;\u8fd9\u4e00\u8282\u62c6\u5f00\u3002<\/p>\n<h4 id=\"4.1%20%E5%86%85%E6%A0%B8%E7%BB%99%E6%AF%8F%E4%B8%AA%E4%BF%A1%E5%8F%B7%E9%87%8F%E8%AE%B0%E7%9A%84%E5%9B%9B%E7%AC%94%E8%B4%A6\">4.1 \u5185\u6838\u7ed9\u6bcf\u4e2a\u4fe1\u53f7\u91cf\u8bb0\u7684\u56db\u7b14\u8d26<\/h4>\n<p>\u5148\u770b man page&#xff08;semop(2)&#xff09;\u7ed9\u7684\u7b54\u6848&#xff0c;\u96c6\u5408\u91cc\u6bcf\u4e00\u4e2a\u4fe1\u53f7\u91cf\u90fd\u6709\u56db\u4e2a\u5173\u8054\u503c&#xff1a;<\/p>\n<p>unsigned short semval;   \/* \u4fe1\u53f7\u91cf\u5f53\u524d\u503c *\/<br \/>\nunsigned short semzcnt;  \/* \u7b49\u5b83\u53d8\u6210 0 \u7684\u8fdb\u7a0b\u6570 *\/<br \/>\nunsigned short semncnt;  \/* \u7b49\u5b83\u53d8\u5927\u7684\u8fdb\u7a0b\u6570 *\/<br \/>\npid_t          sempid;   \/* \u6700\u540e\u4e00\u4e2a\u64cd\u4f5c\u5b83\u7684\u8fdb\u7a0b PID *\/<\/p>\n<p>\u4e70\u7968\u89c6\u89d2&#xff1a;semval \u662f\u5269\u4f59\u7968\u6570&#xff1b;semncnt \u662f\u6392\u7740\u961f\u7b49\u653e\u7968\u7684\u4eba\u6570&#xff1b;semzcnt \u662f\u7b49\u7740&#034;\u7968\u5168\u90e8\u5356\u5b8c&#034;\u8fd9\u4e2a\u72b6\u6001\u7684\u4eba\u6570&#xff1b;sempid \u8bb0\u7740\u6700\u540e\u4e00\u5f20\u7968\u662f\u8c01\u4e70\u7684\u3002<\/p>\n<h4 id=\"4.2%20%E4%B8%80%E6%AC%A1%E6%93%8D%E4%BD%9C%E6%80%8E%E4%B9%88%E5%A1%AB%EF%BC%9A%E5%86%99%E4%B8%80%E5%BC%A0%22%E6%93%8D%E4%BD%9C%E5%8D%95%22%E4%BA%A4%E7%BB%99%E5%86%85%E6%A0%B8\">4.2 \u4e00\u6b21\u64cd\u4f5c\u600e\u4e48\u586b&#xff1a;\u5199\u4e00\u5f20&#034;\u64cd\u4f5c\u5355&#034;\u4ea4\u7ed9\u5185\u6838<\/h4>\n<p>\u5bf9\u4fe1\u53f7\u91cf\u7684\u6bcf\u6b21\u64cd\u4f5c&#xff0c;\u4f60\u90fd\u8981\u586b\u4e00\u5f20\u64cd\u4f5c\u5355&#xff08;struct sembuf&#xff09;\u4ea4\u7ed9 semop&#xff1a;<\/p>\n<p>struct sembuf {<br \/>\n    unsigned short sem_num;  \/* \u64cd\u4f5c\u96c6\u5408\u91cc\u7b2c\u51e0\u4e2a\u4fe1\u53f7\u91cf&#xff08;\u4ece 0 \u5f00\u59cb&#xff09; *\/<br \/>\n    short          sem_op;   \/* \u64cd\u4f5c\u503c&#xff1a;\u6b63 \/ \u8d1f \/ \u96f6&#xff0c;\u4e09\u79cd\u8bed\u4e49 *\/<br \/>\n    short          sem_flg;  \/* \u6807\u5fd7&#xff1a;IPC_NOWAIT \/ SEM_UNDO *\/<br \/>\n};<\/p>\n<p>\u6ce8\u610f\u7c7b\u578b&#xff1a;sem_op \u662f short&#xff08;\u6709\u7b26\u53f7&#xff09;&#xff0c;\u6240\u4ee5\u5b83\u80fd\u5e26\u6b63\u8d1f\u53f7&#xff1b;\u53e6\u5916\u4e24\u4e2a\u662f unsigned short\u3002\u8fd9\u4e2a\u7c7b\u578b\u7ec6\u8282\u522b\u5ffd\u7565&#xff0c;\u5b83\u5c31\u662f\u4e09\u79cd\u8bed\u4e49\u7684\u7269\u7406\u57fa\u7840\u3002<\/p>\n<h4 id=\"4.3%20%E6%93%8D%E4%BD%9C%E5%80%BC%E7%9A%84%E4%B8%89%E7%A7%8D%E8%AF%AD%E4%B9%89%EF%BC%9A%E7%94%B3%E8%AF%B7%20%2F%20%E9%87%8A%E6%94%BE%20%2F%20%E7%AD%89%E5%BD%92%E9%9B%B6\">4.3 \u64cd\u4f5c\u503c\u7684\u4e09\u79cd\u8bed\u4e49&#xff1a;\u7533\u8bf7 \/ \u91ca\u653e \/ \u7b49\u5f52\u96f6<\/h4>\n<table>\n<tr>\u64cd\u4f5c\u503c\u542b\u4e49\u884c\u4e3a\u7535\u5f71\u9662<\/tr>\n<tbody>\n<tr>\n<td>&lt; 0<\/td>\n<td>P \u64cd\u4f5c&#xff0c;\u7533\u8bf7 |sem_op| \u4efd\u8d44\u6e90<\/td>\n<td>\u591f\u51cf\u5c31\u51cf&#xff0c;\u4e0d\u591f\u5c31\u963b\u585e&#xff08;semncnt&#043;&#043;&#xff09;<\/td>\n<td>\u4e70\u7968&#xff0c;\u6ca1\u7968\u5c31\u6392\u961f<\/td>\n<\/tr>\n<tr>\n<td>&gt; 0<\/td>\n<td>V \u64cd\u4f5c&#xff0c;\u91ca\u653e sem_op \u4efd\u8d44\u6e90<\/td>\n<td>\u76f4\u63a5\u52a0&#xff0c;\u6c38\u4e0d\u963b\u585e<\/td>\n<td>\u9000\u7968<\/td>\n<\/tr>\n<tr>\n<td>&#061; 0<\/td>\n<td>\u7b49\u5f85\u8ba1\u6570\u53d8\u6210 0<\/td>\n<td>\u5df2\u662f 0 \u5c31\u8fc7&#xff1b;\u4e0d\u662f 0 \u5c31\u963b\u585e&#xff08;semzcnt&#043;&#043;&#xff09;<\/td>\n<td>\u7b49&#034;\u7968\u5168\u90e8\u5356\u5b8c&#034;\u518d\u8fdb\u573a\u6536\u573a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e09\u79cd\u91cc\u53ea\u6709 V \u6c38\u4e0d\u963b\u585e\u2014\u2014\u9000\u7968\u6c38\u8fdc\u662f\u5141\u8bb8\u7684&#xff0c;\u5929\u7ecf\u5730\u4e49\u3002<\/p>\n<p>\u64cd\u4f5c\u503c &#061; 0 \u5e73\u65f6\u7528\u5f97\u5c11&#xff0c;\u5178\u578b\u573a\u666f\u662f\u7b49\u8d44\u6e90\u88ab&#034;\u5168\u90e8\u7528\u5b8c&#034;\u518d\u7edf\u4e00\u56de\u6536&#xff0c;\u6bd4\u5982\u7ba1\u7406\u8fdb\u7a0b\u7b49\u6240\u6709\u4f7f\u7528\u8005\u6563\u573a\u3002<\/p>\n<h4 id=\"4.4%20%E4%B8%A4%E4%B8%AA%E9%87%8D%E8%A6%81%E6%A0%87%E5%BF%97%EF%BC%9A%E4%B8%8D%E7%AD%89%E5%BE%85%20%2F%20%E8%87%AA%E5%8A%A8%E5%9B%9E%E6%BB%9A\">4.4 \u4e24\u4e2a\u91cd\u8981\u6807\u5fd7&#xff1a;\u4e0d\u7b49\u5f85 \/ \u81ea\u52a8\u56de\u6eda<\/h4>\n<p>IPC_NOWAIT&#xff1a;\u4e0d\u963b\u585e\u3002\u62ff\u4e0d\u5230\u8d44\u6e90\u76f4\u63a5\u8fd4\u56de\u9519\u8bef&#xff0c;errno \u7f6e EAGAIN\u3002\u800c\u4e14 man page \u660e\u6587\u5199\u4e86&#xff1a;\u6574\u4e2a\u64cd\u4f5c\u6570\u7ec4\u4e00\u4e2a\u90fd\u4e0d\u4f1a\u6267\u884c\u3002\u5bf9\u5e94\u7535\u5f71\u9662\u91cc&#034;\u770b\u6ca1\u7968\u4e86&#xff0c;\u4e0d\u7b49\u4e86&#xff0c;\u8d70\u4eba&#034;\u3002<\/p>\n<p>SEM_UNDO&#xff1a;\u8fdb\u7a0b\u9000\u51fa\u65f6&#xff0c;\u5185\u6838\u81ea\u52a8\u56de\u6eda\u5b83\u505a\u8fc7\u7684 P\/V\u3002\u5bf9\u5e94&#034;\u4eba\u8dd1\u4e86&#xff08;\u8fdb\u7a0b\u5d29\u4e86&#xff09;&#xff0c;\u7968\u81ea\u52a8\u9000\u56de\u6c60\u5b50&#034;\u3002\u4e3a\u4ec0\u4e48\u9700\u8981\u5b83\u3001\u5185\u6838\u600e\u4e48\u5b9e\u73b0&#xff0c;\u7b2c\u5341\u8282\u8ffd\u95ee\u91cc\u4e13\u95e8\u8bb2\u2014\u2014\u8fd9\u91cc\u5148\u8bb0\u4f4f\u7535\u5f71\u9662\u7248\u672c\u5c31\u591f\u3002<\/p>\n<h4 id=\"4.5%20%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E5%8E%9F%E5%AD%90%E6%89%A7%E8%A1%8C%EF%BC%9A%E8%A6%81%E4%B9%88%E5%85%A8%E5%81%9A%EF%BC%8C%E8%A6%81%E4%B9%88%E5%85%A8%E4%B8%8D%E5%81%9A\">4.5 \u4e3a\u4ec0\u4e48\u8981\u539f\u5b50\u6267\u884c&#xff1a;\u8981\u4e48\u5168\u505a&#xff0c;\u8981\u4e48\u5168\u4e0d\u505a<\/h4>\n<p>\u4e00\u6b21 semop \u4f20\u8fdb\u53bb\u7684\u6574\u4e2a\u64cd\u4f5c\u6570\u7ec4&#xff0c;\u8981\u4e48\u5168\u90e8\u6267\u884c\u5b8c&#xff0c;\u8981\u4e48\u4e00\u4e2a\u90fd\u4e0d\u6267\u884c&#xff0c;\u4e2d\u95f4\u4e0d\u4f1a\u88ab\u522b\u7684\u8fdb\u7a0b\u63d2\u961f\u3002\u8fd9\u4e5f\u662f\u7cfb\u7edf\u8c03\u7528\u8fdb\u5185\u6838\u540e\u7531\u5185\u6838\u52a0\u9501\u4fdd\u8bc1\u7684\u3002\u4e3a\u4ec0\u4e48\u5fc5\u987b\u8fd9\u6837&#xff0c;\u7b2c\u516d\u8282\u8bb2\u5b8c\u4fe1\u53f7\u91cf\u96c6\u518d\u56de\u6765\u770b\u3002<\/p>\n<hr \/>\n<h3 id=\"%E4%BA%94%E3%80%81%E6%80%8E%E4%B9%88%E7%94%A8%EF%BC%9A%E5%88%9B%E5%BB%BA%E3%80%81%E5%88%9D%E5%A7%8B%E5%8C%96%E3%80%81%E5%8A%A0%E5%87%8F%E3%80%81%E5%88%A0%E9%99%A4\">\u4e94\u3001\u600e\u4e48\u7528&#xff1a;\u521b\u5efa\u3001\u521d\u59cb\u5316\u3001\u52a0\u51cf\u3001\u5220\u9664<\/h3>\n<p>System V \u4e09\u4ef6\u5957\u7684\u7528\u6cd5\u5f62\u6001\u9ad8\u5ea6\u4e00\u81f4&#xff0c;\u4fe1\u53f7\u91cf\u8fd9\u5957&#xff0c;\u5c31\u662f\u7bc727 \u6d88\u606f\u961f\u5217\u90a3\u5957\u7684&#034;\u4fe1\u53f7\u91cf\u7248&#034;\u3002\u9010\u4e2a\u62c6\u3002<\/p>\n<h4 id=\"5.1%20%E5%88%9B%E5%BB%BA%EF%BC%9A%E6%80%8E%E4%B9%88%E6%8B%BF%E5%88%B0%E4%B8%80%E4%B8%AA%E4%BF%A1%E5%8F%B7%E9%87%8F%E9%9B%86%EF%BC%88semget%EF%BC%89\">5.1 \u521b\u5efa&#xff1a;\u600e\u4e48\u62ff\u5230\u4e00\u4e2a\u4fe1\u53f7\u91cf\u96c6&#xff08;semget&#xff09;<\/h4>\n<p>int semget(key_t key, int nsems, int semflg);<\/p>\n<ul>\n<li>key&#xff1a;\u54ea\u4e2a\u4fe1\u53f7\u91cf\u96c6&#xff08;ftok \u751f\u6210&#xff0c;\u7bc725 \u8bb2\u8fc7&#xff09;<\/li>\n<li>nsems&#xff1a;\u8fd9\u4e2a\u96c6\u5408\u91cc\u653e\u51e0\u4e2a\u4fe1\u53f7\u91cf<\/li>\n<li>semflg&#xff1a;IPC_CREAT \/ IPC_EXCL \/ \u6743\u9650\u4f4d&#xff08;0666 \u90a3\u5957&#xff09;<\/li>\n<li>\u8fd4\u56de&#xff1a;semid<\/li>\n<\/ul>\n<p>\u6ce8\u610f\u5b83\u521b\u5efa\u7684\u662f&#034;\u96c6&#034;&#xff0c;\u4e0d\u662f\u5355\u4e2a\u4fe1\u53f7\u91cf\u2014\u2014\u54ea\u6015\u4f60\u53ea\u8981\u4e00\u4e2a&#xff0c;\u4e5f\u662f nsems &#061; 1 \u7684\u96c6\u5408\u3002\u4e3a\u4ec0\u4e48\u8bbe\u8ba1\u6210\u96c6&#xff0c;\u4e0b\u4e00\u8282\u8bb2\u3002<\/p>\n<h4 id=\"5.2%20%E6%8E%A7%E5%88%B6%EF%BC%9A%E5%88%9D%E5%A7%8B%E5%8C%96%E3%80%81%E6%9F%A5%E7%8A%B6%E6%80%81%E3%80%81%E5%88%A0%E9%99%A4%E9%83%BD%E9%9D%A0%E5%AE%83%EF%BC%88semctl%EF%BC%89\">5.2 \u63a7\u5236&#xff1a;\u521d\u59cb\u5316\u3001\u67e5\u72b6\u6001\u3001\u5220\u9664\u90fd\u9760\u5b83&#xff08;semctl&#xff09;<\/h4>\n<p>int semctl(int semid, int semnum, int cmd, &#8230;);<\/p>\n<p>\u7b2c\u56db\u4e2a\u53c2\u6570\u662f\u53ef\u53d8\u53c2\u6570&#xff0c;\u7c7b\u578b\u662f union semun\u3002<\/p>\n<p>\u5e38\u7528 cmd&#xff1a;<\/p>\n<table>\n<tr>cmd\u5e72\u4ec0\u4e48\u7b2c\u56db\u53c2\u7528\u54ea\u4e2a\u6210\u5458<\/tr>\n<tbody>\n<tr>\n<td>SETVAL<\/td>\n<td>\u628a\u7b2c semnum \u4e2a\u4fe1\u53f7\u91cf\u8bbe\u6210\u6307\u5b9a\u503c<\/td>\n<td>arg.val<\/td>\n<\/tr>\n<tr>\n<td>GETVAL<\/td>\n<td>\u8bfb\u7b2c semnum \u4e2a\u4fe1\u53f7\u91cf\u7684\u503c<\/td>\n<td>\u4e0d\u7528<\/td>\n<\/tr>\n<tr>\n<td>IPC_STAT \/ IPC_SET<\/td>\n<td>\u53d6\/\u6539\u6574\u4e2a\u96c6\u7684\u5c5e\u6027<\/td>\n<td>arg.buf<\/td>\n<\/tr>\n<tr>\n<td>IPC_RMID<\/td>\n<td>\u5220\u6389\u6574\u4e2a\u4fe1\u53f7\u91cf\u96c6<\/td>\n<td>\u4e0d\u7528<\/td>\n<\/tr>\n<tr>\n<td>GETALL \/ SETALL<\/td>\n<td>\u4e00\u6b21\u8bfb\/\u5199\u96c6\u5408\u91cc\u5168\u90e8\u503c<\/td>\n<td>arg.array<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>SETVAL \u662f\u521d\u59cb\u5316\u7684\u552f\u4e00\u624b\u6bb5\u2014\u2014\u521b\u5efa\u5b8c&#xff0c;\u4fe1\u53f7\u91cf\u503c\u4e0d\u4f1a\u81ea\u52a8\u662f\u4f60\u60f3\u8981\u7684\u6570&#xff0c;\u5fc5\u987b\u624b\u52a8\u8bbe\u3002\u5fd8\u4e86\u8bbe\u521d\u503c\u5c31\u7528&#xff0c;\u662f\u65b0\u624b\u7b2c\u4e00\u5927\u5751\u3002<\/p>\n<h4 id=\"5.3%20%E4%BC%A0%E5%8F%82%E7%94%A8%E7%9A%84%E8%81%94%E5%90%88%E4%BD%93%EF%BC%9A%E4%B8%BA%E4%BB%80%E4%B9%88%E5%BF%85%E9%A1%BB%E8%87%AA%E5%B7%B1%E5%AE%9A%E4%B9%89%EF%BC%88semun%EF%BC%89\">5.3 \u4f20\u53c2\u7528\u7684\u8054\u5408\u4f53&#xff1a;\u4e3a\u4ec0\u4e48\u5fc5\u987b\u81ea\u5df1\u5b9a\u4e49&#xff08;semun&#xff09;<\/h4>\n<p>\u8fd9\u662f\u4fe1\u53f7\u91cf\u63a5\u53e3\u6700\u51fa\u540d\u7684\u5751\u3002semctl \u7b2c\u56db\u53c2\u7684\u7c7b\u578b union semun&#xff0c;\u7cfb\u7edf\u5934\u6587\u4ef6\u4e0d\u63d0\u4f9b\u5b9a\u4e49&#xff0c;\u5fc5\u987b\u4f60\u81ea\u5df1\u5199\u3002man page \u91cc\u5199\u5f97\u5f88\u660e\u786e&#xff08;&#034;The calling program must define this union as follows&#034;&#xff09;&#xff1a;<\/p>\n<p>union semun {<br \/>\n               int              val;    \/* SETVAL \u64cd\u4f5c\u4f7f\u7528\u7684\u4fe1\u53f7\u91cf\u503c *\/<br \/>\n               struct semid_ds *buf;    \/* IPC_STAT\u3001IPC_SET \u64cd\u4f5c\u4f7f\u7528\u7684\u7f13\u51b2\u533a *\/<br \/>\n               unsigned short  *array;  \/* GETALL\u3001SETALL \u64cd\u4f5c\u4f7f\u7528\u7684\u6570\u7ec4 *\/<br \/>\n               struct seminfo  *__buf;  \/* IPC_INFO \u64cd\u4f5c\u4f7f\u7528\u7684\u7f13\u51b2\u533a<br \/>\n                                           (Linux \u7cfb\u7edf\u7279\u6709) *\/<br \/>\n           };<\/p>\n<p>\u56db\u4e2a\u6210\u5458\u4e00\u4e2a\u4e0d\u80fd\u5c11&#xff0c;\u7b2c\u56db\u4e2a\u540d\u5b57\u662f __buf&#xff08;\u53cc\u4e0b\u5212\u7ebf\u5f00\u5934&#xff09;\u3002\u4e3a\u4ec0\u4e48 POSIX \u4e0d\u7ed9\u5b9a\u4e49&#xff1f;\u5386\u53f2\u9057\u7559\u2014\u2014\u5404\u5bb6 UNIX \u5b9e\u73b0\u5bf9\u8fd9\u4e2a\u8054\u5408\u4f53\u7684\u5b9a\u4e49\u6253\u67b6&#xff0c;\u6807\u51c6\u5e72\u8106\u7529\u7ed9\u5e94\u7528\u7a0b\u5e8f\u81ea\u5df1\u58f0\u660e\u3002\u7ed3\u679c\u5c31\u662f\u6bcf\u4e00\u4efd System V \u4fe1\u53f7\u91cf\u4ee3\u7801\u5f00\u5934\u90fd\u8d34\u7740\u540c\u4e00\u6bb5\u3002<\/p>\n<h4 id=\"5.4%20%E7%9C%9F%E6%AD%A3%E7%9A%84%20P%2FV%EF%BC%9A%E4%B8%80%E6%AC%A1%E8%83%BD%E5%90%8C%E6%97%B6%E6%93%8D%E4%BD%9C%E4%B8%80%E6%89%B9%E4%BF%A1%E5%8F%B7%E9%87%8F%EF%BC%88semop%EF%BC%89\">5.4 \u771f\u6b63\u7684 P\/V&#xff1a;\u4e00\u6b21\u80fd\u540c\u65f6\u64cd\u4f5c\u4e00\u6279\u4fe1\u53f7\u91cf&#xff08;semop&#xff09;<\/h4>\n<p>int semop(int semid, struct sembuf *sops, size_t nsops);<\/p>\n<ul>\n<li>sops&#xff1a;struct sembuf \u6570\u7ec4<\/li>\n<li>nsops&#xff1a;\u6570\u7ec4\u91cc\u6709\u51e0\u4e2a\u64cd\u4f5c<\/li>\n<\/ul>\n<p><span style=\"color:#ff9900\">\u4f20\u6570\u7ec4\u610f\u5473\u7740\u4e00\u6b21\u7cfb\u7edf\u8c03\u7528\u53ef\u4ee5\u5bf9\u96c6\u5408\u91cc\u591a\u4e2a\u4fe1\u53f7\u91cf\u540c\u65f6\u64cd\u4f5c&#xff0c;\u800c\u4e14\u6574\u4f53\u539f\u5b50&#xff08;\u7b2c\u56db\u8282 4.5 \u8bf4\u8fc7&#xff09;\u3002<\/span><\/p>\n<hr \/>\n<h3 id=\"%E5%85%AD%E3%80%81%E4%B8%80%E6%AC%A1%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E7%AE%A1%E5%A4%9A%E4%B8%AA%E4%BF%A1%E5%8F%B7%E9%87%8F\">\u516d\u3001\u4e00\u6b21\u4e3a\u4ec0\u4e48\u8981\u7ba1\u591a\u4e2a\u4fe1\u53f7\u91cf<\/h3>\n<p>\u524d\u9762\u521b\u5efa\u63a5\u53e3\u57cb\u7684\u95ee\u9898\u5728\u8fd9&#xff1a;\u4e3a\u4ec0\u4e48 semget \u521b\u5efa\u7684\u662f&#034;\u96c6&#034;&#xff1f;<\/p>\n<h4 id=\"6.1%20%E4%B8%A4%E4%B8%AA%E5%8F%82%E6%95%B0%E5%88%AB%E6%90%9E%E6%B7%B7%EF%BC%9A%E5%BB%BA%E5%87%A0%E4%B8%AA%20vs%20%E5%8A%A8%E7%AC%AC%E5%87%A0%E4%B8%AA\">6.1 \u4e24\u4e2a\u53c2\u6570\u522b\u641e\u6df7&#xff1a;\u5efa\u51e0\u4e2a vs \u52a8\u7b2c\u51e0\u4e2a<\/h4>\n<ul>\n<li>nsems&#xff1a;\u521b\u5efa\u65f6\u6307\u5b9a&#xff0c;\u8fd9\u4e2a\u96c6\u5408\u91cc\u6709\u51e0\u4e2a\u4fe1\u53f7\u91cf&#xff08;\u5185\u6838\u91cc\u5c31\u662f\u6309\u6570\u7ec4\u6765\u653e\u7684&#xff09;<\/li>\n<li>semnum&#xff1a;\u64cd\u4f5c\u65f6\u6307\u5b9a&#xff0c;\u52a8\u7684\u662f\u96c6\u5408\u91cc\u7b2c\u51e0\u4e2a&#xff08;\u4ece 0 \u6570&#xff09;<\/li>\n<\/ul>\n<p>\u4e00\u4e2a\u662f&#034;\u76d6\u697c\u65f6\u5b9a\u51e0\u5c42&#034;&#xff0c;\u4e00\u4e2a\u662f&#034;\u8fdb\u697c\u65f6\u53bb\u51e0\u5c42&#034;&#xff0c;\u522b\u6df7\u3002<\/p>\n<h4 id=\"6.2%20%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E6%89%93%E5%8C%85%E6%88%90%22%E9%9B%86%22%EF%BC%9A%E5%A4%9A%E4%B8%AA%E9%94%81%E4%B8%80%E6%AC%A1%E5%8E%9F%E5%AD%90%E6%93%8D%E4%BD%9C\">6.2 \u4e3a\u4ec0\u4e48\u8981\u6253\u5305\u6210&#034;\u96c6&#034;&#xff1a;\u591a\u4e2a\u9501\u4e00\u6b21\u539f\u5b50\u64cd\u4f5c<\/h4>\n<p>\u4e00\u4e2a\u50cf\u6837\u7684\u5e76\u53d1\u573a\u666f\u5f80\u5f80\u4e0d\u6b62\u4e00\u628a\u9501\u3002\u7ecf\u5178\u7684\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u5c31\u8981\u4e09\u4e2a\u4fe1\u53f7\u91cf&#xff1a;<\/p>\n<ul>\n<li>empty&#xff1a;\u7a7a\u4f4d\u8fd8\u5269\u51e0\u4e2a&#xff08;\u751f\u4ea7\u8005\u770b\u5b83&#xff09;<\/li>\n<li>full&#xff1a;\u8d27\u7269\u6512\u4e86\u51e0\u4e2a&#xff08;\u6d88\u8d39\u8005\u770b\u5b83&#xff09;<\/li>\n<li>mutex&#xff1a;\u7f13\u51b2\u533a\u672c\u8eab\u7684\u4e92\u65a5\u9501<\/li>\n<\/ul>\n<p>\u5982\u679c\u53ea\u80fd\u4e00\u4e2a\u4e00\u4e2a\u521b\u5efa&#xff0c;\u4e09\u4e2a\u4fe1\u53f7\u91cf\u4e09\u6b21\u521b\u5efa\u3001\u4e09\u6b21\u7ba1\u7406\u3002\u8bbe\u8ba1\u6210\u96c6&#xff1a;\u4e00\u6b21\u521b\u5efa\u3001\u4e00\u4e2a semid \u5168\u7ba1&#xff0c;\u800c\u4e14 semop \u4f20\u6570\u7ec4\u53ef\u4ee5\u4e00\u6b21\u539f\u5b50\u5730\u52a8\u5b83\u4eec\u4ee8\u2014\u2014\u8981\u4e48\u4e09\u4e2a\u4fe1\u53f7\u91cf\u7684\u72b6\u6001\u4e00\u8d77\u6539\u6210\u529f&#xff0c;\u8981\u4e48\u90fd\u4e0d\u52a8\u3002\u8fd9\u5728\u591a\u9501\u573a\u666f\u662f\u9632\u6b7b\u9501\u7684\u5173\u952e&#xff1a;\u5148\u62ff\u5168\u518d\u52a8&#xff0c;\u4e0d\u7ed9\u4eba\u63d2\u961f\u5236\u9020&#034;\u62ff\u4e86 A \u7b49 B\u3001\u62ff\u4e86 B \u7b49 A&#034;\u7684\u673a\u4f1a\u3002<\/p>\n<p>\u7535\u5f71\u9662\u7248&#xff1a;\u591a\u4e2a\u5f71\u5385\u5404\u4e00\u5957\u7968&#xff0c;\u53ef\u4ee5\u4e00\u6b21\u4e70\u9f50\u4e24\u573a\u8fde\u6620\u7684\u7968\u2014\u2014\u8981\u4e48\u4e24\u573a\u90fd\u5230\u624b&#xff0c;\u8981\u4e48\u4e00\u5f20\u90fd\u4e0d\u4e70&#xff0c;\u4e0d\u4f1a\u51fa\u73b0&#034;\u4e70\u4e86 1 \u53f7\u5385\u7684\u7968\u30012 \u53f7\u5385\u5356\u5149\u4e86\u3001\u7968\u9000\u4e0d\u6389&#034;\u7684\u5c34\u5c2c\u3002<\/p>\n<h4 id=\"6.3%20%E7%B3%BB%E7%BB%9F%E4%B8%8A%E9%99%90%EF%BC%9A%E4%B8%80%E4%B8%AA%E9%9B%86%E6%9C%80%E5%A4%9A%E8%83%BD%E6%94%BE%E5%A4%9A%E5%B0%91%E4%BF%A1%E5%8F%B7%E9%87%8F\">6.3 \u7cfb\u7edf\u4e0a\u9650&#xff1a;\u4e00\u4e2a\u96c6\u6700\u591a\u80fd\u653e\u591a\u5c11\u4fe1\u53f7\u91cf<\/h4>\n<p>semget(2) man page \u5199\u5f97\u660e\u767d&#xff0c;\u51e0\u4e2a\u5173\u952e\u9650\u5236&#xff1a;<\/p>\n<table>\n<tr>\u9650\u5236\u542b\u4e49\u8001\u9ed8\u8ba4&#xff08;&lt;3.19&#xff09;\u65b0\u9ed8\u8ba4&#xff08;\u22653.19&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>SEMMSL<\/td>\n<td>\u5355\u4e2a\u96c6\u6700\u591a\u51e0\u4e2a\u4fe1\u53f7\u91cf<\/td>\n<td>250<\/td>\n<td>32000<\/td>\n<\/tr>\n<tr>\n<td>SEMMNI<\/td>\n<td>\u7cfb\u7edf\u6700\u591a\u51e0\u4e2a\u96c6<\/td>\n<td>128<\/td>\n<td>32000<\/td>\n<\/tr>\n<tr>\n<td>SEMMNS<\/td>\n<td>\u7cfb\u7edf\u4fe1\u53f7\u91cf\u603b\u6570<\/td>\n<td>&#061; SEMMNI \u00d7 SEMMSL<\/td>\n<td>\u540c\u5de6<\/td>\n<\/tr>\n<tr>\n<td>SEMOPM<\/td>\n<td>\u5355\u6b21 semop \u6700\u591a\u51e0\u4e2a\u64cd\u4f5c<\/td>\n<td>32<\/td>\n<td>500<\/td>\n<\/tr>\n<tr>\n<td>SEMVMX<\/td>\n<td>\u4fe1\u53f7\u91cf\u6700\u5927\u503c<\/td>\n<td>32767&#xff08;\u786c\u7f16\u7801&#xff0c;\u6539\u4e0d\u4e86&#xff09;<\/td>\n<td>\u540c\u5de6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5b9e\u6d4b\u65b9\u6cd5&#xff08;\u53ef\u4ee5\u76f4\u63a5\u8dd1&#xff09;&#xff1a;<\/p>\n<p>$ cat \/proc\/sys\/kernel\/sem<br \/>\n250 32000 32 128<\/p>\n<p>\u6ce8\u610f\u8fd9\u56db\u4e2a\u6570\u7684\u987a\u5e8f&#xff1a;SEMMSL SEMMNS SEMOPM SEMMNI\u2014\u2014\u4e0d\u662f\u5b57\u6bcd\u5e8f&#xff0c;\u4e5f\u4e0d\u662f&#034;\u96c6\u5728\u524d&#034;\u7684\u76f4\u89c9\u5e8f\u3002\u9762\u8bd5\u5b98\u5c31\u7231\u62ff\u8fd9\u4e2a\u987a\u5e8f\u9493\u4eba&#xff0c;\u7b54\u9519\u987a\u5e8f\u7b49\u4e8e\u6ca1\u67e5\u8fc7\u3002<\/p>\n<hr \/>\n<h3 id=\"%E4%B8%83%E3%80%81%E8%BF%9B%E7%A8%8B%E9%80%80%E5%87%BA%E5%AE%83%E8%BF%98%E5%9C%A8%EF%BC%9A%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F%E4%B8%8E%E6%B8%85%E7%90%86\">\u4e03\u3001\u8fdb\u7a0b\u9000\u51fa\u5b83\u8fd8\u5728&#xff1a;\u751f\u547d\u5468\u671f\u4e0e\u6e05\u7406<\/h3>\n<h4 id=\"7.1%20%E6%80%8E%E4%B9%88%E6%9F%A5%E7%9C%8B%E5%92%8C%E5%88%A0%E9%99%A4%EF%BC%9A%E5%91%BD%E4%BB%A4%E8%A1%8C%20%2B%20%E4%BB%A3%E7%A0%81%E8%B0%83%E7%94%A8\">7.1 \u600e\u4e48\u67e5\u770b\u548c\u5220\u9664&#xff1a;\u547d\u4ee4\u884c &#043; \u4ee3\u7801\u8c03\u7528<\/h4>\n<p>$ ipcs -s          # \u67e5\u770b\u7cfb\u7edf\u91cc\u6240\u6709\u4fe1\u53f7\u91cf\u96c6&#xff08;-s &#061; semaphore&#xff09;<br \/>\n$ ipcrm -s semid   # \u547d\u4ee4\u884c\u5220\u4e00\u4e2a<\/p>\n<p>\u4ee3\u7801\u91cc\u5220&#xff1a;semctl(semid, 0, IPC_RMID)&#xff08;\u5bf9\u5e94\u7b2c\u4e94\u8282\u8bb2\u7684\u5220\u9664\u7528\u6cd5&#xff09;\u3002<\/p>\n<h4 id=\"7.2%20%E8%BF%9B%E7%A8%8B%E9%80%80%E5%87%BA%E5%AE%83%E8%BF%98%E5%9C%A8%EF%BC%9A%E7%94%A8%E5%AE%8C%E5%BF%85%E9%A1%BB%E8%87%AA%E5%B7%B1%E5%88%A0\">7.2 \u8fdb\u7a0b\u9000\u51fa\u5b83\u8fd8\u5728&#xff1a;\u7528\u5b8c\u5fc5\u987b\u81ea\u5df1\u5220<\/h4>\n<p>\u548c\u5171\u4eab\u5185\u5b58\u3001\u6d88\u606f\u961f\u5217\u4e00\u4e2a\u813e\u6c14&#xff1a;<span style=\"color:#fe2c24\">\u4fe1\u53f7\u91cf\u7684\u751f\u547d\u5468\u671f\u968f\u5185\u6838&#xff0c;\u4e0d\u968f\u8fdb\u7a0b<\/span>\u3002\u8fdb\u7a0b\u9000\u4e86&#xff0c;\u4fe1\u53f7\u91cf\u8fd8\u5728&#xff1b;\u91cd\u542f\u624d\u5f7b\u5e95\u6e05\u3002\u6240\u4ee5&#xff1a;<\/p>\n<ul>\n<li>\u7528\u5b8c\u5fc5\u987b\u663e\u5f0f\u5220&#xff08;IPC_RMID&#xff09;&#xff0c;\u5fd8\u4e86\u5220\u5c31\u662f\u5185\u6838\u8d44\u6e90\u6cc4\u6f0f<\/li>\n<\/ul>\n<h4 id=\"7.3%20%E5%88%A0%E9%99%A4%E7%9A%84%E5%89%AF%E4%BD%9C%E7%94%A8%EF%BC%9A%E9%98%BB%E5%A1%9E%E4%B8%AD%E7%9A%84%E8%BF%9B%E7%A8%8B%E4%BC%9A%E8%A2%AB%E4%B8%80%E5%B9%B6%E5%94%A4%E9%86%92\">7.3 \u5220\u9664\u7684\u526f\u4f5c\u7528&#xff1a;\u963b\u585e\u4e2d\u7684\u8fdb\u7a0b\u4f1a\u88ab\u4e00\u5e76\u5524\u9192<\/h4>\n<p>man page \u91cc\u4e00\u6761\u5bb9\u6613\u88ab\u5ffd\u7565\u7684\u7ec6\u8282&#xff1a;IPC_RMID \u5220\u96c6\u5408\u65f6&#xff0c;\u6240\u6709\u963b\u585e\u5728\u8fd9\u4e2a\u96c6\u4e0a semop \u7684\u8fdb\u7a0b\u4f1a\u88ab\u4e00\u8d77\u5524\u9192&#xff0c;\u5b83\u4eec\u7684 semop \u8fd4\u56de\u5931\u8d25&#xff0c;errno \u7f6e EIDRM\u3002\u4e0d\u662f\u8ba9\u5b83\u4eec\u6c38\u8fdc\u7761\u4e0b\u53bb\u3002<\/p>\n<p>\u5bf9\u5e94\u7535\u5f71\u9662&#xff1a;\u5f71\u5385\u76f4\u63a5\u62c6\u4e86&#xff0c;\u6392\u961f\u7684\u4eba\u5f53\u573a\u6563\u4f19&#xff0c;\u5404\u81ea\u6536\u5230\u901a\u77e5\u3002<\/p>\n<hr \/>\n<h3 id=\"%E5%85%AB%E3%80%81%E5%86%85%E6%A0%B8%E6%80%8E%E4%B9%88%E5%AD%98%E6%94%BE%E3%80%81%E5%8F%88%E6%80%8E%E4%B9%88%E7%BB%9F%E4%B8%80%E7%AE%A1%E7%90%86%E4%B8%89%E4%BB%B6%E5%A5%97\">\u516b\u3001\u5185\u6838\u600e\u4e48\u5b58\u653e\u3001\u53c8\u600e\u4e48\u7edf\u4e00\u7ba1\u7406\u4e09\u4ef6\u5957<\/h3>\n<p>\u95ee\u8001\u95ee\u9898&#xff1a;\u5185\u6838\u91cc\u8fd9\u4e48\u591a\u4fe1\u53f7\u91cf&#xff0c;OS \u600e\u4e48\u7ba1&#xff1f;<\/p>\n<p>\u8001\u7b54\u6848&#xff1a;\u5148\u63cf\u8ff0&#xff0c;\u518d\u7ec4\u7ec7&#xff08;\u7bc725 \u8bb2\u5171\u4eab\u5185\u5b58\u65f6\u7684 shmid_ds\u3001\u7bc727 \u7684 msqid_ds&#xff0c;\u540c\u4e00\u4e2a\u5957\u8def&#xff09;\u3002\u4fe1\u53f7\u91cf\u7684&#034;\u63cf\u8ff0&#034;\u5c31\u662f struct semid_ds\u3002<\/p>\n<h4 id=\"8.1%20%E5%86%85%E6%A0%B8%E6%80%8E%E4%B9%88%22%E6%8F%8F%E8%BF%B0%22%E4%BF%A1%E5%8F%B7%E9%87%8F%EF%BC%9A%E4%B8%80%E5%BC%A0%E6%A1%A3%E6%A1%88%E8%A1%A8%EF%BC%88semid_ds%EF%BC%89\">8.1 \u5185\u6838\u600e\u4e48&#034;\u63cf\u8ff0&#034;\u4fe1\u53f7\u91cf&#xff1a;\u4e00\u5f20\u6863\u6848\u8868&#xff08;semid_ds&#xff09;<\/h4>\n<p>\u7bc727 \u53ea\u70b9\u4e86\u4e2a\u540d&#xff0c;\u8fd9\u91cc\u7ed9\u5168&#xff08;semctl(2) man page \u539f\u6587&#xff09;&#xff1a;<\/p>\n<p>struct semid_ds {<br \/>\n    struct ipc_perm sem_perm;   \/* \u6240\u6709\u6743\u4e0e\u6743\u9650 *\/<br \/>\n    time_t          sem_otime;  \/* \u6700\u540e\u4e00\u6b21 semop \u65f6\u95f4 *\/<br \/>\n    time_t          sem_ctime;  \/* \u521b\u5efa \/ \u6700\u540e\u4e00\u6b21 semctl \u6539\u52a8\u65f6\u95f4 *\/<br \/>\n    unsigned long   sem_nsems;  \/* \u96c6\u5408\u91cc\u4fe1\u53f7\u91cf\u4e2a\u6570 *\/<br \/>\n};<\/p>\n<p>\u4e09\u4e2a\u65f6\u95f4\u6233 &#043; \u4e00\u4e2a\u8ba1\u6570&#xff0c;\u7ba1\u7684\u662f&#034;\u6574\u4e2a\u96c6&#034;\u7684\u6863\u6848\u3002\u5355\u4e2a\u4fe1\u53f7\u91cf\u7684 semval \/ semncnt \u90a3\u56db\u4e2a\u503c&#xff08;4.1 \u8282&#xff09;\u662f\u96c6\u5408\u5185\u90e8\u6bcf\u4e2a\u6210\u5458\u5404\u81ea\u6302\u7684&#xff0c;\u4e0d\u5728\u8fd9\u4e2a\u7ed3\u6784\u91cc\u3002<\/p>\n<h4 id=\"8.2%20%E6%A1%A3%E6%A1%88%E5%BC%80%E5%A4%B4%E7%9A%84%E6%9D%83%E9%99%90%E5%A4%B4%EF%BC%9A%E8%B0%81%E5%BB%BA%E7%9A%84%E3%80%81%E6%9D%83%E9%99%90%E5%A4%9A%E5%A4%A7%EF%BC%88ipc_perm%EF%BC%89\">8.2 \u6863\u6848\u5f00\u5934\u7684\u6743\u9650\u5934&#xff1a;\u8c01\u5efa\u7684\u3001\u6743\u9650\u591a\u5927&#xff08;ipc_perm&#xff09;<\/h4>\n<p>sem_perm \u7684\u7c7b\u578b&#xff0c;\u7528\u6237\u6001\u5b8c\u6574\u5b9a\u4e49&#xff08;man page \u539f\u6587&#xff09;&#xff1a;<\/p>\n<p>struct ipc_perm {<br \/>\n    key_t          __key;   \/* \u4f60\u4f20\u7ed9 semget \u7684\u90a3\u4e2a key *\/<br \/>\n    uid_t          uid;     \/* \u6240\u6709\u8005 *\/<br \/>\n    gid_t          gid;<br \/>\n    uid_t          cuid;    \/* \u521b\u5efa\u8005 *\/<br \/>\n    gid_t          cgid;<br \/>\n    unsigned short mode;    \/* \u6743\u9650\u4f4d&#xff0c;\u4f4e 9 \u4f4d\u6709\u6548 *\/<br \/>\n    unsigned short __seq;   \/* \u5e8f\u5217\u53f7&#xff08;\u5185\u6838\u7528&#xff09; *\/<br \/>\n};<\/p>\n<p>\u5bf9\u4fe1\u53f7\u91cf\u6765\u8bf4&#xff0c;\u6743\u9650\u91cc\u7684&#034;\u5199&#034;\u5b9e\u9645\u542b\u4e49\u662f alter&#xff08;\u6539\u52a8&#xff09;\u2014\u2014\u80fd P\/V \u5c31\u7b97&#034;\u5199&#034;&#xff0c;\u8bfb semval \u7b97&#034;\u8bfb&#034;\u3002<\/p>\n<h4 id=\"8.3%20%E5%AE%B9%E6%98%93%E8%B8%A9%E5%9D%91%EF%BC%9A%E5%90%8C%E5%90%8D%E7%BB%93%E6%9E%84%EF%BC%8C%E7%94%A8%E6%88%B7%E6%80%81%E5%BF%AB%E7%85%A7%20%E2%89%A0%20%E5%86%85%E6%A0%B8%E5%AE%9E%E4%BD%93\">8.3 \u5bb9\u6613\u8e29\u5751&#xff1a;\u540c\u540d\u7ed3\u6784&#xff0c;\u7528\u6237\u6001\u5feb\u7167 \u2260 \u5185\u6838\u5b9e\u4f53<\/h4>\n<p>\u6ce8\u610f\u533a\u5206\u4e24\u4e2a\u540d\u5b57\u5f88\u50cf\u7684\u4e1c\u897f&#xff1a;<\/p>\n<ul>\n<li>\u7528\u6237\u6001 struct ipc_perm&#xff1a;IPC_STAT \u62f7\u51fa\u6765\u7ed9\u4f60\u770b\u7684&#034;\u5feb\u7167&#034;&#xff0c;\u5b57\u6bb5\u662f uid_t\u3001unsigned short mode<\/li>\n<li>\u5185\u6838 struct kern_ipc_perm&#xff1a;\u5185\u6838\u91cc\u771f\u6b63\u6302\u5728\u8d44\u6e90\u5934\u4e0a\u7684\u90a3\u4e2a&#xff0c;\u5b57\u6bb5\u662f kuid_t\u3001umode_t&#xff0c;\u8fd8\u5e26\u9501\u548c\u5f15\u7528\u8ba1\u6570<\/li>\n<\/ul>\n<p><span style=\"color:#fe2c24\">\u524d\u8005\u662f\u7ed9\u4f60\u770b\u7684\u62a5\u8868&#xff0c;\u540e\u8005\u662f\u4ed3\u5e93\u91cc\u771f\u5b9e\u7684\u8d27\u67b6\u6807\u7b7e\u3002<\/span>\u957f\u5f97\u5f88\u50cf&#xff0c;\u4e0d\u662f\u4e00\u4e2a\u4e1c\u897f\u30028.4 \u7684\u4e3b\u89d2\u5c31\u662f\u540e\u8005\u3002<\/p>\n<p>\u89c4\u5f8b\u56de\u6307&#xff08;\u7bc727 3.2 \u8bb2\u8fc7&#xff09;&#xff1a;<span style=\"color:#a2e043\">shmid_ds \/ msqid_ds \/ semid_ds \u4e09\u5144\u5f1f&#xff0c;\u5f00\u5934\u90fd\u662f ipc_perm<\/span>\u2014\u2014\u4e09\u4ef6\u5957\u63a5\u53e3\u957f\u5f97\u50cf&#xff0c;\u6839\u5b50\u5728\u8fd9\u3002<\/p>\n<h4 id=\"8.4%20%E4%B8%89%E7%B1%BB%E8%B5%84%E6%BA%90%E5%85%B1%E7%94%A8%E7%9A%84%22%E6%A1%A5%E6%8E%A5%E5%A4%B4%22%EF%BC%88kern_ipc_perm%EF%BC%89\">8.4 \u4e09\u7c7b\u8d44\u6e90\u5171\u7528\u7684&#034;\u6865\u63a5\u5934&#034;&#xff08;kern_ipc_perm&#xff09;<\/h4>\n<p>\u8bf4\u5b8c\u4e86\u5355\u4e2a\u4fe1\u53f7\u91cf\u7684&#034;\u63cf\u8ff0&#034;&#xff0c;\u518d\u770b\u4e09\u7c7b\u8d44\u6e90\u600e\u4e48&#034;\u7ec4\u7ec7&#034;\u8d77\u6765&#xff1a;<span style=\"color:#ff9900\">\u5185\u6838\u91cc\u8eba\u7740\u5927\u91cf\u4fe1\u53f7\u91cf\u96c6\u5408\u3001\u6d88\u606f\u961f\u5217\u3001\u5171\u4eab\u5185\u5b58\u6bb5&#xff0c;\u5b83\u9760\u4ec0\u4e48\u7edf\u4e00\u7ba1\u8fd9\u4e9b&#xff1f;\u8fd8\u662f<\/span><span style=\"color:#fe2c24\">\u5148\u63cf\u8ff0&#xff0c;\u518d\u7ec4\u7ec7<\/span><span style=\"color:#ff9900\">&#xff1a;<\/span><\/p>\n<ul>\n<li>\u63cf\u8ff0&#xff1a;\u5171\u4eab\u5185\u5b58\u7528 struct shmid_kernel&#xff0c;\u6d88\u606f\u961f\u5217\u7528 struct msg_queue&#xff0c;\u4fe1\u53f7\u91cf\u7528 struct sem_array<\/li>\n<li>\u7ec4\u7ec7&#xff1a;\u628a\u6240\u6709\u63cf\u8ff0\u7ed3\u6784\u6302\u8fdb\u540c\u4e00\u5f20\u8868\u7edf\u4e00\u7ba1\u7406<\/li>\n<\/ul>\n<p>\u8fd9\u4e09\u7c7b\u63cf\u8ff0\u7ed3\u6784\u4f53&#xff0c;\u7b2c\u4e00\u4e2a\u6210\u5458\u90fd\u662f struct kern_ipc_perm\u3002<\/p>\n<p>\u8fd9\u5c31\u662f&#034;\u6865\u6881\u5934&#034;&#xff1a;\u5185\u6838\u62ff\u5230\u4e00\u4e2a kern_ipc_perm \u6307\u9488&#xff0c;\u4e0d\u7528\u7ba1\u5b83\u80cc\u540e\u662f\u4fe1\u53f7\u91cf\u3001\u6d88\u606f\u961f\u5217\u8fd8\u662f\u5171\u4eab\u5185\u5b58&#xff0c;\u5c31\u80fd\u7edf\u4e00\u6302\u8868\u3001\u7edf\u4e00\u6309 key\/id \u67e5\u627e\u3001\u7edf\u4e00\u505a\u6743\u9650\u68c0\u67e5\u3002\u5b66\u8fc7 C&#043;&#043; \u7684\u591a\u6001\u518d\u770b\u8fd9\u4e2a\u4f1a\u975e\u5e38\u773c\u719f\u2014\u2014\u8fd9\u5c31\u662f\u62ff&#034;\u57fa\u7c7b\u6307\u9488&#034;\u7ba1\u6240\u6709\u6d3e\u751f\u7c7b\u7684\u5185\u6838\u7248\u3002<\/p>\n<h4 id=\"8.5%20%E7%BB%84%E7%BB%87%E6%96%B9%E5%BC%8F%EF%BC%9A%E6%8A%8A%E6%8F%8F%E8%BF%B0%E7%BB%93%E6%9E%84%E7%BB%9F%E4%B8%80%E6%8C%82%E8%BF%9B%E4%B8%80%E5%BC%A0%E8%A1%A8\">8.5 \u7ec4\u7ec7\u65b9\u5f0f&#xff1a;\u628a\u63cf\u8ff0\u7ed3\u6784\u7edf\u4e00\u6302\u8fdb\u4e00\u5f20\u8868<\/h4>\n<p>\u5185\u6838\u65e9\u671f\u7684\u7ec4\u7ec7\u65b9\u5f0f&#xff08;2.6 \u65f6\u4ee3\u7684\u4ee3\u7801&#xff09;&#xff1a;<\/p>\n<p>struct ipc_id_ary {<br \/>\n    int size;                    \/* \u6570\u7ec4\u5bb9\u91cf *\/<br \/>\n    struct kern_ipc_perm *p[0];  \/* \u67d4\u6027\u6570\u7ec4&#xff1a;\u6bcf\u4e2a\u5143\u7d20\u6307\u5411\u4e00\u4e2a\u8d44\u6e90 *\/<br \/>\n};<\/p>\n<p>struct ipc_ids {<br \/>\n    int in_use;                  \/* \u5f53\u524d\u5728\u7528\u51e0\u4e2a *\/<br \/>\n    int max_id;<br \/>\n    unsigned short seq;          \/* \u5e8f\u5217\u53f7&#xff0c;\u9632 ID \u91cd\u7528 *\/<br \/>\n    unsigned short seq_max;<br \/>\n    struct mutex mutex;<br \/>\n    struct ipc_id_ary *entries;  \/* \u2190 \u6307\u5411\u90a3\u5f20\u8868 *\/<br \/>\n};<\/p>\n<p>p[0] \u662f C \u91cc\u7684\u67d4\u6027\u6570\u7ec4\u6280\u5de7&#xff1a;\u7ed3\u6784\u4f53\u672b\u5c3e\u7559\u4e00\u4e2a\u96f6\u957f\u5ea6\u6570\u7ec4&#xff0c;\u5b9e\u9645\u5206\u914d\u65f6\u591a\u7ed9\u4e00\u622a\u5185\u5b58&#xff0c;p \u5c31\u6210\u4e86&#034;\u957f\u5ea6\u53ef\u53d8\u7684\u6307\u9488\u6570\u7ec4&#034;\u3002\u5168\u5c40\u4e00\u5f20\u8fd9\u6837\u7684\u8868&#xff0c;ID \u5c31\u662f\u6570\u7ec4\u4e0b\u6807&#xff0c;\u67e5\u8d44\u6e90 &#061; \u53d6\u4e0b\u6807&#xff0c;O(1)\u3002<\/p>\n<h4 id=\"8.6%20%E6%9B%B4%E6%AD%A3%EF%BC%9A%E7%8E%B0%E4%BB%A3%E5%86%85%E6%A0%B8%E5%B7%B2%E4%B8%8D%E7%94%A8%E6%95%B0%E7%BB%84%EF%BC%8C%E6%8D%A2%E6%88%90%20IDR%20%E5%9F%BA%E6%95%B0%E6%A0%91\">8.6 \u66f4\u6b63&#xff1a;\u73b0\u4ee3\u5185\u6838\u5df2\u4e0d\u7528\u6570\u7ec4&#xff0c;\u6362\u6210 IDR \u57fa\u6570\u6811<\/h4>\n<p>\u5199\u8fd9\u7bc7\u65f6\u67e5\u4e86\u5185\u6838\u6e90\u7801&#xff0c;\u5fc5\u987b\u8bf4\u6e05\u695a&#xff1a;ipc_id_ary \u662f 2007 \u5e74\u4e4b\u524d\u7684\u6a21\u578b&#xff0c;Linux 2.6.23 \u8d77\u88ab\u5220\u9664\u3002<\/p>\n<p>\u8bc1\u636e\u662f 2007 \u5e74 LKML \u4e0a Nadia Derbey \u7684\u8865\u4e01\u7cfb\u5217&#xff08;&#034;Storing ipcs into IDRs&#034;&#xff09;&#xff1a;struct ipc_id_ary \u6574\u4e2a\u5220\u6389&#xff0c;\u8fde\u914d\u5957\u7684\u6269\u5bb9\u51fd\u6570 grow_ary() \u4e00\u5e76\u79fb\u9664&#xff0c;\u6362\u6210 IDR \u57fa\u6570\u6811\u3002\u73b0\u4ee3\u5185\u6838&#xff08;5.x \/ 6.x&#xff09;\u7684 struct ipc_ids \u957f\u8fd9\u6837&#xff1a;<\/p>\n<p>struct ipc_ids {<br \/>\n    int in_use;<br \/>\n    unsigned short seq;<br \/>\n    unsigned short seq_max;<br \/>\n    struct rw_semaphore rw_mutex;<br \/>\n    struct idr ipcs_idr;         \/* \u2190 IDR \u57fa\u6570\u6811\u53d6\u4ee3\u4e86\u67d4\u6027\u6570\u7ec4 *\/<br \/>\n};<\/p>\n<p>IDR \u662f\u5185\u6838\u91cc\u4e13\u95e8\u5e72&#034;\u62ff\u4e00\u4e2a\u6574\u6570 ID \u5feb\u901f\u627e\u5bf9\u8c61&#034;\u7684\u6811\u5f62\u7ed3\u6784&#xff08;\u57fa\u6570\u6811\u7684\u5c01\u88c5&#xff09;\u3002\u6362\u5b83\u7684\u539f\u56e0\u5f88\u5b9e\u9645&#xff1a;IPC \u5bf9\u8c61\u6570\u91cf\u52a8\u6001\u589e\u51cf&#xff0c;\u9759\u6001\u6570\u7ec4\u8981\u4e48\u5f00\u5927\u4e86\u6d6a\u8d39\u3001\u8981\u4e48\u4e0d\u591f\u4e86\u9891\u7e41\u6269\u5bb9\u642c\u5185\u5b58&#xff1b;\u57fa\u6570\u6811\u6309\u9700\u751f\u957f&#xff0c;\u67e5\u6539\u5220\u90fd\u9ad8\u6548\u3002<\/p>\n<p>\u4f46\u6ce8\u610f\u2014\u2014\u601d\u60f3\u4e00\u4e2a\u5b57\u6ca1\u53d8&#xff1a;\u6362\u6210 IDR \u4e4b\u540e&#xff0c;\u6811\u91cc\u5b58\u7684\u4ecd\u7136\u662f\u6307\u5411 struct kern_ipc_perm \u7684\u6307\u9488\u3002\u5bb9\u5668\u4ece\u6570\u7ec4\u6362\u6210\u4e86\u6811&#xff0c;&#034;\u7edf\u4e00\u6865\u63a5\u5934 &#043; \u4e00\u5f20\u8868\u7ba1\u4e09\u79cd\u8d44\u6e90&#034;\u7684\u8bbe\u8ba1\u539f\u5c01\u4e0d\u52a8\u3002<\/p>\n<p>\u6240\u4ee5\u5e38\u89c1\u7684\u8bb2\u6cd5\u662f\u4e00\u4e2a\u7b80\u5316\u6a21\u578b&#xff1a;\u601d\u60f3\u662f\u771f\u7684&#xff08;\u5148\u63cf\u8ff0\u518d\u7ec4\u7ec7\u3001kern_ipc_perm \u7edf\u4e00\u6302\u8868&#xff09;&#xff0c;\u5bb9\u5668\u662f\u6f14\u8fdb\u7684&#xff08;\u67d4\u6027\u6570\u7ec4 \u2192 IDR \u57fa\u6570\u6811&#xff09;\u3002\u9762\u8bd5\u91cc\u80fd\u4e3b\u52a8\u8bb2\u51fa&#034;\u7b80\u5316\u6a21\u578b\u548c\u771f\u5b9e\u5185\u6838\u5dee\u5728\u8fd9\u4e00\u6b65&#034;&#xff0c;\u662f\u5b9e\u6253\u5b9e\u7684\u52a0\u5206\u9879\u3002<\/p>\n<h4 id=\"8.7%20%E4%B8%89%E4%B8%AA%E5%AE%B9%E6%98%93%E5%BF%BD%E7%95%A5%E7%9A%84%E7%BB%86%E8%8A%82\">8.7 \u4e09\u4e2a\u5bb9\u6613\u5ffd\u7565\u7684\u7ec6\u8282<\/h4>\n<p>ID \u4e0d\u662f\u4e0b\u6807\u3002 \u7528\u6237\u62ff\u5230\u7684 semid &#061; seq \u00d7 SEQ_MULTIPLIER &#043; \u5185\u6838\u5185\u90e8 id&#xff0c;\u5176\u4e2d SEQ_MULTIPLIER &#061; IPCMNI &#061; 32768\u3002seq \u6bcf\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61\u52a0 1&#xff0c;\u5185\u90e8 id \u53ef\u4ee5\u88ab\u590d\u7528\u2014\u2014\u4f46 seq \u4e0d\u91cd\u7528&#xff0c;\u6240\u4ee5\u540c\u4e00\u4e2a\u5185\u90e8 id \u5728\u4e0d\u540c&#034;\u8f6e\u6b21&#034;\u62fc\u51fa\u7684\u7528\u6237 ID \u4e0d\u540c\u3002\u8fd9\u6837\u8fdb\u7a0b\u624b\u91cc\u5c31\u7b97\u6525\u7740\u8fc7\u671f\u7684\u65e7 ID&#xff0c;\u4e5f\u51e0\u4e4e\u4e0d\u53ef\u80fd\u9519\u62ff\u5230\u590d\u7528\u540e\u7684\u65b0\u8d44\u6e90\u3002<\/p>\n<p>\u4e09\u7c7b\u5404\u4e00\u5f20\u8868\u3002 struct ipc_namespace \u91cc\u6709 ids[3]&#xff0c;\u4e0b\u6807\u987a\u5e8f\u662f&#xff1a;0 \u4fe1\u53f7\u91cf\u30011 \u6d88\u606f\u961f\u5217\u30012 \u5171\u4eab\u5185\u5b58\u3002semid\u3001msqid\u3001shmid \u5404\u8d70\u5404\u7684\u8868&#xff0c;\u4e92\u4e0d\u5e72\u6270\u3002<\/p>\n<p>kern_ipc_perm \u91cc\u90fd\u6709\u4ec0\u4e48&#xff08;4.16 \u6e90\u7801&#xff0c;\u5b57\u6bb5\u6311\u91cd\u70b9&#xff09;&#xff1a;<\/p>\n<p>struct kern_ipc_perm {<br \/>\n    spinlock_t    lock;      \/* \u81ea\u65cb\u9501\u4fdd\u62a4\u81ea\u5df1 *\/<br \/>\n    bool          deleted;<br \/>\n    int           id;<br \/>\n    key_t         key;       \/* \u4f60\u7ed9\u7684\u90a3\u4e2a key *\/<br \/>\n    kuid_t        uid;       kgid_t        gid;<br \/>\n    kuid_t        cuid;      kgid_t        cgid;<br \/>\n    umode_t       mode;      \/* \u6743\u9650 *\/<br \/>\n    unsigned long seq;<br \/>\n    void         *security;<br \/>\n    \/* 4.15 \u8d77\u8fd8\u52a0\u4e86 RCU\u3001\u5f15\u7528\u8ba1\u6570\u7b49\u5e76\u53d1\u76f8\u5173\u6210\u5458&#xff0c;\u73b0\u9636\u6bb5\u4e0d\u7528\u6df1\u7a76 *\/<br \/>\n};<\/p>\n<p>\u5bf9\u7167 8.2 \u7684\u7528\u6237\u6001 ipc_perm&#xff1a;\u5b57\u6bb5\u540d\u51e0\u4e4e\u4e00\u4e00\u5bf9\u5e94&#xff0c;\u7c7b\u578b\u5168\u6362\u4e86\u5185\u6838\u79c1\u6709\u7684&#xff08;kuid_t \/ umode_t&#xff09;&#xff0c;\u8fd8\u591a\u4e86\u9501\u3002\u5feb\u7167 vs \u5b9e\u4f53&#xff0c;\u533a\u522b\u5c31\u5728\u8fd9\u3002<\/p>\n<h4 id=\"8.8%20%E4%B8%80%E5%BC%A0%E5%9B%BE%E7%9C%8B%E6%87%82%E5%85%A8%E5%B1%80%EF%BC%9A%E4%BB%8E%E5%86%85%E6%A0%B8%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4%E5%88%B0%E5%AE%9E%E9%99%85%E8%B5%84%E6%BA%90\">8.8 \u4e00\u5f20\u56fe\u770b\u61c2\u5168\u5c40&#xff1a;\u4ece\u5185\u6838\u547d\u540d\u7a7a\u95f4\u5230\u5b9e\u9645\u8d44\u6e90<\/h4>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1312\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260907235226-6a9f4e3ab3866.png\" width=\"3296\" \/><\/p>\n<\/p>\n<p>\u4e00\u5f20\u8868&#xff08;\u73b0\u5728\u662f\u6811&#xff09;\u3001\u4e00\u4e2a\u5171\u540c\u7684\u5934\u3001\u4e09\u79cd\u8d44\u6e90\u3002\u8fd9\u5c31\u662f&#034;\u5148\u63cf\u8ff0&#xff0c;\u518d\u7ec4\u7ec7&#034;\u5728 System V IPC \u4e0a\u7684\u5b8c\u6574\u5f62\u6001\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1246\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260907235230-6a9f4e3ec3f7f.png\" width=\"1041\" \/><\/p>\n<hr \/>\n<h3 id=\"%E4%B9%9D%E3%80%81%E4%BF%A1%E5%8F%B7%20%2F%20%E4%BF%A1%E5%8F%B7%E9%87%8F%20%2F%20%E4%BA%92%E6%96%A5%E9%94%81%EF%BC%9A%E6%98%93%E6%B7%B7%E6%A6%82%E5%BF%B5%E4%B8%80%E6%AC%A1%E5%88%86%E6%B8%85\">\u4e5d\u3001\u4fe1\u53f7 \/ \u4fe1\u53f7\u91cf \/ \u4e92\u65a5\u9501&#xff1a;\u6613\u6df7\u6982\u5ff5\u4e00\u6b21\u5206\u6e05<\/h3>\n<p>\u8fd9\u4e00\u8282\u5168\u662f\u9ad8\u9891\u6df7\u6dc6\u70b9&#xff0c;\u6bcf\u4e2a\u90fd\u7ed9\u7b54\u6848&#xff0c;\u4e0d\u53ea\u6446\u95ee\u9898\u3002<\/p>\n<h4 id=\"9.1%20%E4%BF%A1%E5%8F%B7%20vs%20%E4%BF%A1%E5%8F%B7%E9%87%8F%EF%BC%9A%E4%B8%80%E4%B8%AA%22%E5%8F%AB%E4%BD%A0%E4%B8%80%E4%B8%8B%22%EF%BC%8C%E4%B8%80%E4%B8%AA%22%E6%95%B0%E4%BD%A0%E4%B8%80%E4%B8%8B%22\">9.1 \u4fe1\u53f7 vs \u4fe1\u53f7\u91cf&#xff1a;\u4e00\u4e2a&#034;\u53eb\u4f60\u4e00\u4e0b&#034;&#xff0c;\u4e00\u4e2a&#034;\u6570\u4f60\u4e00\u4e0b&#034;<\/h4>\n<table>\n<tr>\u4fe1\u53f7\u4fe1\u53f7\u91cf<\/tr>\n<tbody>\n<tr>\n<td>\u662f\u4ec0\u4e48<\/td>\n<td>\u5f02\u6b65\u901a\u77e5\u673a\u5236<\/td>\n<td>\u540c\u6b65\u4e92\u65a5\u7684\u8ba1\u6570\u5668<\/td>\n<\/tr>\n<tr>\n<td>\u5e72\u4ec0\u4e48<\/td>\n<td>\u544a\u8bc9\u8fdb\u7a0b&#034;\u67d0\u4e8b\u4ef6\u53d1\u751f\u4e86&#034;&#xff08;\u5982 SIGKILL\u3001SIGSEGV&#xff09;<\/td>\n<td>\u7ba1&#034;\u8d44\u6e90\u8fd8\u5269\u51e0\u4efd\u3001\u8c01\u80fd\u8fdb\u4e34\u754c\u533a&#034;<\/td>\n<\/tr>\n<tr>\n<td>\u7528\u6cd5<\/td>\n<td>kill \u53d1\u9001 \/ signal \u6ce8\u518c\u5904\u7406\u51fd\u6570<\/td>\n<td>semget \/ semop P\u3001V<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u540d\u5b57\u53ea\u5dee\u4e00\u4e2a\u5b57&#xff0c;\u673a\u5236\u5b8c\u5168\u65e0\u5173\u3002\u9762\u8bd5\u53e3\u5934\u56de\u7b54\u5c31\u4e00\u53e5&#xff1a;\u4fe1\u53f7\u662f&#034;\u53eb\u4f60\u4e00\u4e0b&#034;&#xff0c;\u4fe1\u53f7\u91cf\u662f&#034;\u6570\u4f60\u4e00\u4e0b&#034;\u3002<\/p>\n<h4 id=\"9.2%20%E4%BF%A1%E5%8F%B7%E9%87%8F%20vs%20%E4%BA%92%E6%96%A5%E9%94%81%EF%BC%9A%E8%B0%81%E9%83%BD%E8%83%BD%E8%A7%A3%20vs%20%E5%8F%AA%E6%9C%89%E4%B8%BB%E4%BA%BA%E8%83%BD%E8%A7%A3\">9.2 \u4fe1\u53f7\u91cf vs \u4e92\u65a5\u9501&#xff1a;\u8c01\u90fd\u80fd\u89e3 vs \u53ea\u6709\u4e3b\u4eba\u80fd\u89e3<\/h4>\n<table>\n<tr>\u4e8c\u5143\u4fe1\u53f7\u91cf\u4e92\u65a5\u9501<\/tr>\n<tbody>\n<tr>\n<td>\u53d6\u503c<\/td>\n<td>0 \/ 1<\/td>\n<td>\u9501\u4e0a \/ \u6ca1\u9501<\/td>\n<\/tr>\n<tr>\n<td>\u6240\u6709\u6743<\/td>\n<td>\u65e0&#xff1a;\u8c01\u90fd\u80fd V<\/td>\n<td>\u6709&#xff1a;\u8c01\u52a0\u7684\u9501\u8c01\u89e3<\/td>\n<\/tr>\n<tr>\n<td>\u5178\u578b\u8bef\u7528<\/td>\n<td>A \u62ff\u4e86\u4fe1\u53f7\u91cf&#xff0c;B \u624b\u6ed1 V \u4e86\u4e00\u4e0b\u2014\u2014\u5408\u6cd5&#xff0c;\u4f46\u903b\u8f91\u5df2\u4e71<\/td>\n<td>B \u89e3 A \u7684\u9501\u2014\u2014\u76f4\u63a5\u62a5\u9519\u62e6\u4f4f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e8c\u5143\u4fe1\u53f7\u91cf\u521d\u503c\u8bbe 1&#xff0c;\u884c\u4e3a\u4e0a\u5f88\u50cf\u9501&#xff0c;\u4f46\u6ca1\u6709\u6240\u6709\u6743\u6982\u5ff5\u3002\u4e92\u65a5\u9501\u9501\u5b9a\u4e86 owner&#xff0c;\u522b\u7684\u7ebf\u7a0b\u89e3\u4e0d\u4e86&#xff1b;\u4fe1\u53f7\u91cf\u8c01\u90fd\u80fd V\u3002\u8fd9\u5c31\u662f&#034;\u4e8c\u5143\u4fe1\u53f7\u91cf \u2248 \u4e92\u65a5\u9501\u4f46\u4e0d\u7b49\u4ef7&#034;\u7684\u6807\u51c6\u7b54\u6848\u2014\u2014\u5927\u5382\u9ad8\u9891\u8ffd\u95ee\u3002<\/p>\n<h4 id=\"9.3%20%E4%BA%8C%E5%85%83%20vs%20%E5%A4%9A%E5%85%83%EF%BC%9A%E4%B8%80%E6%AC%A1%E6%94%BE%E4%B8%80%E4%B8%AA%EF%BC%8C%E8%BF%98%E6%98%AF%E6%94%BE%20N%20%E4%B8%AA\">9.3 \u4e8c\u5143 vs \u591a\u5143&#xff1a;\u4e00\u6b21\u653e\u4e00\u4e2a&#xff0c;\u8fd8\u662f\u653e N \u4e2a<\/h4>\n<ul>\n<li>\u4e8c\u5143&#xff08;\u521d\u503c 1&#xff09;&#xff1a;\u4e92\u65a5&#xff0c;\u4e00\u6b21\u653e\u4e00\u4e2a<\/li>\n<li>\u591a\u5143&#xff08;\u521d\u503c N&#xff09;&#xff1a;\u8d44\u6e90\u6c60 \/ \u9650\u6d41&#xff0c;\u4e00\u6b21\u653e N \u4e2a&#xff08;\u6bd4\u5982\u6700\u591a 5 \u4e2a\u5e76\u53d1\u8fde\u63a5&#xff09;<\/li>\n<\/ul>\n<p>\u5224\u65ad\u4f9d\u636e\u5c31\u4e00\u6761&#xff1a;\u4f60\u7684\u8d44\u6e90\u5230\u5e95\u6709\u51e0\u4efd\u3002<\/p>\n<h4 id=\"9.4%20%E4%B8%89%E7%A7%8D%E6%A1%A3%E6%A1%88%E7%BB%93%E6%9E%84%E5%AF%B9%E6%AF%94%EF%BC%9A%E5%88%86%E5%88%AB%E7%AE%A1%E4%BB%80%E4%B9%88%E3%80%81%E5%B7%AE%E5%9C%A8%E5%93%AA\">9.4 \u4e09\u79cd\u6863\u6848\u7ed3\u6784\u5bf9\u6bd4&#xff1a;\u5206\u522b\u7ba1\u4ec0\u4e48\u3001\u5dee\u5728\u54ea<\/h4>\n<table>\n<tr>shmid_dsmsqid_dssemid_ds<\/tr>\n<tbody>\n<tr>\n<td>\u7ba1\u4ec0\u4e48<\/td>\n<td>\u5171\u4eab\u5185\u5b58\u6bb5<\/td>\n<td>\u6d88\u606f\u961f\u5217<\/td>\n<td>\u4fe1\u53f7\u91cf\u96c6<\/td>\n<\/tr>\n<tr>\n<td>\u6838\u5fc3\u5dee\u5f02\u5b57\u6bb5<\/td>\n<td>\u5206\u79bb\/\u6302\u63a5\u65f6\u95f4\u3001\u5927\u5c0f<\/td>\n<td>\u961f\u5217\u5b57\u8282\u6570\/\u6761\u6570\u3001\u6536\u53d1\u8fdb\u7a0b<\/td>\n<td>sem_nsems&#xff08;\u96c6\u91cc\u51e0\u4e2a&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5f00\u5934<\/td>\n<td>ipc_perm<\/td>\n<td>ipc_perm<\/td>\n<td>ipc_perm<\/td>\n<\/tr>\n<tr>\n<td>\u89d2\u8272<\/td>\n<td>\u7ba1\u6570\u636e<\/td>\n<td>\u7ba1\u6570\u636e<\/td>\n<td>\u7ba1\u540c\u6b65<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e00\u53e5\u8bdd\u6536\u675f&#xff1a;\u5171\u4eab\u5185\u5b58\u548c\u6d88\u606f\u961f\u5217\u7ba1\u7684\u662f&#034;\u6570\u636e\u600e\u4e48\u8fc7\u53bb&#034;&#xff0c;\u4fe1\u53f7\u91cf\u7ba1\u7684\u662f&#034;\u8c01\u6709\u8d44\u683c\u52a8&#034;\u3002<\/p>\n<hr \/>\n<h3 id=\"%E5%8D%81%E3%80%81%E9%9D%A2%E8%AF%95%E5%AE%98%E9%AB%98%E9%A2%91%E8%BF%BD%E9%97%AE%E4%B8%8E%E5%8F%82%E8%80%83%E7%AD%94%E6%A1%88\">\u5341\u3001\u9762\u8bd5\u5b98\u9ad8\u9891\u8ffd\u95ee\u4e0e\u53c2\u8003\u7b54\u6848<\/h3>\n<p>Q1&#xff1a;\u4fe1\u53f7\u91cf\u7684\u672c\u8d28\u662f\u4ec0\u4e48&#xff1f;<\/p>\n<p>\u8ba1\u6570\u5668&#xff0c;\u8868\u660e\u4e34\u754c\u8d44\u6e90\u4e2d\u5269\u4f59\u8d44\u6e90\u7684\u6570\u91cf\u3002P \u51cf V \u52a0&#xff0c;\u64cd\u4f5c\u539f\u5b50\u3002<\/p>\n<p>Q2&#xff1a;\u4fe1\u53f7\u91cf\u672c\u8eab\u662f\u5171\u4eab\u8d44\u6e90\u5417&#xff1f;<\/p>\n<p>\u662f&#xff0c;\u4f46\u8981\u5206\u4e24\u5c42\u7b54&#xff08;\u53ea\u7b54\u4e00\u4e2a&#034;\u4e0d\u662f&#034;\u4f1a\u9732\u602f&#xff09;\u3002<\/p>\n<ul>\n<li>\u5b83\u662f\u5171\u4eab\u5bf9\u8c61&#xff1a;semval \u5728\u5185\u6838\u91cc&#xff0c;\u591a\u8fdb\u7a0b\u901a\u8fc7\u540c\u4e00\u4e2a semid \u64cd\u4f5c\u540c\u4e00\u4e2a\u503c\u3002\u4e0d\u5171\u4eab\u5c31\u6ca1\u6cd5\u540c\u6b65\u2014\u2014A \u8fdb\u7a0b P \u5b8c&#xff0c;B \u5fc5\u987b\u770b\u5230\u51cf\u8fc7\u7684\u503c\u3002\u53cd\u8bc1\u5b83\u786e\u5b9e\u662f\u5171\u4eab\u7684&#xff1a;\u5185\u6838\u7ed9\u5b83\u52a0\u81ea\u65cb\u9501\u3001\u628a semop \u505a\u6210\u539f\u5b50&#xff0c;\u6b63\u662f\u56e0\u4e3a\u5b83\u8981\u88ab\u5e76\u53d1\u8bbf\u95ee\u3002<\/li>\n<li>\u4f46\u5b83\u4e0d\u662f&#034;\u88ab\u4fdd\u62a4\u7684\u90a3\u4e2a\u5171\u4eab\u8d44\u6e90&#034;&#xff1a;\u5728\u8fd9\u5957\u65b9\u6848\u91cc\u5b83\u662f\u7ba1\u7406\u5458&#xff0c;\u88ab\u4fdd\u62a4\u7684\u4e34\u754c\u8d44\u6e90\u662f\u5171\u4eab\u5185\u5b58\u90a3\u5757\u6570\u636e\u3002<\/li>\n<\/ul>\n<p>&#034;\u4fe1\u53f7\u91cf\u672c\u8eab\u4e0d\u662f\u5171\u4eab\u8d44\u6e90&#034;\u8fd9\u53e5\u8bdd&#xff0c;\u8bb2\u7684\u662f\u7b2c\u4e8c\u5c42\u7684\u89d2\u8272\u5206\u5de5&#xff0c;\u4e0d\u80fd\u62ff\u6765\u5426\u8ba4\u7b2c\u4e00\u5c42\u7684\u7269\u7406\u4e8b\u5b9e\u3002\u8865\u5145\u4e00\u70b9&#xff1a;\u5b83\u81ea\u5df1\u4e0d\u9700\u8981\u518d\u5957\u4e00\u5c42\u4fe1\u53f7\u91cf\u6765\u4fdd\u62a4&#xff0c;\u56e0\u4e3a\u5185\u6838\u7684\u539f\u5b50 semop \u5df2\u7ecf\u515c\u5e95\u4e86\u3002<\/p>\n<p>Q3&#xff1a;P\/V \u4e3a\u4ec0\u4e48\u5fc5\u987b\u539f\u5b50&#xff1f;\u5185\u6838\u600e\u4e48\u4fdd\u8bc1&#xff1f;<\/p>\n<p>P\/V \u662f&#034;\u8bfb\u503c-\u5224\u65ad-\u6539\u503c&#034;\u4e09\u6b65&#xff0c;\u5982\u679c\u4e0d\u539f\u5b50&#xff0c;\u4e24\u4e2a\u8fdb\u7a0b\u540c\u65f6\u8bfb\u5230\u540c\u4e00\u4e2a\u65e7\u503c\u3001\u90fd\u5224\u65ad\u901a\u8fc7\u3001\u5404\u81ea\u51cf 1\u2014\u2014\u4e00\u4e2a\u540d\u989d\u653e\u8fdb\u4fe9\u4eba&#xff0c;\u4e92\u65a5\u76f4\u63a5\u5931\u6548\u3002\u4fdd\u8bc1\u624b\u6bb5&#xff1a;semop \u662f\u7cfb\u7edf\u8c03\u7528&#xff0c;\u8fdb\u5165\u5185\u6838\u540e\u7531\u5185\u6838\u52a0\u9501&#xff08;\u81ea\u65cb\u9501\/\u4fe1\u53f7\u91cf&#xff09;\u4e32\u884c\u6267\u884c&#xff0c;\u7528\u6237\u6001\u63d2\u4e0d\u4e86\u961f\u3002<\/p>\n<p>Q4&#xff1a;sem_op \u4e3a\u6b63 \/ \u4e3a\u8d1f \/ \u4e3a 0 \u5206\u522b\u662f\u4ec0\u4e48\u8bed\u4e49&#xff1f;\u54ea\u79cd\u6c38\u8fdc\u4e0d\u963b\u585e&#xff1f;<\/p>\n<p>\u8d1f &#061; P&#xff08;\u7533\u8bf7&#xff09;&#xff0c;\u503c\u4e0d\u591f\u5c31\u963b\u585e&#xff1b;\u6b63 &#061; V&#xff08;\u91ca\u653e&#xff09;&#xff0c;\u6c38\u4e0d\u963b\u585e&#xff1b;0 &#061; \u7b49\u8ba1\u6570\u53d8 0&#xff08;wait-for-zero&#xff09;&#xff0c;\u4e0d\u662f 0 \u5c31\u963b\u585e\u3002<\/p>\n<p>Q5&#xff1a;semop \u4f20\u6570\u7ec4&#xff08;nsops &gt; 1&#xff09;\u6709\u4ec0\u4e48\u7528&#xff1f;<\/p>\n<p>\u4e00\u6b21\u7cfb\u7edf\u8c03\u7528\u539f\u5b50\u5730\u64cd\u4f5c\u96c6\u5408\u91cc\u591a\u4e2a\u4fe1\u53f7\u91cf&#xff0c;\u8981\u4e48\u5168\u505a\u8981\u4e48\u5168\u4e0d\u505a\u3002\u591a\u9501\u573a\u666f\u9632\u6b7b\u9501\u7684\u5173\u952e&#xff1a;\u907f\u514d&#034;\u62ff\u4e86\u4e00\u534a\u7b49\u53e6\u4e00\u534a&#034;\u7ed9\u522b\u7684\u8fdb\u7a0b\u63d2\u961f\u5236\u9020\u73af\u5f62\u7b49\u5f85\u7684\u673a\u4f1a&#xff08;\u751f\u4ea7\u8005-\u6d88\u8d39\u8005\u7684 empty\/full\/mutex \u4e09\u4ef6\u5957\u5c31\u662f\u5178\u578b\u5e94\u7528&#xff09;\u3002<\/p>\n<p>Q6&#xff1a;IPC_NOWAIT \u5931\u8d25\u65f6&#xff0c;\u6570\u7ec4\u91cc\u5176\u4ed6\u64cd\u4f5c\u6267\u884c\u4e86\u5417&#xff1f;<\/p>\n<p>\u4e00\u4e2a\u90fd\u6ca1\u6267\u884c&#xff0c;\u6574\u4f53\u4f5c\u5e9f&#xff0c;errno &#061; EAGAIN\u3002\u539f\u5b50\u6027\u4fdd\u8bc1\u7684&#034;\u5168\u6216\u65e0&#034;\u3002<\/p>\n<p>Q7&#xff1a;\u8fdb\u7a0b\u6301\u6709\u4fe1\u53f7\u91cf\u65f6\u5d29\u4e86\u600e\u4e48\u529e&#xff1f;<\/p>\n<p>\u4e24\u4e2a\u5c42\u9762\u7b54\u3002\u7528\u6237\u6001&#xff1a;sem_flg \u8bbe SEM_UNDO&#xff0c;\u8fdb\u7a0b\u9000\u51fa\u65f6\u5185\u6838\u81ea\u52a8\u56de\u6eda\u5b83\u7684 P\/V\u3002\u7cfb\u7edf\u6001&#xff1a;\u5c31\u7b97\u6ca1\u8bbe UNDO&#xff0c;\u5176\u4ed6\u8fdb\u7a0b\u4e5f\u80fd\u5bf9\u4fe1\u53f7\u91cf\u505a V&#xff08;\u65e0\u6240\u6709\u6743&#xff09;&#xff0c;\u4e0d\u81f3\u4e8e\u6c38\u4e45\u6b7b\u9501\u2014\u2014\u4f46\u8bed\u4e49\u4e0a\u5df2\u7ecf\u9760\u4eba\u8089\u8865\u507f\u4e86&#xff0c;\u5de5\u7a0b\u4e0a\u5fc5\u987b\u9760 SEM_UNDO\u3002<\/p>\n<p>Q8&#xff1a;SEM_UNDO \u5185\u6838\u91cc\u5230\u5e95\u600e\u4e48\u5b9e\u73b0\u7684&#xff1f;<\/p>\n<p>\u673a\u5236&#xff08;\u5df2\u5bf9 v5.6 \u5185\u6838\u6e90\u7801\u6838\u5b9e&#xff09;&#xff1a;<\/p>\n<ul>\n<li>\u6bcf\u4e2a\u8fdb\u7a0b\u7684 task_struct \u91cc\u6709 sysvsem.undo_list&#xff0c;\u6302\u4e00\u6761&#034;\u6211\u505a\u8fc7\u7684\u53ef\u64a4\u9500\u64cd\u4f5c&#034;\u94fe\u8868<\/li>\n<li>\u8fdb\u7a0b\u52a8\u8fc7\u7684\u6bcf\u4e2a\u4fe1\u53f7\u91cf\u96c6\u5bf9\u5e94\u4e00\u4e2a struct sem_undo&#xff1a;\u8bb0\u7740 semid \u548c\u4e00\u4e2a semadj \u6570\u7ec4&#xff08;\u96c6\u5408\u91cc\u6bcf\u4e2a\u4fe1\u53f7\u91cf\u4e00\u4e2a\u8c03\u6574\u503c&#xff09;<\/li>\n<li>\u505a P&#xff08;sem_op &lt; 0&#xff09;\u65f6&#xff0c;|sem_op| \u7d2f\u52a0\u8fdb semadj&#xff1b;\u505a V \u65f6\u4ece semadj \u91cc\u51cf\u6389\u2014\u2014semadj \u8bb0\u7684\u662f&#034;\u6211\u51c0\u6b20\u4e86\u591a\u5c11\u4efd\u8d44\u6e90&#034;<\/li>\n<li>\u8fdb\u7a0b\u9000\u51fa\u65f6 do_exit() \u8c03 exit_sem()&#xff1a;\u904d\u5386 undo_list&#xff0c;\u628a\u6bcf\u4e2a semadj[i] \u52a0\u56de\u5bf9\u5e94\u4fe1\u53f7\u91cf\u7684 semval&#xff0c;\u7ed3\u679c\u5939\u5728 [0, 32767] \u533a\u95f4&#xff0c;\u7136\u540e\u5524\u9192\u7b49\u8d44\u6e90\u7684\u8fdb\u7a0b<\/li>\n<\/ul>\n<p>\u7535\u5f71\u9662\u7248\u4e00\u53e5\u8bdd&#xff1a;\u5f71\u9662\u7ed9\u6bcf\u4e2a\u89c2\u4f17\u8bb0\u4e00\u7b14\u8d26&#xff08;\u4e70\u4e86\u6ca1\u9000\u7684\u7968\u6570&#xff09;&#xff0c;\u4eba\u4e0d\u7ba1\u600e\u4e48\u8d70\u7684&#xff0c;\u6563\u573a\u65f6\u6309\u8d26\u672c\u628a\u7968\u5168\u90e8\u56de\u6536\u8fdb\u7968\u6c60\u3002<\/p>\n<p>Q9&#xff1a;union semun \u4e3a\u4ec0\u4e48\u8981\u81ea\u5df1\u5b9a\u4e49&#xff1f;<\/p>\n<p>POSIX \u6807\u51c6\u628a\u5b9a\u4e49\u7529\u7ed9\u4e86\u5e94\u7528\u7a0b\u5e8f&#xff08;\u5404\u5bb6 UNIX \u5b9e\u73b0\u5386\u53f2\u5206\u6b67&#xff0c;\u6807\u51c6\u7d22\u6027\u4e0d\u7edf\u4e00&#xff09;&#xff0c;Linux \u5934\u6587\u4ef6\u4e5f\u5c31\u4e0d\u7ed9\u3002\u6240\u4ee5\u6bcf\u4e2a\u7a0b\u5e8f\u8981\u81ea\u5df1\u58f0\u660e\u8fd9\u56db\u6210\u5458\u8054\u5408\u4f53&#xff1a;val \/ buf \/ array \/ __buf\u3002\u624b\u5199\u4e0d\u51fa\u6765\u8bf4\u660e\u6ca1\u771f\u5199\u8fc7 System V \u4fe1\u53f7\u91cf\u4ee3\u7801\u3002<\/p>\n<p>Q10&#xff1a;\/proc\/sys\/kernel\/sem \u91cc\u56db\u4e2a\u6570\u662f\u4ec0\u4e48&#xff1f;\u4ec0\u4e48\u987a\u5e8f&#xff1f;<\/p>\n<p>SEMMSL&#xff08;\u6bcf\u96c6\u6700\u591a\u4fe1\u53f7\u91cf\u6570&#xff09;\u3001SEMMNS&#xff08;\u7cfb\u7edf\u603b\u4fe1\u53f7\u91cf\u6570&#xff09;\u3001SEMOPM&#xff08;\u5355\u6b21 semop \u6700\u591a\u64cd\u4f5c\u6570&#xff09;\u3001SEMMNI&#xff08;\u7cfb\u7edf\u6700\u591a\u96c6\u6570&#xff09;\u3002\u987a\u5e8f\u5c31\u662f SEMMSL SEMMNS SEMOPM SEMMNI&#xff0c;\u53cd\u76f4\u89c9&#xff0c;\u522b\u6309\u5b57\u6bcd\u5e8f\u80cc\u3002<\/p>\n<p>Q11&#xff1a;\u7528\u6237\u770b\u5230\u7684 semid \u662f\u6570\u7ec4\u4e0b\u6807\u5417&#xff1f;<\/p>\n<p>\u4e0d\u662f\u3002semid &#061; seq \u00d7 32768 &#043; \u5185\u6838\u5185\u90e8 id\u3002seq \u9632 ID \u590d\u7528\u649e\u8f66\u3002<\/p>\n<p>Q12&#xff1a;ipc_perm \u548c kern_ipc_perm \u4ec0\u4e48\u533a\u522b&#xff1f;<\/p>\n<p>\u7528\u6237\u6001\u7684 ipc_perm \u662f IPC_STAT \u62f7\u7ed9\u5e94\u7528\u7a0b\u5e8f\u770b\u7684\u5feb\u7167&#xff08;uid_t\u3001unsigned short mode&#xff09;&#xff1b;kern_ipc_perm \u662f\u5185\u6838\u91cc\u771f\u6b63\u6302\u5728\u8d44\u6e90\u5f00\u5934\u7684\u5b9e\u4f53&#xff08;kuid_t\u3001umode_t&#xff0c;\u5e26\u81ea\u65cb\u9501\u3001RCU\u3001\u5f15\u7528\u8ba1\u6570&#xff09;\u3002<\/p>\n<p>Q13&#xff1a;\u4e09\u7c7b IPC \u5728\u5185\u6838\u91cc\u600e\u4e48\u7edf\u4e00\u7ba1\u7406&#xff1f;\u73b0\u4ee3\u5185\u6838\u8fd8\u662f ipc_id_ary \u5417&#xff1f;<\/p>\n<p>\u90fd\u662f&#034;\u63cf\u8ff0\u7ed3\u6784\u7b2c\u4e00\u4e2a\u6210\u5458\u653e kern_ipc_perm&#034;\u2014\u2014\u5185\u6838\u62ff\u8fd9\u4e2a\u6865\u6881\u5934\u7edf\u4e00\u6302\u8868\u3001\u67e5\u627e\u3001\u505a\u6743\u9650\u68c0\u67e5\u3002\u4f46 ipc_id_ary \u662f\u8001\u6a21\u578b&#xff0c;2007 \u5e74 2.6.23 \u8d77\u6362\u6210 struct ipc_ids \u91cc\u7684 IDR \u57fa\u6570\u6811&#xff08;ipcs_idr&#xff09;&#xff0c;\u5b58\u7684\u8fd8\u662f kern_ipc_perm \u6307\u9488\u3002\u80fd\u7b54\u51fa&#034;\u67d4\u6027\u6570\u7ec4\u6a21\u578b vs \u73b0\u4ee3\u5185\u6838\u7684 IDR&#034;\u8fd9\u4e00\u5c42\u5dee\u5f02&#xff0c;\u5c31\u662f\u52a0\u5206\u9879\u3002<\/p>\n<p>Q14&#xff1a;\u4fe1\u53f7\u548c\u4fe1\u53f7\u91cf\u4ec0\u4e48\u5173\u7cfb&#xff1f;<\/p>\n<p>\u6ca1\u5173\u7cfb\u3002\u4fe1\u53f7\u662f\u5f02\u6b65\u4e8b\u4ef6\u901a\u77e5&#xff0c;\u4fe1\u53f7\u91cf\u662f\u540c\u6b65\u8ba1\u6570\u5668\u3002\u4e00\u4e2a\u5b57\u4e4b\u5dee&#xff0c;\u4e24\u4e2a\u4e16\u754c\u3002<\/p>\n<hr \/>\n<h3 id=\"%E5%8D%81%E4%B8%80%E3%80%81%E5%B0%8F%E7%BB%93\">\u5341\u4e00\u3001\u5c0f\u7ed3<\/h3>\n<ul>\n<li>\u672c\u8d28&#xff1a;\u8ba1\u6570\u5668&#xff0c;\u6570\u7684\u662f&#034;\u8d44\u6e90\u8fd8\u5269\u51e0\u4efd&#034;&#xff1b;\u5b83\u81ea\u5df1\u4e5f\u662f\u5185\u6838\u91cc\u7684\u5171\u4eab\u5bf9\u8c61&#xff08;\u7531\u5185\u6838\u9501\u4fdd\u8bc1\u5b89\u5168&#xff09;&#xff0c;\u4f46\u4e0d\u662f\u88ab\u5b83\u4fdd\u62a4\u7684\u90a3\u4efd\u5171\u4eab\u8d44\u6e90<\/li>\n<li>\u6838\u5fc3\u7c7b\u6bd4&#xff1a;\u7535\u5f71\u9662\u8ba2\u7968\u2014\u2014\u4e70\u7968\u662f P\u3001\u9000\u7968\u662f V\u3001\u7968\u6c60\u521d\u503c\u662f\u5ea7\u4f4d\u6570\u3001SEM_UNDO \u662f&#034;\u4eba\u8dd1\u4e86\u7968\u81ea\u52a8\u9000&#034;<\/li>\n<li>\u4fdd\u62a4\u601d\u8def&#xff1a;\u5171\u4eab\u5185\u5b58\u5212\u5206\u56fa\u5b9a\u533a\u57df&#xff0c;\u6240\u6709\u8fdb\u7a0b\u8bbf\u95ee\u4e00\u5c0f\u5757\u524d\u5fc5\u987b\u5148\u7533\u8bf7\u4fe1\u53f7\u91cf<\/li>\n<li>\u64cd\u4f5c&#xff1a;sembuf \u4e09\u5b57\u6bb5&#xff0c;sem_op \u6b63\u8d1f\u96f6\u4e09\u79cd\u8bed\u4e49&#xff0c;\u539f\u5b50\u6267\u884c<\/li>\n<li>\u63a5\u53e3&#xff1a;semget&#xff08;\u521b\u5efa\u96c6&#xff09;\u2192 semctl SETVAL&#xff08;\u521d\u59cb\u5316&#xff0c;union semun \u81ea\u5df1\u5b9a\u4e49&#xff09;\u2192 semop&#xff08;P\/V&#xff0c;\u53ef\u4f20\u6570\u7ec4&#xff09;\u2192 semctl IPC_RMID&#xff08;\u5220\u9664&#xff09;&#xff1b;ipcs -s \u67e5\u770b\u3001ipcrm -s \u6e05\u573a<\/li>\n<li>\u5185\u6838\u7ec4\u7ec7&#xff1a;semid_ds \u63cf\u8ff0 \u2192 kern_ipc_perm \u5f53\u6865\u6881\u5934 \u2192 ipc_ids \u7edf\u4e00\u7ba1\u4e09\u4ef6\u5957&#xff1b;ipc_id_ary \u662f 2.6 \u65e9\u671f\u6a21\u578b&#xff0c;\u73b0\u4ee3\u5185\u6838\u7528 IDR \u57fa\u6570\u6811&#xff0c;\u601d\u60f3\u4e0d\u53d8<\/li>\n<\/ul>\n<p>\u4fe1\u53f7\u91cf\u4e0d\u96be&#xff0c;\u96be\u7684\u662f\u628a&#034;\u8ba1\u6570\u5668&#034;\u548c&#034;\u9884\u8ba2&#034;\u8fd9\u4e24\u5c42\u610f\u601d\u710a\u6b7b\u5728\u8111\u5b50\u91cc\u2014\u2014\u60f3\u4e0d\u901a\u7684\u65f6\u5019\u56de\u7535\u5f71\u9662\u770b\u4e00\u773c&#xff0c;\u4e70\u7968\u9000\u7968&#xff0c;\u5c31\u90a3\u4e48\u70b9\u4e8b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00&#xff1a;\u7bc727 \u7ed9\u4fe1\u53f7\u91cf\u53ea\u7559\u4e86\u4e24\u53e5\u8bdd\u2014\u2014\u672c\u8d28\u662f\u8ba1\u6570\u5668&#xff0c;P \u52a0\u9501 V \u89e3\u9501&#xff0c;\u4e09\u4e2a\u63a5\u53e3\u4e5f\u53ea\u70b9\u4e86\u540d\u3002\u8fd9\u7bc7\u8865\u4e0a\u6574\u5757\u62fc\u56fe&#xff1a;\u7528\u7535\u5f71\u9662\u8ba2\u7968\u8bb2\u900f\\&#8221;\u9884\u8ba2\\&#8221;\u672c\u8d28&#xff0c;\u62c6\u5f00 P\/V \u7684\u4e09\u79cd\u8bed\u4e49\u548c\u6574\u5957\u7528\u6cd5&#xff0c;\u518d\u5f80\u5185\u6838\u8d70\u4e00\u6b65&#xff0c;\u770b OS \u600e\u4e48\u7528\u4e00\u5f20\u5927\u8868\u7edf\u4e00\u7ba1\u7406\u4e09\u4ef6\u5957\u3002 \u76ee\u5f55<br \/>\n\u200b\u7f16\u8f91<br \/>\n\u4e00\u3001\u4fe1\u53f7\u91cf\u662f\u4ec0\u4e48&#xff1a;\u672c\u8d28\u662f\u4e00\u4e2a\u8ba1\u6570\u5668<br \/>\n\u4e8c\u3001\u7535\u5f71\u9662\u8ba2\u7968&#xff1a;\u7406\u89e3\u4fe1\u53f7\u91cf\u7684\u6700\u4f73\u7c7b\u6bd4<br \/>\n2.1 \u4e70\u7968\u5c31\u662f\u9884\u8ba2&amp;#<\/p>\n","protected":false},"author":2,"featured_media":102128,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,43,44],"topic":[],"class_list":["post-102131","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\u7cfb\u7edf\u7bc728\u2014\u2014\u901a\u4fe1\uff08\u4e94\uff09\uff1a\u4fe1\u53f7\u91cf\u4e13\u7bc7\uff1a\u4ece\u7535\u5f71\u9662\u8ba2\u7968\u5230\u5185\u6838\u4e00\u5f20\u5927\u8868\uff0c\u628a\u4fe1\u53f7\u91cf\u4e00\u6b21\u8bb2\u900f - \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\/102131.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\u7cfb\u7edf\u7bc728\u2014\u2014\u901a\u4fe1\uff08\u4e94\uff09\uff1a\u4fe1\u53f7\u91cf\u4e13\u7bc7\uff1a\u4ece\u7535\u5f71\u9662\u8ba2\u7968\u5230\u5185\u6838\u4e00\u5f20\u5927\u8868\uff0c\u628a\u4fe1\u53f7\u91cf\u4e00\u6b21\u8bb2\u900f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u524d\u8a00&#xff1a;\u7bc727 \u7ed9\u4fe1\u53f7\u91cf\u53ea\u7559\u4e86\u4e24\u53e5\u8bdd\u2014\u2014\u672c\u8d28\u662f\u8ba1\u6570\u5668&#xff0c;P \u52a0\u9501 V \u89e3\u9501&#xff0c;\u4e09\u4e2a\u63a5\u53e3\u4e5f\u53ea\u70b9\u4e86\u540d\u3002\u8fd9\u7bc7\u8865\u4e0a\u6574\u5757\u62fc\u56fe&#xff1a;\u7528\u7535\u5f71\u9662\u8ba2\u7968\u8bb2\u900f&quot;\u9884\u8ba2&quot;\u672c\u8d28&#xff0c;\u62c6\u5f00 P\/V \u7684\u4e09\u79cd\u8bed\u4e49\u548c\u6574\u5957\u7528\u6cd5&#xff0c;\u518d\u5f80\u5185\u6838\u8d70\u4e00\u6b65&#xff0c;\u770b OS \u600e\u4e48\u7528\u4e00\u5f20\u5927\u8868\u7edf\u4e00\u7ba1\u7406\u4e09\u4ef6\u5957\u3002 \u76ee\u5f55 \u200b\u7f16\u8f91 \u4e00\u3001\u4fe1\u53f7\u91cf\u662f\u4ec0\u4e48&#xff1a;\u672c\u8d28\u662f\u4e00\u4e2a\u8ba1\u6570\u5668 \u4e8c\u3001\u7535\u5f71\u9662\u8ba2\u7968&#xff1a;\u7406\u89e3\u4fe1\u53f7\u91cf\u7684\u6700\u4f73\u7c7b\u6bd4 2.1 \u4e70\u7968\u5c31\u662f\u9884\u8ba2&amp;#\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/102131.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-07T23:52:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260907235226-6a9f4e3a7c262.jpg\" \/>\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=\"10 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/102131.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/102131.html\",\"name\":\"Linux\u7cfb\u7edf\u7bc728\u2014\u2014\u901a\u4fe1\uff08\u4e94\uff09\uff1a\u4fe1\u53f7\u91cf\u4e13\u7bc7\uff1a\u4ece\u7535\u5f71\u9662\u8ba2\u7968\u5230\u5185\u6838\u4e00\u5f20\u5927\u8868\uff0c\u628a\u4fe1\u53f7\u91cf\u4e00\u6b21\u8bb2\u900f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-07T23:52:32+00:00\",\"dateModified\":\"2026-09-07T23:52:32+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/102131.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/102131.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/102131.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\u7cfb\u7edf\u7bc728\u2014\u2014\u901a\u4fe1\uff08\u4e94\uff09\uff1a\u4fe1\u53f7\u91cf\u4e13\u7bc7\uff1a\u4ece\u7535\u5f71\u9662\u8ba2\u7968\u5230\u5185\u6838\u4e00\u5f20\u5927\u8868\uff0c\u628a\u4fe1\u53f7\u91cf\u4e00\u6b21\u8bb2\u900f\"}]},{\"@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":"Linux\u7cfb\u7edf\u7bc728\u2014\u2014\u901a\u4fe1\uff08\u4e94\uff09\uff1a\u4fe1\u53f7\u91cf\u4e13\u7bc7\uff1a\u4ece\u7535\u5f71\u9662\u8ba2\u7968\u5230\u5185\u6838\u4e00\u5f20\u5927\u8868\uff0c\u628a\u4fe1\u53f7\u91cf\u4e00\u6b21\u8bb2\u900f - \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\/102131.html","og_locale":"zh_CN","og_type":"article","og_title":"Linux\u7cfb\u7edf\u7bc728\u2014\u2014\u901a\u4fe1\uff08\u4e94\uff09\uff1a\u4fe1\u53f7\u91cf\u4e13\u7bc7\uff1a\u4ece\u7535\u5f71\u9662\u8ba2\u7968\u5230\u5185\u6838\u4e00\u5f20\u5927\u8868\uff0c\u628a\u4fe1\u53f7\u91cf\u4e00\u6b21\u8bb2\u900f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u524d\u8a00&#xff1a;\u7bc727 \u7ed9\u4fe1\u53f7\u91cf\u53ea\u7559\u4e86\u4e24\u53e5\u8bdd\u2014\u2014\u672c\u8d28\u662f\u8ba1\u6570\u5668&#xff0c;P \u52a0\u9501 V \u89e3\u9501&#xff0c;\u4e09\u4e2a\u63a5\u53e3\u4e5f\u53ea\u70b9\u4e86\u540d\u3002\u8fd9\u7bc7\u8865\u4e0a\u6574\u5757\u62fc\u56fe&#xff1a;\u7528\u7535\u5f71\u9662\u8ba2\u7968\u8bb2\u900f\"\u9884\u8ba2\"\u672c\u8d28&#xff0c;\u62c6\u5f00 P\/V \u7684\u4e09\u79cd\u8bed\u4e49\u548c\u6574\u5957\u7528\u6cd5&#xff0c;\u518d\u5f80\u5185\u6838\u8d70\u4e00\u6b65&#xff0c;\u770b OS \u600e\u4e48\u7528\u4e00\u5f20\u5927\u8868\u7edf\u4e00\u7ba1\u7406\u4e09\u4ef6\u5957\u3002 \u76ee\u5f55 \u200b\u7f16\u8f91 \u4e00\u3001\u4fe1\u53f7\u91cf\u662f\u4ec0\u4e48&#xff1a;\u672c\u8d28\u662f\u4e00\u4e2a\u8ba1\u6570\u5668 \u4e8c\u3001\u7535\u5f71\u9662\u8ba2\u7968&#xff1a;\u7406\u89e3\u4fe1\u53f7\u91cf\u7684\u6700\u4f73\u7c7b\u6bd4 2.1 \u4e70\u7968\u5c31\u662f\u9884\u8ba2&amp;#","og_url":"https:\/\/www.wsisp.com\/helps\/102131.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-07T23:52:32+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260907235226-6a9f4e3a7c262.jpg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"10 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/102131.html","url":"https:\/\/www.wsisp.com\/helps\/102131.html","name":"Linux\u7cfb\u7edf\u7bc728\u2014\u2014\u901a\u4fe1\uff08\u4e94\uff09\uff1a\u4fe1\u53f7\u91cf\u4e13\u7bc7\uff1a\u4ece\u7535\u5f71\u9662\u8ba2\u7968\u5230\u5185\u6838\u4e00\u5f20\u5927\u8868\uff0c\u628a\u4fe1\u53f7\u91cf\u4e00\u6b21\u8bb2\u900f - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-07T23:52:32+00:00","dateModified":"2026-09-07T23:52:32+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/102131.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/102131.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/102131.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Linux\u7cfb\u7edf\u7bc728\u2014\u2014\u901a\u4fe1\uff08\u4e94\uff09\uff1a\u4fe1\u53f7\u91cf\u4e13\u7bc7\uff1a\u4ece\u7535\u5f71\u9662\u8ba2\u7968\u5230\u5185\u6838\u4e00\u5f20\u5927\u8868\uff0c\u628a\u4fe1\u53f7\u91cf\u4e00\u6b21\u8bb2\u900f"}]},{"@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\/102131","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=102131"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/102131\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/102128"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=102131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=102131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=102131"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=102131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}