JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Multithreaded Programming Guide     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information


1.  Covering Multithreading Basics

2.  Basic Threads Programming

3.  Thread Attributes

4.  Programming with Synchronization Objects

5.  Programming With the Oracle Solaris Software

6.  Programming With Oracle Solaris Threads

7.  Safe and Unsafe Interfaces

8.  Compiling and Debugging

9.  Programming Guidelines

A.  Extended Example: A Thread Pool Implementation



The Multithreaded Programming Guide describes the multithreaded programming interfaces for POSIX threads and Oracle Solaris threads in the Oracle Solaris Operating System (Oracle Solaris OS). This guide shows application programmers how to create new multithreaded programs and how to add multithreading to existing programs.

Although this guide covers both the POSIX and Oracle Solaris threads interfaces, most topics assume a POSIX threads interest. Information applying to only Oracle Solaris threads is covered in Chapter 6, Programming With Oracle Solaris Threads. The two sets of interfaces share a common implementation and are fully compatible with one another. Calls to POSIX threads interfaces can be freely intermixed with calls to Oracle Solaris threads interfaces.

POSIX threads information can be found in the Single UNIX Specification Version 3 at

Note - This Oracle Solaris release supports systems that use the SPARC and x86 families of processor architectures: UltraSPARC, SPARC64, AMD64, Pentium, and Xeon EM64T. For a list of supported systems see the Oracle Solaris OS: Hardware Compatibility Lists. This document cites any implementation differences between the platform types.

In this document the term “x86” refers to 64-bit and 32-bit systems manufactured using processors compatible with the AMD64 or Intel Xeon/Pentium product families. For supported systems, see the Oracle Solaris 10 Hardware Compatibility List.

Who Should Use This Book

This guide is for application developers who want to create new multithreaded programs or add multithreading to existing programs.

Developers that use this book should be familiar with and be able to use the following technologies:

How This Guide Is Organized

Chapter 1, Covering Multithreading Basics gives a structural overview of threads implementation in this release.

Chapter 2, Basic Threads Programming discusses the general POSIX threads routines, emphasizing creating a thread with default attributes.

Chapter 3, Thread Attributes covers creating a thread with nondefault attributes.

Chapter 4, Programming with Synchronization Objects covers the threads synchronization routines.

Chapter 5, Programming With the Oracle Solaris Software discusses changes to the operating environment to support multithreading.

Chapter 6, Programming With Oracle Solaris Threads covers Oracle Solaris threads (as opposed to POSIX threads) interfaces.

Chapter 7, Safe and Unsafe Interfaces covers multithreading safety issues.

Chapter 8, Compiling and Debugging covers the basics of compiling and debugging multithreaded applications.

Chapter 9, Programming Guidelines discusses issues that affect programmers writing multithreaded applications.

Appendix A, Extended Example: A Thread Pool Implementation shows how to implement a pool of worker threads.

Access to Oracle Support

Oracle customers have access to electronic support through My Oracle Support. For information, visit or visit if you are hearing impaired.

Related Books

Multithreading requires a different way of thinking about function interactions. The following books are recommended reading.

Typographic Conventions

The following table describes the typographic changes used in this book.

Table P-1 Typographic Conventions

Typeface or Symbol
The names of commands, files, and directories; on-screen computer output
Edit your .login file.

Use ls -a to list all files.

machine_name% you have mail.

What you type, contrasted with on-screen computer output
machine_name% su Password:
Command-line placeholder: replace with a real name or value
To delete a file, type rm filename.
Book titles, new words, or terms, or words to be emphasized.
Read Chapter 6 in User's Guide.

These are called class options.

You must be root to do this.

Shell Prompts in Command Examples

The following table shows the default system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.

Table P-2 Shell Prompts

C shell prompt
C shell superuser prompt
Bourne shell and Korn shell prompt
Bourne shell and Korn shell superuser prompt