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

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top