Different types of Threading..

 Posted by Bharathi Cherukuri on 7/24/2012 | Category: C# Interview questions | Views: 1911 | Points: 40

The Threading are of 5 types.They are
1) Running
2) Wait/Sleep/Join
3) Abort
4) Resume
5) Suspend


If you start a thread by Thread.Start, then the thread will moves to the running state.
The Thread in the Running state can move to 3 different states.
You can directly move from running state to abort state,by calling Abort method and then finally moving to sleep state.
If you want to suspend the thread,then you can call the suspend method and let the thread move to the suspend state and then move to running state by calling Resume method.
A thread can go to Wait/Sleep/Join in 3 ways.
When the Monitors Wait method is called,then it is the first way.Thread will again go back to Running state when the Pulse method of the Monitor object is called.
The second way is by calling the Sleep method,the thread can go in Wait/Sleep/Join state.
After the specified millisecond elapses the thread comes back to Running state.
The third way is calling the join method. When the join method is called the thread goes in the Wait/Sleep/Join state. Once the other thread finishes this dependent thread is released either to Running or Aborted depending on what kind of logic it is currently running.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response