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.
Cost Involved in Inter-Processor Communication Because data is assigned to too many processors in a parallel computer whilst executing a parallel algorithm processors may be ne
List the typical functions of operating systems. Classical functions of operating system are given as: (1) Process management: A process is a program throughout execution.
What is micro operation? A micro operation is an elementary operation performed with the data kept in registers. 1) Register transfer microoperation transfer binary inform
Types of validation controls provided by ASP.Net There are following types of validation controls provided by ASP.Net: 1. Required Field Validator 2. Compare Validator
Steps in Building the Structure Chart 1. Recognize top level modules and decompose them into lower levels 2. Add control connections 3. Add couples 4. Review and revis
Explain Session Layer of OSI Model. The session layer manages, establishes and terminates communication sessions. Communication sessions contain service of requests and serv
What is binary adder? Binary adder is constructed with full adder circuit linked in cascade, with the output carry from one full adder linked to the input carry of next full ad
The larger the Grade of Service, the worse is the service given, it is true or false. Ans: It is true that larger the Grade of Service, the worse service is provided.
When is a memory unit called as RAM? A memory unit is called as RAM if any location can be accessed for a read or writes operation in some fixed quantity of time that is indepe
What are the different types of parameters? Formal Parameters: Parameters, which are described during the definition of subroutine with the FORM statement.
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