Slowing down your CPU
Hey everyone! I have a question about something I''m doing. I recently came across a neat little program called CPUKiller. Some of you might have come across it too. Basically it slows down your CPU so that you can run older programs that run too fast on newer faster computers. Anyhow I was thinking about how I would go about doing this. I created a little program that simply detects user input via the arrow keys and creates a certain number of threads that count to 100 or so. This serves to slow down the CPU, the only thing is it is not as stable as the program CPUKiller. I get little spats in time where my game speeds up then slows down, creating a jerky like motion sometimes. Is this the right approach? the only other alternative that I can think of would be to reduce the amount of memory available to windows by having another little program allocate alot of memory for "bogus" things like objects, etc.. would this work and be a little more stable than the thread approach? Any input would be very much appreciated as I''m trying to figue this thing out...
Thanks!!
~Bolt
If you''re trying to slow down your own program, forget about it and implement framerate-independent motion.
No, I''m not trying to slow down my program. I''m trying to slow down my machine (CPU) so that other programs will INTENTIONALLY run slow. (hehe) kinda funny trying to make the computer run slow, but that''s what I want it to do.,.
quote:Original post by Boltimus
the only other alternative that I can think of would be to reduce the amount of memory available to windows by having another little program allocate alot of memory for "bogus" things like objects, etc.. would this work and be a little more stable than the thread approach?
No. That would just increase the amount of paging, and would not provide a ''stable'' slowdown.
Change the settings in BIOS, the multiplier and FSB speeds. That is of course if you''re bios lets ya do that and yer cpu isn''t locked as some are so u could only change the FSB if that was the case. I guess u want to do it with software not hardware, but it would work just fine.
Another program that does that is moslow. If you are intent on making your own I would suggest this as a much more stable way of sucking cycles. Have one thread that is set to the highest priorities. Check out SetThreadPriority and SetPriorityClass api''s. Then burn time in a loop and check a high res timer often. Every so often you should Sleep(). By timing how long you run vs. how much time has elapsed you should be able with a little tweaking to tell it what percentage of processor time to take.
Jack
Jack
just create a SINGLE realtime thread which MUST call sleep at regular intervals (ie give up some timeslice). realtime priority is VERY dangerous so use caution when testing.
This is just a thought I had while reading your post. I think it would be pretty difficult to get this to work right, but you could write your program to use the debugging facilities of the cpu (and the OS). For example, set the CPU to break after each instruction and then you could implement a short delay or something. I think this would give you the most exact control over how fast the other program is running. This will of course not slow down everything on your computer, only the program that your ''speedkiller'' is attached to.
As I said, just a thought, I don''t know much about writing debuggers for windows.
As I said, just a thought, I don''t know much about writing debuggers for windows.
quote:Original post by Boltimus
Hey everyone! I have a question about something I''m doing. I recently came across a neat little program called CPUKiller. Some of you might have come across it too. Basically it slows down your CPU so that you can run older programs that run too fast on newer faster computers. Anyhow I was thinking about how I would go about doing this. I created a little program that simply detects user input via the arrow keys and creates a certain number of threads that count to 100 or so. This serves to slow down the CPU, the only thing is it is not as stable as the program CPUKiller. I get little spats in time where my game speeds up then slows down, creating a jerky like motion sometimes. Is this the right approach? the only other alternative that I can think of would be to reduce the amount of memory available to windows by having another little program allocate alot of memory for "bogus" things like objects, etc.. would this work and be a little more stable than the thread approach? Any input would be very much appreciated as I''m trying to figue this thing out...
Thanks!!
~Bolt
I am not entirely sure how these programs work, but I would guess they either make some modification to system setting or they just tie up CPU time. Of course you wouldn''t have to worry about it the original program had based the speed of his game on something like the system timer instead of how fast the CPU can a loop.
Thanks for all those ideas! I never thought about the sleep idea let alone setting one thread that has a high priority! Every so often I would keep getting a seg fault.. hehe Also even when one thread was made it would really slow down my CPU too much..I like the idea of timing the thread then giving control back to windows. I''ll try a combination of all the recomendations and see what works! thx!!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement