Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

One quick question in the Garbage collection?

 
Shanmugam nagaraj
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
What all are the algorithm we are using in the garbage collection? what is the purpose of each algorithm? can you please explain me for my hard question which is simple to you?

Thanks

Shanmugam
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure what you mean.

A Java programmer doesn't perform garbage collection.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JVM does garbage collection for us. The algorithms are wonderfully complex and varied. It seems every new release of the JVM has improved gc. Googling on "Sun garbage collection algorithm" got a few hits like THIS. Note it is specific to one particular dot release of the JVM.

This is a fascinating area, but one we really should stay away from in coding. Don't try to optimize your code for some particular gc version, or try to invoke the gc yourself to improve performance. I trust that it is far smarter than I am, and it is likely to change in ways that will make my optimization today the worst possible choice tomorrow. So read it, be impressed, and try to forget.
 
Shanmugam nagaraj
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your timely response!
My sincere appologise for the inconvinience cause to you due to my communication gap and wasted your precious time.
I am very new to java and to javaranch also, now only I trying a job.

One interviewer asked me like:
What all are the algorithm using by jvm for garbage collection? What is the purpose of each?


For eg:
mark and sweep is one of the algorithm using by garbage collection. but he(inteviewer) say there is some more algorithm is available and each one is do one process while doing the garbage collection operation.


thanks
Shanmugam
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Follow up with the Google search I suggested, or craft your own search around mark-sweep and see what alternatives show up. This is neat stuff and in rare situations someone will really have to dig into all the tuning options on the JVM. I've always managed to make sure that wasn't me, so I can't rattle off the details.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An interviewer asking that sort of question was either: -

(A) Not really expecting you to list all possible algorithms and describe them in detail, but instead just hoping to find out what you did know and whether you could talk intelligently on a non-trivial technical subject

... or ...

(B) A fool who didn't realise what a tough question it was

I guess you'll have determined which it was, by how the rest of the interview went.
 
Shanmugam nagaraj
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks for your explanation.
At last peter make me fool
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic