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.
Every computer connected to Internet has a unique address. Let's just say your IP address is 1.2.3.4 and you want to send a message to computer with IP address 5.6.7.8. Message you
Recombination: Therefore during the selection and mating process then the GA repeatedly lines up pairs of individuals for reproduction. Hence the next question is how to gener
What is the benefit of MITRE''s evolutionary approach to KM?
LINQ Providers are a set of classes that takes a LINQ query and dynamically produces a method that implements an equivalent query against an exact data source.
In general, all public processes of a controller class are treated as action processes. If you require prevent this default behaviour, just decorate the public process with NonActi
Q. The work function of a metal surface is 6.626 X 10-19 joule. Compute the frequency of the radiation? Work function W = hγ o The fre
Discuss about Constrained-Random Verification Methodology Advent of constrained-random verification gives verification engineers an effective method to achieve covera
List Out the Features of Computer Memory? Features of each type of memory Type Volatile? Write able? Erase Size
Q. What is Domain explain? Domain can be an apartment complex, a town or even a country. Sub-domains can correspond to organizations like expertsmind. United States comes under
Draw an expression tree for the string. f + (x+y) *((a+b)/(c-d)). Indicate the register requirement for each node and list out the evaluation order for the expression tree. For
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