1. KUVEMPU UNIVERSITY Department of Computer Science Jnana Sahyadri Shankarghatta Seminar on “ PRAM ALGORITHMS ” Presented by : Deepika R, 2 nd sem , M.Sc, Dept. Of Computer Science, Shankarghatta. Under the Guidance of : Suresh M, Dept. Of Computer Science, Shankarghatta.
2.
3. Introduction: There are many application in day to day life that demand real time solution to problem. For example weather forecasting has to done in a timely fashion etc.. If an expert system is used to aid a physician in surgical procedures ,decisions have to be made within seconds. And so on. Programs written for such applications have to perform an enormous amount of computation. Even the fastest single-processor machine may not be able to come up with solutions within tolerable time limits. Parallel Random Access Machines (PRAM) offer the potential of decreasing the solution times enormously .
4. Example:- Say there are 100 numbers to be added and there are two persons A and B. Person A can add the first 50 numbers. At the same time B can add the next 50 numbers. When they are done, one of them can add two individual sums to get the final answer. So two people can add the 100 numbers in almost half the time required by one.
5. Computational model:- In the RAM (Random Access Machine) we assume that any of the following operation can be done in one unit of time: addition, subtraction, multiplication, division, comparison, memory access, assignment, and so on. This model widely accepted as a valid sequential model. An important feature of parallel computing that is absent in sequential computing is need for interprocessor communication . For example given any problem, the processor have to communicate among themselves and agree on the subproblems each will work on. Also they need to communicate to see whether every one has finished its task so on.
6.
7. Fixed connection machines A fixed connection network is a graph whose nodes represent processor and edges represent communication links between processors. Here communication time depends on the lengths of these path. Ex:-
8. Shared memory model Here a number of processor work synchronously. They communicate with each other using common block of global memory that is accessible by all. This global memory is called common or shared memory.
9.
10. Odd-Even Merge Odd-even merge is a merging algorithm based on divide-and conquer that yield itself to efficient parallelization. Step 1. Partition X 1 and X 2 into their odd and even parts. That is, partition X 1 odd =k 1 ,k 3 ,…..,k m-1 and X 1 even =k 2 ,k 4 ,…..,k m . Similarly, partition X 2 into X 2 odd and X 2 even Step 2. Recursively merge X 1 odd with X 2 odd using m processors. Let L 1 =l 1 ,l 2 ,……..l m be the result. Note that X 1 odd , X 1 even , X 2 odd and X 2 even using other m processors to get L 2 =l m+1 ,l m+2 ,……..l 2m Step 3.Shuffle L 1 and L 2 ; that is, form the sequence L=l 1 ,l m+1 ,l 2 ,l m+2 ,……..l m ,l 2m . Compare every pair and inter change them if they are out of order. That is, compare l m+1 with l 2 and interchange them if need be, compare l m+2 with l 3 and interchange them if need be, so on, Output the resultant sequence.
11. X1=2,5,8,11,13,16,21,25 X2=4,9,12,18,23,27,31,34 2,8,13,21 5,11,16,25 4,12,23,31 9,18,27,34 L 1 = 2,4,8,12,13,21,23,31 L 2 =5,9,11,16,18,25,27,34 L=2, 5,4 9,8 11,12 16,13 18,21 25,23 27,31 ,34 2,4,5,8,9,11,12,13,16,18,21,23,25,31,34 Compare and exchange Shuffle Merge Merge X 1 odd X 1 even X 2 odd X 2 even
12. Sorting Sorting is the task of arranging an unordered collection (sequence) of elements into monotonically increasing (or decreasing) order. Odd-Even Merge Sort Odd even merge sort employs the classical divide and conquer strategy. If X=k 1 ,k 2 ,…..,k n is the given sequence of n keys, it is partitioned into two subsequences X 1 1 =k 1 ,k 2 ,…..,k n/2 and X 2 1 =k n/2+1 ,k n/2+2 ,…..,k n of equal length. X 1 1 and X 2 1 are sorted recursively assigning n/2 processor to each. The two sorted subsequences are then finally merged.