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 is a digital comparator? Ans: Digital Comparator: The comparison of two numbers is an operation which evaluates if one number is greater than, less than, or equival
1. The network shown in figure 2 uses neurons with: (a) Unipolar Binary; (b) Bipolar Binary. Calculate a table of responses to all four possi
Explain difference of Circuit switching versus Packet switching. Within circuit switching an end-to-end path is to be establishing before any data can be sent. Previously a con
What happens if the both source and destination are named the same? Ans) The import operation present in MS Access does not overwrite or change any of the existing tables or obj
Convert the decimal number 45678 to its hexadecimal equivalent number. Ans: (45678) 10 =(B26E) 16 (45678) 10 =(B26E) 16
Q. Binary floating-point number range? Smallest Negative number Maximum mantissa and maximum exponent = - (1 -2 -24 ) × 2 127 Largest negative number
How many logical drives is it possible to fit onto a physical disk? Ans) Maximum of 24 logical drives can be fit into physical disk. The extended partition can only have 23 lo
What is Hashing? Hashing: Hashing gives the direct access of record from the file no matter where the record is in the file. This is possible with the help of a hashing functio
CLASSIFICATION OF DIGITAL COMPUTER Computer are classified under a number of factors.Some people classify them according to their processing speed.main memory,technology used
Illustrate the list of key differences to word processors The following is a list of key differences to word processors: - Most word processors force users to work on a doc
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