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.
What functions connect( ) and accept ( ) call in Socket interfacing? connect() system call: Clients use procedures connect to initiate connection with an exact server. The
Define Handshaking. Handshaking is a method commonly used to accompany ever data item being transfer with the control signal that show the presence of data in the bus. The unit
In RDBMS, what is the efficient data structure used in the internal storage representation? B+ tree. Because in B+ tree, all the data is kept only in leaf nodes, that makes sea
Association and classes betwnn student and university Association and classes are alike in the sense that classes describe objects, and association describe links. Figure shows
Explain with the help of examples FIFO algorithms? FIFO policy: This policy easy removes pages in the order they arrived into the main memory. By using this policy we easily
Explain any three policies for process scheduling that uses resource consumption information. All three policies for process scheduling are explained below in brief: 1. Fi
What is a SAP system? The union of all s/w components that are assigned to the similar databases is known as a SAP system.
State about the multiple inheritance multiple inheritance is shown in Figure. In this, one class is inherited from more than one class.
What is loader? Loader is a system software which having a set of utility programs. It will load the object program to the memory.
What is meant by common control? In several switching systems, the control subsystem may be an integral part of the switching network itself. This system is termed as direct co
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