GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 417 of 436    Print  
Garbage Collector Generations Algorithm
Explain the Generations Algorithm used in the context of Garbage Collector


  
Total Answers and Comments: 2 Last Update: December 28, 2008     Asked by: vshylaja 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
April 18, 2008 05:47:09   #1  
sutanu_halder Member Since: December 2007   Contribution: 12    

RE: Garbage Collector Generations Algorithm
* The (original) copying collector (Enabled by default). When this collector kicks in all application threads are stopped and the copying collection proceeds using one thread (which means only one CPU even if on a multi-CPU machine). This is known as a stop-the-world collection because basically the JVM pauses everything else until the collection is completed. * The parallel copying collector (Enabled using -XX:+UseParNewGC). Like the original copying collector this is a stop-the-world collector. However this collector parallelizes the copying collection over multiple threads which is more efficient than the original single-thread copying collector for multi-CPU machines (though not for single-CPU machines). This algorithm potentially speeds up young generation collection by a factor equal to the number of CPUs available when compared to the original singly-threaded copying collector. * The parallel scavenge collector (Enabled using -XX:UseParallelGC). This is like the previous parallel copying collector but the algorithm is tuned for gigabyte heaps (over 10GB) on multi-CPU machines. This collection algorithm is designed to maximize throughput while minimizing pauses. It has an optional adaptive tuning policy which will automatically resize heap spaces. If you use this collector you can only use the the original mark-sweep collector in the old generation (i.e. the newer old generation concurrent collector cannot work with this young generation collector).
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
December 28, 2008 00:45:23   #2  
Loki117 Member Since: February 2007   Contribution: 5    

RE: Garbage Collector Generations Algorithm
Garbage collection in .Net is an automated process.

All objects are swept by the GC to check if they are still alive and are assigned a generation each sweep. The lower the generation the more frequently the objects are checked for example a gen 1 may be checked every 5ms if a object has been alive for a longer period it will be bumped up a generation (up to a max of gen 5 I believe) and checked less frequently as the logic goes that this longer living object must be a important integral object to the application if it is still being referenced. To ensure a heavy object is picked up quickly make sure to use the using key word to set it's scope and perhaps call GC.Collect() after moving out of the scope.

 
Is this answer useful? Yes | No

 Related Questions

Yes. Set all references to null and then call System.GC.Collect().If you need to have some objects destructed, and System.GC.Collect() doesn't seem to be doing it for you, you can force finalizers 
Latest Answer : GC.Collect();It is recomended that you should not forcefully call the GC. GC does it in the optimal way, since it knows the inner details like which object actually created inner objects.But some case you may need to force GC to free the scarce memory ...

C# has finalizers (similar to destructors except that the runtime doesn't guarantee they'll be called), and they are specified as follows: class C{~C(){// your code}public static void Main() 
Latest Answer : If you are not declare any Main() method in your program then compiler will give you this errors. Basically Main() is the entry point for compiler for execution. One more thing C# ia a case sensitive language so be carefull about the spelling of Main() ...

In a garbage collected environment, it's impossible to get true determinism. However, a design pattern that we recommend is implementing IDisposable on any class that contains a critical resource. 

.NET FRAMEWORK1. What is .NET Framework?The .NET Framework has two main components: the common language runtime and the .NET Framework class library.You can think of the runtime as an agent that manages 
Latest Answer : The .NET framework is a platform over which multiple languages are running.The 2 main components are 1. FRAMEWORK CLASS LIBRARY2. COMMON LANGUAGE RUNTIMEIt's features like CTS provide Cross Language Interoprabality.The CLR is the main Governing body ...
Read Answers (1) | Asked by : Prasanna Muthukrishnan

Skill/Topic: IntermediateA) Language InteroperabilityB) Garbage CollectionC) Multiple Inheritance 
Latest Answer : by the interface we can go for the multiplle inhertiance also so my answer ids corrget for tHAT ...

Skill/Topic: AdvancedA) Managed CodeB) Smart CachingC) Garbage Collection 
Latest Answer : C) Garbage Collection ...

Skill/Topic: AdvancedA) Copies the IL code to the heapB) Destroys the pointersC) is responsible for automatic memory management 
Latest Answer : ans:C) is responsible for automatic memory management ...

Skill/Topic: AdvancedA) TrueB) False 
Latest Answer : true, we can call GC using System.GC.Collect() method. ...

Skill/Topic: AdvancedA) ManifestB) Garbage CollectorC) Heap 
Latest Answer : Assembly Manifest ...

Skill/Topic: AdvancedA) Garbage.CollectB) System.GC.Collect()C) Gc.Clea.Up() 
Latest Answer : System.GC.Collect() ...


 Sponsored Links

 
Related Articles

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 

HR Interview - How To Prepare For Your HR Interview

How To Prepare For Your HR Interview Before you begin thinking about how you are going to dress for the interview it is important to do your research first You should learn everything you can about the company you wish to work for When you have detailed information about your employer you will conve
 

HR Interview - Telephone Interview Etiquette

Telephone Interview Etiquette When you conduct a telephone interview for a job it is important to show the proper etiquette Not only is it important it is critical is you wish to be hired by the company There are a number of things you will want to do and other things should never be done mosgoogle
 

HR Interview - How To Succeed At HR Interviews

How To Succeed At HR Interviews There are a number of things you will need to do in order to make sure you pass the interview process Your appearance is something that you will want to pay close attention to Even if you feel that your appearance shouldn t be a factor in whether or not you re highere
 

HR Interview - Do's and Dont's in a HR Interview

Do s and Dont s in a HR Interview There are a number of things that you will want to avoid during the HR interview process While some of these things are directed at the interviewer the other things are directed at the applicant If interviewers fail to follow the proper procedures throughout the int
 

HR Interview - HR Interview Tips

HR Interview Tips It has become more challenging for companies to find the right employees because of the market When you hold an interview for a potential employee there are a number of things you will want to keep in mind mosgoogle The goal of a company should be to hire an employee who can perfor
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape