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.
What are SPA/GPA parameters (SAP memory) SPA/GPA parameters are field values saved globally in memory. There are two ways to use SPA/GPA parmeters: By setting field attrib
When will the current screen processing terminates? A current screen processing terminates when control reaches either a Leave-screen or the end of PAI.
RST 4.5 is known as TRAP.
Does it makes sense for two domain name servers to contain exactly the same set of names? Why? Yes. This is very advantageous for two domain servers having similar set of names
Conversion of fractional number 0.6875 into its equivalent binary number ? Ans. Multiply the fractional number 0.6875 with 2 until the remainder becomes 0 that is, Ther
Define Edge-triggered S-R flip-flop Basic Symbol small triangle, called the dynamic input indicator, is used to identify an edge-triggered flip-flop. Truth Table.
Amdahl's law is suitable for applications where response time is critical. On the other hand, there are a lot of applications which need that accuracy of the resultant output shoul
You have been contacted by Jean-Luc Picard commanding officer of Star Trek: The Next Generation. The Commander needs your support to develop a software routine to simulate the Robo
A red and blue car were involved in a head-on collision. The red car was at a standstill and the blue car was possibly speeding. Eye witness video recorded suddenly following the
Logic manufactures have produced 'large scale' logic (LSI) blocks to achieve complex functions; a typical set of logic functions is that of data storage. There are two main types o
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: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd