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.
Explain Client Server Model. In the client- server model, communication usually takes the form of a request message from the client to the server asking for several works to be
Distinguish between enhancement mode and depletion mode metal oxide semiconductor field effect transistors giving their characteristics. Ans. Enhancement mode and depleti
Two-dimensional array is represented in memory in following two ways: 1. Row major representation: To attain this linear representation, the first row of the array is kept in
Some of the plug-ins have proven unstable. These have been moved into a split download, which should be available anywhere you got the GIMP, in the file gimp-plugins-unstable-VERSI
What is line option explicit Line explicit function makes the compiler to recognize all the variables which are not particular by the dim statement. This command significantly
Microprocessor development system Computer systems have undergone many changes recently. Machines that once filled large areas have been reduced to small desktop computer syste
Explain BOOTP (Boot Strap Protocol). TCP or IP designer observed that several of the configuration steps could be combined in a single step if a server was capable to supply mo
Proving ( or disproving) mathematical theorems are an intensive intellectual task. This is because it requires deductions from hypotheses and also involves judgment. This judgm
What is skew? Clock Skew: In circuit design, clock skew is a phenomenon within synchronous circuits wherein the clock signal (sent through the clock circuit) arrives at dive
Describe generic framework for electronic commerce Generic Framework for electronic commerce contains the Applications of EC (like as banking, shopping in online stores and m
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