#include #include #include #include #include "pvm3.h" #define EXEC "hello_combined" #define BUFF 100 int main(void){ int cc, tid, mytid, ptid; char buf[BUFF]; mytid = pvm_mytid(); ptid = pvm_parent(); if(ptid == PvmNoParent){ cc = pvm_spawn(EXEC, (char**)0, 0, "", 1, &tid); if (cc == 1) { cc = pvm_recv(-1, -1); pvm_bufinfo(cc, (int*)0, (int*)0, &tid); pvm_upkstr(buf); printf("from t%x: %s\n", tid, buf); } else printf("can't spawn child\n"); } else{ strcpy(buf, "hello, world from "); gethostname(buf + strlen(buf), 64); pvm_initsend(PvmDataDefault); pvm_pkstr(buf); pvm_send(ptid, 1); } pvm_exit(); exit(0); }