q explain the use of functions in parallel


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.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: q explain the use of functions in parallel
Reference No:- TGS0313263

Expected delivery within 24 Hours