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.
Handlers Classification In 1977, Wolfgang Handler suggested a complex notation for representing the pipelining and parallelism of computers. Handler's categorization addresses
Q. Illustrate what is a ion pair energy? Answer:- Ion energy contains electric charges called protons (+) and neutrons (0) and electrons (-) charges. It's present in an at
In computer science, garbage collection (GC) is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage, or memory occupied by
A) What does this file have? Where was the information in this file acquired from? What is the information in this file used for? B) What is the range for popular ports? What i
what are the feasibility study of online result management system?
Q. Define Wait protocol? The wait protocol is used for resolving conflicts that arise due to some multiprocessors requiring same resource. There are 2 kinds of wait protocols:
For this phase of the project you are required to formulate a social media strategy for a product/service/business/concept/charity...etc. the strategy can include technologies such
Explain Garbage collection In this method two passes are made over the memory to identify new areas. In the first pass it traverses all pointers pointing to allocated areas an
Illustrate the role of World Wide Web into the field of e-commerce. In the 1990 year, the advent of the World Wide Web upon the Internet represented a turning point into e-com
Q. Versions of small computer systems interface? SCSI-1 calls for a cable with 8 data wires plus one for parity. SCSI-2 allows use of multiple cables to support 16- or
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: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd