Explain the use of functions in parallel programming, Computer Engineering

Assignment Help:

Q. Explain the Use of functions in parallel programming?

include "pvm3.h"

main()

{

   int cc, tid, msgtag;

   char buf[100];

   printf("%x\n", pvm_mytid());

   cc = pvm_spawn("hello_other", (char**)0, 0, "", 1, &tid);

   if (cc == 1) {

        msgtag = 1;

      pvm_recv(tid, msgtag);

      pvm_upkstr(buf);

      printf("from t%x: %s\n", tid, buf);

   } else

      printf("can't start hello_other\n");

   pvm_exit();

}

In this program, pvm_mytid( ) returns TID of running program (In this case task id of the program hello.c). This program is designed to be invoked manually after printing its task id (attained with pvm_mytid()), it starts a copy of other program called hello_other using pvm_spawn() function. A successful spawn makes the program to execute a blocking receive using pvm_recv. After receiving the message program prints message sent by its counterpart as well its task id the buffer is extracted from the message using pvm_upkstr. The final pvm_exit call dissociates the program from PVM system.


Related Discussions:- Explain the use of functions in parallel programming

Illustrate diffrent types of modems, Q. Illustrate Diffrent types of modems...

Q. Illustrate Diffrent types of modems? There are four different types of modems: half-duplex, full-duplex, synchronous, and asynchronous.With half-duplex modems data can be tr

Calculate blocking probability in a two stage network, In a two stage netwo...

In a two stage network there are 512 inlets and outlets, r=s=24. If the probability that a given inlet is active is 0.8, calculate: Blocking probability Given: N =M =512,

Page directive include, What is the difference between, page directive incl...

What is the difference between, page directive include, action tag include? Ans) One difference is whereas using the include page directive, in translation time it is making t

Various ways of floating point representation in memory, Describe the vario...

Describe the various ways of floating point representation in memory. What is the importance of normalizing the mantissa in this representation? Explain it by example(s)?

Translate the sentences into predicate calculus, Translate each of the foll...

Translate each of the following sentences into predicate calculus, conceptual dependencies, and conceptual graphs: 1. Bill sold the book to the book store." 2. "John borrowed

Design the counter using sequential logic, Q. Design the counter using sequ...

Q. Design the counter using sequential logic with following counting sequence using RS- flip-flops. 000, 100, 101, 111, 010, ... ... ... ... ... ... ... ... ... ...

Area under curve, Write a program to find the area under the curve y = f(x)...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw   #includ

Binary, 8:1 Mux for a given function, f=S (0, 1,5,7,9, 13)..

8:1 Mux for a given function, f=S (0, 1,5,7,9, 13)..

Explain about api s of olap, Microsoft in the late 1997 introduced a standa...

Microsoft in the late 1997 introduced a standard API called as OLE DB. After which XML was used for analysis specification and this specification was largely used by a lot of vendo

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

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!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd