M - algorithm corrections, C/C++ Programming

Of course it is C[i] = A[i] + B[i].It was a typing mistake,never mind. You just understand the concept.

27-1 b.

for grain-size=1

n=A.length

grain-size=1

r=n

for k=0 to n-1

spawn ADD-SUBARRAY(A,B,C,k+1,min((k+1),n)

)

sync

This will make n sub branches all to be executed in parallel and finally sync instruction will cause the flow of execution to be synchronized at that point.

27-1 C.

x1 is the constant to represent computational cost of spawning a new process. This step is executed (n/grain-size) number of times.
x2 is the constant to represent the computational cost of the addition operation. This step is executed (grain-size) number of times for each spawned preocess in parallel.

Hence total time for a parallel thread is x1(n/grain-size) + x2.(grainsize)

Posted Date: 3/19/2013 3:46:47 AM | Location : United States







Related Discussions:- M - algorithm corrections, Assignment Help, Ask Question on M - algorithm corrections, Get Answer, Expert's Help, M - algorithm corrections Discussions

Write discussion on M - algorithm corrections
Your posts are moderated
Related Questions
What is the role of && operator in a program code? - && is also referred to as AND operator. - When this operator is used, all conditions specified should be TRUE before nex

Explain about the Expressions in c Language? An expression is the combination of constants, variables and operators arranged as per the syntax of the language. Some of the illu

- Create a program that uses at least two functions that will be called from your main. This program is a number game program that asks for parts of your phone and after manipulati

Need someone to look over my assignment for correctness and make any necessary changes.

program to convert string from super ascii string with minimum cost

#include stdio.h> #include conio.h> #include string.h>   void del(char[],char *); main() {           char str[30],ch,*pp;           clrscr();           p

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

C program to demonstrate call by reference: void disp(int *,int*,int*,int*); void main() {                 int a=2,b=3, sum,mul;                 printf("Enter 1st n

Pebble Merchant Problem Description There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci