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.
Divide (101110) 2 by (101) 2 Ans. Quotient is = -1001 Remainder is = -001
how to write this program,what are the declaration and function are needed in java program in java // aakash , suraj , prem sasi kumar kamaraj college program 1 : pack
What is applying of an Open Source Systems? No licensing issues No initial cost Speed of Access Openness and Transparency
Data packets: USB communication takes the form of packets. Originally, all packets are sent from the host, using the root hub and possibly more hubs, to components. Some of th
Q. Show the characteristic of cache memory? The essential characteristic of cache memory is its fast access time. So very little or no time should be wasted when searching for
In a clinic 0.15 of the patients have got the HIV virus. Assume a blood test is carried out on a patient. If the patient has got the virus the test will turn out positive with prob
Central processing unit (CPU) : The part of the computer which executes program instructions is known as the processor or central processing unit (CPU). CPU is over single ele
CPU burst time indicates the time, the process needs the CPU. The following are the set of processes with their respective CPU burst time (in milliseconds). Process
What is Verilog Verilog language is still rooted in it's native interpretative mode. Compilation is a means of speeding up simulation however has not changed the or
Specifying Constraint Problems: However as with most successful "AI" techniques there constraint solving is all about solving problems as: somehow phrase the intelligent task
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