CS 160 Lab 6

Introduction to PVM Programming



Objective


Get to know PVM routines

Outline of Lab

  1. Let's start from "hello world !"
    Makefile
    hello.cc
    hello_other.cc
    Can't run it? Make sure you have started pvm daemon.
  2. PVM routines (all the following routines can be found from URL: PVM 3 User Guide [ug.ps] )
    #include pvm3.h
    
    int tid= pvm_mytid(void);
    int numt= pvm_spawn(char *task, char **argv, int flag, char *where, int ntask, int *tids);
    int info= pvm_exit(void);
    int bufid= pvm_initsend(int encoding);
    int info= pvm_pk*(..);
    int info= pvm_send(int tid, int msgtag);
    int bufid= pvm_recv(int tid, int msgtag);
    int info= pvm_bufinfo(int bufid, int *bytes, int *msgtag, int *tid);
    int info= pvm_upk*(..);
    int size= pvm_joingroup(char *group);
    int tid= pvm_gettid(char *group, int instance_num);
    int size= pvm_gsize(char *group);
    
  3. semaphores
    #include semaphore.h
    
    int sem_init(sem_t *sem, int pshared, unsigned int value);
    //here pshared should be 0 to indicate that the semaphore is local
    int sem_wait(sem_t * sem);
    int sem_post(sem_t * sem);
    int sem_destroy(sem_t * sem);
    
  4. Hints to Assignment Two
    a) Client/Server, two seperate programs
    b) one server with multiple clients
    c) read/write locks on data list
    d) database file location

  5. Reminders to Assignment Two
    a) thread-safe issues
    b) halt pvm after usage

Useful Links
PVM 3 homepage
PVM FAQ
You are strongly encouraged to read the example programs within PVM package and start your programming ASAP !