KR100753821B1 - Garbage collection apparatus and method - Google Patents

Garbage collection apparatus and method Download PDF

Info

Publication number
KR100753821B1
KR100753821B1 KR1020050124056A KR20050124056A KR100753821B1 KR 100753821 B1 KR100753821 B1 KR 100753821B1 KR 1020050124056 A KR1020050124056 A KR 1020050124056A KR 20050124056 A KR20050124056 A KR 20050124056A KR 100753821 B1 KR100753821 B1 KR 100753821B1
Authority
KR
South Korea
Prior art keywords
area
garbage collection
garbage
blocks
delete delete
Prior art date
Application number
KR1020050124056A
Other languages
Korean (ko)
Other versions
KR20070047193A (en
Inventor
이상윤
원희선
김상욱
차창일
김형준
황규정
Original Assignee
한국전자통신연구원
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 한국전자통신연구원 filed Critical 한국전자통신연구원
Priority to US11/584,281 priority Critical patent/US20070100919A1/en
Publication of KR20070047193A publication Critical patent/KR20070047193A/en
Application granted granted Critical
Publication of KR100753821B1 publication Critical patent/KR100753821B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)

Abstract

임베디드 환경에서의 가비지 컬렉션 장치 및 그 방법이 개시된다. 메모리를 제1영역 및 제2영역으로 구성되는 젊은 세대 영역 및 소정 개수의 블록으로 구성되는 늙은 세대 영역으로 분할하고, 젊은 세대에 대해서는 영역을 반으로 나누어 제1영역 및 제2영역에 대해 복사 가비지 컬렉션을 번갈아가며 수행하고, 늙은 세대 영역에 대해서는 소정 개수의 블록을 포함하는 프레임 단위로 점진적으로 가비지 컬렉션을 수행한다. 이로써 가비지 컬렉션의 시간 지연을 최소화하여 실시간성을 보장할 수 있다.Disclosed are a garbage collection apparatus and an method thereof in an embedded environment. The memory is divided into a young generation area consisting of the first area and a second area and an old generation area consisting of a predetermined number of blocks, and the copying garbage for the first area and the second area by dividing the area in half for the young generation. The collection is alternately performed, and the aged generation area is gradually garbage collected in units of frames including a predetermined number of blocks. This minimizes the time delay of garbage collection to ensure real time.

Description

가비지 컬렉션 장치 및 그 방법{Garbage collection apparatus and method}Garbage collection apparatus and method

도 1은 자바 가상 머신을 통해 메모리 관리 및 가비지 컬렉션을 수행하는 시스템의 일 실시예를 도시한 도면,1 illustrates an embodiment of a system for performing memory management and garbage collection through a Java virtual machine;

도 2는 세대 가비지 콜렉터의 동작 방법의 일 실시예를 도시한 도면,2 is a diagram illustrating an embodiment of a method of operating a generation garbage collector;

도 3은 본 발명에 따른 가비지 컬렉션 장치의 일 실시예의 구성을 도시한 도면,3 is a view showing the configuration of an embodiment of a garbage collection device according to the present invention;

도 4는 본 발명에 따른 메모리의 힙 구조의 일 실시예를 도시한 도면,4 is a diagram illustrating an embodiment of a heap structure of a memory according to the present invention;

도 5는 도 4의 힙 구조 중 늙은 세대의 구조를 도시한 도면,5 is a view showing the structure of the old generation of the heap structure of FIG.

도 6은 본 발명에 따라 프레임별로 가비지 컬렉션이 수행되는 모습을 도시한 도면,6 is a view illustrating a garbage collection performed for each frame according to the present invention;

도 7은 본 발명에 따른 1차 필터를 이용한 쓰기 방지 처리 방법의 일 실시예를 도시한 도면,7 is a diagram showing an embodiment of a write protection processing method using a primary filter according to the present invention;

도 8은 본 발명에 따른 2차 필터를 이용한 쓰기 방지 처리 방법의 일 실시예를 도시한 도면,8 is a view showing an embodiment of a write protection processing method using a secondary filter according to the present invention;

도 9는 본 발명에 따른 가비지 컬렉션 방법의 일 실시예의 흐름을 도시한 흐름도,9 is a flowchart illustrating a flow of an embodiment of a garbage collection method according to the present invention;

도 10은 본 발명에 따른 젊은 세대의 힙에서의 가비지 컬렉션 방법을 도시한 흐름도, 그리고,10 is a flowchart illustrating a garbage collection method in a heap of a young generation according to the present invention, and

도 11은 본 발명에 따른 늙은 세대의 힙에서의 가비지 컬렉션 방법을 도시한 흐름도이다.11 is a flowchart illustrating a garbage collection method in an old generation heap according to the present invention.

본 발명은 가비지 컬렉션 장치 및 그 방법에 관한 것으로, 보다 상세하게는, 임베디드 환경에서 가비지 컬렉션에 의한 지연 시간을 줄여 실시간성을 보장할 수 있도록 하는 가비지 컬렉션 장치 및 그 방법에 관한 것이다.The present invention relates to a garbage collection apparatus and a method thereof, and more particularly, to a garbage collection apparatus and method for ensuring a real-time by reducing the delay time by the garbage collection in the embedded environment.

Java 플랫폼 중 J2ME는 임베디드 환경을 위한 자바 기술로서, 스마트폰, 핸드헬드 디바이스, PDA, 스크린폰, 셋탑박스, 넷 TV와 같이 네트워크로 연결된 임베디드 혹은 모바일 기기에서 사용되며, 타겟에 따라 다시 CLDC(Connected Limited Device Configuration)와 CDC(Connected Device Configuration) 플랫폼으로 구분된다. J2ME is a Java technology for embedded environment. It is used in networked embedded or mobile devices such as smart phones, handheld devices, PDAs, screen phones, set-top boxes, and net TVs. It is divided into Limited Device Configuration (CDC) and Connected Device Configuration (CDC) platforms.

