added the scheduler for the sub threads