cz.zcu.kiv.ppr.msloup.kernel
Class Scheduler

java.lang.Object
  extended by cz.zcu.kiv.ppr.msloup.kernel.Scheduler

public class Scheduler
extends Object

Trida sluzici k naplanovani Fiberu. Take hlida stavy a provadi pripadne zmeny stavu u fiberu.

Author:
Martin Sloup

Constructor Summary
Scheduler(Memory memory)
          Konstruktor planovace
 
Method Summary
protected  boolean hasFiberAvailable()
          Vraci true, pokud jsou v seznamu Fiberu jeste nejake Fibery
protected  void checkFibersState()
          Osetruje stavy BLOCKED, SLEEPED a TORMINATED u Fiberu.
protected  Fiber selectFiber()
          Vraci nahodne vybrany Fiber ze seznamu Fiberu, ktery je mozny spustit (je ve stavu RUNABLE).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scheduler

public Scheduler(Memory memory)
Konstruktor planovace

Parameters:
memory - objekt s pameti, kde je seznam Fiberu a zamku
Method Detail

selectFiber

protected Fiber selectFiber()
Vraci nahodne vybrany Fiber ze seznamu Fiberu, ktery je mozny spustit (je ve stavu RUNABLE). Pokud takovy Fiber neexistuje, vraci null.

Returns:
nahodne vybrany Fiber

checkFibersState

protected void checkFibersState()
Osetruje stavy BLOCKED, SLEEPED a TORMINATED u Fiberu.


hasFiberAvailable

protected boolean hasFiberAvailable()
Vraci true, pokud jsou v seznamu Fiberu jeste nejake Fibery

Returns:
je k dispozici Fiber