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.
Q. What do you mean by Program Counter? Program Counter (PC): It determines the instruction that is to be executed next which means after the execution of an on-going instructi
What are the advantages offered by data mining? Advantages offered through Data Mining are given below: a) Facilitates discovery of knowledge through massive, large data set
Determine the benefits of Message passing Message passing provides two major benefits: An object's properties are expressed by its methods, thus message passing support
Write a short note on structure chart. Structure Chart is an significant program design method and it shows all components of code in a hierarchical format
Explain the importance of Object Oriented Modelling It is important to note that wi t h the growing complexity of systems, significance of modelling techniques increases. Beca
Q. Displaying the List of Files with DIR? You can display the list of files kept in a diskette or hard disk with the DIR commend. This Commends list files and sub directories i
Explain characteristics of program translation model. The program translation model characteristics are: A program should be translated before this can be executed.
Q. Calculate Register Transfer Time? A clock isn't included explicitly in any statements discussed above. But it is presumed that all transfers take place during clock edge tra
I am the inventor of the railway signaling device now operated by timer. I wish to move on to the next phase where the equipment will be operated by DTMF codes. The device is a si
Question: (a) Primary and secondary memory differs in their way they access data: (i) Mention the four generic access methods usually present in a computer system. (ii) E
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