CLDC 플랫폼은 휴대폰이나 PDA와 같이 메모리나 CPU 성능이 극히 제한적인 타겟에 탑재되어 사용되며 CDC 플랫폼은 홈네트워크, 텔레매틱스, 셋탑박스 등 좀 더 확장된 리소스와 성능을 갖춘 임베디드 시스템에서 주로 사용된다.The CLDC platform is used on targets with extremely limited memory or CPU capabilities, such as mobile phones and PDAs, and the CDC platform is mainly used in embedded systems with more extended resources and capabilities such as home networks, telematics and set-top boxes.

가비지 콜렉터는 일반적으로 객체의 레퍼런스를 세는 방법(Reference Counting Garbage Collector)과 루트셋으로부터 도달 가능 여부를 마크한 후 한꺼번에 가비지를 회수하는 방법(Mark & Sweep), 힙 메모리 공간을 두 개로 분할한 후 한쪽의 살아남은 객체를 다른 쪽으로 복사하는 방법(Semi-Space Copying Collector) 등을 사용한다.The Garbage Collector typically uses the Reference Counting Garbage Collector to mark objects as reachable from the rootset, and reclaims them all at once (Mark & Sweep). Use a semi-space copying collector to copy the surviving object to another.

Java에서 동적인 메모리 할당이나 가비지 컬렉션은 기기의 성능에 결정적인 영향을 미친다. 특히 임베디드 환경에서는 여러가지 문제가 있다. 첫째, 대부분의 임베디드 디바이스는 메모리 용량이 작다. 둘째, 배터리로 동작되는 시스템에서는 전력 소비가 중요한 최적화 파라미터이다. 셋째, 임베디드 환경에서의 Java 가상 머신은 많은 네이티브 클래스가 지원하는 일반적인 시스템만큼 성능이 우수하지 않다. 임베디드 Java 가상 머신이 제한된 메모리의 임베디드 시스템에서 오랜 시간동안 동작되도록 설계됨에 따라 Java 객체를 생성하고 관리하는 것이 중요하다. In Java, dynamic memory allocation or garbage collection has a critical impact on device performance. Especially in the embedded environment, there are various problems. First, most embedded devices have a small memory capacity. Second, power consumption is an important optimization parameter in battery-operated systems. Third, the Java virtual machine in the embedded environment is not as good as the general system supported by many native classes. As the embedded Java virtual machine is designed to run for a long time in an embedded system with limited memory, it is important to create and manage Java objects.

본 발명이 이루고자 하는 기술적 과제는, 임베디드 환경에서 가비지 컬렉션에 의한 시간 지연을 최소화하고 메모리를 최대한 효율적으로 사용할 수 있도록 하는 가비지 컬렉션 장치 및 그 방법을 제공하는 데 있다.It is an object of the present invention to provide a garbage collection device and a method for minimizing time delay caused by garbage collection in an embedded environment and using a memory as efficiently as possible.

상기의 기술적 과제를 달성하기 위한, 본 발명에 따른 가비지 컬렉션 장치의 일 실시예는, 메모리를 제1영역 및 제2영역으로 구성되는 젊은 세대 영역 및 소정 개수의 블록으로 구성되는 늙은 세대 영역으로 분할하는 메모리 관리부; 및 상기 젊은 세대에 대해서는 상기 제1영역 및 상기 제2영역에 대해 가비지 컬렉션을 번갈아가며 수행하고, 상기 늙은 세대 영역에 대해서는 소정 개수의 블록을 포함하는 프레임 단위로 가비지 컬렉션을 수행하는 가비지 컬렉터;를 포함한다. According to one embodiment of the garbage collection apparatus according to the present invention, the memory is divided into a young generation area consisting of a first area and a second area and an old generation area consisting of a predetermined number of blocks. A memory manager; And a garbage collector configured to alternate garbage collection for the first and second regions for the young generation, and to perform garbage collection on a frame-by-frame basis for the old generation region. Include.

상기의 기술적 과제를 달성하기 위한, 본 발명에 따른 가비지 컬렉션 방법의 일 실시예는, (a) 메모리를 제1영역 및 제2영역으로 구성되는 젊은 세대 영역 및 소정 개수의 블록으로 구성되는 늙은 세대 영역으로 분할하는 단계; 및 (b) 상기 젊은 세대에 대해서는 상기 제1영역 및 상기 제2영역에 대해 가비지 컬렉션을 번갈아가며 수행하고, 상기 늙은 세대 영역에 대해서는 소정 개수의 블록을 포함하는 프레임 단위로 가비지 컬렉션을 수행하는 단계;포함한다.In order to achieve the above technical problem, an embodiment of the garbage collection method according to the present invention includes (a) a young generation area including a first area and a second area, and an old generation consisting of a predetermined number of blocks. Dividing into regions; And (b) alternately performing garbage collection on the first and second regions for the young generation, and performing garbage collection on a frame basis including a predetermined number of blocks for the old generation region. It includes.

이하에서, 첨부된 도면들을 참조하여 본 발명에 따른 가비지 컬렉션 장치 및 그 방법에 대해 상세히 설명한다.Hereinafter, a garbage collection apparatus and a method thereof according to the present invention will be described in detail with reference to the accompanying drawings.

도 1은 자바 가상 머신을 통해 메모리 관리 및 가비지 컬렉션을 수행하는 시스템의 일 실시예를 도시한 도면이다.1 is a diagram illustrating an embodiment of a system for performing memory management and garbage collection through a Java virtual machine.

