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.
What are the advantages and disadvantages of hardwired and micro programmed control? Advantages of hardwired control i. Operate at high speed ii Each state of this coun
In which input data does the algorithm quick sort exhibit its worst-case Behaviour? The Quick Sort method exhibits its worst-case behavior when the input data is " Already Comp
Prolog Programming Language : Probably programming languages are procedural: than the programmer specifies exactly the right instructions (algorithms) required to get an agent
Program Level This is usually the dependability of the operating system, which runs processes simultaneously. Different programs are evidently independent of each other. So par
What is the role of MAR and MDR? The MAR (memory address register) is used to hold the address of the location to or from which data are to be transferred and the MDR(memory d
I²C TECHNOLOGIES The I2C protocol bus is two bi-directional wires, serial data (SDA) and serial clock (SCL), that transmit information between the devices connected to the bus.
I want some one to provide me the matlab codes
Explain overlay structured program ? A program having overlays is termed as overlay structured program, here an overlay is a part of program that has similar load origin as som
Can you tell me some of system tasks and their purpose? $display, $displayb, $displayh, $displayo, $write, $writeb, $writeh, $writeo. The most useful of these is $display. T
Diagnosis: Medical diagnosis program bases on probabilistic analysis have been able to perform at the level of an expert physician tin several areas of medicine. Heckerman(1981)
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