久久久久久久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 | 在线一级片| 国产在线中文字幕 | 欧美视频二区 | 午夜免费在线 | 亚洲综人网 | 又黄又爽网站 | 看一级黄色片 | 久久国产小视频 | 在线观看一区 | 长河落日| 97在线超碰 | 久热伊人| 少妇一级淫免费观看 | 国产精品1区2区3区 国产黄在线观看 | 在线免费看毛片 | 国产精品二区一区二区aⅴ污介绍 | 在线观看二区 | 国产精品国产精品国产专区不卡 | a视频 | 日韩欧美精品在线观看 | 国产黄色免费视频 | 成人午夜视频在线观看 | 日皮视频在线观看 | 超碰777| 麻豆中文字幕 | 麻豆一区二区三区四区 | 欧美日韩成人在线观看 | 亚洲精品成人 | 一级黄色片视频 | 久久色av| 欧美aaaaa| 国产性生活视频 | 日本欧美在线 | 日韩一区二区三区在线 | 国产精品日韩精品 | 久久久久毛片 | 欧美精品区 | 久久av免费 | 国产精品羞羞答答 |