Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 05 Mar 2004 20:10:04 +0800
From:      "Zhang Weiwu" <weiwuzhang@hotmail.com>
To:        questions@freebsd.org
Subject:   Re: priority-- curious about cpu resouce share
Message-ID:  <Law11-F265To5G9c60p0002b28e@hotmail.com>

next in thread | raw e-mail | index | archive | help
Sergey 'DoubleF' Zaharchenko wrote:

>On Wed, 03 Mar 2004 00:34:37 +0800
>"Zhang Weiwu" <weiwuzhang@hotmail.com> probably wrote:
>
>>Today I did't experiment on {rt|id}prio(1), just to be interesting. I am 
>>trying to understand FreeBSD priority mechenism. IMHO realtime/idle 
>>priority only starvs processes when there is no cpu resource at all. 
>>
>>To test, I run mpg321 on realtime priority 3, run ppp on realtime 
priority 
>>4, a little lower than mpg321, and scp over the ppp tunnel on normal 
>>priority. 
>>
>>Top(1) shows an average about:
>>55.2% user,  0.0% nice, 21.5% system, 12.2% interrupt, 11.1% idle
>>* mpg321 takes average about 70%;
>>* ppp is seriously slowed down, it takes about 1.5% (normally 17% on full 

>>speed);
>>* sshd almost starves; it takes 0.00% (normally 2%) and only transfer 
>>several bytes once several minutes; the otherside scp prompts "stalled".
>
>
>sshd doesn't starve CPU, I guess; as you reach it through ppp, and ppp
>gets slow, sshd does, too.
>
>>I'm the kind of newbie think 11.1% idle cpu time to be free cpu resource, 

>>because I don't have idle process. I wish to know why, as there are still 

>>11.1% free cpu resource, ppp and sshd doesn't get this share? 
>
>
>The most frequent cause is that they don't need the CPU so much as
>something else, like disk I/O, etc. Could you please post the whole
>output of top (and a snapshot of systat -vmstat, for example)?
>
Here is my systat -vmstat
=============================================================================

    2 users    Load  1.44  0.91  0.42                  Mar  5 20:00
                                                                            
  
Mem:KB    REAL            VIRTUAL                     VN PAGER  SWAP PAGER
        Tot   Share      Tot    Share    Free         in  out     in  out
Act    9004    2144    62560     4228    2232 count
All   22104    3040  2307048     7032         pages    4
                                                                 Interrupts
Proc:r  p  d  s  w    Csw  Trp  Sys  Int  Sof  Flt      6 cow     352 total
           1 33       624  130   96  465   99   37  11312 wire    100 0: 
clk
                                                     6392 act         1: 
atkb
 6.0%Sys   6.3%Intr 33.9%User  0.0%Nice 53.9%Idl     3356 inact    86 5: 
sbc0
     |    |    |    |    |    |    |    |    |       1452 cache       6: 
fdc0
===+++>>>>>>>>>>>>>>>>>                               780 free     31 7: 
ppc0
                                                          daefr   128 8: 
rtc
 amei         Name-cache    Dir-cache                  29 prcfr     5 11: 
rl0
    Calls     hits    %     hits    %                   1 react       13: 
npx
       82       72   88                                   pdwak     2 14: 
ata
                                       13 zfod            pdpgs
Disks   ad0                             9 ofod            intrn
KB/t  14.15                            67 %slo-z     5072 buf
tps       2                            51 tfree        14 dirtybuf
=============================================================================

And my top:
=============================================================================

last pid:  3451;  load averages:  1.01,  0.72,  0.33   up 0+18:29:36  
19:59:22
35 processes:  1 running, 34 sleeping
CPU states: 39.3% user,  0.0% nice,  9.5% system, 20.6% interrupt, 30.6% 
idle
Mem: 6512K Active, 3596K Inact, 11M Wired, 1616K Cache, 5072K Buf, 356K 
Free
Swap: 128M Total, 13M Used, 115M Free, 10% Inuse
                                                                            
  
  PID USERNAME   PRI NICE   SIZE    RES STATE    TIME   WCPU    CPU COMMAND
 3445 music       -8 -104  5556K   884K pcmwr    1:43 36.08% 36.08% mpg123
 2075 root        98    0  3856K  1292K select   7:43  6.79%  6.79% ppp
 3448 zhangweiwu  96    0  6436K  2072K select   0:04  1.61%  1.61% sshd
 3451 zhangweiwu  96    0  2212K  1220K RUN      0:02  0.93%  0.93% top
  211 root        96    0  1812K   228K select   0:23  0.00%  0.00% 
dhclient
  420 root        96    0  3488K   328K select   0:09  0.00%  0.00% sshd
  271 root        96    0  1312K   228K select   0:03  0.00%  0.00% syslogd
  444 root         8    0  1336K   188K nanslp   0:02  0.00%  0.00% cron
 3426 music        5  -91  9936K  2704K ttyin    0:01  0.00%  0.00% cmp3
 3450 zhangweiwu   4    0  2576K  1124K sbwait   0:01  0.00%  0.00% scp
 3446 root         4    0  6220K  1688K sbwait   0:01  0.00%  0.00% sshd
  373 root        96    0  1236K    84K select   0:01  0.00%  0.00% usbd
 3415 root         4    0  6244K     0K sbwait   0:00  0.00%  0.00% <sshd>
 3420 root         4    0  6244K   768K sbwait   0:00  0.00%  0.00% sshd
=============================================================================


Before this vmstat and top snapshoot, I tried ppp+ssh send a file, speed is 
average 40KB/s, cpu is mostly free. And I start the mpg123 at rtprio 20, 
ssh begin to speed down. 10 seconds since the music begin, ssh display 
higovdemo.avi                                 10% 2064KB   4.8KB/s - 
stalled -

What I don't understand is there are 30.6% idle cpu resource, enough 
bandwith, what starved ssh?

>FWIW, splay uses <30% of a P150:)
>

_________________________________________________________________
Ãâ·ÑÏÂÔØ MSN Explorer:   http://explorer.msn.com/lccn  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Law11-F265To5G9c60p0002b28e>