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.
"George has a dog called Ernie, which is a trained Labrador. Trained Labradors and poodles are obedient, and all obedient dogs are good dogs. All good dogs that have a master will
How congestion is controlled in TCP? One of the most significant aspects of TCP is a mechanism for congestion control. In main modern internets, extreme long delays or packet l
Add 648 and 487 in BCD code. Ans. In BCD Code, addition of 648 and 487: 6 4 8 = 0 1 1 0 0 1 0 0 1 0 0 0 4 8 7 = 0 1 0 0 1 0 0 0 0 1 1 1 ---------------------
Q. Fundamental components of a CPU? The two fundamental components of a CPU are control unit and arithmetic and logic unit. The control unit of CPU selects and interprets progr
Standard Query Operators are executed as extension methods in .NET Framework. These Standard Query Operators can be used to work with any collection of objects that executes the IE
Which loader is executed when a system is first turned on or restarted? Ans. Bootstrap loader executed while a system is first turned on or restarted.
Are there standards for electronic imaging? Given the sensitive nature of most permanent records, there are microphotography standards in place which contain microfilm, compute
Discuss about Charles Babbagein brief Mechanism for advancing or reversing of control card were allowed therefore enabling execution of any desired instruction. In ot
As CMOS is a special chip with its own battery, the best way to clear out a CMOS chip is to cut off it from its power supply. To clear the CMOS password you just take away the
Q. Why we use Debugger? Debugger is a program which allows the user to test as well as debug the object file. Theuser can use this program to perform subsequent functions.
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