-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
關於 SHM 沒有加上 volatile 這件事 #97
Comments
我想應該是要加才對? XD |
恩... 感覺直接改一行的話效能會降低 |
若要更謹慎的話,應可加上 ISO C11 的 因為 lock-free atomic 像 References:
|
SHM 是一整個 data structure ,沒辦法用 |
用在當作 synchronization lock 的變數上面。 |
那是完全另一回事了。SHM 現在就是沒有 lock |
不過在
Lines 533 to 537 in 86f1574
Lines 562 to 566 in 86f1574
以及其它名字帶 這些 members 就適合使用 |
Lines 430 to 455 in 86f1574
Like this. |
Not jut SHM, I think we need to add volatile to all cache.c variables:
although, since we have never see issues so far, I'd assume the compiler is smart enough to figure hat shm, bcache, and currutmp are non-cacheable pointers. |
Figuring out which global pointers point to non-cacheable contents is theoretically impossible without using link-time optimization (LTO). Enabling LTO requires the flag Not every code which accesses the data pointed by these pointers is compiled with the code which makes these pointers point into the shared memory. These codes are linked together instead of being compiled together, so the compiler is unable to figure out such usages at compile-time. The reason why issues have not been observed should be because there have been efforts to reduce the frequency of writing into shared memory in the PttBBS codebase. Writes into shared memory are more restricted and secured in PttBBS compared to the most of other MapleBBS-family BBSes, although the race condition issues due to the time-slicing scheduling of Linux and especially multi-processor environments (which cannot be solved by using Note: The shared-memory–"caching" issue is about caching into the register of the processor (which |
目前遇到的問題:
沒有,只是想確認。
在 var.c:L397 當中的 SHM 理論上應該要加上 volatile 來保護? 避免其他 Process 存取時因為編譯器優化所以讀到舊的值。
The text was updated successfully, but these errors were encountered: