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.
What is an interpreted languages In interpreted languages, the instructions are implemented immediately after parsing. Both tasks are done by the interpreter. The code is sav
A graph with n vertices will definitely have a parallel edge or self loop of the total number of edges are More than n(n-1)/2
What are the 2 other types of Views, which are not allowed in Release 3.0? The two views are:- Structure Views. Entity Views.
Diffrentiate programming tools and authoring tools Distinction between programming tools and authoring tools is not at first obvious. Though, authoring tools require less techn
What is a symbolic constant? How it is defined ? Symbolic constants are constants of any type declared by using the #define compiler directive. It is a preprocessor directive.
In an ASP.NET web application that does not build use of routing, an incoming browser request should map to a physical file. If the file does not exist, we get page not found error
External Interrupt: Interrupt signal came from input-output devices connected external to processor. These interrupts depend on external conditions that are independent of the
You should now have a reasonably clear understanding of what is meant by interaction design. However, there are several other terms which are often used to refer to particular aspe
Q. Explain Cell Spacing and Cell Padding? Couple of attributes known as CELLSPACING and CELLPADDING. Both are part of tag. CELLPADDING is the amount of space between
In this model a one process can have multiple, concurrent implementations paths. The major programs are scheduled to run by the native operating system. It loads and obtains all th
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