implemented O(1) scheduler.