Thread: [GD-General] responsive threading
Brought to you by:
vexxed72
From: Andras B. <and...@gm...> - 2005-07-29 17:43:56
|
I'm developing a graphics application, that I want to be very responsive, very smooth, all the time! The rendering is pretty simple, the framerate is high and stable, so I just lock to vsync, and everything moves beautifully smooth! The CPU usage for this thread is always below 10%. However, I also have another thread, that has to do some heavy work. This thread does tons of IO operations, and also makes the CPU sweat! There is no synchronization between the two threads, so they should be able to run independently. Still, I'm experienceing sudden spikes in the framerate, when the second thread is really hammering. What could be the reason for this? Is it possible to do something about it, to regain the continuous framerate? I'm really not interested in the performance of the second thread, I just want my first thread to run as smooth as possible! I've tried lowering the priority for the second thread, and it does help, but there are still some spikes. Is it possible that it's Windows itself doing some operations at higher priority, like memory management, IO stuff, and the likes? Thanks, Andras |
From: Jamie F. <ja...@qu...> - 2005-07-29 18:57:15
|
Our experience is that you're never going to get that to work, Windows thread management just isn't good enough. You should be able to get further with fibres. Jamie Andras Balogh wrote: > I'm developing a graphics application, that I want to be very > responsive, very smooth, all the time! The rendering is pretty simple, > the framerate is high and stable, so I just lock to vsync, and > everything moves beautifully smooth! The CPU usage for this thread is > always below 10%. > > However, I also have another thread, that has to do some heavy work. > This thread does tons of IO operations, and also makes the CPU sweat! > > There is no synchronization between the two threads, so they should be > able to run independently. Still, I'm experienceing sudden spikes in the > framerate, when the second thread is really hammering. What could be the > reason for this? Is it possible to do something about it, to regain the > continuous framerate? I'm really not interested in the performance of > the second thread, I just want my first thread to run as smooth as > possible! I've tried lowering the priority for the second thread, and it > does help, but there are still some spikes. Is it possible that it's > Windows itself doing some operations at higher priority, like memory > management, IO stuff, and the likes? > > Thanks, > > > Andras > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies > from IBM. Find simple to follow Roadmaps, straightforward articles, > informative Webcasts and more! Get everything you need to get up to > speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > Gamedevlists-general mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-general > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=557 |
From: Andras B. <and...@gm...> - 2005-08-04 19:13:02
|
It turns out that all the spikes were my fault. I'm deeply ashamed.. I have failed to follow the most important rule of all, that says: profile first! I was pretty sure my application was not the one causing the stalls, since when I turned the other thread off, I got no spikes at all.. What happened is that I also called another small 3rd party library from my main thread, but only when the other thread was also running. This library converts coordinates between different projections (this is a mapping software), and it seems like that sometimes it takes a pretty long time to do this operation, that I assumed to be basically free. Now I'm going to dive into this library, to see what's going on. I think I've learned my lesson: PROFILE, PROFILE, PROFILE! DO NOT MAKE ASSUMPTIONS! EVER! Thanks, Andras Andras Balogh wrote: > I'm developing a graphics application, that I want to be very > responsive, very smooth, all the time! The rendering is pretty simple, > the framerate is high and stable, so I just lock to vsync, and > everything moves beautifully smooth! The CPU usage for this thread is > always below 10%. > > However, I also have another thread, that has to do some heavy work. > This thread does tons of IO operations, and also makes the CPU sweat! > > There is no synchronization between the two threads, so they should be > able to run independently. Still, I'm experienceing sudden spikes in the > framerate, when the second thread is really hammering. What could be the > reason for this? Is it possible to do something about it, to regain the > continuous framerate? I'm really not interested in the performance of > the second thread, I just want my first thread to run as smooth as > possible! I've tried lowering the priority for the second thread, and it > does help, but there are still some spikes. Is it possible that it's > Windows itself doing some operations at higher priority, like memory > management, IO stuff, and the likes? > > Thanks, > > > Andras |