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.
During the Persian Gulf crisis of 1991, U .S forces deployed a Dynamic Analysis and Re planning Tool, DART ( Cross and Walker, 1994) to do automated logistics planning and schedu
Which techniques are utilized to gain on the number pairs and also explain how it helps in connecting number of subscribers. In rural areas, subscribers are usually dispersed.
a) Briefly describe the relationship between distributed computing, mobile computing and pervasive computing. b) Suppose the following scenario, which demonstrate the possibili
PCI bus transactions: PCI bus traffic is prepared of a series of PCI bus transactions. Each transaction is build up of an address phase that is followed by 1 or more data phas
Software engineering is:- The application of a disciplined engineering move towards to the development of software systems. A body of information and knowledge in software d
How and when race conditions happen in process control? How can it be avoided? b. Differentiate among following functions giving related syntax: (i) fork and vfork (ii) w
The 2's complement of the number 1101110 is ? Ans. 1's complement of 1101110 is = 0010001 ans hence 2's complement of 1101110 is = 0010001 + 1 = 0010010.
Discuss the various enhanced services that can be made available to the subscribers because of stored program control. One of the instant benefits of stored program control is
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
Q. Evaluate Speed of disk drive? Drive Speed: Amount of information which can be transferred in or out of memory in a second is called as disk drive speed or data transfer ra
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