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. Convention used to represent micro-operations? The convention used to represent micro-operations is: 1. Computer register names are designated by capital letters (someti
What is the means of communications between R/3 and external applications? The means of communication among R/2,R/3 and external applications is by the CPI-C handler or SAP Gat
Instruction Stream and Data Stream The term 'stream' indicates to a series or flow of either instructions or data operated on by computer. In the entire cycle of instruction ex
Q. Major problems associated in writing with cache memories? The data in main and cache memory can be written by processors or I/O devices. The major problems associated in wri
Q. Convert the following DECIMAL numbers into OCTAL, double check by converting the result OCTAL to DECIMAL. a) 932 b) 4429.625 c) 19
a. Explain about exception? When do they occur? Show using an example how to give your own exception handler. b. Can you restrict the types of exception that a function can thro
what is the importance of chemistry for computer engineering?
design modulo 12 up synchronous counter using t flip flop
Determine the types of Sensors Different types of sensors are used to give real time information to computers. Frequently, an analogue to digital converter (ADC) is required a
VBA is licensed to Microsoft and this compatible with and only Microsoft products. Code written is compiled by an intermediate language known as P-code and this is stored in hostin
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