The C# Memory Model

 

不妨,可以先看看java的内存模型,然后再来看后续的英文;效果可能要好一些!

 

http://blog.csdn.net/it_dx/article/details/70045286?locationNum=4&fps=1

 

先要看这个:

https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/acquire-and-release-semantics

然后:

http://www.albahari.com/threading/part4.aspx

然后:

https://msdn.microsoft.com/en-us/magazine/jj863136.aspx

 

https://msdn.microsoft.com/en-us/magazine/jj883956.aspx

 

https://www.codeproject.com/Articles/37282/Memory-Model-Memory-Barrier-and-Singleton-Pattern

 

note1:

 

    This means (in our case) that you can run .NET code on any CPU which has a CLR, and so long as you follow the rules of the memory model, you should be okay !

 

note2:

  "strong" or "weak" the memory model of the hardware itself is

 A "strong" memory model is one which guarantees a lot; a "weak" model is one which doesn't guarantee much at all, often giving better performance but requiring more work on the part of the developer

 

note3:

   when you have access to shared data, you need to make sure you read fresh data

 

posted @ 2018-01-28 15:39  咕-咚  阅读(222)  评论(0编辑  收藏  举报