Advanced
C#
Q97 / 100
What is the .NET Memory Model and how does it differ from the JMM?
Correct! Well done.
Incorrect.
The correct answer is B) The .NET Memory Model uses volatile reads/writes and Interlocked for synchronization. volatile in C# is weaker than Java — it does not guarantee ordering of other memory operations
B
Correct Answer
The .NET Memory Model uses volatile reads/writes and Interlocked for synchronization. volatile in C# is weaker than Java — it does not guarantee ordering of other memory operations
Explanation
C# volatile prevents read/write reordering for that specific variable but doesn't have Java's full happens-before guarantee for surrounding operations. Use Thread.MemoryBarrier() or Interlocked for stronger guarantees.
Progress
97/100