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.
Determine the term- Security When using Internet, security can be enhanced using encryption. Debit and credit card transactions can also be protected by a specific type of pas
What is a binary tree? A binary tree 'T' is described as A finite set of elements, known as nodes, such that: either (i) or (ii) happens: (i) T is empty (known as the 'nu
what inputcombinations may those hazard take place and how can they be eliminated? F1= AB'' + A''C + BC''D'' F2= AB + A''C''D + AB''D
what is complex instruction set computer and reduced complex instruction set computer
Define Polling. A Polling process is used to recognize the highest priority source by software means. In this process there is one common branch address for all interrupts.
What is compiler? A system software program known as a compiler translates the high-level language program into a suitable machine language program having instruction such as t
What is the difference between thread and process? Thread - is used to execute more than one program at a time. process - executes single program A thread is a path of e
In this segment, we will give very brief details of registers of a RISC system known as MIPS. MIPS is a register-to-register or load/store architecture and employs three address
Q. Explain Point-to-point Message Passing? In point to point message passing, one process transmits/receives message from/to another process. There are four communication modes
What are two reasons for using layered protocol? Layered protocol implies protocols used into each layer are the layer's own business that is they don't influence protocol of a
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