long-term scheduler

still needs to be pthread-ified