|Skip Navigation Links|
|Exit Print View|
|Multithreaded Programming Guide Oracle Solaris 11.1 Information Library|
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 http://www.opengroup.org/.
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.
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:
A UNIX SVR4 system - preferably the current Oracle Solaris release.
The C programming language - multithreading interfaces are provided by the standard C library.
The principles of concurrent or parallel programming (as opposed to sequential programming).
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.
Oracle customers have access to electronic support through My Oracle Support. For information, visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=info or visit http://www.oracle.com/pls/topic/lookup?ctx=acc&id=trs if you are hearing impaired.
Multithreading requires a different way of thinking about function interactions. The following books are recommended reading.
Multicore Application Programming: for Windows, Linux, and Oracle Solaris by Darryl Gove (Addison-Wesley, 2010)
The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit (Morgan Kaufmann, 2012)
The Art of Concurrency: A Thread Monkey's Guide to Writing Parallel Applications by Clay Breshears (O'Reilly, 2009)
Concurrent Programming by Alan Burns & Geoff Davies (Addison-Wesley, 1993)
Distributed Algorithms and Protocols by Michel Raynal (Wiley, 1988)
Operating System Concepts by Silberschatz, Peterson, & Galvin (Addison-Wesley, 1991)
Principles of Concurrent Programming by M. Ben-Ari (Prentice-Hall, 1982)
Programming with Threads by Steve Kleiman, Devang Shah, & Bart Smaalders (Prentice Hall, 1996)
Programming with POSIX Threads by David R. Butenhof (Addison-Wesley Professional, 1997)
The following table describes the typographic changes used in this book.
Table P-1 Typographic Conventions
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