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

Recurrence relation, Take the following recurrence relation consider only f...

Take the following recurrence relation consider only for n = 2k for integers k ≥ 1: T(2) = 9, and for n ≥ 4, T(n) = n + T(n /2). Three students were working together in a stu

Mplement a second-order low-pass filter using the finite dif, you will impl...

you will implement a second-order low-pass filter using the finite difference method. The finite difference method is a useful mathematical method that is used to numerically solve

Is the basic list deleted when the new list is created, Is the basic list d...

Is the basic list deleted when the new list is created? No.  It is not removed and you can return back to it using one of the standard navigation functions like clicking on th

Show the transmission control protocol, Q. Show the Transmission Control Pr...

Q. Show the Transmission Control Protocol? Transmission Control Protocol (TCP) TCP makes Internet reliable. TCP solves many problems which can occur in a packet switching

Describe about immediate addressing mode, Q. Describe about Immediate Addre...

Q. Describe about Immediate Addressing mode? When an operand is interpreted as an immediate value for example LOAD IMMEDIATE 7 it is actual value 7 which is put in CPU register

Five design principles, Visibility. Controls should be clearly visible, so ...

Visibility. Controls should be clearly visible, so users can see the controls that are available to them. Visual feedback should also be clearly visible, so users can understand wh

What is interpreter, What is interpreter? An  interpreter is a program ...

What is interpreter? An  interpreter is a program that appears to execute a source program as if it were machine language.

Explain bitwise operator, Bitwise Operators Like  other  operators  bit...

Bitwise Operators Like  other  operators  bitwise  operators  have  rules  of  precedence  and  associativity  that determine how expressions involved them are evaluated.

What are multi-cycle paths, What are multi-cycle paths? Multi-cycle pat...

What are multi-cycle paths? Multi-cycle paths are paths among registers which take more than one clock cycle to turn out to be stable. For illustration analyzing the de

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