Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Sebastian Burckhardt - Data Race Detection with CHESS

22 minutes, 7 seconds


Right click “Save as…”

Sebastian Burckhardt gives a short tutorial of some of the new features of CHESS: data race detection and ChessBoard. CHESS is a concurrency testing tool takes a concurrent unit test and executes it with different thread schedules. Sebastian explains us how CHESS can detect data races, a very subtle kind of concurrency bug. You'll also learn how to drill into concurrency issues using the ChessBoard, a little application designed to drill and investigate concurrent tests.

The Research in Software Engineering team (RiSE) coordinates Microsoft's research in Software Engineering in Redmond, USA.


Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
  • Allan LindqvistaL_ Kinect ftw

    cool stuff Smiley

    but im a little bit confused.. why didnt the old chess find this bug? if it ran with all the combinations of context switches, wouldnt the assert be false?

  • CHESS only places schedule points at synchronization points (calls to System.Threading API, volatiles, interlocked increments). So you need data race detection to uncover more bugs. CHESS now has an option /preemptaccesses that places schedule points before every read/write. However, as currently implemented, this has high overhead.

    -- Tom

  • I spent a couple of time to build a good, working solution for .NET 2.0 / 3.5, so you do not need to wait and install .NET 4.0

    Can you test it using CHESS?


        public abstract class PluginBaseWorkItem<T>


            private static object _sync = new object();

            private T _item;

            public T Item { get { return _item; } }

            public void Run()


                List<WaitHandle> _waitHandles = new List<WaitHandle>();

                for (int i = 0; i < TaskCount; i++)


                    _waitHandles.Add(new AutoResetEvent(false));


                for (int i = 0; i < TaskCount; i++)


                    ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessHandle), _waitHandles[i]);




            protected abstract void ProcessItem();

            protected void SetValue(T item)


                _item = item;


            protected T GetValue()


                return _item;


            protected virtual int TaskCount { get { return Environment.ProcessorCount; } }

            private void Process()




            private void ProcessHandle(object sync)


                AutoResetEvent waitHandle = (AutoResetEvent)sync;






             private class WorkItem : PluginBaseWorkItem<Puzzle>


                protected override void ProcessItem()


                    DlxEngine engine = new DlxEngine();

                    Puzzle value = engine.Generate(20);

                    lock (this)


                        Puzzle item = GetValue();

                        if (item == null || value.Rating > item.Rating)








            public static IPuzzle Create()


                WorkItem workItem = new WorkItem();


                IPuzzle puzzle = workItem.Item;

                return Create(puzzle.Text, puzzle.Seed);


  • garrettvmgarrettvm garrett

    Excellent post! Great use of Picture-in-picture technology. Improves user experience a lot


    seems to be a bug in the comment recording. my comment box showed up blank while the comment showed up under hack2roothotmai??!!

  • I tested it, it works !
    Many thanks for this excellent post !!!

  • Good job ... thank you for this help.

Remove this comment

Remove this thread


Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.