This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Thread safety


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 ||||


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]