/**
 * Process.java
 *
 * A solution to the Critical Section Problem 
 * using monitors
 *
 * @author Jalal Kawash
 * @version 1.0 - February 7, 2001
 * 
 */


public class Process extends Thread {

    public Process(int id, CriticalSection cs) {
	this.id = id;
	this.cs = cs;
    }	
  
    public void run() {
	while(true) {
	    cs.critical(this.id);
	    try {
		Thread.sleep( (int) (Math.random() * 3000));
	    }
	    catch (InterruptedException e) {}
	}
    }
 
private int id;
private CriticalSection cs;
}
     

