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.
It allows code reusability. Reusability saves time in program development. It encourages the reuse of proven and debugged high-quality software, thus decreasing problem after a sys
A model for parallel programming is an abstraction in addition its machine architecture is independent. A model is able to be implemented on different hardware and memory architect
Question : a) E-mail is a common feature nowadays in IT. What does it stands for and what is it used for? b) Briefly describe four advantages of using the electronic mail s
Andrew, a 17 zear old university student decided to hold a post exams party for his friends. Andrew asked Kath, a family friend and the owner of 'Kath's Katerers' to supply food
Q. VLSI Implementation of Control Unit? A main potential advantage of RISC is VLSI implementation of microprocessor. VLSI Technology has decreased the delays of transfer of inf
explain the construction and working of calomel electrode
Objectives After going through this unit, you will be able to : Tell historical facts of parallel computing; Can explain the essential concepts of the discipline, e.g.
A CSMA/CD bus spans a distance of 1.5 Km. If data is 5 Mbps, What is minimum frame size where propagation speed in LAN cable is 200 m µs. Usual propagation speed in LAN cables
Information Gain: Now next here instantly return to the problem of trying to determine the best attribute to choose for a particular node in a tree. As in the following measur
Transfer Domain Create an interpolation algorithm using the fast Fourier transformer. Assess the performance of the algorithm by using the PSNR and SSIM. Compare your results w
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