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.
I need help coming with an idea for BSCE final project, which is solvable in about a semester
Q. Role of information system in business? Ans. 1. Information System is grouping of two terms namely - 1) Information 2) System 1. Information - Information is dat
What is process control block? Each process is shown in the OS by a process control block. It having many pieces of information associated with a specific process.
What is a client in SAP terminology? A S/W component that uses the service (offered by a s/w component) is known as a Client. At the similar time these clients may also be ser
Q. Fundamental types of flash memory? Code Storage Flash which is made by Intel, AMD, Atmel. It stores programming algorithms and it is largely found in cell phones. Data
Explain the term - Computer Aided Software Engineering Production of software became much commercial. Software development tools were devised. Concept of Computer Aided Softwar
What are the security aspects of SIP Visualizer
The Prisoner's Dilemma is a well-known problem in game theory. Two thieves are arrested and held in custody separately. The police offer each the same deal. Inform on your partn
To work with Internet as well as to utilize its facilities we use certain tools. For illustration, Telnet is a tool, which is utilized for logging on remote computers on the Intern
Define class NP. Problems that can be solved in polynomial time by a nondeterministic TM. Contains all problems in P and some problems possibly outside P.
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