Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 6. Parallel Optimization Using Threads

Chapter 6. Parallel Optimization Using Threads

Key Points

  • Threads enable the utilization of multiple processor cores to complete a task; however, special handling is required to coordinate work both correctly and efficiently.

  • The performance increase offered by parallelism is limited by the amount of the application that must execute serially. Several conditions limit the ability of code to execute in parallel. Some of these conditions can be removed, while some cannot.

  • Focus analysis on the areas of highest execution as this will provide the highest return on your investment. Use the execution time profile to determine bounds on expected speedup from the parallelization effort.

  • Thread-related bugs are difficult to diagnose because they are non-deterministic; the symptom may only show if threads execute in a specific order.

  • Synchronization solves data race issues but can lead to thread stalls and deadlocks. Thread verification tools can help find thread-related bugs. When using thread verification tools, ensure the regions of code that are threaded are executed during the analysis run.

  • Use thread performance tools to help gauge the amount of the application executing in parallel, the workload balance, and amount of synchronization occurring.


Accomplishing tasks in parallel comes in many guises. At the highest level, multiple computers can divide a task and work on it collectively. An example of this type of parallelism is the SETI@home [1] project where thousands of computers work collectively on analyzing radio signals for patterns indicative of intelligence. At the lowest level, modern microprocessors execute instructions specified in its machine language in parallel. For example, the Intel® Pentium® processor has a U execution pipe and a V execution pipe capable of executing different instructions at the same time. The motivation for enabling parallel execution at these different levels of computation is performance. Furthermore, the use of one type of parallel execution does not negate the benefit of employing other types of parallel execution. Threads are another means of enabling parallelism that complements the already mentioned types and is of smaller granularity than the process level concurrency mentioned in the SETI@home example, but certainly of larger granularity than the instruction level parallelism example of the Pentium® processor. Threads offer the ability to have multiple sections of one task in flight at the same time. In technical-speak: threads offer the ability to concurrently execute multiple contexts of the same process.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial