Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 6. Windows Threading > Setting Thread Priority

Setting Thread Priority

Windows uses a priority system to determine which thread gets the next slice of CPU resources. The higher the priority of a thread, the more CPU time it will get, and conversely a thread with a low priority will get fewer CPU resource than other higher-priority threads. In some instances, it can be useful to adjust the priority of different threads in an application. The obvious example is when the application is performing a long-running background task. A background task is best run at a low priority in order to keep the machine responsive, while a high-priority background task could consume all the CPU resources over a long period of time and stop the machine from performing other short-lived compute-intensive tasks.

Consider burning a CD or DVD. Here the system needs to keep feeding data to the burner, and any interruption to the data stream could cause an error resulting in an unusable disk being written. To avoid this, it might be appropriate to run the burning application at a higher than usual priority level.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint