public static void main(String[] args){
    BoundedBuffer server = new BoundedBuffer(7);
    int numproc = 8; //number of threads
    int steps = 3;   //number of steps
    Producer producerThreads[ ] = new Producer[numproc];
    Consumer consumerThreads[ ] = new Consumer[numproc];
    int j;

    //now create the producer and consumer threads
    for (j = 0; j < numproc; j++)
    {
      System.out.println("Top thread creates proc " + j);
      if(j%2 == 0)
      {
	producerThreads[j] = new Producer(server, steps, j);
      }
      else
      {
	consumerThreads[j] = new Consumer(server, steps, j);
      }
    }

    for ( j = 0; j < numproc; j++)
    {
      if(j%2 == 0)
      {
	producerThreads[j].start( );
      }
      else
      {
	consumerThreads[j].start( );
      }
    }

  }