Languages such as Java and C# rely on garbage collection (GC) to manage their memory. GC relieves developers from error-prone memory reclamation but application performance is hurt by the additional GC work. To reduce GC overhead, most garbage collectors uses a simple heuristic. The same heuristic is applied throughout the entire execution time, regardless of the kind of memory objects and the kind of applications. However, the memory behavior of applications is significantly different. Moreover, even a single application may show very different behaviors as it executes. Therefore, the traditional garbage collectors fail to support a wide range of applications and to match the varying behavior of an application.
This thesis proposes a phase-adaptive garbage collector (PAGC) for Java virtual machine. The goal of the proposed collector is to improve GC efficiency by tailoring all its operations to the behavioral pattern (i.e., the phase) of applications. To this end, PAGC dynamically identifies application phases by monitoring application methods. Then, PAGC groups memory objects by their associated phase and determine the best GC timing for the grouped objects by considering the phase behavior. Furthermore, to collect the determined group efficiently, PAGC uses either the in-place GC or the phase-boundary GC. Applications usually have a ramp phase that objects are intensively allocated and a cliff phase that a lot of objects die en masse. The in-place GC and the phase-boundary GC improve the efficency of the garbage collection invoked at the ramp phase and at the cliff phase respectively.
We implemented PAGC on SableVM research virtual machine and evaluated it using several benchmarks. The experimental results show that PAGC successfully recognizes application phases. Compared with the traditional generational garbage collector, PAGC improves the garbage collection time by as much as 41%.
자바나 C#등의 프로그래밍 언어들은 메모리를 관리하는 기능을 프로그래머가 직접 구현할 필요가 없다. 대신 각각의 실행 환경에서 제공하는 불용 정보처리기(가비지 콜렉터)가 자동으로 메모리 관리 기능을 수행한다. 가비지 콜렉터를 이용하게 되면 메모리 관리시에 발생 할 수 있는 오류를 크게 줄일 수 있는 장점이 있지만, 반대로 프로그램의 실행 성능이 저하되는 단점이 있다. 성능 저하를 줄이기 위해, 대부분의 가비지 콜렉터들은 간단한 형태의 휴리스틱을 이용한다. 하지만, 사용자 프로그램의 동작 형태는 프로그램의 목적에 따라 매우 상이하므로 단순 휴리스틱 기반의 가비지 콜렉터들의 성능 향상에는 한계가 있다.
이를 해결하기 위해서, 본 논문에서는 자바가상머신의 성능 향상을 위해 새로운 형태의 위상 적응형 가비지 콜렉터를 제안하였다. 제안된 가비지 콜렉터의 목적은 다양하게 변화하는 사용자 프로그램의 동작 패턴을 실행중에 분석하여 각각의 패턴에 맞는 최적의 알고리즘을 적용하는 것이다. 본 가비지 콜렉터는 아래와 같이 세가지 주요 부분으로 구성되었다. 첫번째는, 사용자 프로그램의 변화화는 동작 형태를 프로그램 실행중에 분석하는 기능이다. 여러가지 통계 자료를 통하여, 소수의 프로그램 함수들이 프로그램의 전체적인 동작 패턴을 좌우함을 알 수 있었고, 이를 기반으로 프로그램의 동작 패턴을 분석하였다. 두번째는, 이렇게 분석된 동작 패턴을 바탕으로 메모리를 분리하여 관리하는 기능이다. 사용자 프로그램들은 일반적으로 동일한 패턴으로 실행되는 동안 비슷한 생명주기를 가지는 메모리 객체를 생성하기 때문에 패턴별로 메모리를 분리함으로써 어느 영역의 메모리 객체들이 언제 불용 객체(가비지)가 될지를 쉽게 판단할 수 있다. 마지막으로, 각각의 패턴에 따라 다양한 형태의 가비지 콜렉션 알고리즘을 적용하는 기능이다. 사용자 프로그램의 여러가지 패턴에 따라 각각 새롭게 제안된 인-플레이스 가비지 콜렉션과 페이즈-바운드리 가비지 콜렉션을 선택적으로 수행한다.
제안된 가비지 콜렉터는 연구용 자바가상머신인 SableVM에 구현되었고 여러가지 벤치마크를 통하여 성능을 측정하였다. 실험을 통해서 제안된 가비지 콜렉터가 다양한 형태의 동작 패턴에 효과적으로 반응함을 확인 알 수 있었다. 또한, 기존의 전통적인 형태의 가비지 콜렉터와 비교했을때, 제안된 가비지 콜렉터를 이용할 경우 가비지 콜렉션으로 소비되는 시간을 최대 41%까지 감소시킬 수 있었다.