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.
Propositional model: Hence a propositional model was simply an assignments of truth values to propositions. In distinguish, a first-order model is a pair (Δ, Θ) where
Python is an interpreter, interactive, object-oriented programming language. It is frequently compared to Tcl, P e r l, Scheme or Java. Python combines remarkable power with v
Q. How will these instructions perform? Let's assume that above machine instructions are stored in three consecutive memory locations 1, 2 and 3 and PC contains a value (1) tha
Define Step by Step Procedure in Computer Programming? The Computer programming is the skill and art of creating a computer program a defined set of instructions in source code
Real time clock A real-time clock keeps the time in real time - i.e. in hours and minutes. Software for the real-time clock comprises an interrupt service procedure which is c
Unit testing and integration testing: Unit testing focuses on the least element of software design by the module. Unit test is conducted on every of the modules to uncover er
Problem (a) Distinguish between how NTFS and FAT store time. Describe your answer. (b) Unix epoch starts as from January 1, 1970, 00:00:00 GMT. Provide that Unix stores
What is branch target? As a result of branch instruction, the processor fetches and implements the instruction at a new address called as branch target, instead of the instruct
Advantages & Disadvantages Enhanced security and convenience: private keys never require be transmitting or revealing to anyone. They can givce a method for digital signatu
Remote Login A login that permits a user terminal to connect to a host computer by a network or direct telecommunications link, and to interact with that host computer as if t
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