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

Preface

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

Rethinking Global Variables

Providing for Static Local Variables

Synchronizing Threads

Single-Threaded Strategy

Reentrant Function

Code Locking

Data Locking

Invariants and Locks

Avoiding Deadlock

Deadlocks Related to Scheduling

Locking Guidelines

Finding Deadlocks

Some Basic Guidelines for Threaded Code

Creating and Using Threads

Working With Multiprocessors

Underlying Architecture

Shared-Memory Multiprocessors

Peterson's Algorithm

Parallelizing a Loop on a Shared-Memory Parallel Computer

Examples of Threads Programs

Further Reading

A.  Extended Example: A Thread Pool Implementation

Index

Chapter 9

Programming Guidelines

This chapter provides some pointers on programming with threads. Most pointers apply to both Oracle Solaris and POSIX threads, but where utility differs, the behavior is noted. A change from single-threaded thinking to multithreaded thinking is emphasized in this chapter. The chapter discusses the following topics: