Skip to content
Snippets Groups Projects
Select Git revision
  • 5708fad37ae701f06a14823d6d598b783abae225
  • master default protected
2 results

Global.java

Blame
  • user avatar
    sfphoton authored
    5708fad3
    History
    Global.java 669 B
    /**
     * the global scheduler
     * It will distribute the incoming tasks between the two schedulers (RR & SRTF) and select which one may determine the active task
     */
    public class Global {
    	
    	private SRTF srtf = new SRTF(); //high priority scheduler
    	private RR rr = new RR(); //low priority scheduler
    	
    	String history = ""; //a string with tha names of task that have taken control so far - I will use this only for the output
    	
    	public void add(Task t) {
    		if (t.isKernel)
    			srtf.add(t);
    		else
    			rr.add(t);
    	}
    	
    	public void tick() {
    	
    	}
    	
    	/**
    	 * A task is forcibly taking control
    	 * @param t the task to be run
    	 */
    	public void changeRunning(Task t) {
    	
    	}
    	
    }