- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Lifecycle and States of a Thread in C#
Threads are lightweight processes. Each thread defines a unique flow of control. The life cycle of a thread starts when an object of the System.Threading.Thread class is created and ends when the thread is terminated or completes execution.
Here are the various states in the life cycle of a thread −
The Unstarted State
It is the situation when the instance of the thread is created but the Start method is not called.
The Ready State
It is the situation when the thread is ready to run and waiting CPU cycle.
The Not Runnable State
- A thread is not executable, when
- Sleep method has been called
- Wait method has been called
- Blocked by I/O operations
The Dead State
It is the situation when the thread completes execution or is aborted.
Advertisements