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.
Define a register. Ans: Register: A register contain a group of flip-flops and gates which effect their transition. The flip flops hold the binary information and the g
Which the digital logic family has the lowest propagation delay time ? Ans. ECL is the digital logic family that has the lowest propagation delay time. In ECL lowest propagati
Explain the working of Dynamic RAM? A plain piece of hardware called a DRAM controller can be used to make DRAM behave more like SRAM and the job of the DRAM controller is to p
Each group is required to complete a group assignment on the analysis, modelling and classification of one of the following classes of mechanisms encountered in robotics and indust
What is sensitivity list? A list of signals which trigger execution of the block when they change value. Sensitivity list indicates that when a change occurs to any one of
If the product of two integers a and b is even after that prove that either a is even or b is even. Answer: It is illustrated that product of a and b is even so let a * b = 2n.
Classification Based On Grain Size This classification is based on identifying the parallelism in a program to be implemented on a multiprocessor system. The plan is to recog
Explain about the term business-to-customer. B2C (business-to-customer): "Electronic commerce" is usually understood mostly as selling goods or services to people ("last
Explain about the network level in detail. Network Level Firewall/Packet Filters: At the Network level firewalls operate upon the mechanism of filtering individual IP pa
Classification of Systems Systems may be categorized as follows: a) Formal or Informal b) Abstract or Physical c) Closed or Open d) Automated orManual.
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