{
"subject": "Re: bitcoin auto-renice-ing",
"content": {
"format": "html",
"body": "<div class=\"post\">It sets different priorities for each thread. The generate threads run at PRIO_MIN. The other threads rarely take any CPU and run at normal.<br/><br/>#define THREAD_PRIORITY_LOWEST PRIO_MIN<br/>#define THREAD_PRIORITY_BELOW_NORMAL 2<br/>#define THREAD_PRIORITY_NORMAL 0<br/><br/>The priorities converted from Windows priorities were probably from a table like this:<br/><br/> \"The following table shows the mapping between nice values and Win32 priorities. Refer to the Win32 documentation for SetThreadPriority() for more information on Win32 priority issues.<br/><br/>nice value Win32 Priority<br/>-20 to -16 THREAD_PRIORITY_HIGHEST<br/>-15 to -6 THREAD_PRIORITY_ABOVE_NORMAL<br/>-5 to +4 THREAD_PRIORITY_NORMAL<br/>+5 to +14 THREAD_PRIORITY_BELOW_NORMAL<br/>+15 to +19 THREAD_PRIORITY_LOWEST\"<br/><br/>If you have better values, suggestions welcome.<br/><br/>Also, there was some advice on the web that PRIO_PROCESS is used on Linux because threads are processes. If that's not true, maybe it accounts for unexpectedly setting the priority of the whole app.<br/><br/> // threads are processes on linux, so PRIO_PROCESS affects just the one thread<br/> setpriority(PRIO_PROCESS, getpid(), nPriority);<br/></div>"
},
"source": {
"name": "Bitcoin Forum",
"url": "https://bitcointalk.org/index.php?topic=72.msg717#msg717"
},
"date": "2010-03-15T18:44:12Z"
}