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.
I''m suppose to create a function called calc_rectang_area(height, width),that takes two parameters: the height and width of the rectangular and return the area of the rectangular.
how to make a dec oder
What is a shift register? Can a shift register be used as a counter? If yes, explain how? Ans: Shift Register: A register wherein data gets shifted towards left or right
Define nondeterministic TM? Arbitrarily chooses move when more than one possibility exists Accepts if there is at least one computation that terminates in an acceptin
Instruction Pipelines As discussed previous, the stream of instructions in the instruction implementation cycle, can be realized through a pipeline where overlapped implementat
Q. Explain Shift register with diagram and waveform. Q. Write a short note on Decoder.
You have two counters counting up to 16, built through negedge DFF, First circuit is synchronous and second is "ripple" as cascading, which circuit has a less propagation delay? Wh
What are the end-to-end layers of OSI structure The layers 4-7 of ISO-OSI reference model communicate with peer entities in end systems. There is not any communication with ent
Determine the term- Files File maintenance is significant. Updating of files generally involves inserting, amending and deleting data. Example: A bank would amend data
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
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