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.
Explain Combinational logic circuits Ans. Combinational logic circuits:- (i) Outputs only depend upon present state of the input. (ii) No memory element present or no f
Massively Parallel System Refers to a parallel computer system having a great number of processors. The number in a great number of keeps increasing and currently it means more
Search Methods and Heuristics - Artificial intelligence: Here now we come to the question of how constraint solvers search for solutions -constraint preserving coursework of v
Can matchcode object contain Ids with different update types? Yes.
Interval between the time of submission and completion of the job is? Ans. Turnaround time is the interval in between the time of submission and completion of the job.
Define Compilers with High Level Programming Language? All high-level programming language (except strictly interpretive languages) comes with a compiler. Effectively the compi
Q. What is Gate? Explain Basic gates with truth table and necessary circuits. Q. Which gates are called Universal Gates? Why? Q. Give the Dual of the rule 17. Q. Realize
Q. Convert the following from octal to binary, decimal, hexadecimal and BCD. a) 7.7 b) 4037 c) 23.34
How to declare array in c
A distributed network configuration in which all data/information pass through a central computer is (A) Bus network (B) Star network (C) Rin
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