Thread Time: The MultiThreaded Programming Guide
暂无分享,去创建一个
Preface. 1. The Process Model. The [Single-Threaded] Process. The Context of a Process. The Process Model Operating System. Process Scheduling. Process Context Switches. Process Life Cycle, Modes, States, and Transitions. An Illustration of a Process. The Limitations of Single-Threaded Programs. Summary. Exercises. 2. The Thread Model. Analogy of Single-Threaded Execution. Analogy of Multithreaded Execution. The Benefits of Threads. Thread Context, Modes, States, and Transitions. User Threads and Kernel Threads. Bound and Unbound Threads. The Thread Model Operating System. Many-to-One (Mx1). One-to-One (1x1). Many-to-Many (MxN). An Illustration of a Multithreaded Program. Summary. Exercises. 3. Introduction to POSIX. The POSIX Standard. POSIX Components. POSIX Options. Compile-Time Checking. Run-Time Checking. Namespace Reservation. Summary. Exercises. 4. Basic Thread Management. Relating Process and Thread Model Functions. Creating a Thread. Waiting for a Thread. Detaching a Thread. Terminating a Thread. Finding and Comparing Thread Ids. Performing One-Time Initialization. Establishing Fork Handlers. Creating Specialized Thread Attributes. Handling Thread Management Errors. Summary. Exercises. 5. Thread Synchronization. Thread Synchronization. Mutexes. Mutex Attributes. Initializing and Destroying Mutexes. Locking and Unlocking Mutexes. Example: Mutexes and Spinlocks. Condition Variables. Condition Variable Attributes. Initializing and Destroying Condition Variables. Waiting on a Condition. Signaling a Condition. Example: Condition Variables and Barriers. Semaphores. Initializing and Destroying Unnamed Semaphores. Locking and Unlocking Semaphores. Handling Synchronization Errors. Memory Models and Synchronization. Summary. Exercises. 6. Thread Scheduling. Thread Scheduling Contention Scopes. Thread Scheduling Policies. SCHED_FIFO. SCHED_RR. SCHED_OTHER. A Thread's Scheduling Policy and Priority. Thread Scheduling Priority Values. Thread Scheduling Allocation Domains. Thread Creation Scheduling Attributes. Dynamic Thread Scheduling. Yielding the Processor. Priority Inversion and Mutexes. Summary. Exercises. 7. Threads and Signals. Signals in the Thread Model. Synchronous and Asynchronous Signals. Examining/Changing a Thread's Signal Mask. Sending Signals to Threads. Waiting for a Signal. Async-Signal Safe Thread Functions. A New Signal Delivery Method: SIGEV_THREAD. Summary. Exercises. 8. Thread Cancellation. Thread Cancellation. Thread Cancelability States. Cancellation Points. Setting Thread Cancelability States. Creating a Cancellation Point. Installing Cancellation Cleanup Handlers. Canceling a Thread. Async-Cancel Safety. Summary. Exercises. 9. Thread-Specific Data. Thread-Specific Data. Creating Thread-Specific Data Keys. Deleting Thread-Specific Data Keys. Accessing Thread-Specific Data Elements. The Special Case, errno. Example: Per-Thread Signal Handlers. Summary. Exercises. 10. Thread Extensions. HP and X/Open Thread Extensions. Thread Stack Attributes. Suspending and Resuming Threads. Mutex Extensions. Condition Variable Expiration Time. Read-Write Locks. Read-Write Lock Attributes. Initializing and Destroying Read-Write Locks. Locking and Unlocking Read-Write Locks. The Timeshare Scheduling Policy. Thread to Processor Binding. Thread Concurrency and MxN Threads. Scheduling Unbound Kernel Entities. Summary. Exercises. 11. Thread F/X. fork(), exec(), exit(), and wait(). File and Message-Passing Operations. Signals. Locale State. Timers and Sleepers. NonLocal Jumps. Scheduling. Other Functions. Summary. Exercises. 12. Writing Thread-Safe Code. Reentrant, Thread-Safe, and Unsafe Functions. How to Manage Shared Objects. How to Avoid Deadlock. How to Find Thread-Safe Library Interfaces. How to Write Cancel-Safe Functions. How to Write Fork-Safe Functions. How to Write a Thread-Safe Library. Summary. Exercises. 13. Programming Guidelines. Basic Thread Management. Thread Synchronization. Thread Scheduling. Threads and Signals. Thread Cancellation. Thread-Specific Data. Thread Extensions. Thread F/X. Summary. Exercises. 14. Debugging Threaded Applications. Deadlock. Inconsistent Behavior Across Platforms. Out of Resources. Poor Performance. Unexpected Behavior, Value, or Output. Summary. Exercises. 15. Parallel Programming Models and Issues. Parallel Programming. The Work-Crew Model. The Boss-Worker Model. The Pipeline Model. The Master-Slave Model. Thread Creation Issues. Thread Synchronization Issues. Multiprocessor Cache Thrashing Issues. Summary. Exercises. APPENDIX A. Pthread Manual Pages. APPENDIX B. Glossary. APPENDIX C. Bibliography. Index.