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
Literals (Constants) Constants are data storage locations whose address is not accessible for the user. Their value is not altered during the course of the program. Literal

Ravi is a newbie to the programming and while learning the programming language he came to know the following rules: · Each program must start with ''''''''{'''''''' and end wi

At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with thes

Define Functions with arguments and no return values The calling function will read a data from the terminal and pass it on to called as function and this will work good as the

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

#include void func(int num, b=5) { auto int total=0; static int sum=0; for ( int i=num; i>0 ; i--) total+=i; sum+=total; cout

Default argument: When the argument is missing then the function will read the default value of the missing argument.  To make use of default argument functionality the argu

Nested Classes Many a times, it becomes essential to have a class contain properties of two other classes. One way is to explain a class within another - that is a class with m

answer for tcs is working question

Q: What are User Defined data types? C supports an extraordinary feature known as "type definition" that permits users to define an identifier that would represent an existing