tailieunhanh - Parallel Programming: for Multicore and Cluster Systems- P13

Parallel Programming: for Multicore and Cluster Systems- P13: Innovations in hardware architecture, like hyper-threading or multicore processors, mean that parallel computing resources are available for inexpensive desktop computers. In only a few years, many standard software products will be based on concepts of parallel programming implemented on such hardware, and the range of applications will be much broader than that of scientific computing, up to now the main application area for parallel computing | Levels of Parallelism 111 When employing the client-server model for the structuring of parallel programs multiple client threads are used which generate requests to a server and then perform some computations on the result see Fig. right for an illustration. After having processed a request of a client the server delivers the result back to the client. The client-server model can be applied in many variations There may be several server threads or the threads of a parallel program may play the role of both clients and servers generating requests to other threads and processing requests from other threads. Section shows an example for a Pthreads program using the client-server model. The client-server model is important for parallel programming in heterogeneous systems and is also often used in grid computing and cloud computing. Pipelining The pipelining model describes a special form of coordination of different threads in which data elements are forwarded from thread to thread to perform different processing steps. The threads are logically arranged in a predefined order T1 . Tp such that thread T receives the output of thread T-1 as input and produces an output which is submitted to the next thread Ti 1 as input i 2 . p - 1. Thread T1 receives its input from another program part and thread Tp provides its output to another program part. Thus each of the pipeline threads processes a stream of input data in sequential order and produces a stream of output data. Despite the dependencies of the processing steps the pipeline threads can work in parallel by applying their processing step to different data. The pipelining model can be considered as a special form of functional decomposition where the pipeline threads process the computations of an application algorithm one after another. A parallel execution is obtained by partitioning the data into a stream of data elements which flow through the pipeline stages one after another. At each point