Accidental slowdown in multithreading

We have a multi-threaded task-based engine in which the scheduler submits the task to a thread blocking queue. The engine is in C ++ with DirectX for rendering and we are using boost :: thread to create threads. When in windowed mode it randomly slows down for a second or so and then speeds up the backup. This seems to be what Vista seems to be, but we can't figure out how to properly resolve it.

One thing we tried to do that seemed to help with random slowdowns was that the thread is a millisecond after processing each task, but causes other problems and is not a great solution.

+2


source to share


2 answers


The first thing I would recommend doing is understanding what is causing the slowdown through profiling.

Throwing in random dreams is rarely a good idea (speaking of experience here, yes, I did it, and yes, I fixed it later), and doesn't speculate on performance issues, especially in a multi-threaded environment.



Visual Studio 2010 beta1 has a great profiler that's perfect for understanding what's causing the slowdown if it's in your application, the Hazim Shafi blog how to use it.

You can also have a look at the xperf tool that is available in Windows productivity tools (you have to use the platform sdk installer, but you only need to install this node to make it pretty fast).

+1


source


Have you tried using the same code under XP and Windows 7?



I have multi-threaded code that displays screen compatible bitmaps. Each stream displays its own compatible bitmap. However, for some odd reason, this figure is adopting AGES on Vista. I lose over 50% of my processing time before GDI rendering. In Win 7 and XP I have no such problems. Interestingly, I came across this article , which means that multithreading of GDI rendering under Vista is hopelessly broken. At some point I will try to come up with a method where all the rendering is done by my main thread, rather than from the sub threads, to see if Vista is improving performance. It would be a huge nightmare of stuff to code, although my main market is using XP, so I'm not al; who was fussing at the moment ...

0


source







All Articles