자바 가상 머신(100)에서 자바 프로그램으로부터 메모리 할당 요구를 받으면 메모리 관리기(110)는 자신이 관리하고 있는 힙(heap)으로부터 요구받은 메모리(130)를 할당하여 응용 프로그램에게 넘겨주고, 메모리 여유 공간이 없으면 가비지 콜렉터(120)를 가동시켜 필요한 메모리를 확보한다. 메모리 관리기(110)와 가비지 콜렉터(120)는 따로 분리될 수 없으며, 가비지 컬렉터(120)의 기법에 따라 메모리 관리기(110)가 가비지 콜렉터(120)에 의존한다. When the Java virtual machine 100 receives a memory allocation request from a Java program, the memory manager 110 allocates the required memory 130 from the heap managed by the Java program to the application and hands it over to an application program. If not, run the garbage collector 120 to secure the necessary memory. The memory manager 110 and the garbage collector 120 cannot be separated separately, and the memory manager 110 depends on the garbage collector 120 according to the technique of the garbage collector 120.

도 2는 세대 가비지 콜렉터의 동작 방법의 일 실시예를 도시한 도면이다.2 is a diagram illustrating an embodiment of a method of operating a generation garbage collector.

도 2에 도시된 세대 기반 가비지 컬렉터는 새로운 객체를 젊은 세대에서 할당받는다. 젊은 세대에 여유 공간이 없으면 젊은 세대의 컬렉터를 가동하고, 컬렉터 기동 후 젊은 세대에 살아남은 객체를 성숙 공간에 복사하여 메모리 공간을 확 보한다. 만일 성숙 공간이 모두 차서 살아남은 객체를 복사할 수 없는 상황이 발생하면 늙은 세대의 가비지 컬렉터를 가동한다. The generation-based garbage collector shown in FIG. 2 is assigned a new object in the young generation. If there is no free space in the young generation, start the collector of the young generation, and secure memory space by copying objects surviving the young generation to the mature space after the collector startup. If a situation arises in which the mature space is full and the surviving object cannot be copied, run the old generation garbage collector.

도 3은 본 발명에 따른 가비지 컬렉션 장치의 일 실시예의 구성을 도시한 도면이다.3 is a diagram illustrating a configuration of an embodiment of a garbage collection apparatus according to the present invention.

도 3을 참조하면, 가비지 컬렉션 장치는 메모리(300), 메모리 관리부(310) 및 가비지 컬렉터(320)로 구성된다.Referring to FIG. 3, the garbage collection apparatus includes a memory 300, a memory manager 310, and a garbage collector 320.

메모리 관리부(310)는 메모리 힙을 젊은 세대 영역 및 늙은 세대 영역으로 나눈다. 또한 메모리 관리부(310)는 젊은 세대 영역를 다시 두 부분으로 분할하고, 늙은 세대 영역은 소정 개수의 블록으로 분할한다.The memory manager 310 divides the memory heap into a young generation area and an old generation area. In addition, the memory manager 310 divides the young generation area into two parts and the old generation area into a predetermined number of blocks.

가비지 컬렉터(320)는 젊은 세대 영역에는 세미스페이스 복사 컬렉터(322)를 적용하고, 늙은 세대 영역에는 복사 컬렉터(324)를 적용한다. The garbage collector 320 applies the semi-space copy collector 322 to the young generation area and the copy collector 324 to the old generation area.

세미스페이스 복사 컬렉터(322)는 젊은 세대 영역의 두 영역, 즉 제1영역 및 제2영역에 대해 번갈아 가며 가비지 컬렉션을 수행하되, 제1영역에 대한 가비지 컬렉션이 수행되는 경우 살아남은 객체를 제2영역으로 복사하고, 제2영역에 대한 가비지 컬렉션이 수행되는 경우 살아남은 객체를 상기 제1영역으로 복사한다. The semispace copy collector 322 alternately performs garbage collection for two areas of the young generation area, that is, the first area and the second area, and when the garbage collection is performed for the first area, the surviving object is stored in the second area. If garbage collection is performed for the second region, the surviving object is copied to the first region.

늙은 세대에서의 복사 컬렉터(324)는 늙은 세대 영역의 소정 개수의 블록들로 구성된 프레임 단위로 가비지 컬렉션을 수행한 후 살아남은 객체를 이전 가비지 컬렉션이 수행되었던 프레임(예약 프레임)으로 복사한다.The copy collector 324 in the old generation performs garbage collection in a frame unit composed of a predetermined number of blocks of the old generation area, and then copies the surviving object into a frame (reserved frame) in which the previous garbage collection was performed.

늙은 세대 영역의 각 블록은 상기 각 블록내의 객체들이 타 객체들에 의해 참조여부를 나타내는 참조 비트맵을 포함하고, 가비지 컬렉터는 상기 참조 비트맵 을 기초로 루트 셋으로부터 도달가능하지 않은 객체들 중 타 객체로부터 참조되지 않은 객체를 추적하여 가비지로 판단한다. 참조 비트맵을 이용한 가비지 판단 및 추적에 대해서는 도 7 및 도 8을 참조하여 상세히 설명한다.Each block of the old generation region includes a reference bitmap that indicates whether or not the objects in each block are referenced by other objects, and the garbage collector is based on the reference bitmap. Objects not referenced from an object are tracked and determined to be garbage. Garbage determination and tracking using the reference bitmap will be described in detail with reference to FIGS. 7 and 8.

도 4는 본 발명에 따른 메모리의 힙 구조의 일 실시예를 도시한 도면이다.4 is a diagram illustrating an embodiment of a heap structure of a memory according to the present invention.

도 4를 참조하면, 힙(400)은 젊은 세대 영역(410) 및 늙은 세대 영역(420) 둘로 나뉜다. 젊은 세대의 영역(410)은 늙은 세대의 영역(420)에 비해 그 크기가 작으므로 가비지 컬렉션에 의한 시간 지연은 실시간성을 충분히 만족할 수 있을 만큼 작다.Referring to FIG. 4, the heap 400 is divided into a young generation area 410 and an old generation area 420. Since the area 410 of the young generation is smaller than the area 420 of the old generation, the time delay caused by garbage collection is small enough to satisfy the real-time.

