RE: /proc on 2.4.21 & 2.6 kernels....

From: Amanulla G
Date: Tue May 03 2005 - 13:42:34 EST


Hi,
Sorry for the late follow up on this.

Re:
>> My second part of question was:
>> On 2.6 kernels, we have /proc/<tgid>/task/xxx
>> My question is /proc/<tgid> stats reflect resource utilization of the
>> threads it has created?

> yes afaik it's cumulative over the threads there.


I just wrote a small program which creates a thread. The thread just hogs
cpu and does nothing else.

***********************************************
#include <pthread.h>
#include <stdio.h>
void *foo(void *p)
{
printf ("Thread ");
fflush(stdout);
while (1);
}
int main(void){
int ret;
pthread_t p1 ;
ret = pthread_create(&p1, NULL, foo, NULL);
pthread_join(p1,NULL);
}
***********************************************

I checked the above program on a machine with 2.6.9-5.EL running.

I checked the top output, it says, global cpu util is 99.% but the cpu
utilization of a.out is 0.0!!

None of the processes that top showed has had more than 0.2% of CPU
utilization, but still global cpu utilization is 99.9%.
Interestingly, /proc/pid related to a.out process had two entries under
/proc/pid/task directory
1) Entry related to a.out
2) Entry related to thread created by a.out

But the statistics under /proc/pid/stat related to a.out process do not
reflect the resource utilization of the thread it has created.

Could you please look into this issue?

With Best Regards,
Amanulla




-----Original Message-----
From: Arjan van de Ven [mailto:arjan@xxxxxxxxxxxxx]
Sent: Tuesday, April 05, 2005 10:05 PM
To: Amanulla G
Cc: linux-kernel@xxxxxxxxxxxxxxx; jdp@xxxxxxxxxxxx
Subject: RE: /proc on 2.4.21 & 2.6 kernels....

On Tue, 2005-04-05 at 21:52 +0530, Amanulla G wrote:
> Hi,
> Thanks for the mail.
> May be I didn't put my question correctly.
> On 2.4.21 based kernels /proc has got hidden directories which has got the
> thread related statistics.

I understood your question.
However 2.4.21 kernels from kernel.org do not have such hidden
directories.

> My second part of question was:
> On 2.6 kernels, we have /proc/<tgid>/task/xxx
> My question is /proc/<tgid> stats reflect resource utilization of the
> threads it has created?

yes afaik it's cumulative over the threads there.




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/