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.
A friend has promised to log in at a particular time. However, he needs to be contacted as soon as he logs in. The shell script checks after every minute whether he has logged in o
What are the conditions that have to be met for a condition to be an invariant of the class? Ans) ? The condition should hold at the end of each constructor. ? The conditi
Minimize the logic function F(A, B, C, D) = ∑ m(1,3,5,8,9,11,15) + d(2,13) using NOR gates with help of K-map. Ans. Realization of given expression by using NOR gates: In POS
What is the functionality of Remote Login? Remote Login gives similar functionality of telnet, along with the added functionality of not involving a password from trusted cli
Polymorphism in C++ is the idea that a base class can be inherited by various classes. A base class pointer can point to its child class and a base class array can store dissimilar
Explain crossbar exchange, with all call processing steps and diagrams. The fundamental idea of crossbar switching is to give a matrix of n x m sets of contacts with only n + m
what is the code to detect image forgery using Matlab..??
Q. Explain proces of defining the Document Page Title? Though the document has a file name, notice it's still labelled Untitled Document; that is because it needs an HTML docum
JK, SR, D master FF 1)draw block diagram 2) combinational circuits using NOR & NAND gate thank you
Q. Explain Logical shifts with example? Logical shifts LOGICAL SHIFT LEFT and LOGICAL SHIFT RIGHT insert zeros to end bit position and other bits of a word are shifted left or
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