The document discusses garbage collection techniques in Java and proposes a hardware/software solution for efficient memory management. It analyzes the dynamic memory usage of various Java applications and finds that most allocation requests are for small blocks with short lifetimes. The solution divides memory into regions, with a small object heap for allocating small blocks. Analysis shows this approach can handle 98.2% of requests in one cycle, improving performance by around 17% compared to software-only allocation.
An efficient memory system for java Garbage Collection
1. Garbage Collection and Efficient
Memory System for Java
Who is collecting your java Garbage
By: Chia-tien, W Srisa and J Morris
IEEE Computer Society Press, Vol 5 ,Apr 2003
An Efficient Memory System for Java
By: Li, Richard C.L. and Fong, Anthony S.S.
IJCSNS , Vol 7 June2007
Presented By:
Rohit Deshpande
130913016
2/16/2014
Department of computer science
and Engg,MIT Manipal
1
2. Table Of Contents
1.
2.
3.
4.
5.
6.
Introduction
Garbage Collection(GC) Techniques
Dynamic Memory Usage in Java
Hardware/Software Memory Management
Results Analysis
Conclusion
2/16/2014
Department of computer science and
Engg,MIT Manipal
2
3. 1. Introduction
One of the significant issues that hinder the
performance of java program execution is
dynamic memory usage.
15.58% of the CPU time is used in handling
memory allocation request and 28.08% of the
CPU time in garbage collection.
JVM performance often depends on the
efficiency of its GC process.
2/16/2014
Department of computer science and
Engg,MIT Manipal
3
4. 2. Garbage Collection Techniques
There are 6 types of Techniques/Strategies
1. Mark-sweep
2. Generational collection
3. Reference counting
4. Copying
5. Mark-compact
6. Stop-the-world
2/16/2014
Department of computer science and
Engg,MIT Manipal
4
5. 2.1 Mark-sweep
Mark-sweep involves two phases: Marking and
sweeping.
Marking phase marks reachable objects through
either a depth-or breadth-first search on the
object reference graph.
The sweep phase consists of reclaiming garbage
back to system.
2/16/2014
Department of computer science and
Engg,MIT Manipal
5
6. 2.2 Generational collection
It make use of Generational collectors.
This collectors divide objects into groups(young ,
old and infant).
Mostly Infant objects die quickly so become
garbage quickly.
Young generation objects involves minimal
marking efforts.
Whereas old generation objects could still need
full marking.
2/16/2014
Department of computer science and
Engg,MIT Manipal
6
7. 2.3 Reference Counting
This technique associates each object with a
reference count, which records the number of
objects that can access the object. Once the
reference reaches 0, the corresponding object
is garbage.
2/16/2014
Department of computer science and
Engg,MIT Manipal
7
8. 2.4 Copying
In this copying collector trace garbage(performs
garbage detection) but do not mark it.
Once it identifies live objects, it copies those
objects to another memory location and free
rest of the memory.
2/16/2014
Department of computer science and
Engg,MIT Manipal
8
9. 2.5 Mark-compact
It involves two phases: marking and compacting.
Marking phase is same as in Mark-sweep. Once
the marking phase is finished, live objects are
moved side by side in memory this is known
as compaction.
2/16/2014
Department of computer science and
Engg,MIT Manipal
9
10. 2.6 Stop-the-world
Stop-the-world garbage collector suspends all
program threads when its threads are
running. Then it search for free objects and
destroy them.
This technique is not used for time critical
applications as it suspends the current
running threads to free the memory.
2/16/2014
Department of computer science and
Engg,MIT Manipal
10
11. 3. Dynamic Memory Usage in Java
In order to obtain the statistics on the memory
allocation and deallocation behavior of java
programs, a tracing tool was developed.
This tracing tool is a profiler agent developed
according to the specification of the Java
Virtual Machine Profiler Interface (JVMPI).
Different Java applications were chosen for
evaluation as follows
2/16/2014
Department of computer science and
Engg,MIT Manipal
11
13. The different results obtained were passed to an
analyzer to analyze the data in 2 different
dimensions:
Size of block requested
Life time of a block
Following are the 3-dimensional plots of the
analysis
2/16/2014
Department of computer science and
Engg,MIT Manipal
13
14. Fig.1 Dynamic Memory Usage of JVM-98 Benchmark
2/16/2014
Department of computer science and
Engg,MIT Manipal
14
15. Fig.2 Dynamic Memory Usage of Java2D Demo
2/16/2014
Department of computer science and
Engg,MIT Manipal
15
16. Fig.3 Dynamic Memory Usage of J2EE PetStore Demo
2/16/2014
Department of computer science and
Engg,MIT Manipal
16
17. On the basis of above study it was stated that
Java applications show similar locality, and
that memory allocation requests are
concentrated on small block sizes(<1K bytes)
and blocks allocated usually have short life
times.
Based on this findings a Hardware/Software
solution was proposed.
2/16/2014
Department of computer science and
Engg,MIT Manipal
17
18. 4. Hardware/Software Memory
Management
Allocation requests are first classified into small
size and large size types.
To provide effective memory management in
hardware, the main memory is divided into
fixed sized regions.
The Small Object Heap (SOH) is used for purpose
of allocating small blocks.
2/16/2014
Department of computer science and
Engg,MIT Manipal
18
19. Fig.4 Memory Management Cache
2/16/2014
Department of computer science and
Engg,MIT Manipal
19
20. 5. Result Analysis
Using above Memory Management Cache
Scheme it was found that around 98.2% of all
memory allocation and deallocation requests
can be handled by the hardware in a single
cycle.
1.6% of the requests will have a penalty on the
miss in the memory management cache and
0.2% of the request will rely on software
method to fulfill the request.
2/16/2014
Department of computer science and
Engg,MIT Manipal
20
21. Effective time for allocation=
98.2% X 1cycle + 1.6% X 1014cycles + 0.2% X 400
cycles=18cycles
Comparing with the 400 cycles required by best
malloc software algo, the performance of the
proposed solution give a gain of
400/18=22 times.
Thus the overall speed up is around 17%.
2/16/2014
Department of computer science and
Engg,MIT Manipal
21
22. 6. Conclusion
With the given algo for garbage collection and
proposed hardware/software combined
memory system that is responsible for
handling memory allocation/deallocation
requests of small size(<=1Kbytes)blocks, while
traditional software malloc routine is used for
handling large block(>1kbytes). An overall 17%
gain is possible while executing Java program.
2/16/2014
Department of computer science and
Engg,MIT Manipal
22