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.
Write a program to display grade message according to the marks
Your task is to implement a memory manager that manages page reads and writes from multiple client threads. In the first programming task the memory manager keeps all the pages in
What Is The Difference Between ViewState and SessionState? View State persist the values of controls of certain page in the client (browser) when post back operation done. When
As spring approaches, your design firm has been tasked with designing a two-lane highway in rural Wyoming. The highway descends a hill, crosses a river, and must shift to a para
Functions for Message Passing: MPI processes don't share memory space and one process can't directly access other process's variables. Therefore they need some form of communi
What do you mean by polynomial and exponential bounds? Bounds of the form nc for c greater than 0 .such a bound are known as polynomial bounds. Bounds of the form 2(n ) .suc
What are the basic functions of Database utility? The basic features of database utility are: Make database objects. Remove database objects. Adjust database obj
What are Attributes? Attributes are declarative tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework: Pred
Bus Master: In computer system, bus mastering is a attribute supported by various bus architectures that enables a device linked to the bus to initiate transacti
What is branch folding? The instruction fetch unit has implemented the branch instruction concurrently with the implementation of other instructions. This technique is referred
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