Go to main content

Developer's Guide for Migrating to Oracle® Solaris 11.4

Exit Print View

Updated: November 2020
 
 

Addressing Multithreaded Application Issues

This section describes how to address multithreaded application issues in Oracle Solaris 11.

Using the Oracle Developer Studio Thread Analyzer

The Oracle Developer Studio Thread Analyzer is an advanced tool for application optimization, and ensures multithreaded application correctness. Specifically, the Thread Analyzer can detect, analyze, and debug the special situations that can arise in multithreaded applications. For more information, see Oracle Developer Studio 12.6: Thread Analyzer User's Guide.

Detecting Race Conditions and Deadlocks

    To instrument the source code to detect race conditions and deadlock issues, you can compile the source code with a special flag, executed under the control of the collect -r command, and then load the program into the Thread Analyzer.

  1. Applications are first compiled with the –xinstrument=datarace compiler flag. To help ensure that the line numbers and call-stacks information are returned correctly, set the –g flag and do not specify an optimization level.

  2. The resulting application code is then executed after the collect –r command is issued, which collects key runtime information. Use the collect -all option to run the program and create a data race detection and deadlock detection experiment during the execution of the process.

    $ collect -r race app params 
    $ collect -r deadlock app params
  3. The results of the experiment are loaded into the Thread Analyzer to identify data race and deadlock conditions.