作者:Amandadahl | 来源:互联网 | 2023-10-10 20:26
Imworkingonanapplicationthatprocesspipelinesinseparatethreads.DuringmytestsIhavesee
I'm working on an application that process pipelines in separate threads. During my tests I have seen that if a process is "lightweight" or the CLR determines that this is going to end quickly CLR recycle this thread rapidly and various units of work can share at the same time the same thread.
我正在研究一个在单独的线程中处理管道的应用程序。在我的测试中,我已经看到如果一个进程是“轻量级的”或者CLR确定这将很快结束CLR快速回收这个线程,并且各种工作单元可以同时共享同一个线程。
On the contrary if a process take's some time or has more load CLR open different threads.
相反,如果一个进程需要一段时间或者有更多负载CLR打开不同的线程。
To me all that difficult TLS Thread local storage programming.
对我来说,所有那些困难的TLS Thread本地存储编程。
In fact my application pipelines take some time to process and it seems that CLR is always assigning one managed thread for each other. BTW if in some case two pipelines share one managed thread they will collide because they use TLS variables.
事实上,我的应用程序管道需要一些时间来处理,似乎CLR总是为彼此分配一个托管线程。顺便说一句,如果在某些情况下两个管道共享一个托管线程,它们将发生冲突,因为它们使用TLS变量。
After all that here comes the real question... Can I do the assumption that If a process takes some time/load it will always use it's own thread, or am I crazy doing that?
毕竟这就是真正的问题......我能否做到这样的假设:如果一个进程需要一些时间/加载,它将始终使用它自己的线程,或者我疯了吗?
For what I have been reading managed threads in .net 3.5 is like acting with a kind of black box. So perhaps this question can never really be responded.
对于我一直在阅读.net 3.5中的托管线程,就像使用一种黑盒子一样。所以也许这个问题永远不会得到回应。
EDIT:
With process I am refereing to the dictionary definition A series of actions, changes, or functions bringing about a result an not the computer process you identify in task manager.
在进程中,我将参考字典定义一系列操作,更改或函数,而不是您在任务管理器中识别的计算机进程。
2 个解决方案