public BoundedBuffer(int buffer_size){
    //buffer is initially empty

    this.buffer_size = buffer_size;    
    buffer = new byte [buffer_size];
    count = 0;

    mutex = new Semaphore(1);
    empty = new Semaphore(buffer_size);
    full  = new Semaphore(0);

    rear = 0;
    front= 0;
    rcopy= 0;
    fcopy= 0;
  }