젊은 세대 영역(410)는 fromSpace(430)와 toSpace(440)로 공간이 분할된다. fromSpace(430)는 가비지 컬렉션의 대상이 되는 영역이고, toSpace(440)는 살아남은 객체가 복사되는 영역이다. The young generation area 410 is divided into spaces fromSpace 430 and toSpace 440. fromSpace 430 is an area for garbage collection, and toSpace 440 is an area for surviving objects to be copied.

객체를 다른 영역으로 옮길 때에는 그 객체의 자식 객체들도 한꺼번에 옮겨 주어야 한다. 각 객체의 자식 객체까지 모두 옮겨졌는지를 구분하기 위하여 각 객체들에게 색상을 입힌다. 예를 들어, 흰색은 해당 객체가 아직 탐색되지 않았음을 의미하고, 회색은 해당 객체가 탐색되었으나 자식 객체까지 모두 탐색되지 않았음을 의미하고, 검은색은 자식 객체까지 모두 탐색되어 완전히 복사되었음을 의미한다.When you move an object to another area, you must move its children as well. Each object is colored to distinguish whether it has been moved to each child object. For example, white means that the object has not been explored yet, gray means that the object has been explored but not all of its child objects, and black means that all of the child objects have been explored and copied completely. do.

도 5는 도 4의 힙 구조 중 늙은 세대의 구조를 도시한 도면이다.FIG. 5 is a diagram illustrating an old generation structure of the heap structure of FIG. 4.

도 5를 참조하면, 늙은 세대의 힙은 블록단위(502,504,512,514,522,524,532,534)로 분할되고 가비지 컬렉션은 프레임 (500,510,420,530)단위로 수행된다. 구체적으로, 늙은 세대 영역은 균등한 크기의 블록 단위로 분할되고 이 블록들은 이중 연결 리스트로 연결된다. 각 블록은 객체 할당과 가비지 컬렉션의 최소 단위이다. 프레임은 블록들이 몇 개 묶여서 형성되며, 이 블록들을 몇 개 묶어서 프레임을 형성하는데, 프레임 순서대로 가비지 컬렉션의 대상 프레임이 된다.Referring to FIG. 5, the old generation heap is divided into block units 502, 504, 512, 514, 522, 524, 532, and 534 and garbage collection is performed in units of frames 500, 510, 420, and 530. Specifically, the old generation area is divided into equally sized blocks and these blocks are connected by a double linked list. Each block is the smallest unit of object allocation and garbage collection. A frame is formed by grouping several blocks together to form a frame, which becomes the target frame of garbage collection in frame order.

프레임 중 한 프레임은 추가적으로 예약되어, 컬렉션 수행시 객체들이 복사되는 공간으로 사용된다. 가비지 컬렉션 대상으로 선정되는 프레임은 객체 할당이 오래된 프레임이다. 객체 할당이 오래된 프레임이 가비지 컬렉션 대상인 이유는, 객체가 생성된 초기에 가비지로 회수되지 않고 살아남은 객체는 오래도록 살아남을 인자를 갖고 있는 세대이기 때문에 이 객체가 사망하기 위한 충분한 시간을 제공해 줌으로써 가비지 회수율을 높이기 위함이다.One frame of the frame is additionally reserved and used as a space where objects are copied when the collection is performed. Frames selected for garbage collection are frames with a long allocation of objects. Frames with outdated object allocations are subject to garbage collection because they are not garbage collected at the beginning of their creation, and the surviving objects are generations that have long-lasting arguments, thus providing enough garbage recovery time for these objects to die. To increase.

도 6은 본 발명에 따라 프레임별로 가비지 컬렉션이 수행되는 모습을 도시한 도면이다.6 is a diagram illustrating garbage collection performed for each frame according to the present invention.

가비지 컬렉터는 한 번 동작할 때 전체 힙이 아닌 특정 대상 프레임에서만 가비지 컬렉션을 수행한 후 다음 대상 프레임으로 이동한다. 가비지 컬렉터는 제1프레임(600)에 대해 첫번째 가비지 컬렉션을 수행한 후, 제2프레임(610)에 대해 두 번째 가비지 컬렉션을 수행한다. 이와 같이 순차적으로 가비지 컬렉터는 제3프레임(620) 및 제4프레임(630)에 대해 각각 가비지 컬렉션을 수행한다. When running once, the garbage collector performs garbage collection only on specific target frames, not the entire heap, and then moves to the next target frame. The garbage collector performs a first garbage collection on the first frame 600, and then performs a second garbage collection on the second frame 610. As described above, the garbage collector sequentially performs garbage collection on the third frame 620 and the fourth frame 630, respectively.

늙은 세대의 힙에는 예약 프레임(640)이 존재하며, 이 예약 프레임에는 가비지 컬렉션 후 살아남은 객체가 복사된다. 소정 프레임에 대한 가비지 컬렉션이 수 행되고 나면, 가비지 컬렉션이 수행된 그 프레임이 예약 프레임(640)이 된다. 예약 프레임(640) 중 공간이 비어 있는 블록은 자유 공간으로 분리되어 새로운 객체가 복사되는 공간으로 활용된다.There is a reservation frame 640 in the old generation heap, in which objects that survive after garbage collection are copied. After garbage collection is performed for a given frame, the frame on which garbage collection is performed becomes the reserved frame 640. Blocks having empty space in the reserved frame 640 are divided into free space and used as a space for copying a new object.

객체가 가비지인지 아닌지는 루트 셋으로부터의 그 객체에 도달 가능한지로 판단할 수 있다. 그러나 루트 셋으로부터 도달가능하지 않더라도 다른 객체로부터 참조가 되고 있는 객체는 가비지로 간주되어서는 안된다. Whether an object is garbage or not can be determined by whether the object from the root set is reachable. However, an object referenced by another object, even if it is not reachable from the root set, should not be considered garbage.

