I am really hoping to get a definitive answer to this.

I have a previous question where I asked "What is a thread (really)?" I got some really good answers and my takeaway from this was that a Thread is:

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.

i.e.

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

and

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.

In addition, I understand threads have TLS (Thread Local Storage) and their own Call Stack.

So to reiterate, to clarify my question, a thread's components (as I have put in my title) are the register values, its TLS, and its call stack. I want to know the components of the other items in my title (processes, appdomains, and contexts).

Here is a diagram from the book I am reading (Pro C# 2008 and the .NET Platform)

The Win32 Process/Thread Relationship

I understand this diagram pertains to Win32 Processes, but I think the same TLS, call Stack idea holds for .NET. Also, I think this diagram would be much better if it included thhe register values (or something to indicate that there were register values) that defined these threads (A and B).

Now I am continuing my investigation, and I want to just ask this all at once. I want to know the same information for Processes, AppDomains, and Contexts (and this is the order that I understand as the "hierarchy" of hosting, i.e. processes host appdomains, appdomains host contexts, contexts host threads).

My ultimate goal is to get enough information that I can diagram the relationships between all these entities (or whatever they are), but also the components that actually make them up (for instance in the case of threads, there are register values, TLS, and call stack that actually make them up). When I do, I will post the diagram up on this question as an edit at the end. For now, here is a diagram taken from the book I am reading (as regards processes, app domains, and contexts):

Processes, application domains, and context boundaries

P.S. if someone knows of a diagram out there that already explains all this I would love to see it. If not . . . why the heck is there not one??

EDIT: HERE IS WHAT I HAVE SO FAR AS A DIAGRAM

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

1

There are 1 answers

1
Stephen Cleary On BEST ANSWER

It's difficult to post a lot of information in an online forum and keep it readable.

Rather, I recommend that you read two books:

  • Windows Internals, for the OS-level concepts (processes and threads).
  • CLR via C#, for the .NET-level concepts (AppDomains and managed threads).