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 fundamental steps in program development The basic steps in program development are as follows: a. Program coding, design and documentation. b. Preparation o
#questifind core radius for single mode operation at 850nm in SI fibre with n1=1.480 & n2=1.47 what is NAon..
Put the node in the right subtree Then, Put the root Put the node in the left subtree
Which structure can be used as a criterion for classification of data structures used in language processing. And. Nature of a data structure, purpose of a data structure and l
Explain R-2R ladder D/A converter. Ans. R-2R ladder D/A converter: An R-2R ladder D/A converter is shown in Fig.(a). It uses resistors of only two values R and 2R. The inp
Explain Flash devices It is possible to read the contents of a one cell, but it is only possible to write an whole block of cells Greater density which leads to superior cap
Building IS into our operational processes - Information System Although information systems are becoming increasingly prevalent they are not always the correct solution to ev
Q. Definition of Decision support system? Definition of DSS: A decision support system is a specific kind of information system which is an interactive system that supports in
Final Animation This is the final piece of work that should stand on its own as a piece of Art or Design. This is your personal response to the idea of Transformation - The pro
This assignment is based on the 'Swansea Docklands Heritage Society' case study attached. The assignment is the third of three related submissions, all based on the Swansea Dockla
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