Which managed memory model?

In this article, Vance Morrison describes some of the issues involved in writing managed multithreaded code that avoids the use of locks.  In particular, he discusses the impact of memory models on lock-free (or low-lock) programming. For managed code running on the CLR, there are two models that matter: The ECMA CLI memory model The…

1

What synchronization primitives would you like to have in the .NET Framework?

The .NET framework currently offers several synchronization primitives: Monitors (via the Monitor class.  C# users know this as the “lock” statement) Two varieties of reader/writer lock (ReaderWriterLock / ReaderWriterLockSlim) Events (ManualResetEvent/AutoResetEvent) Mutexes (for inter-process locking) Semaphores Static constructors (which synchronize initialization of a class) We also provide some basic building blocks for rolling your own…

0

Fun programming problem: a simple lock-free algorithm

Can the program below ever print “oops?”    #include <stdio.h> #include <process.h>   struct Globals {     volatile int start;     int a;     int b;     volatile int end; };   Globals globals;   void WriterThread(void*) {     int i = 0;     while (true) {         globals.start = i;         globals.a = i;…

3

Welcome

Welcome to my new blog.  I just moved to the Common Language Runtime team here in rainy Redmond, after spending nearly seven years in sunny California developing storage services for Hotmail (now Windows Live Mail).  Luckily, I spent three years prior to that here in Redmond developing tests for Windows 2000, during which time I learned to love…

0