[OpenVMS documentation]
[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
Updated: 11 December 1998

Guide to DECthreads


Begin Index

Contents (summary)
Preface Preface
Part 1 DECthreads Overview and Programming Guidelines
Chapter 1 Introducing DECthreads for Multithreaded Programming
Chapter 2 DECthreads Objects and Operations
Chapter 3 Programming with Threads
Chapter 4 Writing Thread-Safe Libraries
Chapter 5 Using the DECthreads Exception Package
Chapter 6 DECthreads Examples
Part 2 POSIX.1c (pthread) Routines Reference
Part 3 Compaq Proprietary Interfaces: tis Routines Reference
Part 4 Appendixes
Appendix A Considerations for DIGITAL UNIX Systems
Appendix B Considerations for OpenVMS Systems
Appendix C Considerations for Windows NT Systems
Appendix D Debugging Multithreaded Applications
Appendix E Migrating from the cma Interface
Appendix F Migrating from the d4 Interface
  Glossary
  Index
  Figures
  Examples
  Tables


Contents


Preface
Preface Preface
Part 1
Part 1 DECthreads Overview and Programming Guidelines
Chapter 1
1 Introducing DECthreads for Multithreaded Programming
     1.1     Advantages of Using Threads
     1.2     Overview of Threads
     1.3     Thread Execution
     1.4     Functional Models for Multithreaded Programming
         1.4.1         Boss/Worker Model
         1.4.2         Work Crew Model
         1.4.3         Pipelining Model
         1.4.4         Combination of Functional Models
     1.5     Potential Issues for Multithreaded Programs
     1.6     DECthreads Libraries and Interfaces
         1.6.1         Multithreading pthread Interface
             1.6.1.1             Optionally Implemented POSIX.1c-1995 Routines
         1.6.2         Thread-Independent Services Interface
         1.6.3         Undocumented and Obsolete DECthreads Interfaces
             1.6.3.1             Undocumented But Supported cma Interface
             1.6.3.2             Obsolete d4 Interfaces
Chapter 2
2 DECthreads Objects and Operations
     2.1     Threads and Synchronization Objects
     2.2     Attributes Objects
     2.3     Thread Objects and Operations
         2.3.1         Creating and Starting a Thread
         2.3.2         Setting the Attributes of a New Thread
             2.3.2.1             Setting the Inherit Scheduling Attribute
             2.3.2.2             Setting the Scheduling Policy Attribute
                 2.3.2.2.1                 Techniques for Setting the Scheduling Policy Attribute
                 2.3.2.2.2                 Comparing Throughput and Real-Time Policies
                 2.3.2.2.3                 Portability of Scheduling Policy Settings
             2.3.2.3             Setting the Scheduling Parameters Attribute
             2.3.2.4             Setting the Stacksize Attribute
             2.3.2.5             Setting the Stack Address Attribute
             2.3.2.6             Setting the Guardsize Attribute
             2.3.2.7             Setting the Contention Scope Attribute
         2.3.3         Terminating a Thread
             2.3.3.1             Cleanup Handlers
         2.3.4         Detaching and Destroying a Thread
         2.3.5         Joining With a Thread
         2.3.6         Scheduling a Thread
             2.3.6.1             Calculating the Scheduling Priority
             2.3.6.2             Effects of Scheduling Policy
         2.3.7         Canceling a Thread
             2.3.7.1             Thread Cancelation Implemented Using Exceptions
             2.3.7.2             Thread Return Value After Cancelation
             2.3.7.3             Controlling Thread Cancelation
             2.3.7.4             Cancelation Points
             2.3.7.5             Cleanup from Synchronous Cancelation
             2.3.7.6             Cleanup from Asynchronous Cancelation
             2.3.7.7             Example of Thread Cancelation Code
     2.4     Synchronization Objects
         2.4.1         Mutexes
             2.4.1.1             Normal Mutex
             2.4.1.2             Default Mutex
             2.4.1.3             Recursive Mutex
             2.4.1.4             Errorcheck Mutex
             2.4.1.5             Mutex Operations
             2.4.1.6             Mutex Attributes
         2.4.2         Condition Variables
         2.4.3         Condition Variable Attributes
         2.4.4         Read-Write Locks
             2.4.4.1             Thread Priority and Writer Precedence for Read-Write Locks
             2.4.4.2             Initializing and Destroying a Read-Write Lock
             2.4.4.3             Read-Write Lock Attributes
     2.5     Process-Shared Synchronization Objects
         2.5.1         Programming Considerations
         2.5.2         Process-Shared Mutexes
         2.5.3         Process-Shared Condition Variables
         2.5.4         Process-Shared Read-Write Locks
     2.6     Thread-Specific Data
Chapter 3
3 Programming with Threads
     3.1     Designing Code for Asynchronous Execution
         3.1.1         Avoid Passing Stack Local Data
         3.1.2         Initialize DECthreads Objects Before Thread Creation
         3.1.3         Do Not Use Scheduling As Synchronization
     3.2     Memory Synchronization Between Threads
     3.3     Using Shared Memory
         3.3.1         Using Static Memory
         3.3.2         Using Stack Memory
         3.3.3         Using Dynamic Memory
     3.4     Managing a Thread's Stack
         3.4.1         Sizing the Stack
         3.4.2         Using a Stack Guard Area
         3.4.3         Diagnosing Stack Overflow Errors
     3.5     Scheduling Issues
         3.5.1         Real-Time Scheduling
         3.5.2         Priority Inversion
         3.5.3         Dependencies Among Scheduling Attributes and Contention Scope
     3.6     Using Synchronization Objects
         3.6.1         Distinguishing Proper Usage of Mutexes and Condition Variables
         3.6.2         Avoiding Race Conditions
         3.6.3         Avoiding Deadlocks
         3.6.4         Signaling a Condition Variable
         3.6.5         Static Initialization Inappropriate for Stack-Based Synchronization Objects
     3.7     Granularity Considerations
         3.7.1         Determinants of a Program's Granularity
             3.7.1.1             Alpha AXP Processor Granularity
             3.7.1.2             VAX Processor Granularity
         3.7.2         Compiler Support for Determining the Program's Actual Granularity
         3.7.3         Word Tearing
         3.7.4         Alignments of Members of Composite Data Objects
         3.7.5         Avoiding Granularity-Related Errors
             3.7.5.1             Changing the Composite Data Object's Layout
             3.7.5.2             Maintaining the Composite Data Object's Layout
             3.7.5.3             Using One Mutex Per Composite Data Object
         3.7.6         Identifying Possible Word-Tearing Situations Using Visual Threads
     3.8     One-Time Initialization
     3.9     Managing Dependencies Upon Other Libraries
         3.9.1         Thread Reentrancy
         3.9.2         Thread Safety
         3.9.3         Lacking Thread Safety
             3.9.3.1             Using Mutex Around Call to Unsafe Code
             3.9.3.2             Using or Copying Static Data Before Releasing the Mutex
             3.9.3.3             Using the DECthreads Global Lock
         3.9.4         Use of Multiple Threads Libraries Not Supported
     3.10     Detecting DECthreads Error Conditions
         3.10.1         Contents of a DECthreads Bugcheck Dump File
         3.10.2         Interpreting a DECthreads Bugcheck


Previous Next Contents Index

[Site home] [Send comments] [Help with this site] [How to order documentation] [OpenVMS site] [Compaq site]
[OpenVMS documentation]

Copyright © Compaq Computer Corporation 1998. All rights reserved.

Legal
6101PRO_CONTENTS.HTML