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.
Stack is a portion of RAM used for saving the content of Program Counter and common purpose registers. LIFO stacks, also called as "push down" stacks, are the conceptually easi
ANN Representation: Mostly 'ANNs' are taught on "AI" courses since their motivation from brain studies and the fact which they are used in an "AI" task and namely machine lear
Create a new project, LastNameFirst 05, for this assignment. You will need to define the classes depicted in the class diagram below. All of the classes should contain complete ja
Define variants of Turing Machine? Variants are Non deterministic turing machine. Mutlitape turing machine. Enumerators
A script kept information on potential subjects for an experiment in a vector of structures known as "subjects". The following show an example of what the contents may be: >> subj
Why is TCP called end-to-end protocol? TCP is termed as an end-to-end protocol as this provides a connection directly by an application in one computer to an application on a r
What is the maximum and minimum number in the range of a 7-digit number for each of the following cases? Express all numerical answers in both the original base and its decimal (ba
Common Tasks to Accomplish: Once you've worried about what and why you're doing "AI", what has inspired you and how you're going to approach the job, then you just start to th
Q. Main drawbacks of CD-ROMs? The main drawbacks of CD-ROMs are: It is read only thus can't be updated Access time is longer than that of magnetic disks. Very
Primary objectives/details of Load Sharing Facility Resource Management Software (LSFRMS) are better resource utilisation by routing task to most suitable system as well a better u
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