Summary

The challenges to parallel programming introduced in Chapter 2 can be reasonably approached using the building blocks that we introduced in this chapter. The importance of the interface class in simplifying the use of function libraries cannot be overstated. The interface class introduces consistency of API by wrapping the function calls of libraries such as MPI or PVM. Type safety and reuse is introduced through interface classes. The interface class allows the programmer to work with a familiar metaphor, as in the case of PVM streams or MPI streams. IPC is simplified by connecting pipe or message streams to iostreams and overriding the << inserter and >> extractor operators for user -defined classes. The ostream_iterator class proves to be very useful in sending entire container objects and their contents between processes. The ostream_iterator and istream_iterator also provide the glue between the standard algorithms and IPC components and techniques. Since a large number of parallel or distributed applications use the message-passing model, any technique that simplifies passing various datatypes between processes will simplify the programming required for the application. Using iostreams, the ostream_iterator and istream_iterator does this simplification. The framework class is introduced here as the basic building block of concurrency applications. We consider classes like the mutex classes, condition variable classes, and the stream classes to low-level components that should be hidden from the programmer within the framework class (where possible!). When building medium- to large-scale applications that require concurrency, the programmer should not have to focus on these low-level components. Ideally, the framework will be the base-level building block for concurrency approaches, which we introduce in the remainder of this book. The framework will provide us with patterns for peer-to-peer and client-server interaction. We can have numeric frameworks, database frameworks, agent frameworks, blackboard frameworks, GUI frameworks, and so on. The approach that we advocate for implementing concurrency requirements builds applications from a collection of frameworks that already have the proper synchronization components wired into the proper relationships. In Chapters 12 and 13, we take a closer look at frameworks that support concurrency. We also introduce the use of standard C++ algorithms, containers, and function objects to manage the creation and spawning of multiple tasks or threads in applications that require concurrency.



Parallel and Distributed Programming Using C++
Parallel and Distributed Programming Using C++
ISBN: 0131013769
EAN: 2147483647
Year: 2002
Pages: 133

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net