다른 객체로부터 참조되는 객체가 가비지가 되는 것을 막기 위해서는 힙 상에 존재하는 모든 객체에 대해서 다른 객체로부터의 참조 여부를 추적하여야 한다. 그러나 종래의 방법은 시간이 많이 소요되므로 실시간성을 요구하는 임베디드 환경에서는 적합하지 않다.To prevent objects referenced from other objects from becoming garbage, all objects on the heap must be tracked for references from other objects. However, the conventional method is time consuming and is not suitable in an embedded environment requiring real time.

도 7은 본 발명에 따른 1차 필터를 이용한 쓰기 방지 처리 방법의 일 실시예를 도시한 도면이다.7 is a diagram illustrating an embodiment of a write protection processing method using a primary filter according to the present invention.

다른 객체로부터 참조되는 객체가 가비지가 되는 문제(즉, 쓰기 장벽 문제)는 크게 두 가지 상황에서 발생한다. 첫 번째 경우는 늙은 세대에서 젊은 세대에 있는 객체를 참조하는 경우 그 객체가 가비지 컬렉션의 대상이 되는 경우이고, 두 번째 경우는 늙은 세대에서 가비지 컬렉션을 수행할 때 가비지 컬렉션 대상이 되고 있는 프레임의 객체를 다른 프레임의 블록에서 참조하는 경우이다. The problem that an object referenced from another object becomes garbage (that is, a write barrier problem) arises in two situations. The first case refers to an object in the young generation from the old generation, and that object is the object of garbage collection. In the second case, an object in the frame that is garbage collected when garbage collection is performed in the old generation. This is the case when is referenced in a block of another frame.

도 7을 참조하면, 늙은 세대의 소정 블록(710)의 객체 A(712)가 젊은 세대(702)의 객체 C(702)를 참조하는 것이 첫 번째 경우에 해당되고, 늙은 세대의 소정블록(710)의 객체 B(714)가 다른 블록(740)의 객체 D(742)를 참조하는 것이 두 번 째 경우에 해당된다.Referring to FIG. 7, it is the first case that the object A 712 of the predetermined block 710 of the old generation refers to the object C 702 of the young generation 702, and the predetermined block 710 of the old generation. This is the second case in which object B 714 of) refers to object D 742 of another block 740.

힙의 각 블록(710,720,730,740)의 헤더는 참조 비트맵(750)을 포함하고, 참조 비트맵(750)은 위치한 해당 블록에 다른 세대 혹은 동일 세대의 다른 블록으로부터 참조되는 객체가 있는지 여부를 나타낸다. 예를 들어, 참조 비트맵(750)에서 1은 참조되는 객체가 있음을 의미하고 0은 참조되는 객체가 없음을 의미한다. 따라서 참조 비트맵을 이용하여 추적해야 할 블록의 수를 걸러낼 수 있다.The header of each block 710, 720, 730, 740 of the heap includes a reference bitmap 750, and the reference bitmap 750 indicates whether there is an object referenced from another generation or another block of the same generation in the corresponding block. For example, in the reference bitmap 750, 1 means that there is an object referenced and 0 means that no object is referenced. Therefore, the reference bitmap can be used to filter the number of blocks to be traced.

참조 비트맵(750)을 이용한 1차 필터에 의해 추적해야 할 블록들이 결정되더라도 하나의 블록에는 많은 수의 객체가 존재할 수 있으며, 이 객체들을 모두 추적하는 것은 역시 상당한 시간이 소요된다. 따라서 2차 필터를 사용할 필요가 있다.Although the blocks to be tracked are determined by the primary filter using the reference bitmap 750, a large number of objects may exist in one block, and tracking all of these objects also takes considerable time. Therefore, it is necessary to use a second order filter.

도 8은 본 발명에 따른 2차 필터를 이용한 쓰기 방지 처리 방법의 일 실시예를 도시한 도면이다.8 is a diagram illustrating an embodiment of a write protection processing method using a secondary filter according to the present invention.

각 블록(800)을 논리적으로 페이지(810) 단위로 분할한 후 각 페이지마다 참조상태를 저장하고, 그 저장된 참조상태에 따라 객체 추적을 달리할 수 있도록 한다.After dividing each block 800 logically into units of pages 810, the reference state is stored for each page, and the object tracking can be changed according to the stored reference state.

도 8을 참조하면, 각 페이지의 참조 상태 정보는 CLEAN, DIRTY, SUMMARIZE 중의 하나이다. CLEAN 상태는 해당 페이지에서 다른 블록으로의 참조가 없음을 의미하고, DIRTY 상태는 해당 페이지에서 다른 블록으로 참조하는 객체 수가 5개 이상임을 의미하고, SUMMARIZE 상태는 해당 페이지에서 다른 블록으로 참조하는 객체 수가 4개 이하임을 의미한다. Referring to FIG. 8, reference state information of each page is one of CLEAN, DIRTY, and SUMMARIZE. The CLEAN state means that there are no references to other blocks on the page, the DIRTY state means that there are at least five objects referenced by other blocks on the page, and the SUMMARIZE state means that the number of objects referenced by other blocks on the page It means four or less.

참조 상태가 CLEAN이면 그 페이지를 추적하지 않아도 되고, DIRTY이면 해당 페이지 내의 모든 객체를 추적하여야 하고, SUMMARIZE이면 참조하는 객체의 주소를 별도의 요약 테이블(820)에 저장하여 빠르게 객체를 가져올 수 있도록 한다. 이 요약 테이블(820)을 이용하여 쉽고 빠르게 다른 블록의 객체를 참조하는 객체에 대한 주소를 얻어올 수 있다.If the reference status is CLEAN, the page does not need to be tracked. If it is DIRTY, all objects in the page should be tracked. If it is SUMMARIZE, the address of the referenced object is stored in a separate summary table 820 so that the objects can be retrieved quickly. . The summary table 820 can be used to quickly and easily obtain an address for an object referencing an object in another block.

도 9는 본 발명에 따른 가비지 컬렉션 방법의 일 실시예의 흐름을 도시한 흐름도이다.9 is a flow chart showing the flow of one embodiment of a garbage collection method according to the present invention.

도 9를 참조하면, 먼저 메모리 힙을 두 영역으로 구성된 젊은 세대 영역 및 소정 개수의 블록으로 구성된 늙은 세대 영역으로 분할한다(S900). 가비지 컬렉터는 분할된 메모리에서 젊은 세대 영역에 대해서는 세미 스페이스 복사 컬레션을 수행하고, 늙은 세대 영역에 대해서는 소정 개수의 블록으로 구성되는 프레임 단위로 복사 컬렉션을 수행한다(S910). 이하, 도 10 및 도 11을 참조하여 가비지 컬렉션 방법에 대해 상세히 살펴본다Referring to FIG. 9, a memory heap is first divided into a young generation area consisting of two areas and an old generation area consisting of a predetermined number of blocks (S900). The garbage collector performs a semi-space copy collection on the young generation area in the divided memory, and performs a copy collection on a frame basis composed of a predetermined number of blocks on the old generation area (S910). Hereinafter, a garbage collection method will be described in detail with reference to FIGS. 10 and 11.

도 10은 본 발명에 따른 젊은 세대의 힙에서의 가비지 컬렉션 방법을 도시한 흐름도이다.10 is a flowchart illustrating a garbage collection method in a heap of a young generation according to the present invention.

도 10을 참조하면, 가비지 컬렉터는 먼저 스택을 포함한 루트 셋을 검사한다(S1000). 가비지 컬렉터는 젊은 세대 힙의 fromSpace 공간에 있는 객체들이 루트 셋으로부터 도달 가능한지 확인한다. 루트 셋으로부터 도달가능하지 않은 객체들은 가비지로 판단되어 바로 회수되고 회수되지 않고 살아남은 객체들은 toSpace로 복사된다(S1005).Referring to FIG. 10, the garbage collector first checks the root set including the stack (S1000). The garbage collector verifies that objects in the fromSpace space of the young generation heap are reachable from the root set. Objects that are not reachable from the root set are determined to be garbage and are immediately recovered and the objects that survived without being recovered are copied to toSpace (S1005).

toSpace로 복사된 객체는 자식 객체까지 모두 탐색되지 않았으므로 도 3에서 설명한 회색으로 칠한다(S1010). 회색으로 칠해진 그 객체에 대해 자식 객체까지 모두 탐색되었는지 파악한다(S1015). 자식 객체까지 모두 탐색되지 않았다면, 자색 객체를 모두 루트 셋에 포함시킨다(S1020). 자식 객체까지 모두 탐색되었다면, 자식 객체까지 모두 탐색되었음을 나타내는 검은색을 그 객체에 칠한다(S1025). Since the object copied to toSpace has not been searched until all the child objects, the object is painted in gray as described with reference to FIG. 3 (S1010). It is determined whether all objects are searched for the object painted in gray (S1015). If all of the child objects are not searched, the purple objects are included in the root set (S1020). If all the objects have been searched for, the object is painted black to indicate that all of the objects have been searched (S1025).

모든 루트 셋의 탐색이 완료되었다면(S1030), fromSpace와 toSpace의 역할을 상호 바꾼다(S1035). 따라서 다음 가비지 컬렉션은 toSpace에서 수행하고 살아남은 객체는 fromSpace로 복사하는 과정을 거친 후 다시 양자의 역할이 바뀐다.If the search of all root sets is completed (S1030), the roles of fromSpace and toSpace are interchanged (S1035). Therefore, the next garbage collection is performed in toSpace, and the surviving object is copied to fromSpace, and then the roles of the two are reversed.

도 11은 본 발명에 따른 늙은 세대의 힙에서의 가비지 컬렉션 방법을 도시한 흐름도이다.11 is a flowchart illustrating a garbage collection method in an old generation heap according to the present invention.

도 11을 참조하면, 가비지 컬렉터는 먼저 가비지 컬렉션의 대상 프레임을 선정한다(S1100). 가비지 컬렉션의 대상 프레임은 위에서 살핀 바와 같이 프레임순서대로 순차적이다. 대상 프레임의 블록에 존재하는 객체들 중 루트 셋으로부터 도달 가능한 객체를 예약 프레임으로 복사한다(S1110). 복사가 완료되면 블록들의 나이를 재조정하고(S920), 해당 프레임을 비운다(S1130). Referring to FIG. 11, the garbage collector first selects a target frame of garbage collection (S1100). The target frames of the garbage collection are sequential in frame order, as noted above. The objects reachable from the root set among the objects existing in the block of the target frame are copied to the reserved frame (S1110). When the copy is completed, the age of the blocks is readjusted (S920) and the corresponding frame is emptied (S1130).

본 발명은 또한 컴퓨터로 읽을 수 있는 기록매체에 컴퓨터가 읽을 수 있는 코드로서 구현하는 것이 가능하다. 컴퓨터가 읽을 수 있는 기록매체는 컴퓨터 시스템에 의하여 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록장치를 포함한다. 컴퓨터가 읽을 수 있는 기록매체의 예로는 ROM, RAM, CD-ROM, 자기 테이프, 플로피디스크, 광데이터 저장장치 등이 있으며, 또한 캐리어 웨이브(예를 들어 인터넷을 통한 전송)의 형태로 구현되는 것도 포함한다. 또한 컴퓨터가 읽을 수 있는 기록매 체는 네트워크로 연결된 컴퓨터 시스템에 분산되어 분산방식으로 컴퓨터가 읽을 수 있는 코드가 저장되고 실행될 수 있다.The invention can also be embodied as computer readable code on a computer readable recording medium. The computer-readable recording medium includes all kinds of recording devices in which data that can be read by a computer system is stored. Examples of computer-readable recording media include ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage, and the like, and may also be implemented in the form of a carrier wave (for example, transmission over the Internet). Include. The computer readable recording medium can also be distributed over network coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.

