Mehr lesen
List of Example Programs. Preface. Intended Audience. About the Author. Acknowledgments. 1. Introduction. The "Bailing Programmers". Definitions and Terminology. Asynchronous. Concurrency. Uniprocessor and Multiprocessor. Parallelism. Thread Safety and Reentrancy. Concurrency Control Functions. Asynchronous Programming is Intuitive... . . . Because Unix is Asynchronous. . . . Because the World is Asynchronous. About the Examples in This Book. Asynchronous Programming, by Example. the Baseline, Synchronous Version. A Version Using Multiple Processes. A Version Using Multiple Threads. Summary. Benefits of Threading. Parallelism. Concurrency. Programming Model. Costs of Threading. Computing Overhead. Programming Discipline. Harder to Debug. To Thread or Not to Thread? POSIX Thread Concepts. Architectural Overview. Types and Interfaces. Checking for Errors. 2. Threads. Creating and Using Threads. The Life of a Thread. Creation. Startup. Running and Blocking. Termination. Recycling. 3. Synchronization. Invariants, Critical Sections, and Predicates. Mutexes. Creating and Destroying a Mutex. Locking and Unlocking a Mutex. Nonblocking Mutex Locks. Using Mutexes for Atomicity. Sizing a Mutex to Fit the Job. Using More Than One Mutex. Lock Hierarchy. Lock Chaining. Condition Variables. Creating and Destroying a Condition Variable. Waiting on a Condition Variable. Waking Condition Variable Waiters. One Final Alarm Program. Memory Visibility Between Threads. 4. A Few Ways to Use Threads. Pipeline. Work Crew. Client/Server. 5. Advanced Threaded Programming. One-Time Initialization. Attributes Objects. Mutex Attributes. Condition Variable Attributes. Thread Attributes. Cancellation. Deferred Cancelability. Asynchronous Cancelability. Cleaning Up. Thread-Specific Data. Creating Thread-Specific Data. Using Thread-Specific Data. Using Destructor Functions. Realtime Scheduling. POSIX Realtime Options. Scheduling Policies and Priorities. Contention Scope and Allocation Domain. Problems With Realtime Scheduling. Priority-Aware Mutexes. Priority Ceiling Mutexes. Priority Inheritance Mutexes. Threads and Kernel Entities. Many-to-One (User Level). One-to-One (Kernel Level). Many-to-Few (Two Level). 6. Posix Adjusts to Threads. Fork. Fork Handlers. Exec. Process Exit. Stdio. Flockfile and Funlockfile. Getchar_Unlocked and Putchar_Unlocked. Thread-Safe Functions. User and Terminal Identification. Directory Searching. String Token. Time Representation. Random Number Generation. Group and User Database. Signals. Si...