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.
Cathode Ray Tube Technology (CRT) CRT is an analog device that is used by a digital device - computer. The interface between these two devices is described. The major component
Advantage 1. By doing threading we neglect the recursive method of traversing a Tree , which makes use of stack and consumes many memory and time . 2. The node
what is mean by refersing screen
Explanation:- Common used functions are placed in libraries. These are located in the SQABas32 subdirectory of the Robot working directory. A library is separated into three fil
Q. Show the Dynamic Range and Colour Depth? Dynamic Range is the number of colours a colour scan or number of grays a monochrome scanner can distinguish. The dynamic range is t
Q. Drawback of indirect addressing? • Drawback of this scheme is that it needs two memory references to fetch actual operand. First memory reference is to fetch the actual addr
Design a 32:1 multiplexer using two 16:1 multiplexers and a 2:1 multiplexer Ans. Design a 32 X 1 MUX by using two 16 X 1 MUX and one 2 X 1. Now here total 32 input lines
Stack Organization The CPU of the most computers comprises of stack or called as last-in-first-out (LIFO) list in which information is stored in such a manner that item stored
In this segment, we will give very brief details of registers of a RISC system known as MIPS. MIPS is a register-to-register or load/store architecture and employs three address
What are the different methods of passing data? There are three different methods of passing data Calling by reference Calling by value Calling by value and result
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