Jump to content

  • Log In with Google      Sign In   
  • Create Account

[java] Threads (garbage collector and finalizer)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 nap202   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 October 2000 - 08:13 AM

Hi, can someone explain why the garbage collector thread and finalizer thread aren''t unified in one thread? Is there any reason for the java developers to have chosen this implementation?

Sponsor:

#2 felonius   Members   -  Reputation: 122

Like
Likes
Like

Posted 19 October 2000 - 08:30 PM

For one thing I don''t think that this part of the standard - it is something that Java VM implementors may choose for themselves.

And why? Because of concurrency. Garbage collection and finalization is something that often can be done in parallel and by making two threads you can utilize multi processor systems much better.

The garbage collector on most VMs in a mark-sweep algorithm that starts with the application object and tries to reach all other objects. Those not reachable are marked for finalization, for instance by putting them in a queue.

The finalization thread can handle this queue and call finalize routines while the other thread performs the mark-sweep algorithm.

Jacob Marner




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS