priority scheduling using thread chaining thread_sleep