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.
the project database is avilable?
What are the Touch Panels In case of touch panels, displayed objects or screen positions is allowed to be selected with the touch of a finger. A typical application of touch pa
Take a look at the code and try to understand the logic, particularly, the way scrambled words are disambiguated, i.e.., whether they are matched successfully against a correct wor
Explain the characteristics of vector processing
Differentiate between message switching, packet switching and circuit switching Message switching: Recourse computer sends data to switching office that stores the data in
At a particular moment in time the output of a COMBINATIONAL logic circuit depends uponthe inputs to the circuit at the same instant.(Unlike sequential logic circuits where the out
A keyword that states the types in a particular namespace can be referred to without requiring their full qualified type names. 'using' reserved word always come with namespace
Web pages or materials which are in the form of hypermedia documents accessed through Internet can be located anywhere in world. No matter from where they originated, most Web d
Q. Write a program to find 1's and 2's complement of a Binary number. Perform necessary checking that if entered number is not a valid number, ask user to enter valid Binary n
What are the concerns for growth of e-commerce in India? Government as Facilitator for the growth of e-commerce has taken following steps: a. Promotion of competitive dataco
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