{"id":480,"date":"2012-06-05T20:24:40","date_gmt":"2012-06-05T12:24:40","guid":{"rendered":"http:\/\/ykyi.net\/?p=480"},"modified":"2012-06-05T20:24:40","modified_gmt":"2012-06-05T12:24:40","slug":"linux%e7%94%a8%e4%b8%a4%e7%a7%8d%e4%bf%a1%e5%8f%b7%e9%87%8f-linux-has-two-kinds-of-semaphore","status":"publish","type":"post","link":"https:\/\/ykyi.net\/?p=480","title":{"rendered":"Linux\u7528\u4e24\u79cd\u4fe1\u53f7\u91cf Linux has two kinds of semaphore"},"content":{"rendered":"<p>\u9762\u8bd5\u4e2d\u7ecf\u5e38\u4f1a\u8003\u4ec0\u4e48\u662f\u4fe1\u53f7\u91cf\uff0c\u5bf9\u4e8elinux,\u5b9e\u9645\u4e0a\u6709\u4e24\u79cdsemaphore.<\/p>\n<p>\u7b2c\u4e00\u79cd\u662f\u6307\u4e00\u79cdIPC(Inter-process communication\u8fdb\u7a0b\u901a\u8baf)\u7684\u65b9\u6cd5\u3002\u8fd9\u79cdIPC\u662f\u4eceUnix SYstem V\u65f6\u4ee3\u5f00\u59cb\u7684\uff0cSystem V\u53d1\u5e03\u65f6\u52a0\u5165\u4e86\u4e09\u79cdIPC\uff0c\u5b83\u4eec\u662fsemaphore\u4fe1\u53f7\u91cf\uff0cmessage queues\u6d88\u606f\u961f\u5217\uff0cshared memory\u5171\u4eab\u5185\u5b58\u3002<\/p>\n<p>Linux\u4e2d\u53e6\u4e00\u79cdSemaphore\u662f\u5185\u6838\u7528\u6765\u540c\u6b65\u7684\u673a\u5236\u3002\u5728kernel\u4e2d\uff0csemaphore\u901a\u5e38\u5f53\u6210\u4e00\u4e2a\u4e8c\u503c\u4fe1\u53f7\u91cf\u4f7f\u7528\u3002\u83b7\u5f97\u4fe1\u53f7\u91cf\u65f6\u6709\u53ef\u80fd\u4f1a\u7761\u7720\uff0c\u8fd9\u6837\u8fdb\u7a0b\u5c31\u4f1a\u88ab\u8c03\u5ea6\u5f00\uff0c\u653e\u5f03\u5904\u7406\u673a\uff1b\u5982\u679c\u67d0\u6bb5\u5185\u6838\u4ee3\u7801\u5f97\u5230\u4e86\u4e00\u4e2a\u4fe1\u53f7\u91cf\uff0c\u8fd9\u6bb5\u4ee3\u7801\u8fd8\u53ef\u4ee5\u7761\u7720\u3002\u8fd9\u70b9\u4e0d\u50cfspinlock\uff0c\u5c1d\u8bd5\u5f97\u5230spinlock\u4f1a\u4e0d\u505c\u5730\u5fd9\u7b49\uff0c\u5f97\u5230spinlock\u540e\u4e0d\u5145\u8bb8\u7761\u7720\u3002\u5f53\u7136\u8fd9\u4e2a&ldquo;\u4e0d\u5145\u8bb8&rdquo;\u4e0d\u662f\u8bed\u6cd5\u5c42\u9762\u7684\uff0c\u800c\u662f\u5e94\u8be5\u88ab\u7a0b\u5e8f\u5458\u9075\u5b88\u3002\u5426\u5219\u6574\u4e2a\u7cfb\u7edf\u7684\u7684\u6027\u80fd\u5c31\u4f1a\u88ab\u8fd9\u4ee3\u4e0d\u9075\u5b88\u7ea6\u5b9a\u7684\u4ee3\u7801\u6bc1\u6389\u4e86\u3002<\/p>\n<p>copyright ykyi.net<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9762\u8bd5\u4e2d\u7ecf\u5e38\u4f1a\u8003\u4ec0\u4e48\u662f\u4fe1\u53f7\u91cf\uff0c\u5bf9\u4e8elinux,\u5b9e\u9645\u4e0a\u6709\u4e24\u79cdsemaphore. \u7b2c\u4e00\u79cd\u662f\u6307\u4e00\u79cdIPC(Inter-process communication\u8fdb\u7a0b\u901a\u8baf)\u7684\u65b9\u6cd5\u3002\u8fd9\u79cdIPC\u662f\u4eceUnix SYstem V\u65f6\u4ee3\u5f00\u59cb\u7684\uff0cSystem V\u53d1\u5e03\u65f6\u52a0\u5165\u4e86\u4e09\u79cdIPC\uff0c\u5b83\u4eec\u662fsemaphore\u4fe1\u53f7\u91cf\uff0cmessage queues\u6d88\u606f\u961f\u5217\uff0cshared memory\u5171\u4eab\u5185\u5b58\u3002 Linux\u4e2d\u53e6\u4e00\u79cdSemaphore\u662f\u5185\u6838\u7528\u6765\u540c\u6b65\u7684\u673a\u5236\u3002\u5728kernel\u4e2d\uff0csemaphore\u901a\u5e38\u5f53\u6210\u4e00\u4e2a\u4e8c\u503c\u4fe1\u53f7\u91cf\u4f7f\u7528\u3002\u83b7\u5f97\u4fe1\u53f7\u91cf\u65f6\u6709\u53ef\u80fd\u4f1a\u7761\u7720\uff0c\u8fd9\u6837\u8fdb\u7a0b\u5c31\u4f1a\u88ab\u8c03\u5ea6\u5f00\uff0c\u653e\u5f03\u5904\u7406\u673a\uff1b\u5982\u679c\u67d0\u6bb5\u5185\u6838\u4ee3\u7801\u5f97\u5230\u4e86\u4e00\u4e2a\u4fe1\u53f7\u91cf\uff0c\u8fd9\u6bb5\u4ee3\u7801\u8fd8\u53ef\u4ee5\u7761\u7720\u3002\u8fd9\u70b9\u4e0d\u50cfspinlock\uff0c\u5c1d\u8bd5\u5f97\u5230spinlock\u4f1a\u4e0d\u505c\u5730\u5fd9\u7b49\uff0c\u5f97\u5230spinlock\u540e\u4e0d\u5145\u8bb8\u7761\u7720\u3002\u5f53\u7136\u8fd9\u4e2a&ldquo;\u4e0d\u5145\u8bb8&rdquo;\u4e0d\u662f\u8bed\u6cd5\u5c42\u9762\u7684\uff0c\u800c\u662f\u5e94\u8be5\u88ab\u7a0b\u5e8f\u5458\u9075\u5b88\u3002\u5426\u5219\u6574\u4e2a\u7cfb\u7edf\u7684\u7684\u6027\u80fd\u5c31\u4f1a\u88ab\u8fd9\u4ee3\u4e0d\u9075\u5b88\u7ea6\u5b9a\u7684\u4ee3\u7801\u6bc1\u6389\u4e86\u3002 copyright ykyi.net &nbsp;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,7],"tags":[52],"class_list":["post-480","post","type-post","status-publish","format-standard","hentry","category-tech_articles","category-unix_linux","tag-linux-kernel"],"_links":{"self":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/480","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=480"}],"version-history":[{"count":0,"href":"https:\/\/ykyi.net\/index.php?rest_route=\/wp\/v2\/posts\/480\/revisions"}],"wp:attachment":[{"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=480"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=480"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ykyi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=480"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}