Thread safety

Mandar Gurav mandarwce@gmail.com
Thu Feb 3 08:50:00 GMT 2011


Ohhh! That's awesome!

But still other question.....

whether the events/ Probes are processed in sequential manner or by
different threads simultaneously?????

----Mandar Gurav

On Wed, Feb 2, 2011 at 9:53 PM, Frank Ch. Eigler <fche@redhat.com> wrote:
>
> mandarwce wrote:
>
>> I have created a counter (global variable in stp file) in my stp
>> file. I want to increment each time when some conditions are met.  I
>> want know that, whether this particular global variable must be
>> protected form concurrent accesses by different instances of the
>> same events???
>
> stap will do that for you automatically.
>
> global foo
> probe perf.BAR { foo ++ }  # exclusively locked
> probe end { println (foo) }  # shared locked
>
>
>> Let us take an example of cache miss. If on a multicore machine two or
>> more cache miss on different cores can happen simultaneously. [...]
>> So I wanted know, whether the events/ Probes are processed in
>> sequential manner or by different threads simultaneously.
>
> Concurrent operation on multiple CPUs is normal.
>
> To make them perform best, you'll want to use aggregate types instead
> of ordinary integer counters, as in:
>
> global foo
> probe perf.BAR { foo <<< 1 }  # may trigger in parallel
> probe end { println (@count(foo)) }
>
>
> - FChE
>



-- 
|||| Mandar Gurav ||||



More information about the Systemtap mailing list