tags:

views:

921

answers:

1

What is the difference between AppDomain, Assembly, Process, and a Thread

+5  A: 

An AppDomain is a unit of code within a process. AppDomains can be created at runtime, loaded with code, and unloaded. Its an isolation boundary designed to make .NET apps more reliable.

An assembly is a compiled chunk of code. Like an .EXE or a .DLL.

A process is an executing application (waaaay oversimplified).

A thread is an execution context. The operating system executes code within a thread. The operating system switches between threads, allowing each to execute in turn, thus giving the impression that multiple applications are running at the same time.

To put it all together (very simplified)...

A program is executed. A process is created by the operating system, and within its single thread it starts loading code to execute. In a .NET application, a single AppDomain is created by the CLR. The application's executing assembly (the .EXE) is loaded into this AppDomain and begins execution. The application can create AppDomains, load other assemblies into these domains, and then create new Threads to execute code in any of these AppDomains.

Will
Technically, an assembly is a component, comprised of one or more modules. It's the modules that are the .EXE or .DLL files.
Dave Van den Eynde
True, you can merge modules into a single assembly. That's one of the MANY details I left out!
Will