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 is memory controller? A memory controller is a circuit which is interposed among the processor and the dynamic memory. It is used for performing multiplexing of address bi
In a particular exchange during busy hour 1200 calls were offered to a group of trunks, during this time 6 calls were lost. The average call duration being 3 minutes Calculate
Q. What is Command Prompt Interface? Operating System gives a text based interface called command prompt. With the help of command prompt commands can be issued to perform fil
Define Process Control Block (PCB). Process Control Block (PCB): Information related with each process is stored into Process control Block. a) Process state b)
What is the use of buffer register? The buffer register is used to avoid speed mismatch among the I/O device and the processor.
State about CSMA/CA It belongs to a class of protocols known as multiple access methods. CSMA/CA stands for: Carrier Sense Multiple Access with Collision Avoidance. In
Q. Show the steps of execution of instructions? Fetch First Instruction into CPU: Step 1: Find/calculate the address of first instruction in memory. In this machine illust
how to swap to nunbers
Q. Hard and Soft Real Time Systems? Hard Real Time Systems that guarantee critical tasks are completed on time. Soft Real Time Systems that are less restrictive type o
The following definition of mapping is adapted from the first edition of the Set Book: Mapping concerns the relationship between controls and their effects in the world. Nearly al
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