12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

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

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

Timehigh-performance computing hardware 371MasterComputeCreateCreateComputeReceiveReceiveReceiveComputeReceiveSendSlave 1computesendcomputesendcomputereceivesendcomputesendSlave 2computesendcomputesendcomputereceivesendcomputesendFigure 14.9 A master process and two slave processes passing messages. Notice how thisprogram has more sends than receives and consequently may lead to results that depend onorder of execution, or may even lock up.2. Have your job start additional processes.3. Have these processes exchange data and coordinate their activities.4. Collect these data and have the processes stop themselves.We show this graphically in Figure 14.9 where at the top we see a master processcreate two slave processes and then assign work for them to do (arrows). The processesthen communicate with each other via message passing, output their datato files, and finally terminate.What can go wrong: Figure 14.9 also illustrates some of the difficulties:• The programmer is responsible for getting the processes to cooperate and fordividing the work correctly.• The programmer is responsible for ensuring that the processes have thecorrect data to process and that the data are distributed equitably.• The commands are at a lower level than those of a compiled language, andthis introduces more details for you to worry about.• Because multiple computers and multiple operating systems are involved,the user may not receive or understand the error messages produced.• It is possible for messages to be sent or received not in the planned order.−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 371

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

Saved successfully!

Ooh no, something went wrong!