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.
Mr. X's MMPI suggests that he either suppresses anger and hostility or has a naturally low level of anger and hostility (O-H=58, ANG=36, TPA=41, AGGR=36). His responses on the PAS
Logical shift A logical shift operation transfers 0 through serial input. We apply symbols shl and shr for logical shift left and shift right microoperations, examples:. R1
Parallel Computer Architecture Introduction We have talked about the classification of parallel computers and their interconnection networks in that order in units 2 and
Instruction Issue degree : The major concept in superscalar processing is how many instructions we can issue per cycle. If we issue k number of instructions per cycle in a supersca
Specify the default alignment for the following field types: 'D' - Left, 'F'-Right, 'N'-Left, 'I'-Right, 'T'-Left.
A chart illustrating the differences among the new cloud-based technologies (Workday) and the traditional . a. The new cloud-based solutions benefit Workday from every facet wh
Q. Function of OSI Transport Layer? - It takes the information to be sent as well as breaks it into individual packets that are sent and reassembled into a complete message by
How to maintain lists? To return from a high list level to the next-lower level (SY-LSIND), the user chooses back on a secondary list. The system then gives the currently dis
Explain the numbering plan for ISDN address structure. The numbering plan for ISDN is evolved with using the following guidelines: 1. This is based on, and is an improvemen
Assembly language: An assembly program has a series of instructions--mnemonics that relate to a stream of executable instructions, when translated by an assembler that may be
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