이제까지 본 발명에 대하여 그 바람직한 실시예들을 중심으로 살펴보았다. 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자는 본 발명이 본 발명의 본질적인 특성에서 벗어나지 않는 범위에서 변형된 형태로 구현될 수 있음을 이해할 수 있을 것이다. 그러므로 개시된 실시예들은 한정적인 관점이 아니라 설명적인 관점에서 고려되어야 한다. 본 발명의 범위는 전술한 설명이 아니라 특허청구범위에 나타나 있으며, 그와 동등한 범위 내에 있는 모든 차이점은 본 발명에 포함된 것으로 해석되어야 할 것이다.So far I looked at the center of the preferred embodiment for the present invention. Those skilled in the art will appreciate that the present invention can be implemented in a modified form without departing from the essential features of the present invention. Therefore, the disclosed embodiments should be considered in descriptive sense only and not for purposes of limitation. The scope of the present invention is shown in the claims rather than the foregoing description, and all differences within the scope will be construed as being included in the present invention.

본 발명에 따른 가비지 컬렉터는 가비지 컬렉션에 의한 지연 시간을 최소화하므로 실시간성을 요구하는 임베디드 환경에 적합하다. 또한 메모리가 제한된 임베디드 환경에서 메모리를 최대한 효율적으로 사용할 수 있고 자바 응용을 동작시키기 위한 자바 가상 머신에 탑재되어 다양한 임베디드 기기에서 자바 응용을 빠르게 동작시킬 수 있다. The garbage collector according to the present invention is suitable for an embedded environment that requires real-time because it minimizes the delay time caused by garbage collection. In addition, it is possible to use the memory as efficiently as possible in the memory-limited embedded environment, and it is installed in the Java virtual machine for running Java applications so that Java applications can be quickly run on various embedded devices.

Claims (17)

삭제delete 삭제delete 삭제delete 삭제delete 메모리를 제1영역 및 제2영역으로 구성되는 젊은 세대 영역 및 소정 개수의 블록으로 구성되는 늙은 세대 영역으로 분할하는 메모리 관리부; 및 A memory manager for dividing the memory into a young generation area consisting of a first area and a second area and an old generation area consisting of a predetermined number of blocks; And 상기 젊은 세대에 대해서는 상기 제1영역 및 상기 제2영역에 대해 가비지 컬렉션을 번갈아가며 수행하고, 상기 늙은 세대 영역에 대해서는 소정 개수의 블록을 포함하는 프레임 단위로 가비지 컬렉션을 수행하는 가비지 컬렉터;를 포함하고 A garbage collector configured to alternate garbage collection with respect to the first area and the second area for the young generation, and to perform garbage collection on a frame-by-frame basis with a predetermined number of blocks for the old generation area. and 상기 가비지 컬렉터는, 상기 젊은 세대 영역의 객체를 루트 셋으로부터 도달 가능한지 탐색되지 않은 객체, 상기 루트 셋으로부터 도달 가능하나 자식객체까지 탐색되지 않은 객체, 상기 루트 셋으로부터 도달가능하나 자식 객체까지 탐색된 객체로 구분하고,The garbage collector is an object that is reachable from the root set, an object that is reachable from the root set, an object reachable from the root set but not searched to a child object, an object reachable from the root set but searched to a child object. Separated by, 상기 가비지 컬렉터는, 상기 젊은 세대 영역의 객체를 색으로 구분하는 것을 특징으로 하는 가비지 컬렉션 장치 The garbage collector is a garbage collection device, characterized in that to color-code the objects of the young generation area 삭제delete 삭제delete 삭제delete 삭제delete 메모리를 제1영역 및 제2영역으로 구성되는 젊은 세대 영역 및 소정개수의 블록으로 구성되는 늙은 세대 영역으로 분할하는 메모리 관리부; 및 A memory manager for dividing the memory into a young generation area comprising a first area and a second area and an old generation area consisting of a predetermined number of blocks; And 상기 젊은 세대에 대해서는 상기 제1영역 및 상기 제2영역에 대해 가비지 컬렉션을 번갈아 가며 수행하고, 상기 늙은 세대 영역에 대해서는 소정 개수의 블록을 포함하는 프레임 단위로 가비지 컬렉션을 수행하는 가비지 컬렉터;를 포함하고, And a garbage collector configured to alternate garbage collection with respect to the first and second regions for the young generation, and to perform garbage collection on a frame-by-frame basis with a predetermined number of blocks for the old generation region. and, 상기 가비지 컬렉터는, 상기 늙은 세대 영역의 각 블록을 소정 페이지 단위로 분할하고, 상기 페이지 단위마다 타 객체에 의한 참조여부를 나타내는 참조 비트맵을 포함하고, The garbage collector divides each block of the old generation area into predetermined page units, and includes a reference bitmap indicating whether reference is made by another object for each page unit. 상기 가비지 컬렉터는, 상기 참조 비트맵을 기초로 루트 셋으로부터 도달 가능하지 않은 객체들 중 타 객체로부터 참조되지 않은 객체를 추적하여 가비지로 판단하는 것을 특징으로 하는 가비지 컬렉션 장치The garbage collector, based on the reference bitmap, the garbage collection device to determine the garbage by tracking an object not referenced from another object among the objects that are not reachable from the root set 제10항에 있어서, 상기 참조 비트맵은 소정 페이지가 타 객체로부터 참조되지 않은 상태, 소정 개수 이상 또는 이하의 객체로부터 참조되는 상태를 나타내는 것을 특징으로 하는 가비지 컬렉션 장치The garbage collection apparatus of claim 10, wherein the reference bitmap indicates a state in which a predetermined page is not referenced from another object, or a state in which a predetermined page is referenced from a predetermined number or more or less. 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete (a) 메모리를 제1 영역 및 제2영역으로 구성되는 젊은 세대 영역 및 소정개수의 블록으로 구성되는 늙은 세대 영역으로 분할하는 단계; 및 (a) dividing the memory into a young generation area consisting of a first area and a second area and an old generation area consisting of a predetermined number of blocks; And (b) 상기 젊은 세대에 대해서는 상기 제1영역 및 상기 제2영역에 대해 가비지 컬렉션을 번갈아가며 수행하고, 상기 늙은 세대 영역에 대해서는 소정 개수의 블록을 포함하는 프레임 단위로 가비지 컬렉션을 수행하는 단계;를 포함하고 (b) alternately performing garbage collection on the first area and the second area for the young generation, and performing garbage collection on a frame basis including a predetermined number of blocks for the old generation area; Including 상기 (b)단계는, 상기 늙은 세대 영역의 각 블록을 소정 페이지 단위로 분할하고, 상기 페이지 단위마다 타 객체에 의한 참조 여부를 나타내는 참조 비트맵을 기초로 루트 셋으로부터 도달 가능하지 않은 객체들 중 타 객체로부터 참조되지 않은 객체를 추적하여 가비지로 판단하는 단계;를 포함하는 것을 특징으로 하는 가비지 컬렉션 방법In step (b), each block of the old generation area is divided into predetermined page units, and among the objects that are not reachable from the root set based on a reference bitmap indicating whether or not a reference is made by another object for each page unit. Determining a garbage by tracking an object not referenced from another object;
KR1020050124056A 2005-11-01 2005-12-15 Garbage collection apparatus and method KR100753821B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US11/584,281 US20070100919A1 (en) 2005-11-01 2006-10-20 Garbage collection unit and method thereof

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR1020050103797 2005-11-01
KR20050103797 2005-11-01

