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.

8.3. READ-COPY UPDATE (RCU) 107also contains a pointer to a later section where thesolution is explained at length. The rcu_read_lock(), rcu_read_unlock(), rcu_dereference(),rcu_assign_pointer(), and synchronize_rcu()primitives should suffice for most of these exercises.Quick Quiz 8.61: The statistical-counter implementationshown in Figure 4.8 (count_end.c)used a global lock to guard the summation in read_count(), which resulted in poor performance andnegative scalability. How could you use RCU toprovide read_count() with excellent performanceand good scalability. (Keep in mind that read_count()’s scalability will necessarily be limited byits need to scan all threads’ counters.)Quick Quiz 8.62: Section 4.5 showed a fancifulpair of code fragments that dealt with counting I/Oaccessestoremovabledevices. Thesecodefragmentssufferedfromhighoverheadonthefastpath(startingan I/O) due to the need to acquire a reader-writerlock. How would you use RCU to provide excellentperformanceandscalability? (Keepinmindthattheperformance of the common-case first code fragmentthat does I/O accesses is much more important thanthat of the device-removal code fragment.)

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

Saved successfully!

Ooh no, something went wrong!