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 Frequency borrowing In the simplest case, frequencies are taken from adjacent cells by congested cells. The frequencies can also be assigned to cells dynamically.
Determine the definition of HDLC HDLC has only one address field. In a LAN, any station may transmit to any other station. The receiving station needs to see its own address in
Which NetWare protocol works on layer 3--network layer-of the OSI model? Ans)IPX
Each link layer process will have two connections: one "up" to the appropriate IP layer process, and one "sideways" to the link layer process on the simulated machine at the other
What is Security solutions Though there are a number of security solutions available due to sophistication in technology, there are a number of risks and difficulties attached
Given a five station token bus LAN with station addresses of 3000, 500, 100, 70, and 50. Stations with addresses of 5000, 4000, 400, 90, and 60 are waiting to enter the ring. Assum
State the Network environment of Intranets and Internet Intranets as well as the Internet are based purely on networks, the company intending to install Intranet must consider
Define Choke packet and Implicit congestion signalling Choke packet: A choke packet is a control packet produced at a congested node and transmitted back to a source node to co
Enumerate about the Star networks Comments: 1 - If one connection/station fails the other devices aren't affected 2 - If central hub breaks down, the whole network fail
Write the Generic Name of the OSI Layer a) The figures below illustrate, side by side, the OSI 7-layer reference model and the Internet protocol stack. Inside each box represen
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