Java記憶體模型FAQ(二) 其他語言,像C++,也有記憶體模型嗎?

喝水會長肉發表於2021-12-02

大部分其他的語言,像C和C++,都沒有被設計成直接支援多執行緒。這些語言對於發生在編譯器和處理器平臺架構的重排序行為的保護機制會嚴重的依賴於程式中所使用的執行緒庫(例如pthreads),編譯器,以及程式碼所執行的平臺所提供的保障。


《Java記憶體模型FAQ(一) 什麼是記憶體模型》


原文

Do other languages, like C++, have a memory model?

Most other programming languages, such as C and C++, were not designed with direct support for multithreading. The protections that these languages offer against the kinds of reorderings that take place in compilers and architectures are heavily dependent on the guarantees provided by the threading libraries used (such as pthreads), the compiler used, and the platform on which the code is run.


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70010294/viewspace-2845374/,如需轉載,請註明出處,否則將追究法律責任。

相關文章