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.
A protocol is a formal description of message formats and the rules two or more machines must follow to exchange those messages. Because TCP (transmission control protocol) and IP
Write a program which collects in data samples from a port at 1 ms interval. The upper 4 bits collected data same as mastered and stored in an array in successive locations. ; R
How do I create a DoDAF OV-2 for the construction of a green data center?
Describe the role of Software developers Software developers have wide experience of tackling such issues. Students who develop software project spending days and nights strug
Explain in detail about Touch screens For people who can't use a keyboard allowing input; also helps people with learning difficulties since icons are easier to understand
Define the term- Verification It is a way of preventing errors when data is copied from one medium to another (for instance from paper to disk/CD or from memory to DVD, etc.).
What are the components of I-way Infrastructure? There are three mechanism of the I-way infrastructure: Consumer access equipment Local on-Ramps Global informa
Reprographic Methods i) Thermography ii) Dyeline jii) Microfiche iv) Fax In this unit you have learnt that: Used for Methods of reprography are used for the
Floating point Arithmetic pipelines Floating point computations are the finest candidates for pipelining. Take the instance of addition of two floating point numbers. Following
Hiding data within the class and making it available only by the methods. This method is used to protect your class against accidental changes to fields, which might leave the clas
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