问题描述
在.NET框架线程的状态解释此链接。
最近我看到这张照片在网站和几个问题来到我的脑海里:
-
在操作系统线程的生命周期并不完全在.NET框架线程的生命周期一致。有人可以提供一个与.NET框架相匹配的状态中OS资源?
-
我们没有在.NET框架所谓的阻止状态。什么将是一个线程的状态,如果它发出的I / O请求?
-
的已中止状态的目的是什么?当一个线程调用
中止()
的方法,它会去的 AbortRequested 状态后,线程响应中断请求时,它会去停止状态。那么,什么是已中止状态? 功能
一个线程,如果其执行已被暂停的同步原语,如锁或互斥的一个阻塞。即在给定时刻执行有用的工作的任何线程,根据定义,没有被阻塞的那一刻。
在 AbortRequested /停止
周期使线程有机会执行有序关机,释放所获取的资源并执行其他清理任务。
http://www.albahari.com/threading/
The state of a thread in .NET framework is explained in this link.
I recently saw this picture in a web-site and a couple of questions came to my mind:
The thread lifecycle in the OS is not completely aligned with thread lifecycle in .NET framework. Can someone provide a resource that matches the states in OS with .NET framework?
We don't have a state called Blocked in .NET framework. What will be the state of a thread if it issues an I/O request?
What is the purpose of the Aborted state? When a thread calls the
Abort()
method, it will go to the AbortRequested state and after the thread responds to abort request, it will go to Stopped state. So what is the function of Aborted state?
A thread is blocked if its execution has been suspended by one of the synchronization primitives, such as a lock or a mutex. Any thread that is performing useful work at a given moment is, by definition, not blocked at that moment.
The AbortRequested/Stopped
cycle gives the thread an opportunity to perform an orderly shutdown, releasing acquired resources and performing other cleanup tasks.
http://www.albahari.com/threading/
这篇关于在.NET框架线程的生命周期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!