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.
Two hosts are connected by a path made of four links as shown in the figure below. The links are of data rate R = 2 Mbps each. Host A has a file of size F = 1,000,000 bytes to tran
Describe about the term- network If network tends to lose the packets, it is better to acknowledge each one of them separately, so the lost packets could be retransmitted. On t
As a system administrator, you require to debug igrp but are worried that the "debug IP igrp transaction" command will flood the console. What is the command that you should use?
What is multiplexing and demultiplexing? Explain. Describe Time division, Frequency division and Wavelength division multiplexing. What is ADSL? How does it use multiplexi
Name the categories of Multiplexing? There are three categories of multiplexing a. Frequency Division Multiplexing (FDM) b. Time Division Multiplexing (TDM) i. Sync
Store-and-forward switch The layer 2 switch accepts a frame on an input line, buffers it briefly, and then routes it to the appropriate output line. Cut-through switch
Data Sharing One of the most important uses of networking is to allow the sharing of data. Before networking was common an accounting employee who wanted to prepare a report f
i want an assignment with 2500 words on this topic with Harvard referencing on 22th of dec can i get it ?
Verify Passwords Step 1 : Telnet to the router from Host2 and verify the Telnet password. You should be able to telnet to either Fast Ethernet interface of the router. I
Write the layer on which layer does L2F, PPTP and L2TP operate?
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