an efficient memory system for java garbage collection
DESCRIPTION
Java Garbage Collection hinders the performance of Java programs. Here is an Efficient memory system which will increase its performance.TRANSCRIPT
Garbage Collection and Efficient Memory System for Java
Who is collecting your java Garbage By: Chia-tien, W Srisa and J MorrisIEEE 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
04/12/2023Department of computer science
and Engg,MIT Manipal 1
Table Of Contents
1. Introduction2. Garbage Collection(GC) Techniques3. Dynamic Memory Usage in Java4. Hardware/Software Memory Management5. Results Analysis6. Conclusion
04/12/2023Department of computer science and
Engg,MIT Manipal 2
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 3
2. Garbage Collection Techniques
There are 6 types of Techniques/Strategies1. Mark-sweep2. Generational collection3. Reference counting4. Copying5. Mark-compact6. Stop-the-world
04/12/2023Department of computer science and
Engg,MIT Manipal 4
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 5
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.04/12/2023
Department of computer science and Engg,MIT Manipal 6
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 7
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 8
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 9
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 10
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
04/12/2023Department of computer science and
Engg,MIT Manipal 11
04/12/2023Department of computer science and
Engg,MIT Manipal 12
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 blockFollowing are the 3-dimensional plots of the
analysis
04/12/2023Department of computer science and
Engg,MIT Manipal 13
Fig.1 Dynamic Memory Usage of JVM-98 Benchmark
04/12/2023Department of computer science and
Engg,MIT Manipal 14
Fig.2 Dynamic Memory Usage of Java2D Demo
04/12/2023Department of computer science and
Engg,MIT Manipal 15
Fig.3 Dynamic Memory Usage of J2EE PetStore Demo
04/12/2023Department of computer science and
Engg,MIT Manipal 16
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 17
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 18
Fig.4 Memory Management Cache
04/12/2023Department of computer science and
Engg,MIT Manipal 19
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 20
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%. 04/12/2023
Department of computer science and Engg,MIT Manipal 21
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.
04/12/2023Department of computer science and
Engg,MIT Manipal 22
04/12/2023 23
Thank You
Department of computer science and Engg,MIT Manipal