lotus

previous page: 16. Does any DBMS vendor provide a thread-safe interface? (Programming)
  
page up: Threads Programming FAQ
  
next page: 18. What tools will help me to program with threads? (Programming)

17. Why is my threaded program running into performance problems? (Programming)




Description

This article is from the Threads Programming FAQ, by Bryan O'Sullivan bos@serpentine.com with numerous contributions by others.

17. Why is my threaded program running into performance problems? (Programming)

There are many possible causes for performance problems in
multithreaded programs. Given the scope for error, all I can do is
detail a few common pitfalls briefly, and point you at the section of
this FAQ on books about multithreaded programming.
* You can probably discount the performance of the threads package
you are using almost straight away, unless it is a user-level
package. If so, you may want to try to find out whether your whole
process is blocking when you execute certain system calls.
Otherwise, you should look at your own code unless you have a very
strong reason for believing that there may be a problem with your
threads package.
* Look at the granularity of your locks. If a single lock protects
too much data for which there is contention, you will needlessly
serialise your code. On the other hand, if your locks protect very
small amounts of data, you will spend too much time obtaining and
releasing locks. If your vendor is worth their salt, they will
have a set of tools available that allow you to profile your
program's behaviour and look for areas of high contention for
locks. Tools of this kind are invaluable.

 

Continue to:













TOP
previous page: 16. Does any DBMS vendor provide a thread-safe interface? (Programming)
  
page up: Threads Programming FAQ
  
next page: 18. What tools will help me to program with threads? (Programming)