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

Explain user datagram protocol, Explain User Datagram Protocol. UDP(Use...

Explain User Datagram Protocol. UDP(User Datagram Protocol) : User Datagram Protocol uses a connectionless communication paradigm. It is an application using UDP does not re

For which class address 192.5.48.3 belogs, Address 192.5.48.3 belongs to? ...

Address 192.5.48.3 belongs to? Address 192.5.48.3 belongs to class C.

Program that will blink as led, Take the last two digits of your UTCID. Thi...

Take the last two digits of your UTCID. This is your duty cycle in percent. If your duty cycle is less than 10%, add 30 to your number. Create an assembly program that runs on t

C programming, Find out useless nonterminal symbols use c program.

Find out useless nonterminal symbols use c program.

Give an example of resource allocation graph & deadlocked, Suppose there ar...

Suppose there are 2 copies of resource A, 3 copies of resource B, and 3 copies of resource C. Suppose further that process 1 holds one unit of resources B and C and is waiting for

What does the future in gimp, Version 2.8 may bring a combined Transform to...

Version 2.8 may bring a combined Transform tool (Scale, Rotate,Flip and Perspective), more use of Cairo for attractive ant aliased graphics and more usability improvements. We will

Two parallel fetch-implement, Take a CPU that shows two parallel fetch-impl...

Take a CPU that shows two parallel fetch-implement pipelines for superscalar processing. Determine the performance improvement over scalar pipeline processing and no-pipeline proce

Write a short note on structure chart, Write a short note on structure char...

Write a short note on structure chart.    Structure Chart is an significant program design method and it shows all components of code in a hierarchical format

Define the don''t care states - simplifying k maps, Define the Don't Care S...

Define the Don't Care States - Simplifying K Maps? The Truth table specifications for a logic function may not to include all possible combinations of the input binary digits for

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