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.
1.Local queue -is a actual queue 2.Cluster queue -is a local queue that is called as throughout a cluster of queue managers 3. Remote queue -structure explaining a queue
Advantages of DDa algorithms for line drawimg
What are the roles of Internet, Intranet and extranet in e-business? Role of Internet, Intranet and extranet into e-business: The given information activities are carried
Yes. In either the system-wide gimprc file or your personal gimprc file, uncomment the line that have install-colormap.
Table, TR and TD Tags Three tags form the essential ingredients for creating a table. TABLE: This is the main tag. It tells the browser that a table follows. It has attrib
In Windows, Thread is a unit of implementation. Process is the environment in which thread implements. Scheduler, schedules the Threads not the process. In Unix variants, Thread is
Differentiate between WML-Script and Web-based scripting languages. WML Script is a lightweight procedural scripting language, optimized for small-memory, low-power CPU wireles
WHAT IS CPE
What is a Turing Machine? Turing machine is a simple mathematical model of a computer. TM has unlimited an unrestricted memory and is a much more accurate model of a general
What are the advantages of open source system? High-quality software Lesser hardware costs Integrated management No vendor lock-in Take control of our softwa
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