Visual Studio Tip: Show Threads in Source

Tuesday, May 29, 2012

Debugging multithreaded applications is always hard, so any help we can get from the debugger is appreciated. Here’s one tip that can help using Visual Studio 2010 when many threads are running at the same time, some of which run similar code.It’s tedious to lookup each thread’s call stack to see where its next instruction pointer is located. Here’s the Threads window in action: To find the actual source line each thread is at the breakpoint moment, we’ll need to switch to that thread by double clicking it in the Threads window and then we’ll see something like...

A Thread’s Stack

Wednesday, September 16, 2009

When creating threads, we don’t usually think of its stack size. In the native world, the CreateThread function accepts a stack size (second argument) which we usually pass as 0. In the managed world, the Thread class exposes a pair of constructors expecting a stack size argument (which I was reminded by a comment). Why is this important? Creating threads has its costs. This is not only the added work the Windows scheduler must undertake or the data structures that must be allocated in the kernel to manage that thread (KTHREAD, ETHREAD, etc.). Even if the threads are...
280 comments

Microsoft HPC Server 2008 and Parallel Techniques

Wednesday, July 15, 2009

The multi-core mini-revolution signalled the rise of multithreading techniques being discussed more vigorously, as the exploitation of multiple cores is no longer the reach of a few individuals, but is as common as the computer itself. Another way to get performance scalability is simply to use multiple machines, running some application or parts of it at the same time, hopefully distributing the workload appropriately and communicating if and as required to get the final result. Combining the two techniques (multiple cores and multiple machines) can be even more powerful. I have been recently introduced to the Microsoft...