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.
1. LINQ to Objects - Implements a LINQ query against a collection of objects 2. LINQ to XML - Implements an XPATH query against XML documents 3. LINQ to SQL - Implements LINQ
Q. Define syntax of barrier directive? Barrier Directive The syntax of barrier directive is #pragma omp barrier When a thread attains barrier it waits till all threa
A v o iding Over fitting - Artificial intelligence As we discussed in the last lecture, over fitting is a normal problem in machine learning. Decision trees suffe
Micro-instructions are stored in control memory. Address register for control memory comprises the address of subsequent instruction which is to be read. Control memory Buffer Regi
Explain the working of any one of centralized SPC? Standby mode of operation is the easiest of dual processor configuration operations. Usually, one processor is active and
Difference between the testing and verification. Verification proves conformance with a specification. Testing tries to find cases where the system does not meet its specifi
Define class P The class of all sets L that can be known in polynomial time by deterministic TM. The class of all decision problems that can be decided in polynomial time.
What are Parallel Algorithms? The central assumption of the RAM model does not hold for some newer computers that can implement operations concurrently, i.e., in parallel algor
Question (a) A 500 MHz Pentium III processor takes 2 ms to run a program with 200,000 instructions. A 300 MHz UltraSparc processor takes 1.8 ms to run the same program with 23
Used to interrupt CPU normal implementation routine and to get its attention .Mostly generated by an external devices, timers, counters...etc
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