{"id":418653,"date":"2021-03-12T18:56:50","date_gmt":"2021-03-12T10:56:50","guid":{"rendered":"http:\/\/4563.org\/?p=418653"},"modified":"2021-03-12T18:56:50","modified_gmt":"2021-03-12T10:56:50","slug":"%e8%af%b7%e6%95%99%e5%a4%a7%e5%ae%b6%e5%85%b3%e4%ba%8e%e5%a4%9a%e6%a0%b8%e5%b9%b6%e5%8f%91%e7%bc%96%e7%a8%8b%e4%b8%ad%ef%bc%8c-cache-%e4%b8%80%e8%87%b4%e6%80%a7%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=418653","title":{"rendered":"\u8bf7\u6559\u5927\u5bb6\u5173\u4e8e\u591a\u6838\u5e76\u53d1\u7f16\u7a0b\u4e2d\uff0c cache \u4e00\u81f4\u6027\u7684\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u8bf7\u6559\u5927\u5bb6\u5173\u4e8e\u591a\u6838\u5e76\u53d1\u7f16\u7a0b\u4e2d\uff0c cache \u4e00\u81f4\u6027\u7684\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : RedBlackTree <\/span>  <span><i><\/i> 1<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5047\u8bbe\u4e24\u4e2a\u7ebf\u7a0b A \u3001B\uff0c\u5171\u4eab\u53d8\u91cf V\uff0cA \u548c B \u5206\u522b\u8dd1\u5728 CPU1 \u3001CPU2 \u4e0a\uff0c\u5404\u81ea cache \u4e2d\u6709 V \u6240\u5728 cache line \u7684\u526f\u672c\uff0c\u5176\u4e2d\u7684 V \u5206\u522b\u4e3a V1 \u3001V2 \u3002<\/p>\n<p>\u90a3\u4e48\u5f53 A \u76f4\u63a5\u4fee\u6539 V\uff0c\u800c\u6ca1\u6709\u4f7f\u7528\u9501\u3001CAS \u7b49\u540c\u6b65\u539f\u8bed\uff0c\u90a3\u4e48 CPU1 \u53ea\u662f\u5355\u7eaf\u4fee\u6539\u81ea\u5df1\u7684 V1 \u800c\u6ca1\u6709\u5199\u56de\u5185\u5b58\uff0c\u4f1a\u4e0d\u4f1a\u5bfc\u81f4 CPU2 \u7684 V2 \u5931\u6548\uff1f\u5373\u4e00\u4e2a CPU \u7684\u67d0\u5757\u7f13\u5b58\u5931\u6548\u7684\u65f6\u673a\u662f\u5185\u5b58\u53d1\u751f\u4e86\u4fee\u6539\uff0c\u8fd8\u662f\u5176\u4ed6 CPU \u7684\u76f8\u540c\u7f13\u5b58\u53d1\u751f\u4e86\u4fee\u6539\uff1f<\/p>\n<p>\u6211\u7684\u7406\u89e3\u662f\u56e0\u4e3a cache \u7684\u4fee\u6539\u5199\u5165\u5185\u5b58\u662f write back\uff0c\u800c\u4e0d\u662f\u7acb\u5373\u5199\u5165\u5185\u5b58\uff0c\u6240\u4ee5\u6ca1\u6709\u4f7f\u7528\u540c\u6b65\u539f\u8bed\u7684\u60c5\u51b5\u4e0b\uff0c\u7ebf\u7a0b A \u5bf9 V1 \u7684\u4fee\u6539\uff0c\u5e94\u8be5\u5bf9\u5185\u5b58\u548c\u7ebf\u7a0b B \u90fd\u662f\u4e0d\u53ef\u89c1\u7684\uff0c\u76f4\u5230\u672a\u6765\u67d0\u4e00\u65f6\u523b A \u7684 cache \u5237\u56de\u5185\u5b58\uff0cB \u6240\u5728\u7684 CPU2 \u4e2d\u7684 cache line \u624d\u4f1a\u88ab\u6807\u8bb0\u4e3a\u5931\u6548\uff0c\u4e4b\u540e\u624d\u80fd\u8bfb\u5230 A \u5bf9 V \u7684\u4fee\u6539\u3002<\/p>\n<p>\u56e0\u6b64\u4e3a\u4e86\u4fdd\u8bc1\u591a\u4e2a\u7ebf\u7a0b\u5bf9\u5171\u4eab\u53d8\u91cf\u5e76\u53d1\u64cd\u4f5c\u7684\u53ef\u89c1\u6027\uff0c\u8bbf\u95ee\u5171\u4eab\u53d8\u91cf\u9700\u8981\u540c\u6b65\u539f\u8bed\uff0c\u4fdd\u8bc1\u6bcf\u6b21\u5199\u90fd\u5199\u5230\u5185\u5b58\u4e0a\uff0c\u6bcf\u6b21\u8bfb\u90fd\u8bfb\u5230\u662f\u5185\u5b58\u4e0a\u6700\u65b0\u7684\u503c\u3002<\/p>\n<p>\u8fd9\u662f\u6211\u4ece The Go Memory Model \u548c TGPL \u4e66\u4e0a\u7684\u7406\u89e3\uff0c\u4e0d\u77e5\u9053\u7406\u89e3\u5f97\u5bf9\u4e0d\u5bf9\uff0c\u987a\u4fbf\u95ee\u4e0b\u5927\u5bb6\u6709\u6ca1\u6709\u7cfb\u7edf\u8bb2\u89e3\u591a\u6838\u7f13\u5b58\u7684\u4e66\u7c4d\u6216\u8d44\u6599\uff1f<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>24<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5579247\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : RedBlackTree <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u56e0\u4e3a\u8bfb Ardanlabs \u7684 Go Scheduler \u8fd9\u7bc7\u6587\u7ae0\uff08 https:\/\/www.ardanlabs.com\/blog\/2018\/08\/scheduling-in-go-part1.html \uff09\u65f6\uff0c\u8bb2\u5230 cache \u65f6\u8fd9\u4e48\u5199\u9053\uff1a<br \/>If one Thread on a given core makes a change to its copy of the cache line, then through the magic of hardware, all other copies of the same cache line have to be marked dirty. When a Thread attempts read or write access to a dirty cache line, main memory access (~100 to ~300 clock cycles) is required to get a new copy of the cache line.<br \/>\u4fee\u6539 cache line \u5c31\u4f1a\u5bfc\u81f4\u5176\u4ed6 CPU \u7684 cache \u5931\u6548\uff0c\u4f46\u6211\u89c9\u5f97\u4e0d\u662f cache \u4fee\u6539\u5199\u56de\u5185\u5b58\u65f6\u624d\u4f1a\u8fd9\u6837\u5417\uff1f\u4e0d\u7136\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528\u540c\u6b65\u539f\u8bed\u540c\u6b65\u5185\u5b58\u5462\uff1f\u6709\u4e86\u56f0\u60d1\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579248\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kkbblzq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u95ee\u7684\u662f MESI \uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579249\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : kuko126 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             https:\/\/www.bilibili.com\/video\/BV1X54y1Q75J<br \/>\u8fd9\u4e2a\u89c6\u9891\u662f\u8bb2\u7684 java \u7684\uff0c\u91cc\u9762\u7684\u7f13\u5b58\u5931\u6548\u90e8\u5206\u5e94\u8be5\u662f\u4e00\u81f4\u7684\uff0c\u4e0d\u77e5\u9053\u80fd\u4e0d\u80fd\u89e3\u7b54\u4f60\u7684\u7591\u95ee                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579250\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yufpga <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u770b\u770b MESI. cache \u4e00\u81f4\u6027\u534f\u8bae\u5e94\u8be5\u662f\u786c\u4ef6(CPU)\u5b9e\u73b0\u7684, \u4f46\u4e8b\u5b9e\u4e0a\u786c\u4ef6\u8981\u505a\u5230\u5f3a\u4e00\u81f4\u6027\u540c\u65f6\u517c\u987e\u6027\u80fd\u4e5f\u5f88\u96be\uff0c\u6240\u4ee5\u5b9e\u73b0\u4e0a\u4f1a\u5f31\u5316\u4e3a\u6700\u7ec8\u4e00\u81f4\u6027, \u4e00\u822c\u60c5\u51b5\u4e0b\u4e5f\u6ca1\u6709\u592a\u5927\u95ee\u9898, \u4f46\u662f\u5728\u5e76\u53d1\u591a\u6838\u7684\u60c5\u51b5\u4e0b\uff0c\u5728\u67d0\u4e9b\u4e34\u754c\u70b9\u4e0a\u8fd8\u662f\u4f1a\u51fa\u73b0\u6570\u636e\u4e0d\u4e00\u81f4\u7684\u60c5\u51b5. \u6240\u4ee5 CPU \u8bbe\u8ba1\u7684\u65f6\u5019\u63d0\u4f9b\u7ed9\u7a0b\u5e8f\u6216\u8005\u7f16\u8bd1\u5668\u5185\u5b58\u5c4f\u969c\u673a\u5236, \u6765\u5904\u7406\u8fd9\u79cd\u60c5\u51b5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579251\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lewis89 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u4e0b TSO \u5bbd\u677e\u5185\u5b58\u6a21\u578b\uff0c\u591a\u6838\u5e76\u53d1\u7684\u65f6\u5019\uff0c\u80af\u5b9a\u8981\u7528\u673a\u5668\u63d0\u4f9b\u7684 mfence lock \u7b49\u6307\u4ee4\u6765\u8fdb\u884c\u5f3a\u5236\u540c\u6b65                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579252\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : LinSP <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u770b\u4e0b\u8bfb\u5199\u5c4f\u969c\uff1f\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579253\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : LeeReamond <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6709\u610f\u601d\u7684\u8ba8\u8bba\uff0c\u5173\u6ce8\u4e00\u6ce2\u3002\u6211\u7406\u89e3\u4e0e LZ \u6709\u4e00\u4e2a\u4e0d\u540c\uff0c\u5373\u5982\u679c\u6ca1\u6709\u4f7f\u7528\u4efb\u4f55\u540c\u6b65\uff0c\u7ebf\u7a0b B \u5728\u5fd9\u65f6\uff0c\u5373\u4f7f A \u4e2d\u7684\u7f13\u5b58\u88ab\u5237\u56de\u5185\u5b58\uff0cB \u7684\u7f13\u5b58\u4e00\u6837\u4e0d\u4f1a\u88ab\u6807\u8bb0\u4e3a\u5931\u6548\u3002\u610f\u601d\u662f\u5982\u679c B \u4f7f\u7528\u7684\u662f while \u5faa\u73af\u7684\u8bdd\u90a3\u4e48\u4f1a\u6c38\u8fdc\u8fd0\u884c\u4e0b\u53bb                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579254\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Brentwans <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6ca1\u770b\u6587\u7ae0\u57fa\u4e8e\u4f60\u7684\u7591\u95ee\u548c\u7406\u89e3\u3002<br \/>\u8fd9\u4e9b\u884c\u4e3a\u57fa\u4e8e\u5185\u5b58\u6a21\u578b\u7684\uff0c\u5176\u6a21\u578b\u5c31\u662f\u8fd9\u6837\u3002go \u7684\u5185\u5b58\u6a21\u578b\u4e0d\u592a\u4e86\u89e3\uff0c\u4f46\u662f\u6bd4\u5982 java \u7684 volatile \u5173\u952e\u5b57\u7684\u8bed\u4e49\u5c31\u662f\u8be5\u53d8\u91cf\uff0c\u8bfb\u53d6\u4f1a\u653e\u5f03 cache \u4e2d\uff0c\u4ece\u5185\u5b58\u4e2d\u5237\u6570\u636e\u3002\u5199\u4f1a\u5f3a\u5236\u5237\u5230\u5185\u5b58\u3002\u81f3\u4e8e\u5e95\u5c42\u771f\u5b9e\u60c5\u51b5\u5982\u4f55\uff0c\u80af\u5b9a\u4e0d\u540c\u786c\u4ef6\u548c\u7cfb\u7edf\u6709\u4e0d\u540c\u5b9e\u73b0\u3002\u53ea\u8981\u5728 jave \u8fd9\u4e00\u5c42\uff0c\u8868\u73b0\u7684\u662f\u5176\u5b9a\u4e49\u8fd9\u6837\u5c31\u53ef\u4ee5\u4e86\u3002<br \/>\u201c\u4fee\u6539 cache line \u5c31\u4f1a\u5bfc\u81f4\u5176\u4ed6 CPU \u7684 cache \u5931\u6548\uff0c\u4f46\u6211\u89c9\u5f97\u4e0d\u662f cache \u4fee\u6539\u5199\u56de\u5185\u5b58\u65f6\u624d\u4f1a\u8fd9\u6837\u5417\uff1f\u4e0d\u7136\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528\u540c\u6b65\u539f\u8bed\u540c\u6b65\u5185\u5b58\u5462\uff1f\u6709\u4e86\u56f0\u60d1\u201d \u8fd9\u4e2a\u5177\u4f53\u5b9e\u73b0\u6709\u5173\u7cfb\u554a\uff0c\u201c\u4fee\u6539 cache line \u5bfc\u81f4\u4e0e\u4e4b\u76f8\u5173\u7684 line \u5931\u6548\u201d\u5c31\u662f\u8fd9\u6837\u5b9e\u73b0\u7684\u554a\uff0c<br \/>\u800c\u4f60\u8bf4\u7684\u201ccache line \u5199\u56de\u624d\u4f1a\u5bfc\u81f4\u76f8\u5173\u5931\u6548\u201d \u90a3\u662f\u4f60\u7684\u7406\u89e3\u5427\u3002\u8981\u6211\u7ad9\u5728 java \u5185\u5b58\u6a21\u578b\uff0c\u6211\u4f1a\u4e5f\u4f1a\u89c9\u5f97\u4e0d\u601d\u8bae\uff0c\u4e3a\u4ec0\u4e48\u4e00\u4e2a core \u7684 cache line \u5199\u56de\uff0c\u5176\u4ed6 core \u7684\u5c31\u8981\u5931\u6548\u5462\uff1f\u6ca1\u5173\u7cfb\uff0c\u5c31\u662f\u8fd9\u6837\uff0c\u4f60\u521b\u5efa\u7684\u6a21\u578b\u5c31\u662f\u8fd9\u6837\uff0c\u6211\u5982\u679c\u6211\u7528\u4f60\u8fd9\u4e2a\u6a21\u578b\uff0c\u6309\u7167\u4f60\u5236\u5b9a\u7684\u6a21\u578b\u7684\u884c\u4e3a\u4f7f\u7528\u5373\u53ef\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579255\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dalabenba <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             A \u5199\u4e86 v \u4e0d\u52a0\u540c\u6b65\u539f\u8bed\u5bf9 B \u4e0d\u53ef\u89c1\u662f\u771f\u7684\uff0c\u4e0d\u8fc7\u4e0d\u662f\u56e0\u4e3a cache\uff0c\u800c\u662f\u56e0\u4e3a\u53ef\u80fd\u6709\u5176\u4ed6\u7684 write buffer, cache \u4e00\u81f4\u6027\u662f\u7531\u786c\u4ef6\u4fdd\u8bc1\u7684\uff0c\u4e0d\u9700\u8981\u540c\u6b65\u539f\u8bed                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579256\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : liuminghao233 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             arm \u7684\u4e0d\u6e05\u695a<br \/>x86 \u5199\u662f\u6709 buffer \u7684 \u8fd9\u4e2a\u4e0d\u662f l123 \u8fd9\u79cd buffer<br \/>\u4f60\u9700\u8981 mfence \u6765\u6e05\u6389 store buffer \u548c write combining buffer\uff0c\u7136\u540e mesi \u4f1a\u8ba9\u8fd9\u4e2a\u5199\u5bf9\u5168\u90e8 u \u53ef\u89c1                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579257\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : runliuv <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u4f60\u7684\u63cf\u8ff0\uff0c\u548c CPU \u6ca1\u534a\u6bdb\u94b1\u5173\u7cfb\u3002<br \/>\u201c\u5047\u8bbe\u4e24\u4e2a\u7ebf\u7a0b A \u3001B\uff0c\u5171\u4eab\u53d8\u91cf V\u201d\uff0c\u4e00\u770b\u5c31\u662f\u5de5\u4f5c\u5728\u5e94\u7528\u5c42\uff08\u8fdb\u7a0b\uff09\u3002OS \u628a CPU \u5c01\u88c5\u6210\u7edf\u4e00\u7684 CPU \u8d44\u6e90\u7ed9\u5e94\u7528\u3002\u5e94\u7528\u5c42\u4e00\u822c\u6ca1\u529e\u6cd5\u76f4\u63a5\u64cd\u4f5c\u5230 CPU CACHE \u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579258\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : NUT <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u4e71\u8bf4\u7684\uff0c<br \/>\u611f\u89c9\u4e3b\u8bf4\u7684\u6709\u4e9b\u7c7b\u4f3c\u4e8e JMM \u7684\u89c4\u5219\u3002<br \/>java volatile \u662f\u4fdd\u8bc1\u5c5e\u6027\u53ef\u89c1\u6027\uff0c\u7ebf\u7a0b\u6808\u6539\u5b8c\u5c31\u5237\u5230\u4e3b\u5185\u5b58\uff0c\u8bfb\u4e5f\u662f\u4ece\u4e3b\u5185\u5b58\u62ff\uff0c\u5176\u5b9e\u9760\u7684\u7981\u6b62 cpu \u6307\u4ee4\u91cd\u6392\u3002<br \/>\u4f46\u662f volatile \u5e76\u4e0d\u662f\u4fdd\u8bc1 cas \u64cd\u4f5c\u3002<br \/>cas \u662f\u4fdd\u8bc1\u66ff\u6362\u7684\u65f6\u5019\u662f\u671f\u671b\u7684\u6761\u4ef6\uff0c \u5f53\u7136\u4f1a\u51fa\u73b0 aba \u7684\u95ee\u9898\u3002\u4f46\u4e5f\u6709\u65b9\u5f0f\u89e3\u51b3\uff0c\u52a0\u6807\u8bb0\u5457\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579259\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : secondwtq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7f13\u5b58\u4e00\u81f4\u6027\uff08 Cache Coherence \uff09\u4fdd\u8bc1\u7684\u5c31\u662f\u4e0d\u540c cache \u7684\u89c6\u56fe\u662f\u4e00\u6837\u7684\uff0c\u6240\u4ee5\u53ea\u8981\u662f cache coherent \u7684\u7cfb\u7edf\uff0c\u5f53\u4e00\u4e2a cache \u4e2d\u7684\u6570\u636e\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u5176\u4ed6 cache \u4e2d\u5bf9\u5e94\u7684\u6570\u636e\u4e5f\u4f1a\u53d1\u751f\u53d8\u5316\u3002<br \/>\u4e3b\u63cf\u8ff0\u7684\u201c\u7ebf\u7a0b A \u5bf9 V1 \u7684\u4fee\u6539\uff0c\u5e94\u8be5\u5bf9\u5185\u5b58\u548c\u7ebf\u7a0b B \u90fd\u662f\u4e0d\u53ef\u89c1\u7684\uff0c\u76f4\u5230\u672a\u6765\u67d0\u4e00\u65f6\u523b A \u7684 cache \u5237\u56de\u5185\u5b58\uff0cB \u6240\u5728\u7684 CPU2 \u4e2d\u7684 cache line \u624d\u4f1a\u88ab\u6807\u8bb0\u4e3a\u5931\u6548\uff0c\u4e4b\u540e\u624d\u80fd\u8bfb\u5230 A \u5bf9 V \u7684\u4fee\u6539\u201d\u4e0d\u7b26\u5408\u7f13\u5b58\u4e00\u81f4\u6027\u7684\u5b9a\u4e49\u3002<\/p>\n<p>\u4f46\u662f\u5b8c\u5168\u5b9e\u73b0\u8fd9\u4e00\u4fdd\u8bc1\uff0c\u6027\u80fd\u4f1a\u51fa\u95ee\u9898\u2014\u2014\u5904\u7406\u5668\u5728\u6267\u884c store \u64cd\u4f5c\u4e4b\u524d\uff0c\u9700\u8981\u544a\u8bc9\u6240\u6709\u5176\u4ed6\u5904\u7406\u5668\u8fd9\u4e2a cacheline \u88ab invalidate \u4e86\uff0c\u7136\u540e\u8fd8\u9700\u8981\u7b49\u5176\u4ed6\u5904\u7406\u5668\u56de\u590d\uff0c\u624d\u80fd\u5b8c\u6210 store \u64cd\u4f5c\u3002\u4f46\u662f\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u6211\u5e76\u4e0d\u9700\u8981\u7b49\u8fd9\u4e2a store \u3002\u6240\u4ee5\u5c31\u51fa\u73b0\u4e86 store buffer \u7f13\u5b58 store \u64cd\u4f5c\uff0c\u4f46\u662f\u4e3a\u4e86\u4fdd\u8bc1\u672c\u5904\u7406\u5668\u7684\u7a0b\u5e8f\u987a\u5e8f\u6b63\u5e38\uff0cstore buffer \u5fc5\u987b\u914d\u5408 load-to-store forwarding\uff0c\u7136\u540e\u5c31\u51fa\u73b0\u4e86\u672c\u5904\u7406\u5668\u548c\u5176\u4ed6\u5904\u7406\u5668\u6240\u611f\u77e5\u5230\u7684\u7a0b\u5e8f\u987a\u5e8f\u4e0d\u4e00\u6837\u7684\u95ee\u9898\uff0c\u4ee5\u53ca\u53ef\u89c1\u6027\u7684\u95ee\u9898\u3002<br \/>\u518d\u5f80\u540e\u53bb\u770b Memory Barriers: a Hardware View for Software Hackers<\/p>\n<p>\u5f53\u7136\u597d\u50cf\u5728\u5404\u8def Java \u6559\u6750\u4e2d\uff0c\u201c\u61d2\u5f97\u5237\u8fdb\u4e3b\u5b58\u7684 \u2018cache\u2019\u201d\u4e8b\u5b9e\u4e0a\u66ff store buffer \u4e4b\u7c7b\u7684\u4f18\u5316\u80cc\u4e86\u9505\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579260\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : secondwtq <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @secondwtq s\/load-to-store forwarding\/store-to-load forwarding<br \/>\u8fd8\u6709\u5fd8\u4e86\u8bf4 &#8230; \u56e0\u4e3a store buffer \u7684\u5b58\u5728\uff0c\u4e00\u822c\u7684 store \u64cd\u4f5c\u5728\u4e0d\u586b\u6ee1 store buffer \u7684\u524d\u63d0\u4e0b\u7684\u5f00\u9500\u662f\u5f88\u5c0f\u7684\uff0c\u548c load \u5dee\u8fdc\u4e86\u3002<\/p>\n<p>\u201c\u8bbf\u95ee\u5171\u4eab\u53d8\u91cf\u9700\u8981\u540c\u6b65\u539f\u8bed\u201d\u53ea\u662f\u56e0\u4e3a\u5185\u5b58\u6a21\u578b\u4e0d\u4fdd\u8bc1\u672a\u4fdd\u62a4\u7684\u8bbf\u95ee\uff0c\u8fd9\u662f\u6982\u5ff5\u5c42\u9762\u800c\u975e\u5b9e\u73b0\u5c42\u9762\u7684\u95ee\u9898\u3002\u5f53\u7136\u5185\u5b58\u6a21\u578b\u662f\u7efc\u5408\u8003\u8651\u8f6f\u4ef6\u9700\u6c42\u548c\u786c\u4ef6\u5b9e\u73b0\u624d\u63d0\u51fa\u7684\uff0c\u6240\u4ee5\u6298\u817e\u5b9e\u73b0\u4e5f\u662f\u6709\u7528\u7684\u3002<\/p>\n<p>\u636e\u8bf4 ARM \u5df2\u7ecf\u5728\u67b6\u6784\u5c42\u9762\u52a0\u5165\u4e86\u76ee\u524d\u6700\u6d41\u884c\u7684 sequential consistency \u6a21\u578b\uff0c\u4e0d\u77e5\u9053\u6548\u679c\u5982\u4f55\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579261\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jooooooooo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5dee\u4e0d\u591a\u662f\u4f60\u8bf4\u7684\u90a3\u6837, \u53ef\u4ee5\u641c\u4e0b MESI                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579262\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Orlion <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             4 \u6b63\u89e3\u3002\u6b63\u597d\u524d\u6bb5\u65f6\u95f4\u6211\u4e5f\u6df1\u5165\u7814\u7a76\u4e86\u8fd9\u4e2a\u95ee\u9898\uff0c\u5e76\u4e14\u6574\u7406\u6210\u4e86\u4e00\u7bc7\u535a\u5ba2: https:\/\/blog.fanscore.cn\/p\/34\/ \u4e3b\u53ef\u4ee5\u53c2\u8003\u4e0b\uff0c\u6216\u8bb8\u5bf9\u4f60\u6709\u5e2e\u52a9                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579263\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : sfqtsh <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b IBM \u7684 PDF: <br \/>Memory Barriers: a Hardware View for Software Hackers                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579264\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : byaiu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u540c\u6b65\u539f\u8bed\u5e94\u8be5\u662f\u4fdd\u8bc1\u8bfb\u5199\u7684\u64cd\u4f5c\u80fd\u63a8\u5230 mesi \u7684\u63a5\u53e3\u4e0a\u53bb\uff0c\u4e4b\u540e\u5c31\u7531\u786c\u4ef6\u6765\u4fdd\u8bc1\u4e00\u81f4\u6027\u4e86\u3002<\/p>\n<p>\u63a8\u800c memory order \u662f\u5230 mdsi \u4e4b\u524d\u7684\u8003\u91cf\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579265\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xcstream <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u201c\u4e0d\u8981\u901a\u8fc7\u5171\u4eab\u5185\u5b58\u6765\u901a\u4fe1\uff0c\u800c\u5e94\u8be5\u901a\u8fc7\u901a\u4fe1\u6765\u5171\u4eab\u5185\u5b58 \u201c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579266\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : surbomfla <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @xcstream \u8001 gopher \u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579267\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : GrayXu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u611f\u89c9\u4e0a\u9762\u5927\u5bb6\u8bb2\u7684\u7f13\u5b58\u4e00\u81f4\u6027\u5b9e\u73b0\u597d\u50cf\u662f\u4e0d\u540c level \u7684\u2026\u5728 CPU \u7684\u89d2\u5ea6\u6765\u8bf4\uff0cMESI \u5b9e\u73b0\u5c31\u662f\u8fd9\u6837\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579268\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wangliran1121 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u300a Memory Barriers: a Hardware View for Software Hackers \u300b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579269\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wangliran1121 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8ba8\u8bba\u8fd9\u4e2a\u95ee\u9898\u4e0d\u80fd\u629b\u5f00 CPU \u67b6\u6784                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5579270\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Dganzh <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u521a\u770b\u6bdb\u5251\u7684\u8bfe\u7a0b\uff0c\u8bb2\u5230 The Go Memory Model\uff0c\u7136\u540e\u5c31\u5237\u5230\u8fd9\u91cc\uff0c\u8fd9\u662f\u5de7\u5408\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf7\u6559\u5927\u5bb6\u5173\u4e8e\u591a\u6838\u5e76\u53d1\u7f16\u7a0b\u4e2d\uff0c ca&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/418653"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=418653"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/418653\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=418653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=418653"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=418653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}