Sign in to follow this  

Set priority

This topic is 3311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Are you referring to the process' scheduling priority? If so, it's architecture-specific... which OS are you targeting? BTW, changing a program's priority usually has very little effect on its performance... what are you using it for?

Share this post


Link to post
Share on other sites
"I just bought a Ferrari; how do I convince the local law enforcement to let me drive faster?"

Process priority is a concept belonging to the operating system. You will need to do something specific depending on which OS you have, and you might not necessarily be allowed to do it from within the program (or it may depend on which user/account runs the program).

Share this post


Link to post
Share on other sites
Quote:
Original post by Sneftel
If the program is using a lot of processor time, it's going to affect things no matter what the priority is.


While true, there's no reason why a long-running task cannot be assigned low priority, so user doesn't notice it. They will only become immediately noticable if they use disk, use extensive memory to cause paging, or hog some other resource, such as network.

Often, there's no need to modify the application at all. Just tell your OS to start the application in a certain way. See here for examples.

Share this post


Link to post
Share on other sites
Quote:
Original post by KontosHarry
Cause I am making a program which needs to run at startup and it should not affect the CPU much...



Well , why you don't just execute functions at fixed time ??

For example , in your (imaginary)"proccess()" function , add something similar to this:



type application::proccess(arguments ?)
{
time_now = get_time_in_milliseconds
dt = (time_now - last_time)
last_time = time_now
cycles += (uint)(1*(uint)dt)
if(cycles >= 1000)
{
update stuff
cycles = 0
}


}




It should work pretty well...

Share this post


Link to post
Share on other sites
Antheus generally told you the right thing to do.

However, you can simulate this by using a low-priority thread doing the job. At least in .NET is very easy and I've tested it - it really works. If you do it in C++, you can always make the thread sleep a while :D. But multithreading is by far the easiest way to go programatically.

Share this post


Link to post
Share on other sites

This topic is 3311 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this