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.
Diiference between ROM and PROM. ROM: It also called Read Only Memory is a Permanent Memory. The data is permanently stored and cannot be changed in Permanent ROM. This can o
Write down the general model for the translation process. For the translation process the general model can be represented as given here:
Pruning and Sorting: This means we can test where each hypothesis explains as entails a common example that we can associate to a hypothesis a set of positive elements in whic
An event handler is a part of a computer program formed to tell the program how to act in response to a definite event.
Q. Explain functions of direct memory access? Though CPU intervention in DMA is minimised however it should use path between interfaces that is system bus. So DMA involves an e
End systems are connected together by communication links. There are various types of communication links, which are made of numerous types of physical media, comprising twisted pa
Game Playing techniques - artificial intelligence: Now we have dispensed with the essential background material for Artificial Intelligence problem solving techniques, and we m
Which Function type has to be used for using "at exit-command" ? To Use AT EXIT - COMMAND, We must assign a function Type "E" to the relevant function in the MENU Painter OR S
Q. Explain working neural network work? ANSWER: A neural network has an input layer with the factors under consideration, a middle or hidden layer that assigns and adjusts weig
Define macros. A macro is a pre-processor directive which is a program that processes the source code before it passes by the compiler. These are placed in the source program
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