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.
I am required to write about the impact of the internet on firms with reference to the following questions: 1. Describe the concept of value creation. Explain how a firm can use
Q. Explain arithmetic shift Micro-operations? In arithmetic shift a signed binary number is shifted to right or to the left. So an arithmetic shift-left causes a number to be m
Explain the Communications of Request/Response Communications requirements for message or procedural- based interaction are very similar. Application interaction (client-server
1- The Privacy Policy: The vendor must explain to the customer how all his information especially sensitive ones will be totally private, and no one can read them or use them i
Specify the goals of parsing. Goals: a. To check the validity of source string b. To agree on the syntactic structure of a source string. For invalid string this rep
Real-Time Software Programs that monitor/analyze/ control real world events as they take place are known as real-time software. Elements of real-time software involve a data
Given memory partitions of 100k, 500k, 200k, 300k, and 600k (in order), apply first fit and best fit algorithms to place processes with the space requirement of 212k, 417k, 112k an
Difference between aggregation and association Aggregation is a particular form of association, not an independent concept. Aggregation acts semantic connotations. If two objec
Superscalar architecture was designed to increase the speed of the scalar processor. But it has been realized it's not easy to apply. Subsequent are a number of problems faced in t
Q. Show the Features of parallel virtual machine? Easy to install; Easy to configure; Multiple users each can use PVM concurrently; Multiple applications fro
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