lkml.org 
[lkml]   [1997]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
DateSat, 12 Apr 1997 13:10:25 -0400 (EDT)
From"Adam D. Bradley" <>
SubjectRe: how to set priority for idle process ?

[-20 priority]
> even this is only theory:
>
> PID USER PRI NI SIZE RES SHRD STAT %CPU %MEM TIME COMMAND
> 1096 root 15 -20 780 220 172 R < 63.5 0.7 0:30 niceloop -20
> 1095 root 17 0 780 220 172 R 33.0 0.7 0:18 niceloop 0
>
> and I don't want to run the whole system at negative priorities (I need them
> for a few other almost realtime tasks) just to be able to have a real and only
> "idle task" in user space...
>
>
> Harald
> -------------------------------------------------------------------------------
> /* niceloop.c */
>
> void main(int argc, char *argv[])
> {
[snip]
> while(1);
> }

The above is the behavior I would expect, actually..."while (1);" (in a
test compile I just did) generates a two-instruction infinite loop (two
jmp's directed at each other), so a process suck in a while(1); is
indistinguishable from any other very CPU-intensive process.
If you really want a process to idle rather than busy-wait, use something
like sleep() or select() on /dev/null. That way, Linux can put the
process on an idle queue where it won't use any cycles; as long as the
process is _doing_ something (and jumping back and forth between two PC's
is, like it or not, "doing something"), it will continue to get
timeslices.

Adam
--
He feeds on ashes; a deluded mind has led him Adam Bradley, UNCA Senior
astray, and he cannot deliver himself or say, Computer Science
"Is there not a lie in my right hand?" Isaiah 44:20
bradley@cs.unca.edu http://www.cs.unca.edu/~bradley <><


\
 
 \ /
  Last update: 2005-03-22 13:39    [from the cache]
©2003-2010