KR100951845B1 - Apparatus and method for dynamically assigning heap memory capable of reducing cash miss - Google Patents
Apparatus and method for dynamically assigning heap memory capable of reducing cash miss Download PDFInfo
- Publication number
- KR100951845B1 KR100951845B1 KR1020070128996A KR20070128996A KR100951845B1 KR 100951845 B1 KR100951845 B1 KR 100951845B1 KR 1020070128996 A KR1020070128996 A KR 1020070128996A KR 20070128996 A KR20070128996 A KR 20070128996A KR 100951845 B1 KR100951845 B1 KR 100951845B1
- Authority
- KR
- South Korea
- Prior art keywords
- cache
- past
- miss
- cache line
- heap
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
Abstract
본 발명은 메모리의 동적 할당에 관한 것으로서, 캐시의 미스를 줄이기 위한 힙 메모리의 동적 할당 장치 및 방법에 관한 것이다.TECHNICAL FIELD The present invention relates to dynamic allocation of memory, and more particularly, to an apparatus and method for dynamically allocating heap memory to reduce a miss of a cache.
본 발명에 따른 힙 메모리 동적 할당 장치는, 캐시내의 각 캐시 라인에 대하여 과거 캐시 접근 정보 및 과거 캐시 미스 정보중 적어도 하나의 정보에 근거하여 캐시 미스 발생 확률을 계산하는 캐시 미스 예측부와, 어플리케이션 프로그램의 힙 메모리 할당 요청에 응답하여, 상기 캐시 미스 예측부에 의해 계산된 각 캐시 라인의 캐시 미스 발생 확률 정보에 근거하여 미사용 캐시 라인 블록을 할당하는 힙 할당부를 포함한다.The heap memory dynamic allocation device according to the present invention includes a cache miss predictor for calculating a cache miss occurrence probability for each cache line in a cache based on at least one of past cache access information and past cache miss information. And a heap allocator configured to allocate an unused cache line block based on cache miss occurrence probability information of each cache line calculated by the cache miss predictor in response to a heap memory allocation request of the cache memory.
캐시 미스(cache miss), 힙(heap), 메모리 할당(memory allocation) Cache miss, heap, memory allocation
Description
본 발명은 메모리의 동적 할당에 관한 것으로서, 캐시의 미스를 줄이기 위한 힙 메모리의 동적 할당 장치 및 방법에 관한 것이다.TECHNICAL FIELD The present invention relates to dynamic allocation of memory, and more particularly, to an apparatus and method for dynamically allocating heap memory to reduce a miss of a cache.
본 발명은 정보통신부 및 정보통신연구진흥원의 IT 성장동력기술개발 사업의 일환으로 수행하였다. [2007-S026-01, MPcore 플랫폼 기반 모바일 멀티미디어 SoC]The present invention was performed as part of the IT growth engine technology development project of the Ministry of Information and Communication and the Ministry of Information and Communication Research. [2007-S026-01, Mobile Multimedia SoC Based on MPcore Platform]
캐시는 프로그램 코드와 데이터를 프로세서에 가깝게 배치하여 빠른 속도의 접근이 가능하도록 만든 메모리이다. 캐시는 제한된 크기의 메모리로 가장 자주 사용되는 코드 또는 데이터를 저장하기 위해 여러 가지 기술들로 구현된다. 대표적인 기술이 세트-어소시어티브 (set-associative) 방식으로, 세트의 수를 증가시켜 충돌(conflict)에 의해 발생되는 미스를 효과적으로 줄일 수 있다. 하지만 세트 수를 늘리면 하드웨어 크기가 증가하고 에너지를 많이 소모하는 단점이 있다.A cache is a memory that places program code and data close to the processor for fast access. Caches are implemented with a variety of techniques to store the code or data most often used in a limited amount of memory. A representative technique is a set-associative manner, in which the number of sets can be increased to effectively reduce misses caused by conflicts. However, increasing the number of sets increases the hardware size and consumes a lot of energy.
앞서 언급한 바와 같이, 세트 개수가 적은 캐시는 충돌에 의한 캐시 미스가 자주 발생한다. 즉, 캐시의 사용 빈도가 적은 라인이 있음에도 불구하고 같은 라인을 빈번하게 사용함으로써 미스가 연속적으로 발생하는 경우가 있다. 예를 들어, 도 1에서와 같이 직접 매핑된(direct mapped) 8 라인 캐시를 사용하는 경우, 프로그램이 메모리 1, 9, 41 주소로 반복해서 접근한다면 캐시의 b 번 라인에서 계속해서 미스가 발생할 것이다. 이러한 상황을 예측해서 도 2와 같이 메모리 사용을 1, 10, 43 로 바꾸어주면 미스가 발생하지 않고 캐시를 효율적으로 사용할 수 있을 것이다.As mentioned above, cache misses due to collisions frequently occur in caches having a small number of sets. In other words, even though there are lines with less frequent use of the cache, misses may occur continuously by using the same line frequently. For example, using a direct mapped 8-line cache, as in Figure 1, if the program repeatedly accesses
본 발명의 목적은 캐시 미스를 줄일 수 있는 힙 메모리의 동적 할당 장치 및 방법을 제공하는 것이다.It is an object of the present invention to provide an apparatus and method for dynamically allocating heap memory that can reduce cache misses.
본 발명의 다른 목적은 캐시 미스 예측 정보를 이용하여 캐시 미스가 적게 일어나는 영역으로 힙 메모리를 할당하는 장치 및 방법을 제공하는 것이다.It is another object of the present invention to provide an apparatus and method for allocating heap memory to areas where cache misses occur less by using cache miss prediction information.
본 발명의 일 특징에 따른 힙 메모리 동적 할당 장치는, 캐시내의 각 캐시 라인에 대하여 과거 캐시 접근 정보 및 과거 캐시 미스 정보중 적어도 하나의 정보에 근거하여 캐시 미스 발생 확률을 계산하는 캐시 미스 예측부와, 어플리케이션 프로그램의 힙 메모리 할당 요청에 응답하여, 상기 캐시 미스 예측부에 의해 계산된 각 캐시 라인의 캐시 미스 발생 확률 정보에 근거하여 미사용 캐시 라인 블록을 할당하는 힙 할당부를 포함한다.According to an aspect of the present invention, there is provided a heap memory dynamic allocation apparatus comprising: a cache miss prediction unit configured to calculate a cache miss occurrence probability for each cache line in a cache based on at least one of past cache access information and past cache miss information; And a heap allocator configured to allocate an unused cache line block based on cache miss occurrence probability information of each cache line calculated by the cache miss predictor in response to a heap memory allocation request of an application program.
본 발명의 다른 특징에 따른 힙 메모리 동적 할당 방법은, 캐시내의 각 캐시 라인에 대하여 과거 캐시 접근 정보 및 과거 캐시 미스 정보중 적어도 하나의 정보에 근거하여 캐시 미스 발생 확률을 계산하는 단계와, 어플리케이션 프로그램의 힙 메모리 할당 요청을 수신하는 단계와, 상기 메모리 할당 요청에 응답하여, 상기 계산된 각 캐시 라인의 캐시 미스 발생 확률 정보에 근거하여 미사용 캐시 라인 블록을 할당하는 단계를 포함한다.According to another aspect of the present invention, a heap memory dynamic allocation method includes calculating a cache miss occurrence probability for each cache line in a cache based on at least one of past cache access information and past cache miss information. And receiving an unused cache line block based on the calculated cache miss occurrence probability information of each cache line in response to the memory allocation request.
본 발명에 따르면, 캐시 미스 예측 정보를 이용하여 캐시 미스가 적게 일어나는 영역으로 힙 메모리를 할당할 수 있으므로 세트를 늘리지 않고 작은 크기의 하드웨어로 효과적인 캐시를 구현할 수 있다. According to the present invention, since the heap memory can be allocated to a region where the cache miss occurs less by using the cache miss prediction information, an effective cache can be implemented with a small size of hardware without increasing the set.
이하에서는 본 발명을 첨부된 도면에 도시된 실시예들과 관련하여 예시적으로 상세히 설명하겠다. 그러나, 이하의 상세한 설명은 단지 예시적인 목적으로 제공되는 것이며 본 발명의 개념을 임의의 특정된 물리적 구성에 한정하는 것으로 해석되어서는 안 될 것이다.Hereinafter, with reference to the embodiments shown in the accompanying drawings, the present invention will be described in detail by way of example. However, the following detailed description is provided for illustrative purposes only and should not be construed as limiting the inventive concept to any particular physical configuration.
도 3은 본 발명의 일실시예에 따른 힙 메모리 동적 할당 장치(300)의 구성도를 도시한다. 도시된 바와 같이, 힙 메모리 할당 장치(300)는 캐시 미스 예측부(310)와 힙 할당부(320)를 포함한다.3 is a block diagram of a heap memory
캐시 미스 예측부(310)는 캐시(330)의 각 라인에 대하여 과거 캐시 접근(access) 정보 및 캐시 미스 정보중 적어도 하나의 정보에 근거하여 미래에 캐시 미스 발생 확률을 계산한다. 프로그램의 지역성(locality) 특성으로 인해 프로세서는 최근에 접근한 캐시 라인에 다시 접근할 가능성이 높다. 이러한 특성을 이용해서 과거 캐시 접근 정보 및/또는 미스 정보를 통해 장래 캐시 미스가 발생할 확률을 예측한다. 대안적으로, 캐시 미스 발생 확률은 프로세서에서의 과거 캐시 접근 정보와 과거 캐시 미스 정보에 적당한 가중치를 주어 계산될 수 있다. 본 발명은 다음 수식에 따라 캐시 미스 발생 확률을 계산한다.The cache miss prediction unit 310 calculates a cache miss occurrence probability in the future based on at least one of past cache access information and cache miss information for each line of the
(예측 알고리즘 1)(Predictive Algorithm 1)
Pai = i 번째 캐시 라인의 미스 발생 확률,Pa i = probability of miss in the i th cache line,
n = 관할 과거 사건 회수,n = past jurisdictions,
Wak = k번째 과거(최근부터)의 가중치,Wa k = weight from kth past (most recent),
Aik = k번째 과거에 i번째 캐시 라인이 접근(access)되었는지 유무에 따라 1 또는 0의 값을 가짐.A ik = 1 or 0 depending on whether the i th cache line has been accessed in the k th past.
(예측 알고리즘 2)(Predictive Algorithm 2)
Pbi = i 번째 캐시 라인의 미스 발생 확률,Pb i = probability of miss at the ith cache line,
n = 관할 과거 사건 회수,n = past jurisdictions,
Wmk = k번째 과거(최근부터)의 가중치,Wm k = weight from kth past (most recent),
Mik = k번째 과거에 i번째 캐시 라인이 미스되었는지 유무에 따라 1 또는 0의 값을 가짐.M ik = 1 or 0 depending on whether the i th cache line was missed in the k th past.
(예측 알고리즘 3) (Predictive Algorithm 3)
Pci는 i번째 캐시 라인의 미스 발생 확률,Pc i is the probability of miss on the i th cache line,
Wak = k번째 과거(최근부터)의 가중치,Wa k = weight from kth past (most recent),
Aik = k번째 과거에 i번째 캐시 라인이 접근(access)되었는지 유무에 따라 1 또는 0의 값을 가짐,A ik = 1 or 0 depending on whether the i th cache line has been accessed in the k th past,
Wmk = k번째 과거(최근부터)의 가중치,Wm k = weight from kth past (most recent),
Mik = k번째 과거에 i번째 캐시 라인이 미스되었는지 유무에 따라 1 또는 0의 값을 가짐.M ik = 1 or 0 depending on whether the i th cache line was missed in the k th past.
힙 할당부(320)는, 어플리케이션 프로그램(340)으로부터의 메모리 할당 요청에 응답하여, 캐시 미스 예측부(310)에서 계산된 캐시 라인의 미스 발생 확률에 따라 미스가 발생할 확률이 높은 캐시 라인을 가능한 배제하면서 연속된 구간의 메모리를 할당한다. 힙 할당부(320)는 소프트웨어로 구현가능하다. 본 발명에 따른 힙 할당 알고리즘은 다음과 같다.In response to the memory allocation request from the
(알고리즘 1)
힙의 미사용 구간 전체를 스캔하여 최소 미스 발생 확률을 가지는 구간을 찾는다. 특정 메모리 할당 요구에 대해 힙 전체를 캐시 라인 크기 단위로 스캔하면서 미스 발생 확률의 합이 최소가 되는 블록을 찾는다. 일실시예에서, 미스 발생 확률의 합이 0이면 스캔을 중단하고 그 블록을 할당한다.Scan the entire unused section of the heap to find the section with the lowest probability of miss. For a particular memory allocation request, the entire heap is scanned by cache line size to find the block with the lowest possible sum of misses. In one embodiment, if the sum of miss occurrence probabilities is zero, the scan is stopped and the block is allocated.
(알고리즘 2)Algorithm 2
알고리즘 1과 같이 힙의 미사용 구간을 스캔하되 미스 발생 확률의 합이 임계치 (threshold) 이하인 경우인 블록이 발견되면 더 이상 스캔하지 않고 그 블록을 할당한다. 이러한 방식에 의하면 힙 영역 전체를 스캔하면서 발생하는 오버헤드를 줄일 수 있다. 여기서, 임계치는 다음의 세 가지 방법으로 정해질 수 있다. As in
(1) 어플리케이션 프로그램에서 요청하는 메모리 할당 크기에 따라서 선형적으로 임계치를 정하는 방법이다. 즉, 메모리 할당의 크기가 커지면 임계치가 커진다. 다음 수식과 같이 표현할 수 있다. (1) The threshold is linearly determined according to the memory allocation size requested by the application program. In other words, as the size of memory allocation increases, the threshold increases. It can be expressed as the following formula.
임계치 = K * SizeThreshold = K * Size
위 수식에서 K는 상수값이고 Size는 할당할 메모리 크기이다.In the above formula, K is a constant value and Size is the memory size to allocate.
(2) 어플리케이션 프로그램으로부터 임계치를 수신하는 방법이다. 즉, 어플리케이션 프로그램에서 프로그래머가 판단해서 할당할 메모리가 자주 쓰인다면 임계치를 작은 값으로 정하고 자주 쓰이지 않는다면 임계치를 큰 값으로 정한다. (2) A method of receiving a threshold value from an application program. In other words, if the memory used by the programmer to allocate memory in the application program is used frequently, set the threshold to a small value.
(3) 어플리케이션으로부터 우선순위(priority-level) 값을 수신하는 방법이다. 즉, 프로그래머가 자주 쓰일 블록에 대해서는 우선 순위를 높게 준다. 우선 순위가 0~4 까지 5단계로 만들어진다고 하면, 다음 수식에 따라 임계치가 정해진다.(3) A method of receiving a priority-level value from an application. That is, programmers give higher priority to blocks that are used frequently. If the priority is made in five steps from 0 to 4, the threshold is determined according to the following equation.
임계치 = K[level] * SizeThreshold = K [level] * Size
K[0] < K[1] < K[2] < K[3] < K[4]K [0] <K [1] <K [2] <K [3] <K [4]
도 4는 본 발명에 따라 힙 메모리를 할당하는 예를 도시한다. 4 shows an example of allocating a heap memory in accordance with the present invention.
미스 예측 정보의 회색 원은 미스가 발생할 가능성이 높은 것을 나타낸다. 현재 프로그램에서의 힙 메모리 할당 요구 크기가 3 라인이라고 하자. 기존 스택 할당 방식은 캐시를 고려하지 않고 10, 11, 12 라인을 할당하여 사용한다. 반면 본 발명에서는 캐시 미스 발생 확률이 높은 10, 11을 빼고 14, 15, 16을 할당하여 사용한다.Gray circles of miss prediction information indicate that misses are more likely to occur. Suppose the heap memory allocation request size in the current program is three lines. The existing stack allocation method allocates 10, 11, and 12 lines without considering cache. On the other hand, in the present invention, 14, 15, and 16 are used after subtracting 10, 11 having a high probability of occurrence of a cache miss.
이상에서, 특정 실시예와 관련하여 본 발명을 설명하였으나, 본 발명은 전술한 실시예 및 첨부된 도면에 한정되는 것이 아니고, 본 발명의 기술적 사상을 벗어나지 않는 범위 내에서, 여러 치환, 변형 및 변경이 가능하다는 것이 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 있어 명백할 것이다. In the above, the present invention has been described in connection with specific embodiments, but the present invention is not limited to the above-described embodiments and the accompanying drawings, and various substitutions, modifications, and changes within the scope not departing from the technical spirit of the present invention. It will be apparent to one of ordinary skill in the art that this is possible.
도 1은 캐시 미스가 빈번히 발생하는 예를 도시한 도면.1 illustrates an example of frequent cache misses.
도 2는 캐시 미스가 방지되는 예를 도시한 도면.2 is a diagram illustrating an example in which a cache miss is prevented.
도 3은 본 발명의 일실시예에 따른 힙 메모리 동적 할당 장치의 구성도.3 is a block diagram of a heap memory dynamic allocation device according to an embodiment of the present invention.
도 4는 본 발명에 따라 힙 메모리를 할당하는 예를 도시한 도면.4 illustrates an example of allocating a heap memory in accordance with the present invention.
Claims (13)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020070128996A KR100951845B1 (en) | 2007-12-12 | 2007-12-12 | Apparatus and method for dynamically assigning heap memory capable of reducing cash miss |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
KR1020070128996A KR100951845B1 (en) | 2007-12-12 | 2007-12-12 | Apparatus and method for dynamically assigning heap memory capable of reducing cash miss |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20090061959A KR20090061959A (en) | 2009-06-17 |
KR100951845B1 true KR100951845B1 (en) | 2010-04-12 |
Family
ID=40991273
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020070128996A KR100951845B1 (en) | 2007-12-12 | 2007-12-12 | Apparatus and method for dynamically assigning heap memory capable of reducing cash miss |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR100951845B1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11860787B2 (en) * | 2021-09-30 | 2024-01-02 | Advanced Micro Devices, Inc. | Cache miss predictor |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020133672A1 (en) | 2001-03-13 | 2002-09-19 | Jan-Wiliem Van De Waerdt | Cache way prediction based on instruction base register |
US20050132147A1 (en) * | 2003-12-10 | 2005-06-16 | International Business Machines Corporation | Method and system for supplier-based memory speculation in a memory subsystem of a data processing system |
JP2005182185A (en) | 2003-12-16 | 2005-07-07 | Fujitsu Ltd | Hit/miss determination method and device for cache controller |
KR20060033606A (en) * | 2004-10-15 | 2006-04-19 | 주식회사 팬택앤큐리텔 | Apparatus and method for controlling a memory allocation |
-
2007
- 2007-12-12 KR KR1020070128996A patent/KR100951845B1/en not_active IP Right Cessation
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020133672A1 (en) | 2001-03-13 | 2002-09-19 | Jan-Wiliem Van De Waerdt | Cache way prediction based on instruction base register |
US20050132147A1 (en) * | 2003-12-10 | 2005-06-16 | International Business Machines Corporation | Method and system for supplier-based memory speculation in a memory subsystem of a data processing system |
JP2005182185A (en) | 2003-12-16 | 2005-07-07 | Fujitsu Ltd | Hit/miss determination method and device for cache controller |
KR20060033606A (en) * | 2004-10-15 | 2006-04-19 | 주식회사 팬택앤큐리텔 | Apparatus and method for controlling a memory allocation |
Also Published As
Publication number | Publication date |
---|---|
KR20090061959A (en) | 2009-06-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10268588B2 (en) | Methods of cache preloading on a partition or a context switch | |
EP3414665B1 (en) | Profiling cache replacement | |
JP6009589B2 (en) | Apparatus and method for reducing castout in a multi-level cache hierarchy | |
US7747820B2 (en) | Managing working set use of a cache via page coloring | |
KR100831557B1 (en) | Cache way prediction based on instruction base register | |
US20130151780A1 (en) | Weighted History Allocation Predictor Algorithm in a Hybrid Cache | |
US8271729B2 (en) | Read and write aware cache storing cache lines in a read-often portion and a write-often portion | |
CN101617298B (en) | Cache coherency maintenance for DMA, task termination and synchronisation operations | |
TWI779438B (en) | Methods of storing data, electronic devices and storage media | |
CN114721844B (en) | Data caching method and device, computer equipment and storage medium | |
Kim et al. | Coda: Enabling co-location of computation and data for multiple gpu systems | |
US20120246446A1 (en) | Dynamically Determining the Profitability of Direct Fetching in a Multicore Architecture | |
US10261915B2 (en) | Intelligently partitioning data cache to allocate space for translation entries | |
KR100951845B1 (en) | Apparatus and method for dynamically assigning heap memory capable of reducing cash miss | |
CN112965921A (en) | TLB management method and system in multitask GPU | |
US20110202727A1 (en) | Apparatus and Methods to Reduce Duplicate Line Fills in a Victim Cache | |
Deayton et al. | Set utilization based dynamic shared cache partitioning | |
WO2008149348A2 (en) | Method architecture circuit & system for providing caching | |
Young et al. | Towards bandwidth-efficient prefetching with slim ampm | |
CN112231241B (en) | Data reading method and device and computer readable storage medium | |
Péneau et al. | Performance and energy assessment of last-level cache replacement policies | |
US20090157968A1 (en) | Cache Memory with Extended Set-associativity of Partner Sets | |
Yu et al. | Hierarchical page eviction policy for unified memory in gpus | |
US7434001B2 (en) | Method of accessing cache memory for parallel processing processors | |
KR101383793B1 (en) | Apparatus and method for memory allocating in system on chip |
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 | ||
LAPS | Lapse due to unpaid annual fee |