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.
Q. What is Gate? Explain Basic gates with truth table and necessary circuits. Q. Which gates are called Universal Gates? Why? Q. Give the Dual of the rule 17. Q. Realize
Explain Bottom-up Parsing Techniques A parser can begin with the input and attempt to rewrite it to the start symbol. Instinctively, the parser attempts to locate the most bas
Address 192.5.48.3 belongs to? Address 192.5.48.3 belongs to class C.
Explain The Boolean Equations for Logic Circuits? A Boolean equation is the mathematical representation of a logic circuit using standard Boolean terms. All the logic gates (AND,
Opening Files for Reading Only : A data file is a file that you can open and read its contents visually - for example, C source files, .dat files, HTML etc - anything that look
Explain Tabulation Method for simplifying k maps? The Tabulation Method (QUINE-McCLUSKEY MINIMIZATION) An expression is represented in the canonical SOP form if not
Q. Show Arithmetic Subtraction? The subtraction can be done easily using 2's complement by taking 2's complement of value which is to be subtracted (inclusive of sign bit) and
Q. What are the principles of transport layer? Transport layer: This layer is the first end-to-end layer. Header of transport layer includes information which helps send the
Explain dynamic server creation briefly. Dynamic Server Creation: If only one server handles one request at a time, each client should wait while the server fulfils the on
Explain Sequential sharing. Sequential sharing: In this technique of sharing, a file can be shared through only one program at a time, it is file accesses by P1 and P2 are
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