Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Does increasing the priority of a thread cause it to finish it's work faster?
Posted

Maybe. Maybe not.

It won't make it run any slower, but that's about all you can say!

Why not? Here are a few reasons:
1) Have a look at your PC's Task Manager, and select the "Processes" Tab. Click on CPU to sort the display by decreasing CPU usage. What process is right at the top, with 98 or 99 percent of your CPU? "System Idle Process" - i.e. the task that only ever gets a go when there is nothing else to do at all! Increasing your thread priority won't give you more CPU if you are the only process using it anyway!
2) Your thread may have very little actual CPU processing to do anyway: you could be mostly waiting for disk access, other processes, external databases, etc., etc.. Changing your priority will not affect these in the least!

On balance, the answer is "probably not", but it may be worth your experimenting to find out if it does in your specific case.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 3-Jun-11 20:31pm    
Great answer, my 5.
--SA
Kim Togo 4-Jun-11 2:47am    
Good answer. My 5.
To add to Griff's answer, you should avoid doing it. If you increase the priority on your thread, it steals time slices from all other running threads, and you could upset other (unseen) application apple carts in the process...
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 3-Jun-11 20:32pm    
Agree! My 5.
--SA
Kim Togo 4-Jun-11 2:48am    
Really good point. My 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900