|
Question 13
What is strong name in .net assembly
A strong name is similar to a guid which helps to gac to differentiate between two different versions of assembly. a strong name is created using sn.exe. assemblies which have a strong name are only allowed to be installed in a gac. strong names are created using public key cryptography (pkc) which has a public key and a private key
|
Question 14
How to add and remove an assembly from gac
In order to install or remove an assembly from gac gacutil.exe tool is used
to install an assembly to gac the following command is used
gacutil.exe /i assembly.dll
to uninstall an assembly to gac the following command is used
gacutil.exe /u assembly.dll
|
Question 15
What is delay signing
In order to install an assembly in gac a strong name is required which has a public key and a private key. delay signing allows an assembly to be installed in gac without private key. delay signing is useful during the development phase when somebody do not want to disclose the private key. later during the packaging time such assemblies will be signed with the private key
|
Question 16
What is garbage collection
The process of releasing memory objects which are no longer used by an application in a .net environment is known as garbage collection. garbage collector helps the clr to perform better memory management. by default garbage collection is an automatic process which is being executed by the clr. by using gc.collect() method we can force clr to perform garbage collection
|
Question 17
How does garbage collection work
The process of releasing memory objects which are no longer used by an application in a .net environment is known as garbage collection. garbage collector helps the clr to perform better memory management.
how garbage collector works.
garbage collector uses a managed heap to store objects. newly created object will be at the top of the heap (higher memory addresses) and older objects will be at the bottom.
based on the age of memory objects, garbage collector group objects into to three different groups which are generally known as generations. there will be 3 different generations. generation 0, generation 1, generation 2
generation 0 – all the newly created objects will be in generation 0. after a period of time objects which are still alive in gen 0 will be moved to generation 1.
generation 1 (gen1) – all the objects which were in gen 0 and have survived a series of garbage collection will be moved to gen 1
generation 2 (gen 2) – objects like global variables, static variables will be usually be in gen 3 because they will be alive till the application runs.
collecting the garbage
during a gc operation clr will pause the application execution
there are two types of collection
1) partial collection – it is considered to a very cheap operation. only objects in gen 0 will be released
2) full collection – gc will perform this operation in all generations and it is considered to a an expensive operation
after this process dead objects will be removed from the heap and live objects will be rearranged to fill the gaps. generations also will be updated after this process
|
Question 18
How finalization affects performance
When the garbage collector runs objects will finalize will not be destroyed immediately. instead it will be moved a finalization queue. also the child objects which are referred to this object cannot be destroyed this time. after the garbage collection finalize thread will execute the finally method and will become dead. these dead objects will be removed only on the next garbage collection. this is the reason finalization has a bad effect on performance
|