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.
1. Create the following ADTs. (a) Write the constructor function makestk, predicate function emptystk and mutator functions pushstk and popstk: i. makestk returns a new stack
Write your text, format text, insert picture through Object window or INSERT -> IMAGE. Insert Menu provides you all features which are available under the Object window. Modify men
a) Give eight properties for each of static RAM (SRAM) and DRAM (dynamic RAM) and provide the low-level structure of each type of memory. b) Assume a system with 16 Megabytes o
Host Computer: An array processor may be attached to a host computer by the control unit. The reason of the host computer is to broadcast a sequence of vector instructions by CU t
Assemblies are made up of IL code modules and the metadata that explains them. Although programs may be compiled by an IDE or the command line, in fact, they are easily translated
Differentiate between validation and exception testing. - Validation testing is done to test software in conformance to requirements specified. It aims to demonstrate that soft
Compare hypertext versus hypermedia. Hypertext is basically similar as regular text - it can be stored, read, searched, or edited - with a significant except ion: hyper text h
Q. Show the format text in Document window? You can format text in Document window by setting properties in Property inspector. First, select the text you want to format and th
Internal Path length It is described as the number of node traversed while moving by one particular node to any other node in the tree.
Single Instruction and Multiple Data stream (SIMD) In this organisation, multiple processing elements are working under the control of a one control unit. It has multiple data
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