Discussion on:

Message 16 of 51
0 Votes
+ -
Stutter thread
I may be mis-understanding your use of the stutter thread, but it sounds like you are trying too hard. It sounds like you are trying to create an additional thread that doesn't to as much work so that it will have some 'free time' - as though it will be getting an equal share of CPU time, and can then 'donate' half of it's share of CPU time to other processes.

I don't think you should make any assumptions about the number of CPUs/Cores available. Just user the appropriate number of threads for the work. And don't try to 'grab CPU cycles' that you don't need to create a 'processing reserve'. Just prioritize your heavy, time-consuming work below normal and let the windows scheduler take care of how CPU cycles are divied up between your threads and between your app and others that may be running - it will anyway.

I think your stutter thread will either have no effect, or may simply result in some unused CPU cycles. It may make your CPU usage graph look like cylces are available, but that doesn't mean another process/app could use them to do work.

Granted thread scheduling adds overhead to any multi-threaded project. I'd bank on the provided thread scheduler doing that work more efficiently and more effectively than what you are building. And it isn't like you can replace the thread scheduler anyway. What you build will run 'in addition to' the thread scheduler.

-D
Posted by davidsaylor@...
8th Oct 2007