10.07.2015 Views

Is Parallel Programming Hard, And, If So, What Can You Do About It?

Is Parallel Programming Hard, And, If So, What Can You Do About It?

Is Parallel Programming Hard, And, If So, What Can You Do About It?

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CONTENTSv6 Locking 676.1 Staying Alive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.1.1 Deadlock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.1.2 Livelock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.1.3 Starvation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.1.4 Unfairness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.1.5 Inefficiency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.2 Types of Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.2.1 Exclusive Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.2.2 Reader-Writer Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.2.3 Beyond Reader-Writer Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.2.4 While Waiting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.2.5 Sleeping Safely . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676.3 Lock-Based Existence Guarantees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 Data Ownership 698 Deferred Processing 718.1 Barriers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718.2 Reference Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718.2.1 Implementation of Reference-Counting Categories . . . . . . . . . . . . . . . . . . . . 728.2.2 Linux Primitives Supporting Reference Counting . . . . . . . . . . . . . . . . . . . . . 758.2.3 Counter Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768.3 Read-Copy Update (RCU) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768.3.1 RCU Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 768.3.2 RCU Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828.3.3 RCU Linux-Kernel API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 908.3.4 “Toy” RCU Implementations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 958.3.5 RCU Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1069 Applying RCU 1099.1 RCU and Per-Thread-Variable-Based Statistical Counters . . . . . . . . . . . . . . . . . . . . 1099.1.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099.1.2 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1099.1.3 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1109.2 RCU and Counters for Removable I/O Devices . . . . . . . . . . . . . . . . . . . . . . . . . . 11110 Validation: Debugging and Analysis 11310.1 Tracing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11310.2 Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11310.3 Static Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11310.4 Probability and Heisenbugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11310.5 Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11310.6 Differential Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11310.7 Performance Estimation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11311 Data Structures 11511.1 Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11511.2 Computational Complexity and Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . 11511.3 Design Tradeoffs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11511.4 Protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11511.5 Bits and Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11511.6 <strong>Hard</strong>ware Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!