Monday, December 19, 2016

Demo :Learn !dumpdomain command


Process boundary

Applications running on windows are protected by each other. Each application has a process and they are separated (isolated) by their process boundary. So if an application crashes due to some issues, its process gets killed, but the other applications are unaffected.

The process boundary provides great security benefits. It also adds few restrictions when processes communicates each other. This is because memory addresses on one process has no meaning for the  other application. The components within an application communicate (transfer data) freely but the data transfer between the processes would require additional work like marshaling (copy data from one  process , pass the data and place it to meaningful address location of other process)

Application domains

App domains carry the same concept of providing isolation and security but they are within the process. By default , .NET CLR create three application domains to any .NET application with names (System ,Shared and default) .User can programmatically add new domains to applications.   The cross-domain communication requires marshaling. 

Hosting applications (Ex: IIS processes) utilizes multiple .NET app domains to load web applications in separate app domain so that applications behave so distinct and isolated each other. 

The brief description of CLR created domains for an application is listed below.

System domain : The first application domain created on the application. It is responsible for creating other two domains ( Shared and default). This domain loads mscorlib dll to shared application domain.

Shared Domain: This is the place where the shared code exists . There is a type of assemblies called domain neutral assemblies(their code can be accessible in all app domains). They are getting loaded to this app domain.

Default domain:  The domain where application specific data and assemblies resides.

.Net Debugging Lab3 : Inspect Compacting the Heaps using WinDBG commands: - !heapstat

Related .NET internals: 1.        Gen 0 and Gen 1 are compacting heap regions :   When Garbage collector (GC) operates on a Gen 0 or ...