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.
Engineering Applications A few of the engineering applications are: Airflow circulation over aircraft machinery, Simulations of simulated ecosystems. Airflow c
What is Fork swap? "Fork ()" is a system call to make a child process. When the parent process calls "fork()" system call, the child process is formed and if there is short of
Assignment 4: Handwritten Bangla Numeral Recognition using Multilayer Feed Forward Neural Network. In this assignment, you will design a multi layer feed forward neural network
Multiple bus architecture: One solution to the bandwidth restriction of a single bus is to simply add extra buses. Consider the architecture indicated in given figure that con
What are the Advantages of carrying out simulations - saves cost (instead of doing the real thing) - Safer (scenarios tried out on the simulation first before used in real
Conversion of Decimal number 82.67 to its Binary Equivalent Ans. Firstly see the integer part 82 and determine its binary equivalent as The Binary equivalent is (101001
Explain the functionality of the quadrant approach in the Spiral Model ?
Develop a regular expression for Real number and Real number with optional fraction (i) A regular expression for real number is [+ | -] (d)+. (d)+ (ii) A regular expression
Describe five bit even parity checker. Ans: Five bit even parity checker: EX-OR gates are utilized for checking the parity as they generate output 1, while the input ha
What are the steps involved in authentication? Steps in Authentication The control over the access of the resources in the repository is exercised in two steps namely Auth
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