.net - 组成进程、应用程序域、上下文和线程的 "components"有哪些不同(以及它们之间的关系)?

标签 .net process applicationdomain

我真的很希望得到一个明确的答案。

我之前问过一个问题 "What is a thread (really)?"我得到了一些非常好的答案,我从中得出的结论是一个线程是:

A thread is an independent set of values for the processor registers (for a single core). Since this includes the Instruction Pointer (aka Program Counter), it controls what executes in what order. It also includes the Stack Pointer, which had better point to a unique area of memory for each thread or else they will interfere with each other.



IE。

A thread isn't anything more "concrete" than a set of register values





The exact list of CPU registers depends on the architecture, but instruction pointer and stack pointer are pretty much universal. They define a thread insofar as when this thread (set of register values) is loaded in the processor core, the thread is running. The processor is fetching instructions demanded by the thread and updating the thread registers. When a context switch is needed, the processor saves this set of register values into memory and loads a set belonging to a different thread, typically as part of the interrupt servicing logic.



此外,我了解线程具有 TLS(线程本地存储)和它们自己的调用堆栈。

所以重申一下,澄清我的问题 ,线程的组件(正如我在标题中所说的那样)是寄存器值、它的 TLS 和它的调用堆栈。我想知道标题中其他项目的组成部分(进程、应用程序域和上下文)。

这是我正在阅读的书中的图表(Pro C# 2008 and the .NET Platform)

The Win32 Process/Thread Relationship

我了解此图与 Win32 进程有关,但我认为相同的 TLS、调用堆栈思想适用于 .NET。另外,我认为这个图如果包含定义这些线程(A 和 B)的寄存器值(或表明存在寄存器值的东西)会更好。

现在我在继续我的调查,我想一下子问这个问题。我想知道 Processes、AppDomains 和 Contexts 的相同信息(这是我理解的托管“层次结构”的顺序,即进程主机 appdomains、appdomains 主机上下文、上下文主机线程)。

我的最终目标是获得足够的信息,以便我可以绘制所有这些实体(或任何实体)之间的关系,以及实际构成它们的组件(例如,在线程的情况下,有寄存器值、TLS、并调用实际构成它们的堆栈)。当我这样做时,我会在最后发布关于这个问题的图表作为编辑。现在,这是我正在阅读的书中的图表(关于进程、应用程序域和上下文):

Processes, application domains, and context boundaries

附言如果有人知道那里已经解释了所有这些的图表,我很乐意看到它。如果不 。 . .为什么没有一个??

编辑:这是我目前所拥有的图表

Processes, Application Domains, Contexts and Threads - components and their relationships

最佳答案

在在线论坛上发布大量信息并保持其可读性是很困难的。

相反,我建议您阅读两本书:

  • Windows Internals , 对于操作系统级别的概念(进程和线程)。
  • CLR via C# ,对于 .NET 级别的概念(AppDomains 和托管线程)。
  • 关于.net - 组成进程、应用程序域、上下文和线程的 "components"有哪些不同(以及它们之间的关系)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5206928/

    相关文章:

    .net - 强制 DataGridView 单元格仅接受数字输入的最佳方法是什么?

    iphone - 从 pid 获取优先级和正常运行时间? ( iOS )

    c++ - 使用 C++ 打开 Windows 应用程序,如游戏或浏览器或任何其他程序

    java - 如何为 Java 程序设置进程名称?

    C# 程序集加载和后期绑定(bind)

    c# - 从 couchbase View 获取计数器文档

    c# - 将拆分视频保存到数据库中并检索它们

    c#-4.0 - 非静态委托(delegate)的 DoCallBack CrossAppDomainDelegate 行为

    c# - 如何在 C# 中以编程方式确定类型是否接受 null 值?

    c# - .NET 中应用程序域的常见用途和最佳实践?