Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Q. Show the Programmes for Parallel Systems?
Adding elements of an array using two processor
int sum, A[ n] ; //shared variables
void main ( ){
int i ;
for (i=0; i scanf ("%d",&A[i] ); sum=0; // now create process to be executed by processor P1 fork(1) add (A,n/2,n-1, sum); // process to add elements from index n/2 to - 1.sum is output variable // now create process to be executed by processor P0 add (A,0,n/2-1, sum); join 1 ; printf ("%d", sum); } add (int A[ ], int lower, int upper, int sum) { int sum1=0, i; for (i=lower; i<=upper; i++) sum1=sum1+A[i]; lock sum; sum=sum+sum1; unlock sum ; } In this program last half of array is passed to processor P1 that adds them. For the meantime processor P0 adds the first half of array. The variable sum is locked to avoid inconsistency.
scanf ("%d",&A[i] );
sum=0;
// now create process to be executed by processor P1
fork(1) add (A,n/2,n-1, sum); // process to add elements from index n/2 to -
1.sum is output variable // now create process to be executed by processor
P0 add (A,0,n/2-1,
sum);
join 1 ;
printf ("%d", sum);
}
add (int A[ ], int lower, int upper, int sum)
{
int sum1=0, i;
for (i=lower; i<=upper; i++)
sum1=sum1+A[i];
lock sum;
sum=sum+sum1;
unlock sum ;
In this program last half of array is passed to processor P1 that adds them. For the meantime processor P0 adds the first half of array. The variable sum is locked to avoid inconsistency.
Von Neumann architecture was first majoranticipated structure for general-purpose computer. However before consideringmain components of von Neumann architecture let us first elabo
In a hundred-line exchange 24 two-motion selectors are used. Draw the schematic you suggest for this exchange and explain its working. How many simultaneous calls can be made durin
What is the functionality of Remote Login? Remote Login gives similar functionality of telnet, along with the added functionality of not involving a password from trusted cli
Example of ANN - artificial intelligence: ANNs look like this: Notice that the x, w, z and y represent actual valued weights and that every the edges in this graph
a. What is the meaning of user interaction? What are the dissimilar styles in which forms of interaction can be classified? Give one advantage, disadvantage and an example of every
What is turnaround time? Turnaround time is the interval from the time of submission to the time of completion of a process. It is the sum of the periods spent waiting to get i
How many two input AND gates and two input OR gates are required to realize Y = BD+CE+AB ? Ans. Here three product terms, therefore three AND gates of two inputs are needed.
#what is the history of computer science
Read only memory (ROM) ROM holds the instructions for starting up the computer. This sort of memory can only be read and can't be altered (that implies deleted or written to) a
What is class, class diagram? An object is an instance of a class. Class explains a group of objects with similar properties (attributes), behaviour (operations), kinds of rela
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd