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.
Pascaline:Mechanical computers Blaise Pascal made the initial attempt in the direction of this automatic computing. He invented a apparatus, which comprised of lots of gears an
consider the 8 bit floating point format including support for normalised nimbers and nonnumeric values.it included 3 bits for mantissa and 4 bitys for excess 7 exponent
What are the three basic types of web documents? There are three fundamental types of web documents: Static, Dynamic and Active. STATIC A static web document resides i
What is software interrupt? A software interrupt is initiated by implementing an instruction. Software interrupt is a special call instruction that behaves like an interrupt
Optimality - Heuristic search strategies: The path cost of a solution is considered as the sum of the costs of the actions that led to which solution is given. This is only on
The ?rst task in the project is to develop a sane system to store change logs and versions of ?les. The simplest approach is to create a "dot" directory in the location of the ?le
Define lazy swapper. Rather than swapping the whole process into main memory, a lazy swapper is used. A lazy swapper never swaps a page into memory unless that page will be re
What are the risks by financial service provider's perspective in Electronic Payment Systems? Through the financial service provider's perspective: • Stolen service or c
Input Output Techniques: o Interrupt driven o Direct Memory Access (DMA) o Programmed Programmed I/O CPU has control over I/O directly Read/write
Explain signed binary number system. Ans. Signed Binary Numbers: In decimal number system positive numbers are signified by (+) sign and negative numbers are represented b
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