• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Garbage collection vs. Java threads

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone!
There are 5 questions I am willing to find out the answers.
As they are all connected I decided to ask without separating them and, put them in 1 topic.
  • Can the GC ever cause pause to the execution of threads?
  • What are our options as far as available garbage collectors?
  • What causes Java garbage collectors to 'thrash' and in general interrupt processing, max out memory, or max out CPU usage?
  • What the relation to number of objects, circular references; what are the limits, do different GCs have different limits? Are there ways to predict, avoid, or interrupt a GC thats in this thrashing state?
  • Are there any known bugs, problems, or pitfalls to using the Java SoftReference or HardReference in caches or similar structures; is there any corelation between them and how they relate to GCs, to threads, to web apps, or to server memory usage?

  • Any link to the related materials in internet will be appreciated.
    Thanks in advance
     
    Ranch Hand
    Posts: 1170
    Hibernate Eclipse IDE Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Can the GC ever cause pause to the execution of threads?


    Usually. there is a new concurrent GC though. but still the synchs will cause a pause if their is contention.

    What are our options as far as available garbage collectors?


    Look in the Java SDK Documentation under tools.

    What causes Java garbage collectors to 'thrash' and in general interrupt processing, max out memory, or max out CPU usage?


    design. They end up collecting everything after a certain amount of mem is used up. They tend to need better hysteresis.

    What the relation to number of objects, circular references; what are the limits, do different GCs have different limits? Are there ways to predict, avoid, or interrupt a GC thats in this thrashing state?


    Limited by amount of memory. Check the Vm specification for the particulat VM though. Sun has a VM spec, again in the Java SDK Documentation.
    Also, GC does not 'thrash.' That would imply its tripping over its feet and causing itself to slow down. Its not. its just doing its job.

    Are there any known bugs, problems, or pitfalls to using the Java SoftReference or HardReference in caches or similar structures; is there any corelation between them and how they relate to GCs, to threads, to web apps, or to server memory usage?


    Unsure the question here. SoftReferences and WeakReferences work exactly as described and I use them without issue.
    http://java.sun.com/developer/technicalArticles/ALT/RefObj/
     
    Spartak Setyan
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    CL Gilbert,
    thanks for your answer.
     
    Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
    a bit of art, as a gift, that will fit in a stocking
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic