Question

Please answer this question. Q) question is explain how the reference counting of object simplifi...

please answer this question.

Q)
question is explain how the reference counting of object simplifie the mark phase of the mark and sweep
garbage collection algorithem, be sure to include time/space tradeoff aspects inherent
in this approach.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

GARBAGE :

garbage means unreachable objects or unreferenced objects

Java Garbage Collection Algorithms used to remove the unreachable objects, it is a background process. There are different types of Garbage Collection Algorithms in Java, one is a Mark and Sweep algorithm.

MARK AND SWEEP ALGORITHM

there are two phases in this algorithm ;

1. mark phase

2. sweep phase

MARKING PHASE [algorithm]

1. Assume all objects in Unreached state.

2. Start with the root set. Put them in state Unscanned.

3.while Unscanned objects remain do

    examine one of these objects;

    make its state be Scanned;

    add all referenced objects to Unscanned if they have not been there;

end;

SWEEP PHASE [algorithm]

  1. Place all objects still in the Unreached state into the Free state.
  2. Place all objects in Scanned state into the Unreached state.
  3. To prepare for the next mark-and-sweep

ADVANTAGES

1. it is a cyclic process, means there is an infinite loop.

2. there is no additional overhead in this algorithm.

DISADVANTAGES

1. It runs many times in a program

Add a comment
Know the answer?
Add Answer to:
Please answer this question. Q) question is explain how the reference counting of object simplifi...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT