Multithreaded application performance impact of global arrays

G

groups

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
 
R

Robert Gamble

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
 
T

Tim Prince

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

Keith Thompson

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top