1
32kviews
Explain the various types of Parallel Programming Models
1 Answer
3
2.9kviews

There are four types of parallel programming models:

1.Shared memory model

2.Message passing model

3.Threads model

4.Data parallel model

Explanation:

1.Shared Memory Model

enter image description here

In this type, the programmer views his program as collection of processes which use common or shared variables.

The processor may not have a private program or data memory. A common program and data are stored in the main memory. This is accessed by all processors.

Each processor is assigned a different part of the program and the data. The main program creates separate process for each processor.

The process is allocated to the processor along with the required data. These process are executed indecently on different processors.

After the execution, all the processors have to rejoin the main program,

Advantages

Program development becomes simple.

There is no need to explicitly specify the communication between data and process.

Disadvantages

Users will not understand where his variables use stored.

The native compiler present at each processor translates user variables into act addresses in main memory.

2.Message Passing Model

enter image description here

In this type, different processes may be present on single multiple processors. Everyprocess has its own set of data

The data transfer between the processes is achieved by send and receive message requires co-operation between every process.

There must be a receive operation for every send operation.

Advantages

The data can be stored anywhere.

Communication between processes is simple.

Many Manage Passing Interfaces (MPS) are available.

Disadvantage

Programmers should take care that there is a reccive function for every send function.

If any of the process, quite, others also will stop working, an they are dependent.

3.Threads Model

A thread is defined as a short sequence of instructions, within a process. Different threads can be executed on same processor or on different process.

If the threads are executed on same processor, then the processor switches between the threads in a random fashion.

If the threads are executed on different processors, they are executed simultaneously.

enter image description here

enter image description here

The threads communicate through global memory.

Advantages

Programmer need not have to worry about parallel processing.

Disadvantages

Care must be taken that no two threeds update the shared resources simultaneously.

4.Data Parallel Model

Data parallelism is one of the simplest form of parallelism. Here data set is orignized into a common structure. It could be an array.

Many programs apply the same operation on different parts of the common structurere

Suppose the task is to add two arrays of 100 elements store the result in another array. If there are four processor then each processor can do 25 additions.

enter image description here

Please log in to add an answer.