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. Define pvm library functions? int info = pvm_freebuf( int bufid ) organizes of a message buffer. bufid message buffer identifier. int pvm_getsbuf( void
List the properties which a hashing function should possess to ensure a good search performance. What approaches are adopted to handle collision? A hashing function h must poss
Explain What is the difference among embedded systems and the system in which RTOS is running? Ans) Embedded system can have RTOS and cannot have also. It depends on the requi
Why Gateways are used during mail transfer? Email using SMTP effort best while both the sender and the receiver are on the internet and can hold TCP connections in between send
We might model such a scenario using three types of object: one for Customers, one for BankAccounts and another for Transactions. In terms of data required, for Customers assume we
When signed numbers are used in binary arithmetic, then which one of the notations would have unique representation for zero ? Ans. When signed numbers are utilized in binary ar
Permanently resident pages: Every virtual memory systems have memory areas that are "pinned down", for example cannot be swapped out to secondary storage, for instance:
Modify your program so that the line "int numStones = ui.readStones();" in the Game constructor is considered. Depending on the value of numStones read from the user, you should cr
Q. Illustrate what is a Centrifugal Force? Answer:- Centrifugal force is the force that is equivalent in magnitude but opposite in direction to the centripetal force which
Describe some general uses for Visual basic applications in general context? Ans) Visual basic can be used within almost all Microsoft products such as Map point, Visio, Auto ca
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