From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,722e40c170241a8c X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-04-09 05:30:04 PST Message-ID: <3e941468@usenet01.boi.hp.com> From: David Butenhof Subject: Re: Thread info Newsgroups: comp.unix.tru64 Reply-To: David.Butenhof@hp.com Date: Wed, 09 Apr 2003 08:28:21 -0400 References: Organization: Hewlett-Packard Company User-Agent: KNode/0.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit NNTP-Posting-Host: kalkin.zko.dec.com X-Original-NNTP-Posting-Host: kalkin.zko.dec.com X-Trace: usenet01.boi.hp.com 1049891944 16.31.48.112 (9 Apr 2003 06:39:04 -0700) X-Original-Trace: 9 Apr 2003 06:39:04 -0700, kalkin.zko.dec.com Path: archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!nntp.cs.ubc.ca!nntp-relay.ihug.net!ihug.co.nz!news.compaq.com!usenet01.boi.hp.com!not-for-mail Xref: archiver1.google.com comp.unix.tru64:9806 Pasquale wrote: > Hi all, > I have developed a multi threads application. > Sometimes, the main process display (through ps -ef command) the cpu > usage at 99%. > With the command "ps m" I have analyzed the threads status and one > thread gets the cpu at 99%, this thread is running and its status is > "nxmidle". > Which means this status? The nxmidle "status" (wait channel) means that the kernel thread is idled in the kernel. If it's really taking CPU time in that state, there's a bug in the kernel. However, it's also possible that the kernel thread is dropping in and out of nxmidle state while you're not looking -- the rate at which you can type 'ps' commands is extremely slow compared to what the thread might be doing. Before you spend too much more time analyzing, check your system version and patch level. Make sure you've at least installed all the thread related kernel and user patches for your version (installing ALL of every patch kit is even better). If that doesn't help... Since nothing shown by 'ps' gives you any easy way to tie the activity you see back to your application threads, you'd be better off attaching to the process with ladebug; its "show thread" command will tell you what the application (POSIX) threads are doing, regardless of how those threads are currently mapped onto kernel threads. You might also want to try running the application with the Visual Threads analysis tool to see what it's doing. If you can't explain the kernel thread's activity through the behavior of the application, you'll need to start looking inside the kernel. For example, you could use "dbx -k", "set $pid=" to attach to the process context, and try to guess (an often frustrating and time consuming process) which kernel thread is involved... usually starting with a "tlist" to show the state of all the kernel threads in the process and eliminating the ones that "can't be" the troublemaker, often by examining each call stack. -- /--------------------[ David.Butenhof@hp.com ]--------------------\ | Hewlett-Packard Company Tru64 UNIX & VMS Thread Architect | | My book: http://www.awl.com/cseng/titles/0-201-63392-2/ | \----[ http://homepage.mac.com/dbutenhof/Threads/Threads.html ]---/