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.
Recursive procedures are implemented by using Recursive procedures are executed by using stacks due to stacks are LIFO data structure and we require this feature to store retur
My name is mrs flo and i apporve dubstep, do you apporve it?
What is an operating system? An operating system is system software which provides interface between hardware and user. The operating system gives the means for the proper uti
There are no needs.. If you need to use a Viewport you can! If you want to render components into divs... you can do that aswell.
Explain any three parsing techniques. Following are three parsing techniques: Top-down parsing: This parsing can be viewed as an attempt to get left-most derivations of an
Case x, z difference, which is preferable, why? CASEZ : Special version of case statement that uses a Z logic value to signify don't-care bits. CASEX : Special
Factor which helps in analysis of parallel algorithms is the total number of processors needed to deliver a solution to a provided problem. So for a given input of size let's say n
Discuss grade of service. During busy hour, 1500 calls were offered to a group of trunks and 8 calls were lost. The average call duration was 120 seconds. Calculate the traffic off
The illustration of the mouse on-screen. Depending on your settings, the cursor can be many dissimilar things.
What is the importance of XML into EDI and electronic commerce? XML has been explained as lightweight SGML: XML demonstrates great promise for its inherent capability to per
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