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.
What are the applications of Electronic Data Interchange in business? The applications of Electronic Data Interchange are as given below: 1. Organisations that use EDI 2
How society is affected thorugh Internet Buying goods and services (for example banking) over the internet has both negative and positive aspects on society. These can be expl
Suppose the random sample used for each tree in the previous random forest is decreased from 1000 rows to 500 rows. Circle ALL that are true for the ensemble classifier. a) Vari
Give explanation about the use of SSL to secure the network. SS L stands for Secure Sockets Layer is a protocol developed through Netscape for transmitting private document
There are two goals to AI; the major one is to produce an artificial system that is about as good as or good than a human being at dealing with the actual world. The second goal is
Factor which helps in analysis of parallel algorithms is the total number of processors needed to deliver a solution to a provided problem. So for a given input of size let's say n
What are the various phases of consumer merchantile model and also differentiate between prepurchase interaction & post purchase interaction. There are three phase of consumer
What are Grouping Notations These notations are boxes into which a model could be decomposed. Their elements includes of packages, frameworks and subsystems.
representation of the adjacency matrix and adjacency list
Write an applet that display the directory holding the HTML file that started the applet and the directory from which, applet class file was loaded. An applet is here given bel
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