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.
Explain the two fundamental models of inter process communication. Two kinds of message passing system are given as: (a) Direct Communication : Along with direct communicat
Q. Explain about working of Multiplexer? Multiplexer is one of the fundamental building units of a computer system that in principle permits sharing of a common line by more th
Determine the term- Security When using Internet, security can be enhanced using encryption. Debit and credit card transactions can also be protected by a specific type of pas
Take a look at the code and try to understand the logic, particularly, the way scrambled words are disambiguated, i.e.., whether they are matched successfully against a correct wor
DADA Electronics makes CD players in 3 processes: programming, and packaging. Direct materials are added at the starting of the assembly process. Conversion costs are incurred even
Q. SPMD model for programming? A normal assumption was that it must be possible and not too hard to capture the SPMD model for programming MIMD computers in data parallel langu
What is the aim of a stair case light is controlled by two switches one at the top of the stairs and another at the bottom of the stair
Q. Describe about Sole Access Protocol? The atomic operations that have conflicts are handled with the help of sole access protocol. The method used for synchronization in this
Q. What is Functions of Input - Output Interface? An I/O interface is bridge between processor and I/O devices. It controls data exchange between external devices and main mem
Q. Sequence of micro -operations to perform a specific function? A digital system executes a sequence of micro-operations on data stored in registers or memory. Specific sequen
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