Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jan 2011 16:07:17 -0800 (PST)
From:      Mark Terribile <materribile@yahoo.com>
To:        freebsd-questions@freebsd.org
Subject:   rusage and pthreads
Message-ID:  <57927.35211.qm@web110302.mail.gq1.yahoo.com>

next in thread | raw e-mail | index | archive | help

Hi,

I'm trying to figure out the interactions between rusage and pthreads.  Peeking around in the kernel (7.2) I see updates occurring in various places.  kern_clock.c, for instance, appears to increment the memory occupancy (*rss) counters.  This would make it appear that every thread gets part of the count, but also that only the process that happens to have the CPU at that moment gets its count updated, even if it holds the memory.  Am I misreading this?

And the context switch counters also appear to be updated per-thread, but in mi_switch(), in kern_synch.c.  Is this true?

If the answer is "yes, it's per-thread", then how does a process report its usages without putting the requisite code in each thread, along with the machinery to divert from whatever the thread is doing (even waiting on I/O) to get the report at (nearly) the same time in all threads?

Is there a big design hole here?

    Mark Terribile


      



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