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.
Highlights of the RMTrack application: ? Web based access permits your users to access the database from anywhere. ? Available as a hosted solution or a download for local in
What are the four necessary conditions of deadlock prevention? Four essential conditions for deadlock prevention are: 1. Removing the mutual exclusion condition implie
Q. Design a 3-bit counter using sequential logic with following counting sequence using JK- flip-flops which counts the sequence 0, 3, 2, 7, 5 and repeat.
#what is decoders? explain with diagram
Q. How to Changing the Directory in DOS? You can change the directory. After changing the directory, the new directory becomes the default directory. For example, you change th
Q. What is Mini computer? The term minicomputer introduced in 1960's when it was realized that numerous computing tasks don't need an expensive modern mainframe computers howev
Implication connective - Modus ponens rule: We notice that this is a trivial example, so it highlights how we use truth tables: as the first line is the only one when both abo
Q. Describe target processor arrangements? Having seen how to describe one or more target processor arrangements we need to initiate mechanisms for distributing data arrays ove
An icon is a picture used to show an object. Some example objects are: data files, program files, folders, email messages, and drives. Every type of object has a dissimilar icon. T
What are the limitations of traditional payment instruments? The limitations of traditional payment system are that they take a lot of time. These systems needs manual work to
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