Next: About this document Up: No Title Previous: Helpful hints

Testing : Running User Programs

Here is a sample user program that creates two other processes. You should make up your own test programs and include them in your submission. Your user programs should demonstrate that your multiprogramming implementation works.


#include "syscall.h"
#define numloop 200

int
main()
{
  SpaceId addr1, addr2;
  int status,i;

  addr1 = Exec("pb");      // create a process that executes pb
  for(i=0;i<numloop;i++)
    Write("P",1,1);        // write a bunch of Ps on the screen
  addr2 = Exec("pa");      // create a process that executes pa
  status = Join(addr1);    // wait for both
  status = Join(addr2);
  Halt();                  // Halt the system
    /* not reached */
}


archna@mimas.cs.umass.edu
Tue May 13 12:29:25 EDT 1997