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.
Artificial intelligence ("AI") can mean a lot of things too many people. Much confusion arises that the word 'intelligence' is ill-defined. The phrase is so broad that people have
Q. Structured Analysis and Design Approach? The objective of structured system analysis and design is to reduce maintenance time as well as effort. Modeling is the act of drawi
In the case of Static call, the called program is a stand-alone program, it is an executable program. During run time we can call it in our called program. As about Dynamic call, t
Which device consume minimum power ? Ans. Minimum power consume by CMOS as in its one p-MOS and one n-MOS transistors are connected in complimentary mode, so one device is ON a
What is finest way to get a reference to the viewport from anywhere in the code? Ans) You can use refs config to set a reference on the Application/Controllers
Example of Structural hazards - computer architecture: A machine has shared a single-memory pipeline for instructions and data. As a consequence, when an instruction which con
What are the importance of Decentralization? a) Self responsibility b) Work autonomy c) Quick decisions d) Continuous involvement and e) Better control. What are the differe
What are the characteristics of semiconductor RAM memories? They are available in a wide range of speeds. Their cycle time range from 100ns to less than 10ns. The
Now we will learn how to compile and run PVM programs. To compile the program change to directory pvm/lib/archname where archname is architecture name of your computer. Then the su
Q. What is Synchronous message passing? In Synchronous message passing is executed on synchronous communication network. In that case sender and receiver processes should be
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