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 your text, format text, insert picture through Object window or INSERT -> IMAGE. Insert Menu provides you all features which are available under the Object window. Modify men
Suppose the random sample used for each tree in the previous random forest is decreased from 1000 rows to 500 rows. Circle ALL that are true for the ensemble classifier. a) Vari
Q. What do you mean by Daisy chain? This scheme provides a hardware poll. With this scheme, an interrupt acknowledge line is chain by different interrupt devices. All I/O inter
What is a structure? A structure is a collection of variables under a single name. These variables can be of different types, and each has a name which is used to select it fro
Explain about CSMA/CD It is an access method used mainly with LANs configured in a bus topology. With CSMA/CD, any station (node) can transmit a message to any other statio
Define Random scan/Raster scan displays? Random scan is a method in which the display is made by the electronic beam which is directed only to the points or part of the screen
An experts systems must perform well that is achieve the same levels of performance in the domain of interest that human experts can achieve. But simply producing good so
#questi on.. How it works explain
Explain the Action-object matrix A matrix showing how update actions influence objects. It may be considered to be part of user object model as it summarizes user object ac
Define memory management system? The part of the computer system that supervises the flow of information among auxiliary memory and main memory is known as memory management sy
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