Publications (2)

Publication Number Publication Date
KR20070047193A KR20070047193A (en) 2007-05-04
KR100753821B1 true KR100753821B1 (en) 2007-08-31

Family

ID=38272213

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020050124056A KR100753821B1 (en) 2005-11-01 2005-12-15 Garbage collection apparatus and method

Country Status (1)

Country Link
KR (1) KR100753821B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010033997A2 (en) * 2008-09-22 2010-03-25 Fiji Systems, Llc Hybrid fragmenting real time garbage collection

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101726361B1 (en) * 2015-04-14 2017-04-13 한양대학교 산학협력단 Method and apparatus for hybrid garbage collection

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999019802A2 (en) 1997-10-14 1999-04-22 Koninklijke Philips Electronics N.V. Space-limited marking structure for tracing garbage collectors
EP0940755A1 (en) 1998-03-06 1999-09-08 Sun Microsystems, Inc. Methods and apparatus for generational dynamic management of computer memory
US20040260732A1 (en) 2003-06-19 2004-12-23 Gerard Chauvel Embedded garbage collection
KR20050077602A (en) * 2004-01-28 2005-08-03 삼성전자주식회사 Method for adaptive garbage collection and device employing the method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999019802A2 (en) 1997-10-14 1999-04-22 Koninklijke Philips Electronics N.V. Space-limited marking structure for tracing garbage collectors
EP0940755A1 (en) 1998-03-06 1999-09-08 Sun Microsystems, Inc. Methods and apparatus for generational dynamic management of computer memory
US20040260732A1 (en) 2003-06-19 2004-12-23 Gerard Chauvel Embedded garbage collection
KR20050077602A (en) * 2004-01-28 2005-08-03 삼성전자주식회사 Method for adaptive garbage collection and device employing the method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2010033997A2 (en) * 2008-09-22 2010-03-25 Fiji Systems, Llc Hybrid fragmenting real time garbage collection
WO2010033997A3 (en) * 2008-09-22 2010-06-03 Fiji Systems, Llc Hybrid fragmenting real time garbage collection

Also Published As

Publication number Publication date
KR20070047193A (en) 2007-05-04

Similar Documents

Publication Publication Date Title
US20070100919A1 (en) Garbage collection unit and method thereof
US7111294B2 (en) Thread-specific heaps
US7707232B2 (en) Implementation for collecting unmanaged memory
US20110264870A1 (en) Using region status array to determine write barrier actions
CN103064639B (en) Date storage method and device
Du et al. The optimal-location query
US9448927B1 (en) System and methods for removing obsolete data in a distributed system of hybrid storage and compute nodes
US9218135B2 (en) Hierarchical allocation for file system storage device
US8423733B1 (en) Single-copy implicit sharing among clones
KR20180027328A (en) A cache management system and a method of managing data thereof
CN105718548A (en) System and method for scalable reference management in a deduplication based storage system
JP2001504971A (en) Memory management to compress data blocks
CN109271343A (en) A kind of data merging method and device applied in key assignments storage system
US8180838B2 (en) Efficiently managing modular data storage systems
US20080195681A1 (en) Method and system for garbage collection in a multitasking environment
KR100806115B1 (en) Design method of query classification component in multi-level dbms
US8447793B2 (en) Efficient remembered set for region-based garbage collectors
CN107870922B (en) Method, equipment and system for data deduplication
KR100907477B1 (en) Apparatus and method for managing index of data stored in flash memory
KR100753821B1 (en) Garbage collection apparatus and method
WO2024041376A1 (en) Distributed graph data processing system, method, apparatus and device, and storage medium
KR102354343B1 (en) Spatial indexing method and apparatus for blockchain-based geospatial data
CN110008178B (en) Distributed file system metadata organization method and device
CN112860628A (en) File system scale management method and system
CN108241640B (en) Distributed file storage method

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
G170 Publication of correction
FPAY Annual fee payment

Payment date: 20100802

Year of fee payment: 4

LAPS Lapse due to unpaid annual fee