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 the restrictions on Subscreens? Subscreens have various restrictions. They cannot: Set their own GUI status Have a named OK code Call another screen
Why do you think you are asked to do valuation given an array of discount rates? a. Would it not be extra accurate to utilize, for intsnces , CAPM to calculate cost of equity
Q. Show Arithmetic Subtraction? The subtraction can be done easily using 2's complement by taking 2's complement of value which is to be subtracted (inclusive of sign bit) and
What is pipelining? What are the various hazards encountered in pipelining? Explain in detail. The major characteristics of a pipeline are: a) Pipelining cannot be exe
Q. How to copy files from a drive and directory? You can copy files from a drive and directory other that the currently selected one. However in that case, you need to speci
Your shell must accept the exit command. This command will be in the form: e x i t When you encounter this command, your shell should terminate. Please note that when you
Explain busy waiting semaphores. Weak, Busy-wait Semaphores: The simplest method to implement semaphores. Useful while critical sections last for a short time, or we
What is the fundamental Digital Design? Digital design is distinct through analog design. In analog circuits we deal along with physical signals that are continuous in amplitud
Equivalences: In this following miscellaneous equivalence rules are often useful during rewriting sessions. So there the first two allow us to completely get rid of implicatio
What is byte addressable memory? The assignment of successive addresses to successive byte locations in the memory is known as byte addressable memory.
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