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!
Example Programmes for Parallel Systems
Now we shall complete this with the examples on shared memory programming.
Example 13: Adding elements of an array using two processor int sum, A[ n] ; //shared variables
void main ( ){
int i ;
for (i=0; i // now create process to be implemented 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 implemented 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, the last half of the array is passed to processor P1 which adds them. Meanwhile processor P0 adds the first half of the array. The variable sum is locked to avoid inconsistency.
// now create process to be implemented 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 implemented 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, the last half of the array is passed to processor P1 which adds them. Meanwhile processor P0 adds the first half of the array. The variable sum is locked to avoid inconsistency.
Selective Repeat ARQ - Processing at the receiver additionally complex - The window size is reduced to 2(m-1) (2m/2 at most) - Both the transmitter as well as the receiv
Questions: A signal of amplitude 10 mV is fed to the amplifier in the figure. What is the amplitude of the voltage at the output from the amplifier?
DLCI- Data Link Connection Identifier. A frame-relay service provider usually assigns DLCI values that are used by frame-relay to distinguish among different virtual circuits on th
Question 1 Write about Circuit Switched Networks Packet Switched Networks Question 2 Write about Protocol Indep
Q. Show the Application Layer Responsibilities? - Make possible user access to the network - User interfaces as well as support for services such as E-Mail File
A logical circuit that is created by Virtual channel links. It carries data among two endpoints in a network. The one more name for Virtual Channel is Virtual Circuit.
The purpose of internetworking is universal service across heterogeneous networks. To give this service all computers, and routers have to agree to forward information from a sourc
How does Intranet Work? An Intranet can be defined as a private network which uses Internet tools. The principal tool is the Web browser, but there are other Internet tools su
explain history of internet?
Process of Securing an Intranet Securing an Intranet is not a simple task. Mere installation of firewall hardware and software would not help the Intranet to protect itself. P
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