By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,652 Members | 1,701 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,652 IT Pros & Developers. It's quick & easy.

Multithreaded application performance impact of global arrays

P: n/a
Hi all,

I've recently ported a rather large C application to run multithreaded.
A few functions have seriously deteriorated in performance, in
particular when accessing a rather large global array, that contains
information that is shared among threads.

Any idea, why the lines accessing this global array now take about 50x
longer in the multithreaded application?

I've googled around for general hints on the performance impact of
various common C language constructs regarding multithreaded
applications, i.e. some sort of "Do's and Don'ts" for multithreaded C
programs.

However, I could not find anything appropriate. Any hints are welcome!

best regards,
jan

Mar 17 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
gr****@barnholt.net wrote:
Hi all,

I've recently ported a rather large C application to run multithreaded.
A few functions have seriously deteriorated in performance, in
particular when accessing a rather large global array, that contains
information that is shared among threads.

Any idea, why the lines accessing this global array now take about 50x
longer in the multithreaded application?


Threaded programming really isn't on topic here, try a group that
focuses on multi-threaded programming or your specific implementation.

<OT> When you did your conversion I assume you used some type of
locking mechanism to protect the global data. I would start by
profiling the functions in question to determine how much time they
spend waiting for the lock. </OT>

Robert Gamble

Mar 17 '06 #2

P: n/a
gr****@barnholt.net wrote:
Hi all,

I've recently ported a rather large C application to run multithreaded.
A few functions have seriously deteriorated in performance, in
particular when accessing a rather large global array, that contains
information that is shared among threads.

Any idea, why the lines accessing this global array now take about 50x
longer in the multithreaded application?

I've googled around for general hints on the performance impact of
various common C language constructs regarding multithreaded
applications, i.e. some sort of "Do's and Don'ts" for multithreaded C
programs.

However, I could not find anything appropriate. Any hints are welcome!


If you're restricting your search to standard C forums, you won't find
the answers. First, determine what style of platform you are working
with, and what style of threading. Then look up subjects like false
sharing, NUMA data placement, etc. accordingly.
Mar 17 '06 #3

P: n/a
gr****@barnholt.net writes:
I've recently ported a rather large C application to run multithreaded.
A few functions have seriously deteriorated in performance, in
particular when accessing a rather large global array, that contains
information that is shared among threads.

Any idea, why the lines accessing this global array now take about 50x
longer in the multithreaded application?


No. Try comp.programming.threads.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Mar 17 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.