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.
When designing a logic circuit with multipleoutputs it is usual to treat it as several circuitseach with one output. So for our example wewould design three circuits; one with outp
Define congestion and grade of service. Congestion : This is uneconomic to give sufficient equipment to carry all the traffic which could possibly be offered to a telec
What are benefits of having densely packed Integrated Circuits? These are stated below: Reliability: The integrated circuit interconnections are in fact more reliable
What is finest way to get a reference to the viewport from anywhere in the code? Ans) You can use refs config to set a reference on the Application/Controllers
Which objects are independent transport objects? Domains, Data elements, Tables, Technical settings for tables, Secondary indexes for transparent tables, Structures, Views, Ma
Network throughput It is an indicative measure of the point carrying capacity of a network. It is distinct as the total number of messages the network can transmit per unit tim
Pipelining - computer architecture: The Pipeline Defined According to John Hayes "A pipeline processor consists of a sequence of processing circuits, called stages or
What is an interface and what is an abstract class? Please, expand by examples of using both. Explain why? Abstract classes are closely related to interfaces. They are classe
Displaying a number Supposing that two digit number 59 is stored as number 5 in BH and number 9 in BL to convert them to equivalent ASCII we will add "0" to each one of them.
Machine Centred versus human Centred The discussion here is based on the difference in approach to the design of the work system when we prioritise either the needs of the mac
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