# I/O ordering 學習記錄 ## 心得紀錄 2022 6月 本身對於作業系統了解的還不夠完整,只有一些基礎的知識,在看這支[影片](https://www.youtube.com/watch?v=ULFytshTvIY)時很痛苦,很多都看不懂,後來是看了 jserv 老師的[多核處理器相關議題](https://youtu.be/HWFLjMIjiB4?t=8330)才稍微有些了解。建議搭配著投影片一起看。 ## 筆記 參考影片[Linux-Kernel Memory Ordering: Help Arrives At Last!](https://www.youtube.com/watch?v=ULFytshTvIY) 、 [投影片](http://www.rdrop.com/users/paulmck/scalability/paper/LinuxMM.2017.04.08b.Barcamp.pdf) 參考投影片 [Uh-oh; it’s I/O ordering!](https://elinux.org/images/a/a8/Uh-oh-Its-IO-Ordering-Will-Deacon-Arm.pdf) ```graphviz digraph g { rankdir = "RL"; "cpu0" [label= "CPU0 | a: WRITE_ONCE(*x, 1); | b: foo = READ_ONCE(*y);", shape="record"]; "cpu1" [label= "CPU1 | c: WRITE_ONCE(*y, 1); | d: bar = READ_ONCE(*x);", shape="record"]; cpu1->cpu0 [color=white] } ``` 註 :$^*x$, $^*y$ 在記憶體裡,初始值為 0,`foo`, `bar` 是 local variable 因為看到指令的順序有可能會對調,*x 跟 *y 是不同的地址,編譯器可能會認為說指令沒有相依性就有可能會將指令重排順序(reorder)。去模擬、試驗,產生一段程式在一段時間內一直跑,跑到不同的結果為止。這工具最主要的目的就是讓我們更清楚程式的順序。  $^*u0$ 與 $^*v0$ 地址不同 `smp_mb()` : memory barries,barries 英文意思指的是籬笆、需跨過之意 以此圖為例,加入 `smp_mb()` 代表 write 一定要在 read 之前完成,則 $^*v0$ 的值必定是1。 參考資料 : [acquire release memory ordering](https://levelup.gitconnected.com/memory-model-basic-d8b5f8fddd5f)、[model checking](https://hackmd.io/@sysprog/concurrency/https%3A%2F%2Fhackmd.io%2F%40sysprog%2Fconcurrency-model-checking) Model checking : 一種形式化驗證 ## diy7 實作
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up