On Sat, Sep 5, 2009 at 12:09 AM, Yossi Lev (Sun Labs)<yosef....@sun.com> wrote:
>
>> Somebody will have to confirm, but I think global variables are
>> lock-protected in DTrace, so you should be able to use one to store the
>> sequence number.
>
> Actually, from messages that I saw in this forum, and my (little)
> experience with dtrace, access to global variable is not MT-safe.  I
> definitely recall trying to increment a global counter to count the
> number of calls to a function called by multiple threads, and seeing
> lost updates.  I also saw messages in this forum telling users to use
> aggregations whenever an MT-safe counting is necessary, for both
> scalability and safety reasons.  So my understanding is that maintaining
> a sequence number (that has to be incremented by each thread at the end
> of each sequence) cannot be done using a global variable --- am I
> missing something?
>

No, that's correct.  There is no protection for global variables in DTrace.

Chad
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to