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

Give brief summary of common aspects found in spreadsheets, Give brief summ...

Give brief summary of common aspects found in spreadsheets -  It's made up of columns and rows; every row is identified by a number and every column is identified with a letter

What is ''LRU'' page replacement policy, 'LRU' page replacement policy is ?...

'LRU' page replacement policy is ? Ans. Least Recently Used.

Define optimistic synchronization, Q. Define Optimistic Synchronization? ...

Q. Define Optimistic Synchronization? Optimistic Synchronization: This method too updates atom by requester process however sole access is granted after atomic operation by abo

Manipulating numbers, Computers manipulate numbers - but decimalnumbers wit...

Computers manipulate numbers - but decimalnumbers with digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 cannot be represented using two states of a digitalcircuit.Instead decimal numbers are co

How do you pass basic types by reference, How do you pass basic types by re...

How do you pass basic types by reference?   In the case of basic types like bool, int, uint, etc. you can in fact choose among the two forms. If you prefix the method parameter

Explain about distributed shared memory systems, Explain about Distributed ...

Explain about Distributed Shared Memory Systems? Distributed Shared Memory (DSM) systems emulate a shared memory abstraction on loosely coupled architectures in order to allow

Advantages & disadvantages of wired-and connection TTL gates, What are adva...

What are advantages and disadvantages of TTL gates design with Wired-AND connection ? Ans. Advantages and disadvantages In this IC added logic is performed with

Pruning - artificial intelligence, Pruning - Artificial intelligence Re...

Pruning - Artificial intelligence Remember that pruning a search space means deciding that particular branches should not be explored. If an agent  surly  knows that exploring

How web-based word processing works, How Web-Based Word Processing Works? ...

How Web-Based Word Processing Works? Web-based word processors are hosted in the cloud, not on the hard drive-as are the documents formed with these applications. And these web

Electrically erasable programmable read only memory- EEPROM, Electrically e...

Electrically erasable programmable read only memory (EEPROM) An EEPROM is a special type of PROM which can be erased by exposing it to an electrical charge. Like other kinds of

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