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.

274 APPENDIX F. ANSWERS TO QUICK QUIZZESQuick Quiz 1.13:Are there any other obstacles to parallel programming?Answer:There are a great many other potential obstacles toparallel programming. Here are a few of them:1. The only known algorithms for a given projectmightbeinherentlysequentialinnature. Inthiscase, either avoid parallel programming (therebeingnolawsayingthatyourprojecthas torunin parallel) or invent a new parallel algorithm.2. The project allows binary-only plugins thatshare the same address space, such that noone developer has access to all of the sourcecode for the project. Because many parallelbugs, including deadlocks, are global in nature,such binary-only plugins pose a severe challengeto current software development methodologies.This might well change, but for the time being,all developers of parallel code sharing a givenaddress space need to be able to see all of thecode running in that address space.3. The project contains heavily used AP<strong>Is</strong> thatwere designed without regard to parallelism.<strong>So</strong>me of the more ornate features of the SystemV message-queue API form a case in point. Ofcourse, ifyourprojecthas beenaroundforafewdecades, and if its developers did not have accesstoparallelhardware,yourprojectundoubtedlyhas at least its share of such AP<strong>Is</strong>.4. The project was implemented without regardto parallelism. Given that there are a greatmany techniques that work extremely well ina sequential environment, but that fail miserablyin parallel environments, if your projectran only on sequential hardware for most of itslifetime, then your project undoubtably has atleast its share of parallel-unfriendly code.5. The project was implemented without regard togood software-development practice. The crueltruth is that shared-memory parallel environmentsare often much less forgiving of sloppydevelopment practices than are sequential evironments.<strong>You</strong> may be well-served to clean uptheexistingdesignandcodepriortoattemptingparallelization.6. The people who originally did the developmenton your project have since moved on, and thepeople remaining, while well able to maintain itor add small features, are unable to make “biganimal” changes. In this case, unless you canwork out a very simple way to parallelize yourproject, you will probably be best off leaving itsequential. That said, there are a number ofsimple approaches that you might use to parallelizeyour project, including running multipleinstances of it, using a parallel implementationof some heavily used library function, or makinguse of some other parallel project, such as adatabase.One can argue that many of these obstacles arenon-technical in nature, but that does not makethem any less real. In short, parallization can bea large and complex effort. As with any large andcomplex effort, it makes sense to do your homeworkbeforehand.Quick Quiz 1.14:Where are the answers to the Quick Quizzes found?Answer:In Appendix F starting on page 271.Hey, I thought I owed you an easy one!!!Quick Quiz 1.15:<strong>So</strong>me of the Quick Quiz questions seem to be fromthe viewpoint of the reader rather than the author.<strong>Is</strong> that really the intent?Answer:Indeed it is! Many are modeled after Paul—justask anyone who has had the misfortune of beingassigned to teach him. Others are quite similarto actual questions that have been asked duringconference presentations and lectures covering thematerial in this book. Still others are from theviewpoint of the author.Quick Quiz 1.16:These Quick Quizzes just are not my cup of tea.<strong>What</strong> do you recommend?Answer:There are a number of alternatives available to you:1. Just ignore the Quick Quizzes and read the restofthebook. <strong>You</strong>mightmissoutontheinterestingmaterial in some of the Quick Quizzes, butthe rest of the book has lots of good material as

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

Saved successfully!

Ooh no, something went wrong!