On Wed, 2008-03-26 at 14:13 +0000, Jon Haslam wrote:
> >> tick-50ms
> >> /pidp && t != NULL/
> >> {
> >> printf("%s lwps %d/thr (%d): %d syscalls\n", procname,
> >> procp->p_lwpcnt,
> >> t->t_tid, t->t_lwp->lwp_ru.sysc);
> >> t = t->t_forw;
> >
> > Now, here comes the crucial question: AFAIK, p_tlist points to
> > a circular list of kernel threads. We are traversing this list
> > using t = t->t_forw. Now, what happens if 't' points to
> > a member of the list that used to be valid but has been
> > deallocated in between the two ticks of tick-50ms?
>
> Using time based probes to iterate over data structures is
> problematic as the data structures may well change beneath you.
> I offered this up as an example of how to iterate over data structures
> using a tick probe as it gets referenced quite a bit but there aren't that
> many examples around of how to do it. The important point about
> this technique is for the user to be aware of its limitations and
> how the data they are observing is modified.
Thanks for confirming my hunch. I guess at this point the only question
I have left is: what is really going to happen the next time
I do t->t_forw? A SEGV? Or I'll be just off to chasing these pointers
forever? See, I really don't know kernel well enough to make
even an educated guess here. Any help would be appreciated.
Thanks,
Roman.
_______________________________________________
dtrace-discuss mailing list
[email protected]