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.
Q. Advantages and Disadvantage of Message Passage Programming? Advantages of Message Passage Programming Portable It is less error prone Offers excellent
Define service (within R/3)? A service is a process or group of processes that perform a exact system function and often give an application-programming interface for other pr
Differentiate between Protection and Security Operating system contains a collection of objects, hardware or software. Every object has a unique name and can be accessed via a
Enumerate in detail about Image Scanners Drawings, graphs, colour and black-and-white photos, or text can be stored for computer processing with an image scanner by passing an
Your shell must accept a change directory command. This will be in the form: cd path where cd is the change directory command and the path is what you will change the direct
Q. How the Characters used in operand data type? A common form of data is character or text strings. Characters are signified in numeric form mostly in ASCII (American Standard
Q. Show the fundamental process of instruction execution? The fundamental process of instruction execution is: 1. Instruction is fetched from memory to CPU registers (calle
What are the type of Internet connection When determining requirements for a VPN, carefully estimate the number of systems to be put behind the VPN, the number of concurrent u
With respect to security, which one is the better choice?.Net or J2EE? Explain? As per majority programmers .NET is the best one which have one vendor compare to, the ease of
Define data type and abstract data type comment upon the significant of both
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