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.
How to clear a datagrid on a button click? You require to Clear the DataSource of the dataGrid. So try this: dataSet1.Clear(); dataGrid1.DataSource = dataSet1.TableNam
Embedded Software Intelligent products have become commonplace for all consumer and industrial market. Embedded software stays in read only memory and is utilised to control
What is Hamiltonian path? A Hamiltonian path in a directed graph G is a directed path that goes through every node exactly once. We consider a special case of this problem whe
What is Instruction Cycle A program residing in the memory unit of the computer having of a sequence of instructions. The program is implemented in the computer by going throu
Handshake packets: Handshake packets consist of nothing but a PID byte, and are usually sent in response to data packets. The 3 basic types are, NAK, indicating that the data
program on multiple queue
Define the Abstraction of OOA Now, let us see how objects can be seen as a problem, and find their associated data and their behaviour. You will notice that an object is an ab
Design-Centered Virtual Manufacturing This gives manufacturing information to the designer throughout the design phase. In this observing the short term and long time definitio
Memory-to-Memory Architecture The pipelines can access vector operands intermediate and final results straight in main memory. This necessitates the higher memory bandwidth. Fu
Problem: (a) Consider the following combinational circuit: (i) Calculate the propagation delay for each output. Assume each gate has a delay of 10 ns. (ii) The abo
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