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.
Question 1 Explain briefly the process of matching production rules against working memory 2 Explain Simplification, Conjunction and Transportation in propositional logic by
Optical disk becomes an attractive alternative for backing up information from hard disk drives and employs large text, audio and video data. Advent of CD-ROM-R and DVD-ROM-R has b
Q. Explain about disk caching scheme? The disk caching scheme can be used to speed up performance of disk drive system. A set (cache) of buffers is assigned to hold some disk b
Design a circuit for determining the 9's compliment of a BCD number by using 4-bit binary adder and some external logic gates? Compliment of a BCD number 9's co
The function noise.m, now installed on ashland too, adds Gaussian, salt, uniform and pepper, additive or multiplicative noise to an image
Sun and Ni's Law The Sun and Ni's Law is a generalization of Amdahl's Law as well as Gustafson's Law. The fundamental idea underlying the Sun and Ni's Law is to find the soluti
FACSIMILE : This is often known as 'fax' and it represents the interface between reprographic and computer technology. By using fax, the contents of a sheet of paper (text or illu
What is the window of the working set of a process? The window of the working set of a method is the total number in which the method had referred the set of pages in the work
Concept of Temporal Parallelism In order to describe what is meant by parallelism inherent in the answer of a problem, let us talk about an example of submission of electricity
Vector reduction Instructions : When operations on vector are being deduced to scalar items as the result, then these are the vector reduction instructions. These instructions are
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