Refactoring scheduler

Moving syscalls from scheduler domain to thread.
These changes will make it easier to implement new schedulers in the
future.