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.
Imp questions solution
Differences between inter statement and intra statement delay? //define register variables reg a, b, c; //intra assignment delays initial begin a = 0; c = 0;
Distributed System 1. What is a message passing system? Discuss the desirable features of a message passing system. 2. Discuss the implementation of RPC Mechanism in detail.
Electronic Data Interchange (EDI ) is used by companies for transactions that happen on regular basis to a pre-determined format. It is one of the electronic commerce technologies.
State about the Behavioral modeling Behavioral means how hardware behaves determine exact way it works we write using HDL syntax. For complex projects it's better mixed approac
Can math operations be performed on a void pointer? No. Pointer addition and subtraction are based on advancing the pointer by a number of elements. By explanation, if you have
With the help of a suitable diagram, explain how do you convert a JK flipflop to T type flipflop. Ans. As here flip flop is JK flip flop and it is required to convert JK in T.
SPC is used for (A) Carrying Exchange Control Functions (B) Carrying Subscriber Control Functions (C) Exchange Hardware (D) Signalling Purpose Ans:
Explain the term Confidentiality - Firewall Design Policy Whilst some corporate data is for public consumption, the vast majority of it should remain private.
Add a byte number from one memory location to a byte from subsequent memory location and put sum in the third memory location. Also save carry flag in the least significant bit of
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