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.
Normal 0 false false false EN-US X-NONE X-NONE
Communication by Message Passing You will agree that a single object alone is generally not very helpful. Objects usually emerge as components of a system or a larger program.
Write the values of the C output for the following gates: For a(n) ________ gate, the output is zero if any of the inputs are equal to one. For a(n) ________ gate ,the
To execute sparse matrix dynamically, Which data structure is used Linked List data structure is used to execute sparse matrix dynamically
Q. What is Cartridge Drive? Cartridge Drive: A cartridge is a protective covering or case which is used to hold a magnetic tape, disk, a printer ribbon or toner. Contents are
QWERTY-based keyboards In addition the standard alphabet keys having QWERTY arrangement, a computer keyboard also comprises the control (alt, Del, Ctrl etc. keys) and function
Which translator perform macro expansion, is called? Ans. Macro pre-processor perform macro expansion.
Draw a neat diagram to explain major components of a web browser. The Major Component of a Web browser A browser contains a set of clients, a controller and a set o
The concept of clustering is definite as the use of multiple computers, typically PCs or multiple storage devices, UNIX workstations, and their interconnections, to form what appea
Explain a multiprocessing operating system? A multiprocessing system is a computer hardware configuration which contains more than one independent processing unit. Multiprocess
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