From owner-freebsd-questions@FreeBSD.ORG Fri Mar 5 04:10:23 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9EEF616A4CE for ; Fri, 5 Mar 2004 04:10:23 -0800 (PST) Received: from hotmail.com (law11-f26.law11.hotmail.com [64.4.17.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id D36B143D39 for ; Fri, 5 Mar 2004 04:10:04 -0800 (PST) (envelope-from weiwuzhang@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Fri, 5 Mar 2004 04:10:04 -0800 Received: from 218.85.105.28 by lw11fd.law11.hotmail.msn.com with HTTP; Fri, 05 Mar 2004 12:10:04 GMT X-Originating-IP: [218.85.105.28] X-Originating-Email: [weiwuzhang@hotmail.com] X-Sender: weiwuzhang@hotmail.com From: "Zhang Weiwu" To: questions@freebsd.org Date: Fri, 05 Mar 2004 20:10:04 +0800 Mime-Version: 1.0 Content-Type: text/plain; charset=gb2312; format=flowed Message-ID: X-OriginalArrivalTime: 05 Mar 2004 12:10:04.0749 (UTC) FILETIME=[CB0C3FD0:01C402AA] Subject: Re: priority-- curious about cpu resouce share X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: zhangweiwu@realss.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Mar 2004 12:10:24 -0000 Sergey 'DoubleF' Zaharchenko wrote: >On Wed, 03 Mar 2004 00:34:37 +0800 >"Zhang Weiwu" 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% 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