POV-Ray : Newsgroups : povray.off-topic : Linux guru question : Re: Linux guru question Server Time
5 Jul 2024 09:08:32 EDT (-0400)
  Re: Linux guru question  
From: Orchid Win7 v1
Date: 18 Sep 2015 13:20:14
Message: <55fc47ce$1@news.povray.org>
On 31/08/2015 11:07 PM, Anthony D. Baye wrote:
> In linux the default priority for any given user-initiated process is 0.  Which
> means that when I run povray, its cpu priority is dead last.

Well... no, no it doesn't. It's still higher priority than anything 
running at priority 1, or priority 2, or priority 3...

Linux priorities run form -20 (the *highest* possible priority) to +19 
(the *lowest* priority). Yes, they're numbered that way around. Yes, 
it's a bit confusing.

> I've gotten in the
> habit of running sudo top alongside so that I can renice the process to -20, but
> this only affects the main thread as far as I can tell.  All child threads have
> a priority of 0.
>
> Is there a way to configure linux so that povray and all of its child threads
> are given top priority?

It probably won't make any difference.

The process priority is *not* "the percentage of the CPU power that you 
get". It doesn't work like that. Rather, the highest-priority task gets 
to use the CPU "first". If it doesn't use all available power, then the 
next task gets a turn, and so on.

If there is only 1 task on the entire system that's actually trying to 
do anything, it will always get 100% of the available CPU. This happens 
utterly regardless of its priority. Priorities only matter if *several* 
tasks are trying to use the CPU at once. In that case, the 
highest-priority task "wins". (The highest priority task can use as much 
CPU as it wants. The second task gets whatever is left over.)

Priority is *not* the percentage of CPU you get. It's about who gets 
first dibs. If only 1 task wants CPU, it can use *all* of it.

Of course, if you *are* trying to do other things as well as POV-Ray... 
well, it depends how compute-intensive it is. But I'm not aware of any 
way of sitting the priority for all child threads. (I'm not even sure if 
priority is per-thread or per-task on Linux...) The best I can come up 
with is looping over the PIDs to renice each one, using some kind of 
shell script. But, again, it's probably pointless.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.