174k views
3 votes
The register context and stacks of a thread are deallocated when the thread:

a) Terminates
b) Blocks
c) Unblocks
d) Spawns

User Pxg
by
7.3k points

1 Answer

7 votes

Final answer:

The register context and stacks of a thread are deallocated when the thread terminates after completing its execution or being killed.

Step-by-step explanation:

The register context and stacks of a thread are deallocated when the thread terminates. During the lifecycle of a thread, it goes through various states such as running, ready, blocked and terminated. Once a thread has completed its execution or has been explicitly killed, it enters the terminated state. In this state, the resources held by the thread, which includes its register context and stacks, are reclaimed by the operating system. When a thread blocks or unblocks, it is simply transitioning to a waiting state or becoming ready to run again, respectively. Spawning a thread is the process of creating a new thread, and thus this action is not related to the deallocation of resources.

User Usman Khawaja
by
8.3k points