{"id":1679,"date":"2015-12-26T22:10:43","date_gmt":"2015-12-26T14:10:43","guid":{"rendered":"http:\/\/www.51cos.com\/?p=1679"},"modified":"2015-12-26T22:10:43","modified_gmt":"2015-12-26T14:10:43","slug":"linux%e7%9a%84%e8%bf%9b%e7%a8%8b%e7%ba%bf%e7%a8%8b%e9%97%b4%e9%80%9a%e4%bf%a1%e6%96%b9%e5%bc%8f%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"http:\/\/www.51cos.com\/?p=1679","title":{"rendered":"Linux\u7684\u8fdb\u7a0b\/\u7ebf\u7a0b\u95f4\u901a\u4fe1\u65b9\u5f0f\u603b\u7ed3"},"content":{"rendered":"<p><span class=\"Apple-style-span\" style=\"font-family: \u5b8b\u4f53;\"><span class=\"Apple-style-span\" style=\"font-size: large;\">\u00a0linux\u65e2\u652f\u6301POSIX\u6807\u51c6\u7684\u6d88\u606f\u961f\u5217\uff0c\u4e5f\u652f\u6301System V<span class=\"Apple-style-span\" style=\"font-family: \u5b8b\u4f53;\"><span class=\"Apple-style-span\" style=\"font-size: large;\">\u6807\u51c6<\/span><\/span>\u7684\u6d88\u606f\u961f\u5217\u3002<\/span><\/span><\/p>\n<p>\u540c\u4e00\u4e3b\u673a\u4e0a\u7684\u8fdb\u7a0b\u901a\u4fe1\u65b9\u5f0f<\/p>\n<p><wbr \/>\u00a0<wbr \/>\u00a0* UNIX\u8fdb\u7a0b\u95f4\u901a\u4fe1\u65b9\u5f0f: \u5305\u62ec\u7ba1\u9053(PIPE), \u6709\u540d\u7ba1\u9053(FIFO), \u548c\u4fe1\u53f7(Signal)<\/p>\n<p><wbr \/>\u00a0<wbr \/>\u00a0* System V\u8fdb\u7a0b\u901a\u4fe1\u65b9\u5f0f\uff1a\u5305\u62ec\u4fe1\u53f7\u91cf(Semaphore), \u6d88\u606f\u961f\u5217(Message Queue), \u548c\u5171\u4eab\u5185\u5b58(Shared Memory)<\/p>\n<p>\u7f51\u7edc\u4e3b\u673a\u95f4\u7684\u8fdb\u7a0b\u901a\u4fe1\u65b9\u5f0f<\/p>\n<p><wbr \/>\u00a0<wbr \/>\u00a0* RPC: Remote Procedure Call \u8fdc\u7a0b\u8fc7\u7a0b\u8c03\u7528<\/p>\n<p><wbr \/>\u00a0<wbr \/>\u00a0* Socket: \u5f53\u524d\u6700\u6d41\u884c\u7684\u7f51\u7edc\u901a\u4fe1\u65b9\u5f0f, \u57fa\u4e8eTCP\/IP\u534f\u8bae\u7684\u901a\u4fe1\u65b9\u5f0f.<\/p>\n<p>\u5404\u81ea\u7684\u7279\u70b9\u5982\u4e0b:<\/p>\n<ul>\n<li><strong>\u7ba1\u9053(PIPE)<\/strong>\uff1a\u7ba1\u9053\u662f\u4e00\u79cd\u534a\u53cc\u5de5\u7684\u901a\u4fe1\u65b9\u5f0f\uff0c\u6570\u636e\u53ea\u80fd\u5355\u5411\u6d41\u52a8\uff0c\u800c\u4e14\u53ea\u80fd\u5728\u5177\u6709\u4eb2\u7f18\u5173\u7cfb(\u7236\u5b50\u8fdb\u7a0b)\u7684\u8fdb\u7a0b\u95f4\u4f7f\u7528\u3002\u53e6\u5916\u7ba1\u9053\u4f20\u9001\u7684\u662f\u65e0\u683c\u5f0f\u7684\u5b57\u8282\u6d41\uff0c\u5e76\u4e14\u7ba1\u9053\u7f13\u51b2\u533a\u7684\u5927\u5c0f\u662f\u6709\u9650\u7684\uff08\u7ba1\u9053\u7f13\u51b2\u533a\u5b58\u5728\u4e8e\u5185\u5b58\u4e2d\uff0c\u5728\u7ba1\u9053\u521b\u5efa\u65f6\uff0c\u4e3a\u7f13\u51b2\u533a\u5206\u914d\u4e00\u4e2a\u9875\u9762\u5927\u5c0f\uff09\u3002<\/li>\n<li><strong>\u6709\u540d\u7ba1\u9053 (FIFO)<\/strong>\uff1a \u6709\u540d\u7ba1\u9053\u4e5f\u662f\u534a\u53cc\u5de5\u7684\u901a\u4fe1\u65b9\u5f0f\uff0c\u4f46\u662f\u5b83\u5141\u8bb8\u65e0\u4eb2\u7f18\u5173\u7cfb\u8fdb\u7a0b\u95f4\u7684\u901a\u4fe1\u3002<\/li>\n<li><strong>\u4fe1\u53f7(Signal)<\/strong>\uff1a \u4fe1\u53f7\u662f\u4e00\u79cd\u6bd4\u8f83\u590d\u6742\u7684\u901a\u4fe1\u65b9\u5f0f\uff0c\u7528\u4e8e\u901a\u77e5\u63a5\u6536\u8fdb\u7a0b\u67d0\u4e2a\u4e8b\u4ef6\u5df2\u7ecf\u53d1\u751f\u3002<\/li>\n<li><strong>\u4fe1\u53f7\u91cf(Semaphore)<\/strong>\uff1a\u4fe1\u53f7\u91cf\u662f\u4e00\u4e2a\u8ba1\u6570\u5668\uff0c\u53ef\u4ee5\u7528\u6765\u63a7\u5236\u591a\u4e2a\u8fdb\u7a0b\u5bf9\u5171\u4eab\u8d44\u6e90\u7684\u8bbf\u95ee\u3002\u5b83\u5e38\u4f5c\u4e3a\u4e00\u79cd\u9501\u673a\u5236\uff0c\u9632\u6b62\u67d0\u8fdb\u7a0b\u6b63\u5728\u8bbf\u95ee\u5171\u4eab\u8d44\u6e90\u65f6\uff0c\u5176\u4ed6\u8fdb\u7a0b\u4e5f\u8bbf\u95ee\u8be5\u8d44\u6e90\u3002\u56e0\u6b64\uff0c\u4e3b\u8981\u4f5c\u4e3a\u8fdb\u7a0b\u95f4\u4ee5\u53ca\u540c\u4e00\u8fdb\u7a0b\u5185\u4e0d\u540c\u7ebf\u7a0b\u4e4b\u95f4\u7684\u540c\u6b65\u624b\u6bb5\u3002<\/li>\n<li><strong>\u6d88\u606f\u961f\u5217(Message Queue)<\/strong>\uff1a\u6d88\u606f\u961f\u5217\u662f\u7531\u6d88\u606f\u7684\u94fe\u8868\uff0c\u5b58\u653e\u5728\u5185\u6838\u4e2d\u5e76\u7531\u6d88\u606f\u961f\u5217\u6807\u8bc6\u7b26\u6807\u8bc6\u3002\u6d88\u606f\u961f\u5217\u514b\u670d\u4e86\u4fe1\u53f7\u4f20\u9012\u4fe1\u606f\u5c11\u3001\u7ba1\u9053\u53ea\u80fd\u627f\u8f7d\u65e0\u683c\u5f0f\u5b57\u8282\u6d41\u4ee5\u53ca\u7f13\u51b2\u533a\u5927\u5c0f\u53d7\u9650\u7b49\u7f3a\u70b9\u3002<\/li>\n<li><strong>\u5171\u4eab\u5185\u5b58(Shared Memory )<\/strong>\uff1a\u5171\u4eab\u5185\u5b58\u5c31\u662f\u6620\u5c04\u4e00\u6bb5\u80fd\u88ab\u5176\u4ed6\u8fdb\u7a0b\u6240\u8bbf\u95ee\u7684\u5185\u5b58\uff0c\u8fd9\u6bb5\u5171\u4eab\u5185\u5b58\u7531\u4e00\u4e2a\u8fdb\u7a0b\u521b\u5efa\uff0c\u4f46\u591a\u4e2a\u8fdb\u7a0b\u90fd\u53ef\u4ee5\u8bbf\u95ee\u3002\u5171\u4eab\u5185\u5b58\u662f\u6700\u5feb\u7684 IPC \u65b9\u5f0f\uff0c\u5b83\u662f\u9488\u5bf9\u5176\u4ed6\u8fdb\u7a0b\u95f4\u901a\u4fe1\u65b9\u5f0f\u8fd0\u884c\u6548\u7387\u4f4e\u800c\u4e13\u95e8\u8bbe\u8ba1\u7684\u3002\u5b83\u5f80\u5f80\u4e0e\u5176\u4ed6\u901a\u4fe1\u673a\u5236\uff0c\u5982\u4fe1\u53f7\u91cf\uff0c\u914d\u5408\u4f7f\u7528\uff0c\u6765\u5b9e\u73b0\u8fdb\u7a0b\u95f4\u7684\u540c\u6b65\u548c\u901a\u4fe1\u3002<\/li>\n<li><strong>\u5957\u63a5\u5b57(Socket)<\/strong>\uff1a \u5957\u89e3\u53e3\u4e5f\u662f\u4e00\u79cd\u8fdb\u7a0b\u95f4\u901a\u4fe1\u673a\u5236\uff0c\u4e0e\u5176\u4ed6\u901a\u4fe1\u673a\u5236\u4e0d\u540c\u7684\u662f\uff0c\u5b83\u53ef\u7528\u4e8e\u4e0d\u540c\u4e3b\u673a\u95f4\u7684\u8fdb\u7a0b\u901a\u4fe1\u3002<\/li>\n<\/ul>\n<p><wbr \/><\/p>\n<p><strong>Linux\u7cfb\u7edf\u4e2d\u7684\u7ebf\u7a0b\u95f4\u901a\u4fe1\u65b9\u5f0f\u4e3b\u8981\u4ee5\u4e0b\u51e0\u79cd:<\/strong><\/p>\n<p>*\u00a0<wbr \/>\u00a0<strong>\u9501\u673a\u5236<\/strong>\uff1a\u5305\u62ec\u4e92\u65a5\u9501\u3001\u6761\u4ef6\u53d8\u91cf\u3001\u8bfb\u5199\u9501<\/p>\n<p><wbr \/>\u00a0<wbr \/>\u00a0\u4e92\u65a5\u9501\u63d0\u4f9b\u4e86\u4ee5\u6392\u4ed6\u65b9\u5f0f\u9632\u6b62\u6570\u636e\u7ed3\u6784\u88ab\u5e76\u53d1\u4fee\u6539\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u8bfb\u5199\u9501\u5141\u8bb8\u591a\u4e2a\u7ebf\u7a0b\u540c\u65f6\u8bfb\u5171\u4eab\u6570\u636e\uff0c\u800c\u5bf9\u5199\u64cd\u4f5c\u662f\u4e92\u65a5\u7684\u3002<\/p>\n<p><wbr \/>\u00a0<wbr \/>\u00a0\u6761\u4ef6\u53d8\u91cf\u53ef\u4ee5\u4ee5\u539f\u5b50\u7684\u65b9\u5f0f\u963b\u585e\u8fdb\u7a0b\uff0c\u76f4\u5230\u67d0\u4e2a\u7279\u5b9a\u6761\u4ef6\u4e3a\u771f\u4e3a\u6b62\u3002\u5bf9\u6761\u4ef6\u7684\u6d4b\u8bd5\u662f\u5728\u4e92\u65a5\u9501\u7684\u4fdd\u62a4\u4e0b\u8fdb\u884c\u7684\u3002\u6761\u4ef6\u53d8\u91cf\u59cb\u7ec8\u4e0e\u4e92\u65a5\u9501\u4e00\u8d77\u4f7f\u7528\u3002<\/p>\n<p>*\u00a0<wbr \/>\u00a0<strong>\u4fe1\u53f7\u91cf\u673a\u5236(Semaphore)<\/strong>\uff1a\u5305\u62ec\u65e0\u540d\u7ebf\u7a0b\u4fe1\u53f7\u91cf\u548c\u547d\u540d\u7ebf\u7a0b\u4fe1\u53f7\u91cf<\/p>\n<p>*\u00a0<wbr \/>\u00a0<strong>\u4fe1\u53f7\u673a\u5236(Signal)<\/strong>\uff1a\u7c7b\u4f3c\u8fdb\u7a0b\u95f4\u7684\u4fe1\u53f7\u5904\u7406<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0linux\u65e2\u652f\u6301POSIX\u6807\u51c6\u7684\u6d88\u606f\u961f\u5217\uff0c\u4e5f\u652f\u6301System V\u6807\u51c6\u7684\u6d88\u606f\u961f\u5217\u3002 \u540c\u4e00\u4e3b\u673a\u4e0a\u7684\u8fdb\u7a0b\u901a\u4fe1\u65b9\u5f0f  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-1679","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1679"}],"version-history":[{"count":1,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1679\/revisions"}],"predecessor-version":[{"id":1680,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/1679\/revisions\/1680"}],"wp:attachment":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1679"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}