久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

我什么時候應該使用 _mm_sfence _mm_lfence 和 _mm_mfe

When should I use _mm_sfence _mm_lfence and _mm_mfence(我什么時候應該使用 _mm_sfence _mm_lfence 和 _mm_mfence)
本文介紹了我什么時候應該使用 _mm_sfence _mm_lfence 和 _mm_mfence的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我閱讀了英特爾架構的英特爾優化指南指南".

I read the "Intel Optimization guide Guide For Intel Architecture".

然而,我仍然不知道我應該什么時候使用

However, I still have no idea about when should I use

_mm_sfence()
_mm_lfence()
_mm_mfence()

誰能解釋一下在編寫多線程代碼時應該何時使用這些?

Could anyone explain when these should be used when writing multi-threaded code?

推薦答案

警告:我不是這方面的專家.我仍在嘗試自己學習這一點.不過這兩天沒有人回復,看來內存柵欄指令的高手并不多.所以這是我的理解......

Caveat: I'm no expert in this. I'm still trying to learn this myself. But since no one has replied in the past two days, it seems experts on memory fence instructions are not plentiful. So here's my understanding ...

英特爾是一個弱序內存系統.這意味著你的程序可能會執行

Intel is a weakly-ordered memory system. That means your program may execute

array[idx+1] = something
idx++

但是在更改為 array 之前,對 idx 的更改可能是全局可見的(例如,對于在其他處理器上運行的線程/進程).在兩個語句之間放置圍欄將確保寫入發送到 FSB 的順序.

but the change to idx may be globally visible (e.g. to threads/processes running on other processors) before the change to array. Placing sfence between the two statements will ensure the order the writes are sent to the FSB.

與此同時,另一個處理器運行

Meanwhile, another processor runs

newestthing = array[idx]

可能已經緩存了 array 的內存并且有一個陳舊的副本,但是由于緩存未命中而獲得更新的 idx.解決方案是預先使用圍欄來確保負載同步.

may have cached the memory for array and has a stale copy, but gets the updated idx due to a cache miss. The solution is to use lfence just beforehand to ensure the loads are synchronized.

本文 或 這篇文章可能會提供更好的信息

This article or this article may give better info

這篇關于我什么時候應該使用 _mm_sfence _mm_lfence 和 _mm_mfence的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

What is the fastest way to transpose a matrix in C++?(在 C++ 中轉置矩陣的最快方法是什么?)
Sorting zipped (locked) containers in C++ using boost or the STL(使用 boost 或 STL 在 C++ 中對壓縮(鎖定)容器進行排序)
Rotating a point about another point (2D)(圍繞另一個點旋轉一個點 (2D))
Image Processing: Algorithm Improvement for #39;Coca-Cola Can#39; Recognition(圖像處理:Coca-Cola Can 識別的算法改進)
How do I construct an ISO 8601 datetime in C++?(如何在 C++ 中構建 ISO 8601 日期時間?)
Sort list using STL sort function(使用 STL 排序功能對列表進行排序)
主站蜘蛛池模板: 成人一区二区三区在线观看 | av永久免费| 欧美在线观看一区 | 免费性视频| 国产精品国产三级国产播12软件 | 日韩在线一区二区三区 | 日本午夜一区 | 国产精品久久一区二区三区 | 亚洲毛片在线观看 | 日本a网站| 999精品在线观看 | 成人精品在线视频 | 成人免费一区二区三区视频网站 | 欧美日韩中文字幕 | 久久天堂网 | 四季久久免费一区二区三区四区 | 精品视频在线免费观看 | www.亚洲视频.com | 日韩在线观看视频一区 | 亚洲一区二区三区四区五区午夜 | 成人小视频在线免费观看 | 午夜精品久久久久久久久久久久久 | 亚洲欧美一区二区三区视频 | 人人爱干 | 日本久久黄色 | 狠狠操av | 日韩欧美在线一区 | 蜜桃视频在线观看免费视频网站www | 日韩一区二区视频 | 免费一级黄色电影 | 色一级片| 福利片在线观看 | 亚洲精品乱码久久久久久按摩 | 成人亚洲 | 韩国主播午夜大尺度福利 | 91视频一区 | 老司机深夜福利网站 | 成人免费小视频 | 国产精品美女久久久久aⅴ国产馆 | 九九亚洲 | 成人午夜激情 |