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.
Bus Master: In computer system, bus mastering is a attribute supported by various bus architectures that enables a device linked to the bus to initiate transacti
Q. What do you mean by True Complement Method? Explain in detail. Q. Show IEEE format for (12.75)10. Q. What are the various ways to represent Negative Numbers in computer sy
How do you turn off cookies for one page in your site? Use the Cookie. Discard Property which Gets or sets the discard flag set by the server. When true, this property initiat
Q. Write an interrupt routine to handle 'division by zero'? This file can be loaded just like a COM file though makes itself permanently resident until the system is running.
Incidence Matrix: - This is the incidence matrix for an undirected group. For directed graphs, the vertex from where an edge is originating will have +1 and the vertex where the ed
What is normal form? A normal form is a guideline for relational database tables that enhances data consistency. As tables satisfy higher levels of normal forms, they are less
Write a BASH/C shell script which takes a name of a directory as a command line argument, and prints unique login name of the users having files in that directory. Your code should
Define the PUBLIC and EXTRN directives- Assembler directives PUBLIC and EXTRN directives are very significant to modular programming. PUBLIC used to declare that labels of data
One might argue that in general processes are more ?exible than threads. For one thing, they can live in two different machines, and communicate via sockets; they are easy to spawn
Multithreaded Architecture: It is clear now that if we give many contexts to multiple threads, then processors with multiple contexts are known as multithreaded systems. These sys
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