Understanding the thread life cycle