Added basic thread management to kernel.