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.
What is point to point link? It refers to a direct connection among two computers on a network. A point to point connection does not require any other network devices other tha
Q. Show Nonreturn to Zero encoding? - Value of signal is for all time positive or negative - NRZ-L Signal level depends on bit represented; positive typically means 0
Question 1: (a) How are IPv4 addresses transformed into IPv6 addresses using IPv4 compatible addresses? (b) Name some of the simplifications that were introduced in IPv6.
(a) You are provided with the following: A. An RSA facility complete with public/private key pair B. A CBC (cipher block chaining) facility incorporating the IDEA block ciph
Simple Mail Transfer Protocol ( SMTP) SMTP is the principal application layer protocol for internet electronic mail. It uses the reliable data transfer service of TCP to
Point to Point Architecture The term peer means equal which can be informally interpreted as a process with capability similar to the other processes with process communic
"arpa" is used by the Cisco IOS for which encapsulation types Ans) Ethernet_II
Q. Explain about Mesh Topology? - Dedicated point-to-point links to each other device - n (n-1)/2 links an every device will have n-1 I/O ports - Advantages - Dedic
Q. Difficulties in Internetwork Communication? - Data arrive at interface f1 of s1 - How does s1 know that they must be sent out from interface f3? - There is no provisio
Question: a) List three characteristics and two potential problems of a peer-to-peer environment. b) List three characteristics and two potential problems of a client/
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