[gentoo-user] Re: Idle Process Scheduling

2009-06-14 Thread Jason Lynch
On Sat, 13 Jun 2009 23:39:52 +0200, Sascha Hlusiak wrote:
 How do you know how many processes are running? What does 'top' say
 about CPU usage and load? Maybe dnetc has two threads, which can each
 occupy a core, so you have still 4 threads that are running, in 3
 processes. You still should get a load of 5 or higher.
 You don't have a lot of IO load, do you?

Technically, in the scenario I described, I only have two processes, as 
dnetc is running with four threads. To simplify the situation, I created 
a simple Python script that does nothing other than loop indefinitely. I 
then start four separate nice 19 copies of it in four separate terminals. 
At this point, top reports that each CPU is almost entirely executing 
niced code. Load average is a little bit above 4, as expected.

At this point, I leave these four copies running, and execute a fifth 
copy without nicing it, so it ends up with a nice value of 0. At this 
point, cpu0 is executing almost 100% user. cpu2 and cpu3 are executing 
almost 100% nice. Finally, cpu1 is almost 100% idle. (The actual CPU 
numbering seems to shift around every so often.)

Thus, I have five processes, four at nice 19, one at nice 0, a load 
average of just over 5, but only 3 out of the 4 cores are actually doing 
anything. 




Re: [gentoo-user] Re: Idle Process Scheduling

2009-06-14 Thread Mike Kazantsev
On Sun, 14 Jun 2009 06:07:16 + (UTC)
Jason Lynch ja...@calindora.com wrote:

 Thus, I have five processes, four at nice 19, one at nice 0, a load 
 average of just over 5, but only 3 out of the 4 cores are actually doing 
 anything. 

That's an interesting observation with quite a trivial scenario.

So I thought to check it out and ran 8 niced copies while True: pass
script on 8-core machine, atop showed 799-800% load, 100% for each core.
Ninth, non-niced process indeed drops the load to 700-710%, with one
core absolutely free.

Then, I've tried to remove nice form the equation and load held at 800%
with 8, 9, 10 and more processes. Nice-only processes behave similary,
loading all eight cores.

So I guess the problem (or feature?) is related to nice / non-nice
processes' scheduling and exists at least in 2.6.29 kernel.
Gotta google it a bit later, bet someone on lkml should've noticed it.

-- 
Mike Kazantsev // fraggod.net


signature.asc
Description: PGP signature