KR20230096811A - Electronic device and mehtod for managing memory - Google Patents

Electronic device and mehtod for managing memory Download PDF

Info

Publication number
KR20230096811A
KR20230096811A KR1020220075779A KR20220075779A KR20230096811A KR 20230096811 A KR20230096811 A KR 20230096811A KR 1020220075779 A KR1020220075779 A KR 1020220075779A KR 20220075779 A KR20220075779 A KR 20220075779A KR 20230096811 A KR20230096811 A KR 20230096811A
Authority
KR
South Korea
Prior art keywords
memory
page
swap
electronic device
swap space
Prior art date
Application number
KR1020220075779A
Other languages
Korean (ko)
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 EP22911762.7A priority Critical patent/EP4357903A1/en
Priority to PCT/KR2022/020344 priority patent/WO2023121129A1/en
Priority to US18/088,087 priority patent/US20230214122A1/en
Publication of KR20230096811A publication Critical patent/KR20230096811A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/0292User address space allocation, e.g. contiguous or non contiguous base addressing using tables or multilevel address translation means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0658Controller construction arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1041Resource optimization

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Memory System (AREA)

Abstract

어플리케이션의 응답성을 개선하기 위해 메모리 가용용량을 확보하여 메모리를 관리하는 전자 장치 및 그 동작 방법이 제공된다. 본 개시의 일 실시예는 제 1 프로세스의 특성에 기초하여, 상기 제 1 프로세스의 페이지를 제 1 메모리 또는 제 2 메모리로 스왑-아웃(swap-out)할지 여부를 식별하고, 제 1 메모리 또는 제 2 메모리의 일부 영역을 스왑(swap)공간으로 할당하고, 제 1 프로세스의 페이지를 스왑-아웃하고, 스왑-아웃된 페이지가 다시 제 1 메모리로 스왑-인(swap-in) 되는지 확인하고, 제 1 메모리 또는 제 2 메모리의 스왑공간을 해제하는 전자 장치 및 전자장치의 동작 방법을 제공한다.Provided are an electronic device and an operating method for managing memory by securing available memory capacity in order to improve responsiveness of an application. An embodiment of the present disclosure identifies whether to swap-out a page of the first process to a first memory or a second memory based on a characteristic of the first process, and determines whether the first memory or the second memory is to be swapped out. 2 Allocates a part of the memory as a swap space, swaps out the pages of the first process, checks whether the swapped out pages are swapped back into the first memory, and An electronic device releasing a swap space of a first memory or a second memory and a method of operating the electronic device are provided.

Description

메모리 관리 방법 및 이를 이용한 전자 장치 {ELECTRONIC DEVICE AND MEHTOD FOR MANAGING MEMORY}Memory management method and electronic device using the same {ELECTRONIC DEVICE AND MEHTOD FOR MANAGING MEMORY}

본 개시의 다양한 실시예는 메모리의 가용용량을 확보하기 위한 전자 장치 및 전자 장치의 동작 방법에 관한 것이다.Various embodiments of the present disclosure relate to an electronic device and an operating method of the electronic device for securing available capacity of a memory.

스마트폰과 같은 휴대용 전자장치에 갈수록 더 많은 어플리케이션이 설치되고 실행됨에 따라, 가용 메모리 용량을 확보하기 위하여 다양한 메모리 관리 기법이 활용되고 있다. As more and more applications are installed and executed in portable electronic devices such as smart phones, various memory management techniques are used to secure available memory capacity.

OOMK(Out-Of-Memory Killer)는 시스템 중단을 막기 위해 중요도가 낮은 프로세스들을 순차적으로 강제 종료하는 메모리 관리 기법이다. 그러나, OOMK는 사용자 허락없이 실행 중이던 프로세스를 종료시키기 때문에 사용자 경험을 악화시킨다. OOMK (Out-Of-Memory Killer) is a memory management technique that sequentially forcibly terminates processes of low importance to prevent system shutdown. However, OOMK deteriorates the user experience because it terminates the process that was running without the user's permission.

한편, 또다른 메모리 관리 방법으로서 스왑(SWAP) 기법은 최근에 사용되지 않은 데이터들을 휘발성 메모리 영역(예를 들어, RAM)에서 휘발성 메모리와 비휘발성 메모리(예를 들어, NAND Flash 저장장치)의 일정 영역로 이동시켜, 프로세스를 죽이지 않고 가용 메모리 용량을 확보하는 메모리 관리 기법이다.On the other hand, as another memory management method, the SWAP technique transfers recently unused data from a volatile memory area (eg, RAM) to a volatile memory and a non-volatile memory (eg, NAND flash storage). It is a memory management technique that secures available memory capacity without killing processes by moving them to an area.

그러나 갈수록 어플리케이션의 크기가 커지고, 사용자가 더 많은 어플리케이션을 설치하면서 스왑을 하더라도 메모리 용량이 부족하게 되면 OOMK가 빈번히 발생하여 사용자 경험을 악화시킨다.However, as the size of the application increases and the user installs more applications and swaps them out, if the memory capacity becomes insufficient, OOMK occurs frequently, deteriorating the user experience.

특히, 사용자의 어플리케이션 수 증가는 어플리케이션 반응 속도를 악화시킬 뿐만 아니라 어플리케이션들 간의 메모리 경쟁을 가속화한다. 스마트폰 환경에서 어플리케이션 실행 속도와 어플리케이션 반응 속도는 스마트폰 사용자의 최우선 요구사항이다. 어플리케이션들 간의 메모리 경쟁이 증가할수록 어플리케이션의 수행 속도는 급격히 저하한다. 따라서 새로운 메모리 관리 방법을 통해 모바일 환경에서 개선된 사용자 경험을 제공하는 기술이 요구된다. 즉, 최대한 OOMK의 동작을 지연시켜 어플리케이션의 응답성을 보장하는 기술이 요구된다. In particular, an increase in the number of user applications not only deteriorates application response speed, but also accelerates memory competition between applications. In the smartphone environment, application execution speed and application response speed are the top priority requirements of smartphone users. As memory competition between applications increases, the execution speed of the applications rapidly decreases. Therefore, a technique for providing an improved user experience in a mobile environment through a new memory management method is required. That is, a technique for ensuring application responsiveness by delaying the operation of OOMK as much as possible is required.

본 개시의 다양한 실시예는 전자 장치에서 휘발성 메모리의 영역과 비휘발성 메모리의 영역을 스왑 영역으로 이용하는 메모리 관리 장치 및 방법에 대해 개시한다. Various embodiments of the present disclosure disclose a memory management apparatus and method for using a volatile memory area and a non-volatile memory area as a swap area in an electronic device.

본 개시의 다양한 실시예는 전자 장치에서 프로세스 상태를 보존하기 위하여 OOMK 동작을 개선하는 메모리 관리 장치 및 방법에 대해 개시한다. Various embodiments of the present disclosure disclose a memory management apparatus and method for improving an OOMK operation to preserve a process state in an electronic device.

상술한 기술적 과제를 해결하기 위하여 본 개시의 일 실시예는 어플리케이션의 응답성을 개선하기 위해 메모리 가용용량을 확보하여 메모리를 관리하는 전자 장치 및 그 동작 방법이 제공된다. In order to solve the above technical problem, an embodiment of the present disclosure provides an electronic device and an operating method thereof for managing memory by securing available memory capacity in order to improve application responsiveness.

본 개시의 일 측면에 따르면, 전자장치는 제 1 메모리, 제 2 메모리 및 상기 제 2 메모리에 저장된 어플리케이션의 실행에 따라서 상기 어플리케이션과 관련된 제1 프로세스의 페이지를 상기 제 1 메모리에 로딩함으로써 상기 제 1 프로세스를 실행하는 프로세서를 포함하고, 상기 프로세서는, 상기 제 1 메모리에 제 2 프로세스를 할당하기 위한 가용 용량을 확인하고, 상기 제 1 메모리에서 실행 중인 상기 제 1 프로세스의 특성에 기초하여, 상기 제 1 프로세스의 페이지를 상기 제 1 메모리 또는 상기 제 2 메모리로 스왑-아웃(swap-out)할지 여부를 식별하고, 상기 제 1 메모리 또는 제 2 메모리의 일부 영역을 스왑(swap)공간으로 할당하여, 상기 제 1 프로세스의 페이지를 스왑-아웃하고, 상기 스왑-아웃된 페이지가 다시 상기 제 1 메모리로 스왑-인(swap-in) 되는 경우, 상기 스왑공간을 해제할 수 있다.According to one aspect of the present disclosure, an electronic device loads a page of a first process related to a first memory, a second memory, and an application stored in the second memory according to the execution of the first memory to the first memory. A processor that executes a process, wherein the processor checks an available capacity for allocating a second process to the first memory, and based on a characteristic of the first process running in the first memory, the second process Identifying whether to swap-out pages of one process to the first memory or the second memory, allocating a part of the first memory or the second memory as a swap space, When a page of the first process is swapped out and the swapped out page is swapped back into the first memory, the swap space may be released.

본 개시의 일 실시예에서, 상기 제 1 프로세스의 특성은 프로세스의 반응 시간 및 상태 보존 정도 중 적어도 하나를 포함할 수 있다.In one embodiment of the present disclosure, the characteristics of the first process may include at least one of a response time and state preservation degree of the process.

본 개시의 일 실시예에서, 상기 제 1 프로세스의 특성에 제 1 프로세스의 페이지가 복수의 프로세스로부터 참조되는 횟수를 추가로 고려하여, 상기 제 1 프로세스의 페이지를 상기 제 1 메모리 또는 상기 제 2 메모리로 스왑-아웃(swap-out)할지 여부를 식별할 수 있다.In one embodiment of the present disclosure, the number of times a page of the first process is referenced by a plurality of processes is additionally considered in addition to the characteristics of the first process, and the page of the first process is stored in the first memory or the second memory. You can identify whether to swap-out with .

본 개시의 일 실시예에서, 상기 제 1 프로세스의 페이지는 공유 라이브러리에 속한 SO(Shared Object) 파일일 수 있다.In one embodiment of the present disclosure, the page of the first process may be a Shared Object (SO) file belonging to a shared library.

본 개시의 일 실시예에서, 상기 프로세서는, 상기 제 1 메모리의 스왑공간이 부족한 경우, 상기 제 1 프로세스의 페이지가 복수의 프로세스로부터 참조되는 횟수에 기초하여 상기 제 1 프로세스의 페이지 중 제 1 페이지를 결정하고, 상기 제 1 페이지를 제 1 메모리에서 제거할 수 있다.In one embodiment of the present disclosure, when the swap space of the first memory is insufficient, the processor selects a first page among pages of the first process based on the number of times the page of the first process is referred from a plurality of processes. may be determined, and the first page may be removed from the first memory.

본 개시의 일 실시예에서, 상기 프로세서는, 상기 제 2 메모리의 스왑공간이 부족한 경우, 상기 제 2 메모리에 쓰여진 페이지가 상기 제 2 메모리에 스왑-아웃된 시간에 기초하여 상기 제 2 메모리에 쓰여진 페이지 중 제 2 페이지를 결정하고, 상기 제 2 페이지를 제 2 메모리에서 제거할 수 있다.In one embodiment of the present disclosure, the processor, when the swap space of the second memory is insufficient, the page written to the second memory is written to the second memory based on the time when the page was swapped out to the second memory. A second page among pages may be determined, and the second page may be removed from the second memory.

본 개시의 일 실시예에서, 상기 프로세서는, 상기 제 1 페이지를 제 1 메모리에서 제거한 후에도 상기 제 1 메모리에 새로운 프로세스를 할당하기 위한 가용 용량이 부족한 경우, 상기 제 2 메모리에 상기 실행 중인 프로세스의 페이지를 스왑-아웃할 스왑공간이 있는지 확인하고, 상기 제 2 메모리의 스왑공간이 부족한 경우, 상기 제 2 메모리에 쓰여진 페이지가 상기 제 2 메모리에 스왑-아웃된 시간에 기초하여 상기 제 2 메모리에 쓰여진 페이지 중 제 2 페이지를 결정하고, 상기 제 2 페이지를 제 2 메모리에서 제거할 수 있다.In one embodiment of the present disclosure, the processor, when the available capacity for allocating a new process to the first memory is insufficient even after the first page is removed from the first memory, the processor stores the running process in the second memory. It is checked whether there is a swap space to swap out a page from, and if the swap space of the second memory is insufficient, the page written to the second memory is stored in the second memory based on the time when the page was swapped out to the second memory. A second page among written pages may be determined, and the second page may be removed from the second memory.

본 개시의 일 실시예에서, 상기 제 1 페이지 및 제 2 페이지는 공유 라이브러리에 속한 SO(Shared Object) 파일일 수 있다.In one embodiment of the present disclosure, the first page and the second page may be SO (Shared Object) files belonging to a shared library.

본 개시의 일 실시예에서, 상기 프로세서는, 상기 제 2 페이지를 제 2 메모리에서 제거한 후에도 상기 제 1 메모리에 새로운 프로세스를 할당하기 위한 가용 용량이 부족한 경우, 상기 복수의 프로세스 별 프로세스 구동 시 소요 시간을 계산하고, 상기 계산된 시간에 기초하여, 상기 제 1 메모리에서 실행 중인 복수의 프로세스의 종료 순서를 결정하고, 상기 제 1 메모리에서 실행 중인 복수의 프로세스 중에서 적어도 하나의 프로세스를 종료시켜, 상기 종료된 프로세스의 데이터가 로딩된 상기 제 1 메모리의 저장영역을 타 프로세스가 사용 가능하도록 할 수 있다.In one embodiment of the present disclosure, the processor, when the available capacity for allocating a new process to the first memory is insufficient even after removing the second page from the second memory, the time required for driving the process for each of the plurality of processes , determining an order of termination of a plurality of processes running in the first memory based on the calculated time, and terminating at least one process among the plurality of processes running in the first memory, The storage area of the first memory into which the data of the processed process is loaded may be made available to other processes.

본 개시의 일 실시예에서, 상기 프로세스 구동 시 소요 시간은 상기 프로세스의 페이지의 공유 심볼 탐색에 소요되는 시간과 XML 기반의 UI 프로세스 실행 시 소요되는 시간 중 적어도 하나를 포함할 수 있다.In one embodiment of the present disclosure, the time required for driving the process may include at least one of a time required for searching for a shared symbol of a page of the process and a time required for executing an XML-based UI process.

상술한 기술적 과제를 해결하기 위하여 본 개시의 다른 실시예는, 메모리 가용용량을 확보하여 어플리케이션의 응답성을 개선하는 메모리 관리 방법을 제공한다. In order to solve the above technical problem, another embodiment of the present disclosure provides a memory management method for improving application responsiveness by securing available memory capacity.

본 개시의 일 측면에 따른 방법은, 제 2 메모리에 저장된 어플리케이션과 관련된 제 1 프로세스를 제 1 메모리에 로딩함으로써 실행하는 단계, 상기 제 1 메모리에 제 2 프로세스를 할당하기 위한 가용 용량을 확인하는 단계, 상기 제 1 메모리에서 실행 중인 상기 제 1 프로세스의 특성에 기초하여, 상기 제 1 프로세스의 페이지를 상기 제 1 메모리 또는 상기 제 2 메모리로 스왑-아웃(swap-out)할지 여부를 식별하는 단계, 상기 제 1 메모리 또는 제 2 메모리의 일부 영역을 스왑(swap)공간으로 할당함으로써 상기 제 1 프로세스의 페이지를 스왑 아웃하는 단계, 및 상기 스왑-아웃된 페이지가 다시 상기 제 1 메모리로 스왑-인(swap-in) 되는 경우, 상기 스왑공간을 해제하는 단계를 포함할 수 있다.A method according to an aspect of the present disclosure includes executing a first process related to an application stored in a second memory by loading it into the first memory, and checking an available capacity for allocating a second process to the first memory. identifying whether to swap-out pages of the first process to the first memory or the second memory, based on characteristics of the first process running in the first memory; swapping out a page of the first process by allocating a part of the first or second memory as a swap space, and swapping the swapped out page back into the first memory ( swap-in), releasing the swap space.

도 1은 일 실시예에 따른 메모리 관리하는 방법을 나타내는 도면이다.
도 2는 본 개시의 일 실시예에 따른 전체적인 시스템 구조를 설명하기 위한 도면이다.
도 3은 본 개시의 일 실시예에 따른 메모리의 가용용량을 확보하기 위한 전자 장치를 설명하기 위한 블록 구성도이다.
도 4는 본 개시의 일 실시예에 따른 메모리의 가용용량을 확보하는 방법을 구체적으로 나타내는 도면이다.
도 5는 본 개시의 일 실시예에 따른 실행 중인 프로세스 별 소요 시간을 계산하여 프로세스의 종료 순서를 결정하는 방법을 설명하기 위한 도면이다.
도 6은 본 개시의 일 실시예에 따른 메모리의 가용용량을 확보하기 위한 순서도이다.
도 7은 본 개시의 일 실시예에 따른 메모리의 가용용량을 확보하기 위한 방법을 구체적으로 나타내는 순서도이다.
도 8은 본 개시의 일 실시예에 따른 페이지를 메모리에서 제거하는 방법을 구체적으로 나타내는 순서도이다.
도 9는 본 개시의 일 실시예에 따른 페이지를 메모리에서 제거하는 방법을 구체적으로 나타내는 순서도이다.
도 10은 본 개시의 일 실시예에 따른 실행 중인 프로세스를 종료하는 방법을 나타내는 순서도이다.
도 11은 본 개시의 일 실시예에 따른 실행 중인 프로세스를 종료하는 방법을 더 구체적으로 나타내는 순서도이다.
1 is a diagram illustrating a method of managing a memory according to an exemplary embodiment.
2 is a diagram for explaining the overall system structure according to an embodiment of the present disclosure.
3 is a block diagram illustrating an electronic device for securing available capacity of a memory according to an embodiment of the present disclosure.
4 is a diagram specifically illustrating a method of securing an available capacity of a memory according to an embodiment of the present disclosure.
5 is a diagram for explaining a method of determining a process termination order by calculating a required time for each running process according to an embodiment of the present disclosure.
6 is a flowchart for securing available capacity of a memory according to an embodiment of the present disclosure.
7 is a flowchart illustrating in detail a method for securing an available capacity of a memory according to an embodiment of the present disclosure.
8 is a flowchart specifically illustrating a method of removing a page from a memory according to an exemplary embodiment of the present disclosure.
9 is a flowchart illustrating a method of removing a page from a memory according to an exemplary embodiment of the present disclosure.
10 is a flowchart illustrating a method of terminating a running process according to an embodiment of the present disclosure.
11 is a flowchart more specifically illustrating a method of terminating a running process according to an embodiment of the present disclosure.

본 개시에서 사용되는 용어에 대해 간략히 설명하고, 본 개시의 일 실시예에 대해 구체적으로 설명하기로 한다.Terms used in the present disclosure will be briefly described, and an embodiment of the present disclosure will be described in detail.

본 개시에서 사용되는 용어는 본 개시의 일 실시예에서의 기능을 고려하면서 가능한 현재 널리 사용되는 일반적인 용어들을 선택하였으나, 이는 당 분야에 종사하는 기술자의 의도 또는 판례, 새로운 기술의 출현 등에 따라 달라질 수 있다. 또한, 특정한 경우는 출원인이 임의로 선정한 용어도 있으며, 이 경우 해당되는 본 개시의 실시예의 설명 부분에서 상세히 그 의미를 기재할 것이다. 따라서 본 개시에서 사용되는 용어는 단순한 용어의 명칭이 아닌, 그 용어가 가지는 의미와 본 개시의 전반에 걸친 내용을 토대로 정의되어야 한다. The terms used in the present disclosure have been selected from general terms that are currently widely used as much as possible while considering functions in an embodiment of the present disclosure, but they may vary depending on the intention or precedent of a person skilled in the art, the emergence of new technologies, and the like. there is. In addition, in a specific case, there is also a term arbitrarily selected by the applicant, and in this case, the meaning will be described in detail in the description of the corresponding embodiment of the present disclosure. Therefore, terms used in the present disclosure should be defined based on the meaning of the term and the general content of the present disclosure, not simply the name of the term.

명세서 전체에서 어떤 부분이 어떤 구성요소를 "포함"한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있음을 의미한다. 또한, 명세서에서 사용되는 "부"라는 용어는 소프트웨어, FPGA 또는 ASIC과 같은 하드웨어 구성요소를 의미하며, "부"는 어떤 역할들을 수행한다. 그렇지만 "부"는 소프트웨어 또는 하드웨어에 한정되는 의미는 아니다. "부"는 어드레싱할 수 있는 저장 매체에 있도록 구성될 수도 있고 하나 또는 그 이상의 프로세서들을 재생시키도록 구성될 수도 있다. 따라서, 일 예로서 "부"는 소프트웨어 구성요소들, 객체지향 소프트웨어 구성요소들, 클래스 구성요소들 및 태스크 구성요소들과 같은 구성요소들과, 프로세스들, 함수들, 속성들, 프로시저들, 서브루틴들, 프로그램 코드의 세그먼트들, 드라이버들, 펌웨어, 마이크로 코드, 회로, 데이터, 데이터베이스, 데이터 구조들, 테이블들, 어레이들 및 변수들을 포함한다. 구성요소들과 "부"들 안에서 제공되는 기능은 더 작은 수의 구성요소들 및 "부"들로 결합되거나 추가적인 구성요소들과 "부"들로 더 분리될 수 있다.When it is said that a certain part "includes" a certain component throughout the specification, it means that it may further include other components without excluding other components unless otherwise stated. Also, the term "unit" used in the specification means a hardware component such as software, FPGA or ASIC, and "unit" performs certain roles. However, "unit" is not meant to be limited to software or hardware. A “unit” may be configured to reside in an addressable storage medium and may be configured to reproduce on one or more processors. Thus, as an example, “unit” can refer to components such as software components, object-oriented software components, class components and task components, processes, functions, properties, procedures, subroutines, segments of program code, drivers, firmware, microcode, circuitry, data, databases, data structures, tables, arrays and variables. Functionality provided within components and "parts" may be combined into fewer components and "parts" or further separated into additional components and "parts".

아래에서는 첨부한 도면을 참고하여 본 개시의 실시예에 대하여 본 개시가 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 상세히 설명한다. 그러나 본 개시의 일 실시예는 여러 가지 상이한 형태로 구현될 수 있으며 여기에서 설명하는 실시예에 한정되지 않는다. 그리고 도면에서 본 개시의 일 실시예를 명확하게 설명하기 위해서 설명과 관계없는 부분은 생략하였으며, 본 개시 전체를 통하여 유사한 부분에 대해서는 유사한 도면 부호를 붙였다.Hereinafter, with reference to the accompanying drawings, embodiments of the present disclosure will be described in detail so that those skilled in the art can easily carry out the present disclosure. However, an embodiment of the present disclosure may be implemented in many different forms and is not limited to the embodiment described herein. And in order to clearly describe an embodiment of the present disclosure in the drawings, parts irrelevant to the description are omitted, and similar reference numerals are attached to similar parts throughout the present disclosure.

명세서 전체에서, 어떤 부분이 다른 부분과 "연결"되어 있다고 할 때, 이는 "직접적으로 연결"되어 있는 경우뿐만 아니라, 그 중간에 다른 소자를 사이에 두고 "전기적으로 연결"되어 있는 경우도 포함한다. 또한 어떤 부분이 어떤 구성요소를 "포함"한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있는 것을 의미한다.Throughout the specification, when a part is said to be "connected" to another part, this includes not only the case of being "directly connected" but also the case of being "electrically connected" with another element in between. . In addition, when a certain component is said to "include", this means that it may further include other components without excluding other components unless otherwise stated.

본 개시에서, 스왑(swap)은 주 기억장치에 적어도 일시적으로 저장된 데이터를 주 기억장치의 또는 보조 기억장치의 다른 영역으로 이동시켜 저장하는 동작을 의미할 수 있다. 일 실시예에서, 주 기억장치에서 이미 실행 중이던 어플리케이션이 차지하는 용량 때문에 새로운 어플리케이션을 실행할 수 없는 경우, 주 기억장치에 실행 중이던 어플리케이션 또는 그 일부인 프로세스를 스왑할 수 있다. 예를 들어, 주 기억장치는 휘발성 메모리이고 보조 기억장치는 비휘발성 메모리일 수 있다.In the present disclosure, swap may mean an operation of moving and storing data at least temporarily stored in a main memory device to another area of a main memory device or a secondary memory device. In one embodiment, when a new application cannot be executed due to the capacity occupied by an application already running in the main storage device, the application running in the main storage device or a process that is part thereof may be swapped. For example, the main storage device may be a volatile memory and the secondary storage device may be a non-volatile memory.

본 개시에서, 스왑(swap)공간은 프로세스를 실행하기 위한 주 기억장치의 가용용량이 부족한 경우, 주 기억장치에 저장된 데이터를 이동시켜 저장할 수 있는 메모리의 영역을 의미할 수 있다. 일 실시예에서, 스왑공간은 주 기억장치의 일부 영역 또는 보조 기억장치의 일부 영역이 될 수 있다. In this disclosure, the swap space is When the available capacity of the main memory device for executing a process is insufficient, it may refer to a memory area in which data stored in the main memory device can be moved and stored. In one embodiment, the swap space may be a portion of main storage or a portion of secondary storage.

본 개시에서, 스왑-아웃(swap-out)은 스왑공간으로 주 기억장치의 데이터를 이동시키는 동작을 의미할 수 있다. 일 실시예에서, 주 기억장치에서 실행 중이던 프로세스를 스왑공간으로 스왑-아웃시켜 주 기억장치의 가용용량을 확보할 수 있다.In the present disclosure, swap-out may refer to an operation of moving data of a main memory device to a swap space. In one embodiment, the usable capacity of the main storage device may be secured by swapping out a process running in the main storage device to the swap space.

본 개시에서, 스왑-인(swap-in)은 스왑공간으로 이동된 데이터를 다시 주 기억장치로 이동시키는 동작을 의미할 수 있다. 일 실시예에서, 스왑공간에 저장되었던 프로세스를 다시 주 기억장치로 스왑-인시켜 주 기억장치에서 해당 프로세스를 다시 실행할 수 있다.In the present disclosure, swap-in may refer to an operation of moving data moved to a swap space back to a main memory device. In one embodiment, a process stored in the swap space may be swapped back into the main storage device and the corresponding process may be executed again in the main storage device.

본 개시에서, SO 페이지(Shared Object Page)는 공유 라이브러리의 Shared Object 파일(.so file)이 메모리에 로딩 되었을 경우의 Shared Object 파일을 의미할 수 있다.In the present disclosure, a shared object page (SO page) may mean a shared object file when a shared object file (.so file) of a shared library is loaded into memory.

이하 첨부된 도면을 참고하여 본 개시를 상세히 설명하기로 한다.Hereinafter, the present disclosure will be described in detail with reference to the accompanying drawings.

도 1은 일 실시예에 따른 메모리 관리하는 방법을 나타내는 도면이다. 도 1을 참조하면, 전자 장치(100)는 프로세서(110), 휘발성 메모리(120), 비휘발성 메모리(130) 등을 포함할 수 있다. 1 is a diagram illustrating a method of managing a memory according to an exemplary embodiment. Referring to FIG. 1 , an electronic device 100 may include a processor 110, a volatile memory 120, and a non-volatile memory 130.

일 실시예에 따른 프로세서(110)는 메모리 관리부(111)를 포함할 수 있다. 메모리 관리부(111)는 어플리케이션이 새로 실행되는 경우, 휘발성 메모리(120) 내 시스템 메모리(121)의 일부 영역을 해당 어플리케이션에 할당할 수 있다. The processor 110 according to an embodiment may include a memory management unit 111 . When an application is newly executed, the memory management unit 111 may allocate a partial area of the system memory 121 in the volatile memory 120 to the corresponding application.

또한, 메모리 관리부(111)는 어플리케이션의 데이터가 가능한 오래 스왑공간에 유지되도록 스왑공간의 크기를 동적으로 조정할 수 있다. 예를 들어, 메모리 관리부(111)는 시스템 메모리(121) 영역의 가용 용량을 확인하고, 가용 용량이 부족한 경우 실행 중인 어플리케이션의 일부 데이터를 스왑-아웃하기 위해 휘발성 메모리(120) 또는 비휘발성 메모리(130)의 일부 영역을 스왑공간으로 할당할 수 있다. 예를 들어, 메모리 관리부(111)는 시스템 메모리(121)에서 실행 중인 어플리케이션의 데이터 일부를 스왑 파일(420) 단위로 스왑공간(140)에 스왑-아웃할 수 있다. 스왑공간(140)은 스왑 파일(420)이 스왑-아웃될 때마다 늘어날 수 있다. 여기서 스왑 파일(420)은 스왑-아웃, 스왑-인 될 수 있는, 여러 개의 페이지로 구성된 파일의 단위를 의미할 수 있다.Also, the memory management unit 111 may dynamically adjust the size of the swap space so that application data is maintained in the swap space for as long as possible. For example, the memory management unit 111 checks the available capacity of the system memory 121 area, and if the available capacity is insufficient, the volatile memory 120 or non-volatile memory ( 130) may be allocated as swap space. For example, the memory management unit 111 may swap out some data of an application running in the system memory 121 to the swap space 140 in units of swap files 420 . The swap space 140 may increase each time the swap file 420 is swapped out. Here, the swap file 420 may mean a unit of a file composed of several pages that can be swapped out and swapped in.

반대로 스왑공간(140)이 필요하지 않은 경우, 스왑공간(140)의 크기를 줄일 수 있다. 예를 들어, 메모리 관리부(111)는 스왑공간의 모든 페이지가 스왑-인되어 스왑공간이 비어 있는 경우, 동적으로 할당한 스왑공간을 즉시 해제한다. 위와 같은 스왑공간의 동적 할당 작업을 통하여 기존의 OOMK 발생을 지연시켜 어플리케이션이 강제 종료되는 빈도수를 줄일 수 있다. 이를 통해 어플리케이션의 응답성이 향상되어 사용자 경험이 개선될 수 있다. Conversely, when the swap space 140 is not needed, the size of the swap space 140 can be reduced. For example, when all pages of the swap space are swapped in and the swap space is empty, the memory management unit 111 immediately releases the dynamically allocated swap space. Through the dynamic allocation of swap space as above, it is possible to reduce the frequency of forced termination of applications by delaying the occurrence of existing OOMK. Through this, the responsiveness of the application may be improved and the user experience may be improved.

일 실시예에 따른 메모리 관리부(111)는 스왑공간의 동적 할당을 수행하여도 스왑공간(140)이 부족한 경우, 휘발성 메모리(120)의 SO 페이지를 제거하여 저장 공간을 확보할 수 있다. 예를 들어, 메모리 관리부(111)는 휘발성 메모리(120)에 저장된 SO 페이지를 스캔하고, 여러 어플리케이션에서 공유되지 않는 SO 페이지를 찾으면 이를 제거할 수 있다. 페이지 제거는 스왑-아웃에 비하여 추가적인 I/O 작업이 필요하지 않기 때문에, 간단하고 비용이 적게 발생한다. The memory management unit 111 according to an embodiment may secure the storage space by removing the SO page of the volatile memory 120 when the swap space 140 is insufficient even after dynamically allocating the swap space. For example, the memory management unit 111 scans the SO pages stored in the volatile memory 120, and if it finds an SO page that is not shared by multiple applications, it can remove it. Page removal is simpler and less expensive than swap-out because it requires no additional I/O operations.

일 실시예에 따른 메모리 관리부(111)는 스왑공간의 동적 할당을 수행하여도 스왑공간(140)이 부족한 경우, 비휘발성 메모리(130)의 SO 페이지를 제거하여 스왑공간을 확보할 수 있다. 예를 들어, 메모리 관리부(111)는 비휘발성 메모리(130)에 스왑-아웃된 파일 중 기 설정된 기간(예를 들어, 7일 또는 30일)동안 스왑-인 되지 않은 파일을 제거할 수 있다. 파일은 SO 페이지를 포함할 수 있다. 또한, 가용할 수 있는 스왑공간의 크기가 사전에 정의된 임계값 이하로 떨어지면 주기적으로 SO 페이지를 제거하여 스왑공간을 확보할 수 있다. The memory management unit 111 according to an embodiment may secure the swap space by removing the SO page of the non-volatile memory 130 when the swap space 140 is insufficient even though the swap space is dynamically allocated. For example, the memory manager 111 may remove a file that has not been swapped in for a predetermined period (eg, 7 days or 30 days) among files swapped out of the nonvolatile memory 130 . The file can contain SO pages. In addition, when the size of available swap space falls below a predefined threshold, the swap space can be secured by periodically removing SO pages.

일 실시예에 따른 메모리 관리부(111)는 SO 페이지 제거를 수행하여도 메모리의 가용 용량이 부족한 경우, 시스템 메모리(121)에 로딩되어 실행 중인 어플리케이션의 일부를 종료할 수 있다. 예를 들어, 메모리 관리부(111)는 어플리케이션 별로 구동 시 소요 시간을 계산하여, 구동 시간이 짧은 어플리케이션 순서대로 어플리케이션의 종료 순서를 결정할 수 있다. 구체적으로, 어플리케이션 구동 시 소요 시간은 어플리케이션을 처음 실행할 때 SO 심볼(Shared Object Symbol) 탐색 시간과 XML(eXtensible Markup Language)-UI(User Interface) 변환(Conversion) 시간을 합쳐서 계산할 수 있다. The memory management unit 111 according to an embodiment may terminate a part of an application that is loaded into the system memory 121 and is running when the available capacity of the memory is insufficient even after removing the SO page. For example, the memory management unit 111 may calculate the required driving time for each application and determine the termination order of the applications in the order of applications having a short driving time. Specifically, the time required for starting the application can be calculated by adding the time for searching for a shared object symbol (SO) and the time for converting an XML (eXtensible Markup Language)-User Interface (UI) when the application is first executed.

SO 심볼 탐색 시간은 어플리케이션 구동 시 필요한 SO 심볼을 동적 공유 라이브러리에서 찾는데 소요되는 시간을 의미할 수 있다. 또한, XML-UI 변환 시간은 어플리케이션 구동 시 XML을 UI로 변환하는 데 소요되는 시간을 의미할 수 있다.The SO symbol search time may mean the time required to search for an SO symbol required for running an application in a dynamic shared library. Also, the XML-UI conversion time may mean the time required to convert XML to UI when the application is running.

도 2는 본 개시의 일 실시예에 따른 전체적인 시스템 구조를 설명하기 위한 도면이다.2 is a diagram for explaining the overall system structure according to an embodiment of the present disclosure.

시스템 계층도는 크게 어플리케이션 계층(210), 어플리케이션 프레임워크 계층(220), 커널 계층(230), 하드웨어 계층(240)으로 구분될 수 있다. The system hierarchy can be largely divided into an application layer 210, an application framework layer 220, a kernel layer 230, and a hardware layer 240.

어플리케이션 계층(210)에서 특정 어플리케이션이 실행되면, 어플리케이션 프레임워크 계층(220) 상의 어플리케이션 구동시간 측정부(221)가 해당 어플리케이션의 구동 비용을 계산할 수 있다. 예를 들어, 어플리케이션 구동 시 필요한 SO 심볼 탐색, XML-UI 변환 등의 초기화 비용을 측정하고, 그 계산 값을 커널 계층(230)의 메모리 관리부(111)에 전달할 수 있다. When a specific application is executed in the application layer 210, the application running time measuring unit 221 on the application framework layer 220 may calculate the driving cost of the corresponding application. For example, initialization costs such as SO symbol search, XML-UI conversion, etc. required for running an application may be measured, and the calculated value may be transmitted to the memory management unit 111 of the kernel layer 230.

커널 계층(230)은 어플리케이션 프레임워크 계층(220)과 하드웨어 계층(240)을 연결해줄 수 있다. 구체적으로, 메모리 관리부(111)를 통해 하드웨어 계층(240)의 휘발성 메모리(120)와 비휘발성 메모리(130)의 저장 공간을 관리한다. The kernel layer 230 may connect the application framework layer 220 and the hardware layer 240 . Specifically, the storage space of the volatile memory 120 and the non-volatile memory 130 of the hardware layer 240 is managed through the memory management unit 111 .

도 3은 본 개시의 일 실시예에 따른 메모리의 가용용량을 확보하기 위한 전자 장치를 설명하기 위한 블록 구성도이다.3 is a block diagram illustrating an electronic device for securing available capacity of a memory according to an embodiment of the present disclosure.

본 개시의 일 실시예에 따른 전자 장치(100)는 메모리 관리를 수행할 수 있는 전자 장치로, 구체적으로 프로그램(330)을 통해 메모리 관리를 수행하는 전자 장치일 수 있다. 도 3을 참조하면, 본 개시의 일 실시예에 따른 전자장치(100)는 프로세서(110) 및 메모리(300)를 포함할 수 있다. 이하 상기 구성요소들에 대해 차례로 살펴본다.The electronic device 100 according to an embodiment of the present disclosure is an electronic device that can perform memory management, and may be specifically an electronic device that performs memory management through the program 330 . Referring to FIG. 3 , an electronic device 100 according to an embodiment of the present disclosure may include a processor 110 and a memory 300. Hereinafter, the above components are examined in turn.

프로세서(110)는 전자 장치(100)의 전반적인 동작을 제어할 수 있고, 메모리(300)에 저장된 하나 이상의 인스트럭션을 실행하여 전자 장치(100)의 동작을 제어할 수 있다. 프로세서(110)는 전자 장치(100)의 다른 구성요소들로부터 수신된 명령을 읽고 명령에 따른 연산이나 데이터 처리를 실행할 수 있다. 프로세서(110)는 전자장치(100)의 제반 동작을 수행하는 동작의 하드웨어 주체가 된다. 프로세서(110)는 소프트웨어가 실행되도록 데이터의 연산, 처리 및 제어를 수행한다. 예를 들어 프로세서(110)는 전자장치(100)의 운영체제 또는 커널을 실행시키고, 또한 커널 상에서 어플리케이션을 실행시킴으로써 다양한 프로세스가 수행되도록 한다. The processor 110 may control the overall operation of the electronic device 100 and may control the operation of the electronic device 100 by executing one or more instructions stored in the memory 300 . The processor 110 may read commands received from other components of the electronic device 100 and execute operations or data processing according to the commands. The processor 110 becomes a hardware subject of operations that perform various operations of the electronic device 100 . The processor 110 performs calculation, processing, and control of data so that software is executed. For example, the processor 110 executes an operating system or a kernel of the electronic device 100 and also executes applications on the kernel, so that various processes are performed.

본 개시의 실시예에 따른 프로세서(110)는 메모리(300)에 저장된 하나 이상의 인스트럭션을 실행함으로써, 휘발성 메모리(120)에 새로운 프로세스를 할당하기 위한 가용 용량을 확인하고, 휘발성 메모리(120)에서 실행 중인 프로세스의 특성에 기초하여, 실행 중인 프로세스의 페이지를 휘발성 메모리(120) 또는 비휘발성 메모리(130)로 스왑-아웃(swap-out)할지 여부를 식별하고, 휘발성 메모리(120) 또는 비휘발성 메모리(130)의 일부 영역을 스왑(swap)공간으로 할당하고, 실행 중인 프로세스의 페이지를 스왑-아웃하고, 스왑-아웃된 페이지가 다시 휘발성 메모리(120)로 스왑-인(swap-in) 되는지 확인하고, 휘발성 메모리(120) 또는 비휘발성 메모리(130)의 스왑공간을 해제할 수 있다.The processor 110 according to an embodiment of the present disclosure checks available capacity for allocating a new process to the volatile memory 120 by executing one or more instructions stored in the memory 300, and executes the instructions in the volatile memory 120. Based on the characteristics of the running process, whether to swap-out pages of the running process to the volatile memory 120 or the non-volatile memory 130 is identified, and the volatile memory 120 or the non-volatile memory Allocate some area of 130 as swap space, swap out pages of the running process, and check if the swapped out pages are swapped back into volatile memory 120 And, the swap space of the volatile memory 120 or the non-volatile memory 130 can be released.

본 개시의 실시예에 따른 프로세서(110)는 메모리(300)에 저장된 하나 이상의 인스트럭션을 실행함으로써, 실행 중인 프로세스의 특성에 실행 중인 프로세스의 페이지가 복수의 프로세스로부터 참조되는 횟수를 추가로 고려하여, 실행 중인 프로세스의 페이지를 휘발성 메모리(120) 또는 비휘발성 메모리(130)로 스왑-아웃(swap-out)할지 여부를 식별할 수 있다.By executing one or more instructions stored in the memory 300, the processor 110 according to an embodiment of the present disclosure further considers the number of times a page of the running process is referred to by a plurality of processes in the characteristics of the running process, It is possible to identify whether a page of a running process is to be swapped out to the volatile memory 120 or the non-volatile memory 130 .

본 개시의 실시예에 따른 프로세서(110)는 메모리(300)에 저장된 하나 이상의 인스트럭션을 실행함으로써, 휘발성 메모리(120)의 스왑공간이 부족한 경우, 실행 중인 프로세스의 페이지가 복수의 프로세스로부터 참조되는 횟수에 기초하여 실행 중인 프로세스의 페이지 중 제 1 페이지를 결정하고, 제 1 페이지를 휘발성 메모리(120)에서 제거할 수 있다. The processor 110 according to an embodiment of the present disclosure, by executing one or more instructions stored in the memory 300, when the swap space of the volatile memory 120 is insufficient, the number of times the page of the running process is referenced by a plurality of processes A first page among pages of a process being executed may be determined based on , and the first page may be removed from the volatile memory 120 .

본 개시의 실시예에 따른 프로세서(110)는 메모리(300)에 저장된 하나 이상의 인스트럭션을 실행함으로써, 비휘발성 메모리(130)의 스왑공간이 부족한 경우, 비휘발성 메모리(130)에 쓰여진 페이지가 비휘발성 메모리(130)에 스왑-아웃된 시간에 기초하여 비휘발성 메모리(130)에 쓰여진 페이지 중 제 2 페이지를 결정하고, 제 2 페이지를 비휘발성 메모리(130)에서 제거할 수 있다.The processor 110 according to an embodiment of the present disclosure executes one or more instructions stored in the memory 300 so that, when the swap space of the non-volatile memory 130 is insufficient, a page written in the non-volatile memory 130 is changed to a non-volatile memory. A second page among pages written to the nonvolatile memory 130 may be determined based on the swapped out time of the memory 130 , and the second page may be removed from the nonvolatile memory 130 .

본 개시의 실시예에 따른 프로세서(110)는 메모리(300)에 저장된 하나 이상의 인스트럭션을 실행함으로써, 휘발성 메모리(120)에 새로운 프로세스를 할당하기 위한 가용 용량이 부족한 경우, 휘발성 메모리(120)에서 실행 중인 복수의 프로세스 별 프로세스 구동 시 소요 시간을 계산하고, 계산된 시간에 기초하여 휘발성 메모리(120)에서 실행 중인 복수의 프로세스의 종료 순서를 결정하고, 휘발성 메모리(120)에서 실행 중인 복수의 프로세스 중에서 적어도 하나의 프로세스를 종료시켜, 종료된 프로세스의 데이터가 로딩된 휘발성 메모리(120)의 저장영역을 타 프로세스가 사용 가능하도록 할 수 있다.The processor 110 according to an embodiment of the present disclosure executes one or more instructions stored in the memory 300, so that when the available capacity for allocating a new process to the volatile memory 120 is insufficient, the volatile memory 120 executes the instructions. Calculate the time required for driving the process for each of the plurality of processes in progress, determine the termination order of the plurality of processes running in the volatile memory 120 based on the calculated time, and among the plurality of processes running in the volatile memory 120 By terminating at least one process, the storage area of the volatile memory 120 loaded with data of the terminated process can be made available to other processes.

메모리(300)는 내장 메모리(310) 또는 외장 메모리(320)를 포함할 수 있다. The memory 300 may include an internal memory 310 or an external memory 320 .

일 실시예에 따르면, 내장 메모리(310)는 Solid State Drive(SSD)일 수도 있다. 내장 메모리(310)는 휘발성 메모리(120)(volatile memory) 또는 비휘발성 메모리(130)(non-volatile Memory)일 수 있다. 예를 들면, 휘발성 메모리(120)는 DRAM(dynamic RAM), SRAM(static RAM), SDRAM(synchronous dynamic RAM) 등이고, 비휘발성 메모리(130)는, NAND flash memory, NOR flash memory 등 일 수 있다. According to one embodiment, the built-in memory 310 may be a Solid State Drive (SSD). The built-in memory 310 may be a volatile memory 120 or a non-volatile memory 130 . For example, the volatile memory 120 may be dynamic RAM (DRAM), static RAM (SRAM), or synchronous dynamic RAM (SDRAM), and the non-volatile memory 130 may be NAND flash memory, NOR flash memory, or the like.

외장 메모리(320)는 flash drive, 예를 들면, CF(compact flash), SD(secure digital), Micro-SD(micro secure digital), Mini-SD(mini secure digital), xD(extreme digital) 등을 더 포함할 수 있다. 외장 메모리(320)는 다양한 인터페이스를 통하여 전자 장치(100)와 기능적으로 연결될 수 있다. 일 실시예에 따르면, 외장 메모리(320)와 연결되는 전자장치(100)는 하드 드라이브와 같은 저장 장치(또는 저장 매체)를 더 포함할 수 있다.The external memory 320 is a flash drive, for example, compact flash (CF), secure digital (SD), micro secure digital (Micro-SD), mini secure digital (Mini-SD), extreme digital (xD), etc. can include more. The external memory 320 may be functionally connected to the electronic device 100 through various interfaces. According to an embodiment, the electronic device 100 connected to the external memory 320 may further include a storage device (or storage medium) such as a hard drive.

메모리(300)는 프로세서(110)의 처리 및 제어를 위한 프로그램(330)을 저장할 수도 있다. 본 개시의 일 실시예에 따른 메모리(300)는 하나 이상의 인스트럭션을 저장할 수 있다. The memory 300 may store a program 330 for processing and control of the processor 110 . Memory 300 according to an embodiment of the present disclosure may store one or more instructions.

본 개시의 일 실시예에 따른 메모리(300)는 커널(kernel)(230), 미들웨어(middleware)(340), 어플리케이션 프로그래밍 인터페이스(API: application programming interface)(330) 또는 어플리케이션(210)과 같은 프로그래밍 모듈을 포함할 수 있다. 커널(230), 미들웨어(340) 또는 어플리케이션 프로그래밍 인터페이스(API)(330)의 적어도 일부는 운영 체제(OS: Operating System)이라 불릴 수 있다. The memory 300 according to an embodiment of the present disclosure may be programmed such as a kernel 230, middleware 340, an application programming interface (API) 330, or an application 210. modules may be included. At least a part of the kernel 230, middleware 340, or application programming interface (API) 330 may be called an Operating System (OS).

커널(230)은 커널 외의 다른 프로그래밍 모듈(예를 들어, 미들웨어, API 또는 어플리케이션)에 구현된 동작 또는 기능을 실행하는 데 사용되는 시스템 리소스들(예를 들어, 프로세서(110) 또는 메모리(300))을 제어 또는 관리할 수 있다. 커널(230)은 미들웨어(340), API(330) 또는 어플리케이션(210)에서 전자 장치(100)의 개별 구성요소에 접근하여 제어 또는 관리할 수 있는 인터페이스를 제공할 수 있다. 커널(230)은 소프트웨어 측면에서 메모리 관리를 위해 도 2의 메모리 관리부(111)를 포함할 수 있다. Kernel 230 includes system resources (eg, processor 110 or memory 300) used to execute operations or functions implemented in other programming modules (eg, middleware, APIs, or applications) other than the kernel. ) can be controlled or managed. The kernel 230 may provide an interface through which the middleware 340 , API 330 , or application 210 can access, control, or manage individual components of the electronic device 100 . The kernel 230 may include the memory management unit 111 of FIG. 2 for memory management in terms of software.

미들웨어(340)는 API(330) 또는 어플리케이션(210)이 커널(230)과 통신하여 데이터를 주고받을 수 있도록 중개 역할을 수행할 수 있다. 또한, 미들웨어(340)는 어플리케이션으로부터 수신된 하나 이상의 작업 요청들을 우선 순위에 따라 처리할 수 있다. 어플리케이션으로부터 수신된 작업 요청들과 관련하여, 미들웨어(340)는 어플리케이션 중 적어도 하나 이상의 어플리케이션에 전자 장치(100)의 시스템 리소스를 사용할 수 있는 우선 순위를 배정하여 작업 요청에 대한 제어(예: 스케쥴링 또는 로드 밸런싱)을 수행할 수 있다.The middleware 340 may perform an intermediary role so that the API 330 or the application 210 communicates with the kernel 230 to exchange data. Also, the middleware 340 may process one or more task requests received from applications according to priority. Regarding task requests received from applications, the middleware 340 assigns a priority for using system resources of the electronic device 100 to at least one of the applications to control the task requests (eg, scheduling or load balancing).

API(330)는 어플리케이션(210)이 커널(230) 또는 미들웨어(340)에서 제공하는 기능을 제어하기 위한 인터페이스이다. 예를 들어, API(330)는 파일 제어, 창 제어, 화상 처리 또는 문자 제어 등을 위한 적어도 하나의 인터페이스 또는 함수(예: 명령어)를 포함할 수 있다. The API 330 is an interface for controlling functions provided by the kernel 230 or the middleware 340 by the application 210 . For example, the API 330 may include at least one interface or function (eg, command) for file control, window control, image processing, or text control.

어플리케이션(210)은 SMS/MMS 어플리케이션, 이메일 어플리케이션, 달력 어플리케이션, 알람 어플리케이션, 영상 재생 어플리케이션, 주식 및 투자 관련 어플리케이션, 건강 관리(health care) 어플리케이션(예: 운동량 또는 혈당 등을 측정하는 어플리케이션) 또는 환경 정보 어플리케이션(예: 기압, 습도 또는 온도 정보 등을 제공하는 어플리케이션) 등을 포함할 수 있다. The application 210 may be an SMS/MMS application, an email application, a calendar application, an alarm application, a video playback application, a stock and investment related application, a health care application (eg, an application for measuring exercise or blood sugar), or an environment. It may include an information application (eg, an application providing air pressure, humidity, or temperature information) and the like.

그러나 도시된 구성요소 모두가 필수구성요소인 것은 아니다. 도시된 구성요소보다 많은 구성요소에 의해 전자 장치(100)가 구현될 수도 있고, 그보다 적은 구성요소에 의해서도 전자 장치(100)가 구현될 수 있다. However, not all illustrated components are essential components. The electronic device 100 may be implemented with more components than those illustrated, or the electronic device 100 may be implemented with fewer components.

도 4는 본 개시의 일 실시예에 따른 메모리의 가용용량을 확보하는 방법을 구체적으로 나타내는 도면이다.4 is a diagram specifically illustrating a method of securing an available capacity of a memory according to an embodiment of the present disclosure.

도 4에 따르면, 전자 장치(100)의 프로세서(110)는 메모리에 저장된 데이터를 스왑공간(140)으로 스왑-아웃할 수 있다. 메모리는 휘발성 메모리(120), 비휘발성 메모리(130), 외장 메모리(320) 등을 포함할 수 있으나, 이에 한정되는 것은 아니다. 스왑공간(140)은 예를 들어, 휘발성 메모리(120)의 일부 공간, 비휘발성 메모리(130)의 일부 공간일 수 있으나, 이에 한정되는 것은 아니다. 데이터는 프로세서(110)에 의해 실행되는 프로세스 또는 어플리케이션에 의해 사용되는 데이터, 동적 라이브러리 파일을 포함할 수 있으나, 이에 한정되는 것은 아니다. 예를 들어, 데이터는 지정된 크기(예를 들어, 4Kbyte)의 단위(예를 들어, 페이지(page))로 처리될 수 있다. 설명의 편의를 위해 데이터 단위가 페이지인 경우를 예시로 설명한다. 페이지는 힙, 스택, 공유 메모리, SO(shared object) 페이지 등을 포함할 수 있으나, 이에 한정되는 것은 아니다.According to FIG. 4 , the processor 110 of the electronic device 100 may swap out data stored in the memory to the swap space 140 . The memory may include a volatile memory 120, a non-volatile memory 130, an external memory 320, and the like, but is not limited thereto. The swap space 140 may be, for example, a partial space of the volatile memory 120 or a partial space of the non-volatile memory 130, but is not limited thereto. The data may include data used by a process or application executed by the processor 110 and a dynamic library file, but is not limited thereto. For example, data may be processed in units (eg, pages) of a designated size (eg, 4Kbyte). For convenience of description, a case where the data unit is a page will be described as an example. The page may include, but is not limited to, a heap, a stack, a shared memory, a shared object (SO) page, and the like.

일 실시예에서, 프로세서(110)는 휘발성 메모리(120)에 저장된 프로세스를 스왑 파일(420) 단위로 비휘발성 메모리(130)로 스왑-아웃할 수 있다. 여기서 스왑 파일(420)은 스왑-아웃, 스왑-인 될 수 있는, 여러 개의 페이지로 구성된 파일의 단위를 의미할 수 있다. 스왑 파일(420) 갯수는 프로세스의 크기와 스왑공간(140)의 크기에 따라 결정될 수 있고, 1개 이상이 될 수 있다. 예를 들어, RAM에 로딩되어 실행 중인 프로세스의 크기가 96Mbyte(24,000 pages)인 경우, 스왑 파일(420)이 3개로 구분될 수 있다. 스왑 파일(420)은 다양한 갯수의 페이지로 구성될 수 있다. 예를 들어, 각 스왑 파일(420)은 10,000 페이지, 10,000 페이지, 4,000 페이지로 구성될 수 있다.In one embodiment, the processor 110 may swap out processes stored in the volatile memory 120 to the non-volatile memory 130 in units of the swap file 420 . Here, the swap file 420 may mean a unit of a file composed of several pages that can be swapped out and swapped in. The number of swap files 420 may be determined according to the size of the process and the size of the swap space 140, and may be one or more. For example, when the size of a process loaded into RAM and running is 96Mbyte (24,000 pages), the swap file 420 may be divided into three. The swap file 420 may be composed of various numbers of pages. For example, each swap file 420 may consist of 10,000 pages, 10,000 pages, or 4,000 pages.

스왑 파일(420) 별 정보는 운영체제 레벨에서 비휘발성 메모리(130)의 주소로 매핑될 수 있다. 예를 들어, swap extent(430)라는 매핑 테이블을 이용하여 스왑 파일(420)이 비휘발성 메모리(130)의 특정 주소에 저장될 수 있다.Information for each swap file 420 may be mapped to an address of the non-volatile memory 130 at the operating system level. For example, the swap file 420 may be stored at a specific address of the non-volatile memory 130 using a mapping table called swap extent 430 .

Start_page는 스왑 파일(420)의 첫 번째 페이지를 결정하고, nr_page는 스왑 파일(420)을 구성하는 페이지 개수를 결정하고, start_block은 비휘발성 메모리(130)에서 스왑 파일(420)이 저장될 시작 위치를 결정한다. 예를 들어, 첫 번째 스왑 파일(411)은 프로세스의 페이지 중 0 페이지로 시작하여(start_page 0) 10,000개의 페이지로 구성되고(nr_pages 10000), 비휘발성 메모리(130)의 블록 주소 중 10,000을 시작위치로 저장된다(start_block 10000).Start_page determines the first page of the swap file 420, nr_page determines the number of pages constituting the swap file 420, and start_block is the starting position where the swap file 420 is to be stored in the non-volatile memory 130. decide For example, the first swap file 411 starts with page 0 of the pages of the process (start_page 0) and consists of 10,000 pages (nr_pages 10000), and sets 10,000 of the block addresses of the non-volatile memory 130 as the starting position. It is saved as (start_block 10000).

일 실시예에서, 프로세서(110)는 비휘발성 메모리(130)의 수명에 기초하여 스왑 파일을 저장한다. 비휘발성 메모리(130)는 블럭(block) 단위로 구성될 수 있고, 블록은 여러 개의 셀(cell)로 구성될 수 있다. 예를 들어, 1개 블록은 100개의 셀로 구성될 수 있다. 반도체 소자의 특성 상 NAND Flash의 수명이 제한되어 있으므로, 프로세서(110)는 많이 쓰이지 않은 블록을 우선순위로 스왑 파일을 저장할 수 있다. 스왑 파일(420)은 반드시 블록에 연속적으로 저장될 필요가 없다. 예를 들어, 도 4를 참조하면, 첫 번째 스왑 파일은 비휘발성 메모리(130)의 블록 주소 10,000을 시작위치로 하여 저장되고, 두 번째 스왑 파일(412)은 블록 주소 60,000을 시작위치로 하여 저장되고, 세 번째 스왑 파일(413)은 블록 주소 30,000을 시작위치로 하여 저장된다.In one embodiment, processor 110 stores a swap file based on the age of non-volatile memory 130 . The non-volatile memory 130 may be configured in block units, and a block may be configured with several cells. For example, one block may consist of 100 cells. Since the lifespan of NAND flash is limited due to the characteristics of semiconductor devices, the processor 110 may store a swap file with a block that is not frequently used as a priority. The swap file 420 is not necessarily stored contiguously in blocks. For example, referring to FIG. 4, the first swap file is stored at block address 10,000 of the non-volatile memory 130 as a starting position, and the second swap file 412 is stored at block address 60,000 as a starting position. and the third swap file 413 is stored with the block address 30,000 as the starting position.

도 5는 본 개시의 일 실시예에 따른 메모리의 가용용량을 확보하기 위한 순서도이다.5 is a flowchart for securing available capacity of a memory according to an embodiment of the present disclosure.

단계 S510에서, 전자 장치(100)는 제 1 메모리의 가용 용량을 확인한다. In step S510, the electronic device 100 checks the available capacity of the first memory.

일 실시예에서, 전자 장치(100)는 제 2 메모리에 저장된 제 1 프로세스를 제 1 메모리에 로딩하기 위하여 제 1 메모리의 여유 공간을 확인할 수 있다. 일 실시예에서, 제 1 메모리는 휘발성 메모리일 수 있다. 일 실시예에서, 제 2 메모리는 비휘발성 메모리일 수 있다.In one embodiment, the electronic device 100 may check the free space of the first memory in order to load the first process stored in the second memory into the first memory. In one embodiment, the first memory may be a volatile memory. In one embodiment, the second memory may be a non-volatile memory.

단계 S520에서, 전자 장치(100)는 제 1 프로세스 특성에 기초하여 프로세스를 제 1 메모리 또는 제 2 메모리로 스왑-아웃할지를 식별할 수 있다.In step S520, the electronic device 100 may identify whether to swap out the process to the first memory or the second memory based on the first process characteristic.

일 실시예에서, 제 1 프로세스의 특성은 해당 프로세스를 포함하는 어플리케이션의 특성에 따라 결정될 수 있다. 예를 들어, 제 1 프로세스의 특성은 프로세스의 반응 시간 및 상태 보존 정도 중 적어도 하나를 포함할 수 있으나, 이에 한정되는 것은 아니다. In one embodiment, the characteristics of the first process may be determined according to the characteristics of an application including the corresponding process. For example, the characteristics of the first process may include, but are not limited to, at least one of a response time and state preservation degree of the process.

일 실시예에서, 제 1 메모리에 로딩 중인 제 1 프로세스를 제 1 메모리의 스왑공간에 스왑-아웃하는 것이 제 2 메모리의 스왑공간에 스왑-아웃하는 것보다 이후 스왑-인 속도가 빠르기 때문에, 실행 시간이 중요한 타입의 어플리케이션의 경우(예를 들어, 메신저 어플리케이션) 제 1 메모리에 스왑공간을 할당함으로써 사용자 경험을 개선할 수 있다.In one embodiment, since swapping out the first process loading into the first memory to the swap space of the first memory is faster than swapping it out to the swap space of the second memory, the execution In the case of a time-critical type of application (eg, a messenger application), user experience can be improved by allocating swap space to the first memory.

단계 S530에서, 전자 장치(100)는 제 1 메모리 또는 제 2 메모리에 스왑공간(140)을 할당할 수 있다.In step S530, the electronic device 100 may allocate the swap space 140 to the first memory or the second memory.

일 실시예에서, 전자 장치(100)는 메모리에 스왑공간(140)을 필요한 크기만큼 할당할 수 있다. 제 1 메모리의 일부 공간을 물리적으로 고정된 파티션(Partitioning)으로 구분하여 스왑공간(140)으로 사용한다면, 스왑공간을 사용하지 않을 경우에 메모리의 저장공간이 낭비될 수 있다. 또한, 메모리에서 고정된 저장공간만을 스왑공간(140)으로 사용한다면, 스왑공간(140)이 부족한 경우 OOMK 작업에 의해 프로세스가 강제로 종료되어 사용자 경험을 악화시키는 문제점이 있다. In one embodiment, the electronic device 100 may allocate a required size of the swap space 140 to memory. If a part of the first memory is physically divided into fixed partitions and used as the swap space 140, the storage space of the memory may be wasted when the swap space is not used. In addition, if only the storage space fixed in the memory is used as the swap space 140, the process is forcibly terminated by the OOMK operation when the swap space 140 is insufficient, which deteriorates the user experience.

반면, 일 실시예에 따르면, 전자 장치(100)는 스왑-아웃할 프로세스 또는 페이지의 크기만큼(예를 들어, 파일 또는 페이지 단위로) 메모리에 스왑공간을 동적으로 확보할 수 있다. 예를 들어, 정해진 파티션이 없으므로 필요할 때마다 추가로 메모리에 스왑공간을 할당하여 데이터를 저장할 수 있다. 이로써, 실행 중인 프로세스가 강제 종료되는 OOMK 작업을 최대한 지연시킬 수 있다.On the other hand, according to an embodiment, the electronic device 100 may dynamically secure a swap space in memory as much as the size of a process or page to be swapped out (eg, in a file or page unit). For example, since there is no fixed partition, swap space can be additionally allocated in memory to store data whenever necessary. In this way, OOMK tasks that forcefully terminate running processes can be delayed as much as possible.

단계 S540에서, 전자 장치(100)는 제 1 메모리 또는 제 2 메모리에 제 1 프로세스의 페이지를 스왑-아웃 할 수 있다. 일 실시예에서, 프로세스의 전체 또는 일부 페이지가 스왑-아웃될 수 있다. 일 실시예에서, SO 페이지가 일반 페이지보다 먼저 스왑-아웃될 수 있다. SO 페이지는 다른 어플리케이션들에 의해 호출될 가능성이 높은 페이지라는 특성을 고려할 때, 일반 페이지보다 먼저 동적으로 스왑공간에 스왑-아웃함으로써, SO 페이지를 포함하는 프로세스가 OOMK에 의해 강제종료되는 상황을 막을 수 있다. In step S540, the electronic device 100 may swap out the page of the first process to the first memory or the second memory. In one embodiment, all or some pages of a process may be swapped out. In one embodiment, SO pages may be swapped out before normal pages. Considering that the SO page is a page that is highly likely to be called by other applications, it is dynamically swapped out to the swap space before a normal page to prevent the process including the SO page from being forcibly terminated by OOMK. can

단계 S550에서, 전자 장치(100)는 스왑공간(140)의 페이지가 스왑-인되는지 확인한다. 일 실시예에서, 한 번 실행했던 어플리케이션을 다시 사용자가 실행하려는 경우, 스왑공간(140)에 스왑-아웃된 페이지가 휘발성 메모리로 다시 스왑-인될 수 있다. In step S550, the electronic device 100 determines whether a page of the swap space 140 is swapped in. In one embodiment, when a user intends to re-execute an application that has been executed once, pages swapped-out in the swap space 140 may be swapped-in again to volatile memory.

단계 S560에서, 전자 장치(100)는 제 1 메모리 또는 제 2 메모리의 스왑공간을 해제한다. 고정적인 스왑공간을 할당하는 경우, 프로세스가 스왑-인되어 스왑공간이 비어 있는 경우에도 메모리의 일부공간이 스왑공간으로 잡혀있어서, 저장공간을 낭비하는 문제점이 있다. 일 실시예에서, 전자장치(100)는 메모리의 일부 스왑공간이 스왑-인을 통해 비게 된다면, 그 즉시 메모리의 스왑공간을 해제하여 일반적인 저장 공간으로 활용할 수 있게 한다.In step S560, the electronic device 100 releases the swap space of the first memory or the second memory. In the case of allocating a fixed swap space, even when a process is swapped in and the swap space is empty, a part of the memory space is held as a swap space, which wastes storage space. In one embodiment, if a part of the swap space of the memory is emptied through swap-in, the electronic device 100 immediately releases the swap space of the memory so that it can be used as a general storage space.

도 6은 본 개시의 일 실시예에 따른 어플리케이션의 타입에 따라 메모리 관리하는 방법을 나타내는 순서도이다.6 is a flowchart illustrating a method of managing a memory according to an application type according to an embodiment of the present disclosure.

단계 S610에서, 전자 장치(100)는 제 1 메모리에 실행 중인 어플리케이션의 타입에 따라 어플리케이션을 분류할 수 있다. 어플리케이션의 타입은 프로세스의 반응 시간 및 상태 보존 정도 중 적어도 하나에 의해 분류할 수 있으나, 이에 한정되는 것은 아니다. In step S610, the electronic device 100 may classify applications according to the type of applications being executed in the first memory. The type of application may be classified according to at least one of process response time and state preservation degree, but is not limited thereto.

일 실시예에서, 어플리케이션의 타입은 기 설정된 분류 기준에 따라 구분되거나 전자 장치(100) 사용자의 어플리케이션 사용 빈도 또는 사용 패턴에 따라 구분될 수 있다. 예를 들어, 반응 시간이 중요한 어플리케이션 타입에는 메신저 어플리케이션, SNS 어플리케이션 등이 있을 수 있다. 예를 들어, 상태 보존이 중요한 어플리케이션 타입에는 주식, 영상 재생, 인터넷 어플리케이션 등이 있을 수 있으나, 이에 한정되는 것은 아니다. 또한, 사용자에 따라 어플리케이션 타입의 구분은 다를 수 있다. In one embodiment, the type of application may be classified according to a predetermined classification criterion or may be classified according to the frequency or usage pattern of the user of the electronic device 100 . For example, application types in which response time is important may include messenger applications and SNS applications. For example, application types in which state preservation is important may include stocks, video playback, and Internet applications, but are not limited thereto. In addition, classification of application types may be different according to users.

단계 S620에서, 전자 장치(100)는 반응 시간이 중요한 어플리케이션 타입인 경우, 해당 어플리케이션 또는 어플리케이션의 일부 프로세스를 스왑-아웃하기 위해 제 1 메모리에 스왑공간을 할당한다. 예를 들어, 어플리케이션이 로딩되는 제 1 메모리에 스왑공간을 할당하는 경우, 다른 메모리에 스왑공간을 할당하는 것보다 더 빠르게 스왑-인, 스왑-아웃 할 수 있어서 프로세스의 재실행 속도를 높일 수 있다. 예를 들어, 비휘발성 메모리(130)에 스왑공간을 할당하는 것보다 휘발성 메모리(120)에 스왑공간을 할당하는 경우 더 빠르게 스왑-인, 스왑-아웃 할 수 있어서 프로세스의 재실행 속도를 높일 수 있기 때문에, 제 1 메모리가 휘발성 메모리(120)일 수 있다. In step S620, if the response time is an important application type, the electronic device 100 allocates a swap space in the first memory to swap out the corresponding application or some processes of the application. For example, when a swap space is allocated to the first memory in which an application is loaded, it is possible to swap-in and swap-out faster than allocating a swap space to another memory, thereby increasing process re-execution speed. For example, if the swap space is allocated to the volatile memory 120 rather than the swap space allocated to the non-volatile memory 130, swap-in and swap-out can be performed more quickly, thereby increasing the re-execution speed of the process. Therefore, the first memory may be the volatile memory 120 .

단계 S630에서, 전자 장치(100)는 어플리케이션의 타입이 분류되지 않는 경우, 해당 어플리케이션 또는 어플리케이션의 일부 프로세스를 강제 종료하여 저장공간을 확보한다. 예를 들어, 전자 장치(100)에 기 설정된 분류 기준에 속하지 않는 어플리케이션의 경우, 스왑-아웃할 필요가 없으므로 OOMK 동작이 실행되어 해당 어플리케이션이 강제 종료된다.In step S630, when the type of application is not classified, the electronic device 100 forcibly terminates the corresponding application or some processes of the application to secure storage space. For example, in the case of an application that does not belong to a classification standard set in the electronic device 100, since there is no need to swap out, an OOMK operation is executed and the corresponding application is forcibly terminated.

단계 S640에서, 전자 장치(100)는 상태 보존이 중요한 어플리케이션 타입인 경우, 해당 어플리케이션 또는 어플리케이션의 일부 프로세스 또는 일부 페이지를 스왑-아웃하기 위해 제 2 메모리에 스왑공간을 할당한다. In step S640, the electronic device 100 allocates a swap space in the second memory to swap out the corresponding application or some processes or some pages of the application if the state preservation is an important application type.

도 7은 본 개시의 일 실시예에 따른 어플리케이션의 타입에 따라 메모리 관리하는 방법을 더 구체적으로 나타내는 순서도이다.7 is a flowchart illustrating a method of managing a memory according to an application type according to an embodiment of the present disclosure in more detail.

단계 S710에서, 전자 장치(100)는 제 1 메모리에 실행 중인 어플리케이션의 타입에 따라 어플리케이션을 분류할 수 있다. 어플리케이션의 타입은 프로세스의 반응 시간 및 상태 보존 정도 중 적어도 하나에 의해 분류할 수 있으나, 이에 한정되는 것은 아니다. In step S710, the electronic device 100 may classify applications according to the type of applications being executed in the first memory. The type of application may be classified according to at least one of process response time and state preservation degree, but is not limited thereto.

단계 S720에서, 전자 장치(100)는 반응 시간이 중요한 어플리케이션 타입인 경우, 해당 어플리케이션 또는 어플리케이션의 일부 프로세스 또는 일부 페이지를 스왑-아웃하기 위해 제 1 메모리에 스왑공간을 할당한다. 예를 들어, 제 1 메모리가 휘발성 메모리(120)인 경우, 비휘발성 메모리(130)에 스왑공간을 할당하는 것보다 더 빠르게 스왑-인, 스왑-아웃 할 수 있어서 프로세스의 재실행 속도를 높일 수 있다. In step S720, if the response time is an important application type, the electronic device 100 allocates a swap space in the first memory to swap out the corresponding application or some processes or some pages of the application. For example, when the first memory is the volatile memory 120, it is possible to swap-in and swap-out faster than allocating swap space to the non-volatile memory 130, thereby increasing the process re-execution speed. .

단계 S730에서, 어플리케이션의 타입이 분류되지 않는 경우, 해당 어플리케이션 또는 어플리케이션의 일부 프로세스를 강제 종료하여 저장공간을 확보한다. 예를 들어, 전자 장치(100)에 기 설정된 분류 기준에 속하지 않는 어플리케이션의 경우, 스왑-아웃할 필요가 없으므로 OOMK가 실행되어 해당 어플리케이션이 강제 종료된다.In step S730, if the type of application is not classified, the corresponding application or some processes of the application are forcibly terminated to secure storage space. For example, in the case of an application that does not belong to a classification criterion set in the electronic device 100, since there is no need to swap out, OOMK is executed and the corresponding application is forcibly terminated.

단계 S740에서, 전자 장치(100)는 상태 보존이 중요한 어플리케이션 타입인 경우, 어플리케이션의 SO 페이지가 다른 어플리케이션으로부터 참조되는 횟수가 기 설정된 임계치 이상인지 확인한다. 기 설정된 임계치 이상인 경우, 해당 어플리케이션 또는 어플리케이션의 일부 프로세스 또는 일부 페이지를 스왑-아웃하기 위하여 제 1 메모리에 스왑공간을 할당한다. 예를 들어, 해당 어플리케이션의 SO 페이지를 참조하는 다른 어플리케이션이 많을 수록, 어플리케이션이 로딩되는 제 1 메모리에 스왑공간을 할당하는 경우, 다른 메모리에 스왑공간을 할당하는 것보다 더 빠르게 스왑-인, 스왑-아웃 할 수 있어서 해당 어플리케이션의 재실행 속도를 높일 수 있다. In step S740, if the state preservation is an important application type, the electronic device 100 checks whether the number of references of the SO page of the application from other applications is equal to or greater than a preset threshold. If the value is equal to or greater than the preset threshold, a swap space is allocated to the first memory in order to swap out the corresponding application or some processes or some pages of the application. For example, the more other applications refer to the SO page of the corresponding application, the faster swap-in and swap occurs when swap space is allocated to the first memory where the application is loaded than when swap space is allocated to other memories. -It can be out, so it can increase the re-execution speed of the application.

단계 S750에서, 전자 장치(100)는 어플리케이션의 SO 페이지가 다른 어플리케이션으로부터 참조되는 횟수가 기 설정된 임계치 이상이 아닌 경우, 해당 어플리케이션 또는 어플리케이션의 일부 프로세스 또는 일부 페이지를 스왑-아웃하기 위하여 제 2 메모리에 스왑공간을 할당한다. In step S750, the electronic device 100, when the number of references of the SO page of the application from other applications is not equal to or greater than a preset threshold, stores the corresponding application or some processes or some pages of the application in the second memory to swap out. Allocate swap space.

도 8은 본 개시의 일 실시예에 따른 페이지를 메모리에서 제거하는 방법을 구체적으로 나타내는 순서도이다. 도 8은 도 5의 단계 S530을 더 구체적으로 나타내는 단계이다.8 is a flowchart specifically illustrating a method of removing a page from a memory according to an exemplary embodiment of the present disclosure. FIG. 8 is a step showing step S530 of FIG. 5 in more detail.

단계 S810에서, 전자 장치(100)는 제 1 메모리의 스왑공간이 충분한지 확인할 수 있다. 일 실시예에서, 전자 장치(100)는 전자 장치(100)는 제 1 메모리의 일부 영역을 스왑공간으로 할당하는데 있어서, 제 1 메모리(예를 들어, 휘발성 메모리(120), RAM)의 스왑공간을 동적으로 확보할 수 있는 공간이 물리적 한계에 이르렀는지 확인한다. 구체적으로, 전자 장치(100)는 제 1 메모리의 스왑공간을 도 5에 의해 추가로 할당하려고 하였으나, 제 1 메모리 공간이 물리적 한계에 이르러 더 이상의 스왑공간을 확보할 수 없는지 확인한다.In step S810, the electronic device 100 may check whether the swap space of the first memory is sufficient. In one embodiment, the electronic device 100 allocates a partial area of the first memory as a swap space, the swap space of the first memory (eg, volatile memory 120, RAM) Check if the space that can be dynamically secured has reached the physical limit. Specifically, the electronic device 100 tries to additionally allocate the swap space of the first memory as shown in FIG. 5 , but checks whether no more swap space can be secured because the first memory space reaches a physical limit.

단계 S820에서, 전자 장치(100)는 제 1 프로세스의 페이지가 다른 프로세스로부터 참조되는 횟수를 확인할 수 있다. In step S820, the electronic device 100 may check the number of times the page of the first process is referred to by another process.

단계 S830에서, 전자 장치(100)는 제 1 메모리에 쓰여진 페이지 중 복수의 프로세스로부터 참조되는 횟수가 기 설정된 임계치 이하인 제 1 페이지를 결정할 수 있다. 일 실시예에서, 기 설정된 임계치는 메모리 공간이 부족할 때마다 n번 씩 증가할 수 있다. 예를 들어, 최초에는 프로세스에 의한 참조 횟수가 1번인 페이지를 제 1 페이지로 결정할 수 있다. 이후에도 메모리 공간이 부족한 경우 참조 횟수가 2번인 페이지를 제 1 페이지로 결정할 수 있다.In step S830, the electronic device 100 may determine a first page whose number of references from a plurality of processes is equal to or less than a preset threshold among pages written in the first memory. In one embodiment, the preset threshold may be increased n times whenever memory space is insufficient. For example, a page whose number of references by a process is 1 may be initially determined as the first page. Even after that, if the memory space is insufficient, a page having a reference count of 2 may be determined as the first page.

단계 S840에서, 전자 장치(100)는 제 1 페이지를 제 1 메모리에서 제거할 수 있다. 일 실시예에서, 제 1 페이지는 SO 페이지 또는 특정 페이지를 포함할 수 있다. 프로세스 전체를 제거하는 대신 프로세스의 일부 페이지를 제거함으로써 프로세스 상태를 보존할 수 있다. 예를 들어, 프로세스의 SO 페이지를 제거하는 경우, 프로세스 전체를 제거하는 것에 비하여 이후 다시 로드하는 경우 실행 속도가 빠르므로, 프로세스 응답 속도를 개선할 수 있다. In step S840, the electronic device 100 may remove the first page from the first memory. In one embodiment, the first page may include an SO page or a specific page. Instead of destroying the entire process, we can preserve the state of the process by destroying some pages of the process. For example, when the SO page of a process is removed, the execution speed is faster when reloaded later than when the entire process is removed, so process response speed can be improved.

단계 S840 이후에 단계 S540 또는 단계 S910이 수행될 수 있다. 일 실시예에서, 제 1 페이지를 제 1 메모리에서 제거함으로써 제 1 메모리의 스왑공간이 확보될 수 있다. 이후 제 1 메모리에 실행 중이던 프로세스 또는 프로세스의 페이지가 제 1 메모리의 스왑공간으로 스왑-아웃될 수 있다.After step S840, step S540 or step S910 may be performed. In one embodiment, a swap space of the first memory may be secured by removing the first page from the first memory. Thereafter, a process running in the first memory or a page of the process may be swapped out to the swap space of the first memory.

도 9는 본 개시의 일 실시예에 따른 페이지를 메모리에서 제거하는 방법을 구체적으로 나타내는 순서도이다. 도 9는 도 5의 단계 S530을 더 구체적으로 나타내는 단계일 수 있고, 도 8의 단계 S840이 수행된 이후에 수행될 수 있다.9 is a flowchart illustrating a method of removing a page from a memory according to an exemplary embodiment of the present disclosure. 9 may be a step showing step S530 of FIG. 5 in more detail, and may be performed after step S840 of FIG. 8 is performed.

단계 S910에서, 전자 장치(100)는 제 2 메모리의 스왑공간이 충분한지 확인할 수 있다. 일 실시예에서, 전자 장치(100)는 제 2 메모리의 일부 영역을 스왑공간으로 할당하는데 있어서, 제 2 메모리(예를 들어, 휘발성 메모리, RAM)의 스왑공간을 동적으로 확보할 수 있는 공간이 물리적 한계에 이르렀는지 확인한다. 구체적으로, 전자 장치(100)는 제 2 메모리의 스왑공간을 도 5에 의해 추가로 할당하려고 하였으나, 제 2 메모리 공간이 물리적 한계에 이르러 더 이상의 스왑공간을 확보할 수 없는지 확인한다. In step S910, the electronic device 100 may check whether the swap space of the second memory is sufficient. In one embodiment, when the electronic device 100 allocates a partial area of the second memory as a swap space, a space capable of dynamically securing the swap space of the second memory (eg, volatile memory, RAM) is required. Check if you have reached your physical limit. Specifically, the electronic device 100 attempts to additionally allocate the swap space of the second memory as shown in FIG. 5 , but checks whether no more swap space can be secured because the second memory space has reached its physical limit.

일 실시예에서, 전자 장치(100)는 도 8에 따라 제 1 페이지를 제 1 메모리에서 제거한 후에도 제 1 메모리에 새로운 프로세스를 할당하기 위한 가용용량이 부족한 경우, 제 1 메모리에 실행 중인 프로세스 또는 해당 프로세스의 페이지를 스왑-아웃하기 위하여 제 2 메모리의 스왑공간이 충분한지 확인할 수 있다. In one embodiment, when the available capacity for allocating a new process to the first memory is insufficient even after removing the first page from the first memory according to FIG. It may be checked whether the swap space of the second memory is sufficient to swap out the page of the process.

단계 S920에서, 전자 장치(100)는 제 2 프로세스의 페이지가 제 2 메모리에 스왑-아웃된 시간을 기준으로 페이지의 순위를 정렬할 수 있다. 예를 들어, 각 페이지마다 스왑-아웃된 때부터 현재 시점까지의 시간을 계산 하여, 오름차순으로 페이지의 순서를 정할 수 있다. 스왑-아웃된 페이지 중 오랫동안 스왑-인되지 않은 페이지의 경우, 다시 스왑-인될 가능성이 낮으므로 제거 대상이 될 수 있다.In step S920, the electronic device 100 may sort the order of the pages based on the swapped-out time of the pages of the second process to the second memory. For example, the order of pages can be determined in ascending order by calculating the time from swap-out for each page to the current point in time. Pages that have not been swapped-in for a long time among swapped-out pages are unlikely to be swapped-in again, and thus may be subject to removal.

단계 S930에서, 전자 장치(100)는 스왑-아웃된 시간이 긴 페이지를 제 2 페이지로 결정할 수 있다. 일 실시예에서, 단계 S920에서 정렬했을 때 가장 스왑-아웃된 시간이 긴 페이지를 제 2 페이지로 결정할 수 있다. 이후에도 메모리 공간이 부족한 경우 그 다음으로 스왑-아웃된 시간이 긴 SO 페이지를 제 2 페이지로 결정할 수 있다.In step S930, the electronic device 100 may determine a page that has been swapped out for a long time as the second page. In one embodiment, when the pages are sorted in step S920, a page that has been swapped out for the longest time may be determined as the second page. If there is still insufficient memory space thereafter, an SO page that has been swapped out for the next longest time may be determined as the second page.

단계 S940에서, 전자 장치(100)는 제 2 페이지를 제 2 메모리에서 제거할 수 있다. 일 실시예에서, 제 2 페이지는 SO 페이지 또는 특정 페이지를 포함할 수 있다. 프로세스 전체를 제거하는 대신 프로세스의 일부 페이지를 제거함으로써 프로세스 상태를 보존할 수 있다. 예를 들어, 프로세스의 SO 페이지를 제거하는 경우, 프로세스 전체를 제거하는 것에 비하여 이후 다시 로드하는 경우 실행 속도가 빠르므로, 프로세스 응답 속도를 개선할 수 있다.In step S940, the electronic device 100 may remove the second page from the second memory. In one embodiment, the second page may include an SO page or a specific page. Instead of destroying the entire process, we can preserve the state of the process by destroying some pages of the process. For example, when the SO page of a process is removed, the execution speed is faster when reloaded later than when the entire process is removed, so process response speed can be improved.

단계 S940 이후에 단계 S540이 수행될 수 있다. 일 실시예에서, 제 2 페이지를 제 2 메모리에서 제거함으로써 제 2 메모리의 스왑공간이 확보될 수 있다. 이후 제 1 메모리에 실행 중이던 프로세스 또는 프로세스의 페이지가 제 2 메모리의 스왑공간으로 스왑-아웃될 수 있다.Step S540 may be performed after step S940. In one embodiment, the swap space of the second memory may be secured by removing the second page from the second memory. Thereafter, a process or a page of a process running in the first memory may be swapped out to a swap space of the second memory.

도 10은 본 개시의 일 실시예에 따른 실행 중인 프로세스를 종료하는 방법을 나타내는 순서도이다. 도 10은 도 8의 단계 S840이 수행된 이후 또는 도 9의 단계 S940이 수행된 이후에 수행될 수 있다.10 is a flowchart illustrating a method of terminating a running process according to an embodiment of the present disclosure. 10 may be performed after step S840 of FIG. 8 or after step S940 of FIG. 9 is performed.

단계 S1010에서, 전자 장치(100)는 사용자 어플리케이션을 실행할 수 있다. In step S1010, the electronic device 100 may execute a user application.

단계 S1020에서, 전자 장치(100)는 메모리 가용 용량이 부족한지 확인할 수 있다. 일 실시예에서, 전자 장치(100)는 스왑공간의 동적 할당 및 프로세스의 페이지 제거에도 불구하고 새로운 프로세스를 할당하기 위한 메모리의 가용 용량이 부족한 경우, 메모리에 실행 중인 적어도 하나의 프로세스를 강제로 종료시킬 수 있다. In step S1020, the electronic device 100 may check whether the available memory capacity is insufficient. In one embodiment, the electronic device 100 forcibly terminates at least one process running in the memory when available capacity of memory for allocating a new process is insufficient despite dynamic allocation of swap space and removal of pages of a process. can make it

단계 S1030에서, 전자 장치(100)는 어플리케이션 구동 시 소요 시간을 계산할 수 있다. 일 실시예에서, 전자 장치(100)는 해당 어플리케이션을 구동할 때 시간이 가장 오래 걸리는 동작의 소요 시간을 계산할 수 있다. 예를 들어, 전자 장치(100)는 SO 심볼 탐색 시간 또는 XML-UI 변환 시간을 계산할 수 있다. In step S1030, the electronic device 100 may calculate the required time for running the application. In one embodiment, the electronic device 100 may calculate the required time of the operation that takes the longest time when driving the corresponding application. For example, the electronic device 100 may calculate SO symbol search time or XML-UI conversion time.

단계 S1040에서, 전자 장치(100)는 계산된 시간에 기초하여 프로세스의 종료 순서를 결정할 수 있다. 예를 들어, 프로세스 별로 계산된 시간이 짧은 순서대로 프로세스 종료 순서를 결정할 수 있다. 구체적으로, 특정 프로세스가 상대적으로 더 긴 구동 시간이 필요한 경우 종료 순서를 늦춰, 가능한 한 오랫동안 메모리에 저장되게 할 수 있다.In step S1040, the electronic device 100 may determine the process termination order based on the calculated time. For example, the process termination sequence may be determined in the order of shorter times calculated for each process. Specifically, if a specific process needs a relatively longer running time, the shutdown sequence can be delayed so that it is stored in memory for as long as possible.

단계 S1050에서, 전자 장치(100)는 가장 높은 순위의 프로세스를 종료할 수 있다. 일 실시예에서, 전자장치(100)는 그 후에도 메모리 가용용량이 부족한 경우, 그 다음 순위가 높은 프로세스를 종료할 수 있다.In step S1050, the electronic device 100 may end the highest-ranking process. In one embodiment, the electronic device 100 may end a process having a higher priority if the available memory capacity is still insufficient.

도 11은 본 개시의 일 실시예에 따른 실행 중인 프로세스를 종료하는 방법을 더 구체적으로 나타내는 순서도이다.11 is a flowchart more specifically illustrating a method of terminating a running process according to an embodiment of the present disclosure.

단계 S1110에서, 전자 장치(100)는 사용자 어플리케이션을 실행할 수 있다. In step S1110, the electronic device 100 may execute a user application.

단계 S1120에서, 전자 장치(100)는 메모리 가용 용량이 부족한지 확인할 수 있다. 일 실시예에서, 전자 장치(100)는 스왑공간의 동적 할당 및 프로세스의 페이지 제거에도 불구하고 새로운 프로세스를 할당하기 위한 메모리의 가용 용량이 부족한 경우, 메모리에 실행 중인 적어도 하나의 프로세스를 강제로 종료시킬 수 있다. In step S1120, the electronic device 100 may check whether the available memory capacity is insufficient. In one embodiment, the electronic device 100 forcibly terminates at least one process running in the memory when available capacity of memory for allocating a new process is insufficient despite dynamic allocation of swap space and removal of pages of a process. can make it

단계 S1130에서, 전자 장치(100)는 어플리케이션 구동 시 소요 시간을 계산할 수 있다. 일 실시예에서, 전자 장치(100)는 해당 어플리케이션을 구동할 때 시간이 가장 오래 걸리는 동작의 소요 시간을 계산할 수 있다. 구체적으로, SO 심볼 탐색 시간과 XML-UI 변환 시간을 계산할 수 있다.In step S1130, the electronic device 100 may calculate the required time for running the application. In one embodiment, the electronic device 100 may calculate the required time of the operation that takes the longest time when driving the corresponding application. Specifically, the SO symbol search time and XML-UI conversion time can be calculated.

일 실시예에서, 전자 장치(100)는 해당 어플리케이션에서 필요한 SO 심볼을 동적 공유 라이브러리에서 찾는데 소요되는 시간을 계산할 수 있다. 예를 들어, 어플리케이션 컴파일 시간동안 어플리케이션의 소스코드를 동적 공유 라이브러리로 링크하는데 걸리는 시간을 측정할 수 있다. 소요 시간은 아래와 같은 방정식으로 측정 가능하다.In one embodiment, the electronic device 100 may calculate the time required to find an SO symbol required by a corresponding application in a dynamic shared library. For example, the time taken to link the source code of an application to a dynamic shared library can be measured during application compilation time. The elapsed time can be measured by the equation below.

Figure pat00001
Figure pat00001

Ts는 동적 공유 라이브러리에서 심볼 탐색 시간, Tr은 필요한 심볼의 메모리 주소를 재할당하는데 걸리는 시간, Tl은 SO 파일의 로딩 시간이다. T는 어플리케이션 별로 필요한 SO 심볼을 탐색하는데 드는 시간이다.Ts is the symbol search time in the dynamic shared library, Tr is the time taken to reallocate the memory address of the required symbol, and Tl is the loading time of the SO file. T is the time required to search for SO symbols required for each application.

일 실시예에서, 전자 장치(100)는 XML 기반의 UI 프로세스 실행 시 소요되는 시간을 계산할 수 있다. 구체적으로, 전자 장치(100)는 XML을 UI로 변환하는데 걸리는 시간을 계산할 수 있다. 어플리케이션의 UI가 복잡해짐에 따라 XML 처리 비용이 증가하므로 어플리케이션 구동시 XML-UI 변환 시간이 오래 소요될 수 있다. In one embodiment, the electronic device 100 may calculate the time required to execute an XML-based UI process. Specifically, the electronic device 100 may calculate the time required to convert XML into UI. As the UI of the application becomes more complex, XML processing cost increases, so it may take a long time to convert XML-UI when running the application.

SO 심볼 탐색 시간과 XML-UI 변환 시간 및 적어도 하나를 계산함으로써 구동 시 시간이 오래 소요되는 프로세스의 종료 순서를 결정, 사용자 경험을 개선할 수 있다.By calculating SO symbol search time, XML-UI conversion time, and at least one, it is possible to improve user experience by determining the termination sequence of processes that take a long time at startup.

단계 S1140에서, 전자장치(100)는 계산된 시간에 기초하여 프로세스의 종료 순서를 결정할 수 있다. 예를 들어, 프로세스 별로 계산된 시간이 짧은 순서대로 프로세스 종료 순서를 결정할 수 있다. 구체적으로, 특정 프로세스가 상대적으로 더 긴 구동 시간이 필요한 경우 종료 순서를 늦춰, 가능한 한 오랫동안 메모리에 저장되게 할 수 있다.In step S1140, the electronic device 100 may determine a process termination sequence based on the calculated time. For example, the process termination sequence may be determined in the order of shorter times calculated for each process. Specifically, if a specific process needs a relatively longer running time, the shutdown sequence can be delayed so that it is stored in memory for as long as possible.

단계 S1150에서, 전자장치(100)는 종료 순서가 가장 높은 순위의 프로세스를 종료할 수 있다. 일 실시예에서, 그 후에도 메모리 가용용량이 부족한 경우, 그 다음 순위가 높은 프로세스를 종료할 수 있다.In step S1150, the electronic device 100 may terminate a process having the highest order of termination. In one embodiment, if the available memory capacity is insufficient even after that, the next higher priority process may be terminated.

Claims (20)

전자장치에 있어서,
제 1 메모리;
제 2 메모리; 및
상기 제 2 메모리에 저장된 어플리케이션의 실행에 따라서 상기 어플리케이션과 관련된 제1 프로세스의 페이지를 상기 제 1 메모리에 로딩함으로써 상기 제 1 프로세스를 실행하는 프로세서를 포함하고,
상기 프로세서는,
상기 제 1 메모리에 제 2 프로세스를 할당하기 위한 가용 용량을 확인하고,
상기 제 1 메모리에서 실행 중인 상기 제 1 프로세스의 특성에 기초하여, 상기 제 1 프로세스의 페이지를 상기 제 1 메모리 또는 상기 제 2 메모리로 스왑-아웃(swap-out)할지 여부를 식별하고,
상기 제 1 메모리 또는 제 2 메모리의 일부 영역을 스왑(swap)공간으로 할당하고,
상기 제 1 프로세스의 페이지를 스왑-아웃하고,
상기 스왑-아웃된 페이지가 다시 상기 제 1 메모리로 스왑-인(swap-in) 되는지 확인하고,
상기 제 1 메모리 또는 제 2 메모리의 스왑공간을 해제하는,
전자 장치.
In electronic devices,
a first memory;
a second memory; and
a processor executing the first process by loading a page of the first process related to the application into the first memory according to the execution of the application stored in the second memory;
the processor,
Checking available capacity for allocating a second process to the first memory;
identify whether to swap-out pages of the first process to the first memory or the second memory based on characteristics of the first process running in the first memory;
Allocating a part of the first memory or the second memory as a swap space;
Swap-out a page of the first process;
Checking whether the swapped-out page is swapped-in to the first memory again;
releasing the swap space of the first memory or the second memory;
electronic device.
제 1항에 있어서,
상기 제 1 프로세스의 특성은 프로세스의 반응 시간 및 상태 보존 정도 중 적어도 하나를 포함하는, 전자 장치.
According to claim 1,
The electronic device of claim 1, wherein the characteristic of the first process includes at least one of a response time and a state preservation degree of the process.
제 2항에 있어서,
상기 제 1 프로세스의 특성에 제 1 프로세스의 페이지가 복수의 프로세스로부터 참조되는 횟수를 추가로 고려하여,
상기 제 1 프로세스의 페이지를 상기 제 1 메모리 또는 상기 제 2 메모리로 스왑-아웃(swap-out)할지 여부를 식별하는, 전자 장치.
According to claim 2,
In addition to the characteristics of the first process, the number of times the page of the first process is referenced by a plurality of processes is considered,
The electronic device that identifies whether to swap-out a page of the first process to the first memory or the second memory.
제 1항에 있어서,
상기 제 1 프로세스의 페이지는 공유 라이브러리에 속한 SO(Shared Object) 파일을 포함하는, 전자 장치.
According to claim 1,
The electronic device of claim 1 , wherein the page of the first process includes a Shared Object (SO) file belonging to a shared library.
제 1항에 있어서,
상기 프로세서는,
상기 제 1 메모리의 스왑공간이 부족한 경우,
상기 제 1 프로세스의 페이지가 복수의 프로세스로부터 참조되는 횟수에 기초하여 상기 제 1 프로세스의 페이지 중 제 1 페이지를 결정하고,
상기 제 1 페이지를 제 1 메모리에서 제거하는,
전자 장치.
According to claim 1,
the processor,
When the swap space of the first memory is insufficient,
determining a first page among pages of the first process based on the number of times the page of the first process is referred to by a plurality of processes;
removing the first page from a first memory;
electronic device.
제 1항에 있어서,
상기 프로세서는,
상기 제 2 메모리의 스왑공간이 부족한 경우,
상기 제 2 메모리에 쓰여진 페이지가 상기 제 2 메모리에 스왑-아웃된 시간에 기초하여 상기 제 2 메모리에 쓰여진 페이지 중 제 2 페이지를 결정하고,
상기 제 2 페이지를 제 2 메모리에서 제거하는,
전자 장치.
According to claim 1,
the processor,
When the swap space of the second memory is insufficient,
determining a second page among pages written to the second memory based on a time at which the page written to the second memory was swapped out to the second memory;
removing the second page from a second memory;
electronic device.
제 5항에 있어서,
상기 프로세서는,
상기 제 1 페이지를 제 1 메모리에서 제거한 후에도 상기 제 1 메모리에 새로운 프로세스를 할당하기 위한 가용 용량이 부족한 경우,
상기 제 2 메모리에 상기 제 1 메모리에서 실행 중인 프로세스의 페이지를 스왑-아웃할 스왑공간이 있는지 확인하고,
상기 제 2 메모리의 스왑공간이 부족한 경우,
상기 제 2 메모리에 쓰여진 페이지가 상기 제 2 메모리에 스왑-아웃된 시간에 기초하여 상기 제 2 메모리에 쓰여진 페이지 중 제 2 페이지를 결정하고,
상기 제 2 페이지를 제 2 메모리에서 제거하는,
전자 장치.
According to claim 5,
the processor,
If the available capacity for allocating a new process to the first memory is insufficient even after the first page is removed from the first memory,
Checking whether there is a swap space in the second memory for swapping out a page of a process running in the first memory;
When the swap space of the second memory is insufficient,
determining a second page among pages written to the second memory based on a time at which the page written to the second memory was swapped out to the second memory;
removing the second page from a second memory;
electronic device.
제 7항에 있어서,
상기 제 1 페이지 및 제 2 페이지는 공유 라이브러리에 속한 SO(Shared Object) 파일을 포함하는,
전자장치.
According to claim 7,
The first page and the second page include a Shared Object (SO) file belonging to a shared library.
electronics.
제 7항에 있어서,
상기 프로세서는,
상기 제 2 페이지를 제 2 메모리에서 제거한 후에도 상기 제 1 메모리에 새로운 프로세스를 할당하기 위한 가용 용량이 부족한 경우,
상기 제 1 메모리에서 실행 중인 복수의 프로세스 별 프로세스 구동 시 소요 시간을 계산하고, 상기 계산된 시간에 기초하여,
상기 제 1 메모리에서 실행 중인 복수의 프로세스의 종료 순서를 결정하고,
상기 제 1 메모리에서 실행 중인 복수의 프로세스 중에서 적어도 하나의 프로세스를 종료시켜,
상기 종료된 프로세스의 데이터가 로딩된 상기 제 1 메모리의 저장영역을 타 프로세스가 사용 가능하도록 하는,
전자장치.
According to claim 7,
the processor,
If the available capacity for allocating a new process to the first memory is insufficient even after the second page is removed from the second memory,
Calculate the time required for process driving for each of the plurality of processes running in the first memory, and based on the calculated time,
determining an order of termination of a plurality of processes running in the first memory;
By terminating at least one process among a plurality of processes running in the first memory,
Making the storage area of the first memory loaded with the data of the terminated process available to other processes,
electronics.
제 9항에 있어서,
상기 프로세스 구동 시 소요 시간은 상기 프로세스의 페이지의 SO 심볼 탐색에 소요되는 시간과 XML 기반의 UI 프로세스 실행 시 소요되는 시간 중 적어도 하나를 포함한,
전자장치.
According to claim 9,
The time required for driving the process includes at least one of the time required for searching for the SO symbol of the page of the process and the time required for executing an XML-based UI process,
electronics.
전자 장치의 메모리 관리 방법에 있어서,
제 2 메모리에 저장된 어플리케이션과 관련된 제 1 프로세스를 제 1 메모리에 로딩함으로써 실행하는 단계;
상기 제 1 메모리에 제 2 프로세스를 할당하기 위한 가용 용량을 확인하는 단계;
상기 제 1 메모리에서 실행 중인 상기 제 1 프로세스의 특성에 기초하여, 상기 제 1 프로세스의 페이지를 상기 제 1 메모리 또는 상기 제 2 메모리로 스왑-아웃(swap-out)할지 여부를 식별하는 단계;
상기 제 1 메모리 또는 제 2 메모리의 일부 영역을 스왑(swap)공간으로 할당하는 단계;
상기 제 1 프로세스의 페이지를 스왑 아웃하는 단계;
상기 스왑-아웃된 페이지가 다시 상기 제 1 메모리로 스왑-인(swap-in) 되는지 확인하는 단계; 및
상기 제 1 메모리 또는 제 2 메모리의 스왑공간을 해제하는 단계,
를 포함하는 전자 장치의 메모리 관리 방법.
In the memory management method of an electronic device,
executing a first process related to an application stored in a second memory by loading it into the first memory;
checking available capacity for allocating a second process to the first memory;
identifying whether to swap-out pages of the first process to the first memory or the second memory based on a characteristic of the first process running in the first memory;
allocating a partial area of the first memory or the second memory as a swap space;
swapping out a page of the first process;
checking whether the swapped-out page is swapped back into the first memory; and
releasing the swap space of the first memory or the second memory;
Memory management method of an electronic device comprising a.
제 11항에 있어서,
상기 제 1 프로세스의 특성은 프로세스의 반응 시간 및 상태 보존 정도 중 적어도 하나를 포함하는 것인, 방법.
According to claim 11,
The method of claim 1, wherein the characteristic of the first process includes at least one of a process response time and a degree of state preservation.
제 12항에 있어서,
상기 제 1 프로세스의 페이지를 상기 제 1 메모리 또는 상기 제 2 메모리로 스왑-아웃(swap-out)할지 여부를 식별하는 단계는,
상기 제 1 프로세스의 페이지가 복수의 프로세스로부터 참조되는 횟수에 기초하여 상기 제 1 메모리 또는 상기 제 2 메모리로 스왑-아웃(swap-out)할지 여부를 식별하는 단계를 더 포함하는, 방법.
According to claim 12,
Identifying whether to swap-out a page of the first process to the first memory or the second memory,
and identifying whether to swap-out to the first memory or the second memory based on the number of times a page of the first process is referenced from a plurality of processes.
제 11항에 있어서,
상기 제 1 프로세스의 페이지는 공유 라이브러리에 속한 SO(Shared Object) 파일을 포함하는, 방법.
According to claim 11,
The method of claim 1 , wherein the page of the first process includes a Shared Object (SO) file belonging to a shared library.
제 11항에 있어서,
상기 제 1 메모리 또는 제 2 메모리의 일부 영역을 스왑(swap)공간으로 할당하는 단계는,
상기 제 1 메모리의 스왑공간이 부족한 경우,
상기 제 1 프로세스의 페이지가 복수의 프로세스로부터 참조되는 횟수에 기초하여 상기 제 1 프로세스의 페이지 중 제 1 페이지를 결정하는 단계; 및
상기 제 1 페이지를 제 1 메모리에서 제거하는 단계를 더 포함하는, 방법.
According to claim 11,
The step of allocating a part of the first memory or the second memory as a swap space,
When the swap space of the first memory is insufficient,
determining a first page among pages of the first process based on the number of times the page of the first process is referenced from a plurality of processes; and
and removing the first page from a first memory.
제 11항에 있어서,
상기 제 1 메모리 또는 제 2 메모리의 일부 영역을 스왑(swap)공간으로 할당하는 단계는,
상기 제 2 메모리의 스왑공간이 부족한 경우,
상기 제 2 메모리에 쓰여진 페이지가 상기 제 2 메모리에 스왑-아웃된 시간에 기초하여 상기 제 2 메모리에 쓰여진 페이지 중 제 2 페이지를 결정하는 단계; 및
상기 제 2 페이지를 제 2 메모리에서 제거하는 단계를 포함하는, 방법.
According to claim 11,
The step of allocating a part of the first memory or the second memory as a swap space,
When the swap space of the second memory is insufficient,
determining a second page among pages written to the second memory based on a time at which the page written to the second memory was swapped out to the second memory; and
and removing the second page from a second memory.
제 15항에 있어서,
상기 제 1 페이지를 제 1 메모리에서 제거한 후에도 상기 제 1 메모리에 새로운 프로세스를 할당하기 위한 가용 용량이 부족한 경우,
상기 제 2 메모리에 상기 제 1 메모리에서 실행 중인 프로세스의 페이지를 스왑-아웃할 스왑공간이 있는지 확인하는 단계;
상기 제 2 메모리의 스왑공간이 부족한 경우,
상기 제 2 메모리에 쓰여진 페이지가 상기 제 2 메모리에 스왑-아웃된 시간에 기초하여 상기 제 2 메모리에 쓰여진 페이지 중 제 2 페이지를 결정하는 단계; 및
상기 제 2 페이지를 제 2 메모리에서 제거하는 단계를 포함하는, 방법.
According to claim 15,
If the available capacity for allocating a new process to the first memory is insufficient even after the first page is removed from the first memory,
checking whether there is a swap space in the second memory for swapping out a page of a process running in the first memory;
When the swap space of the second memory is insufficient,
determining a second page among pages written to the second memory based on a time at which the page written to the second memory was swapped out to the second memory; and
and removing the second page from a second memory.
제 17항에 있어서,
상기 제 1 페이지 및 제 2 페이지는 공유 라이브러리에 속한 SO(Shared Object) 파일을 포함하는,
방법.
According to claim 17,
The first page and the second page include a Shared Object (SO) file belonging to a shared library.
method.
제 17항에 있어서,
상기 제 2 페이지를 제 2 메모리에서 제거한 후에도 상기 제 1 메모리에 새로운 프로세스를 할당하기 위한 가용 용량이 부족한 경우,
상기 제 1 메모리에서 실행 중인 복수의 프로세스 별 프로세스 구동 시 소요 시간을 계산하는 단계;
상기 계산된 시간에 기초하여, 상기 제 1 메모리에서 실행 중인 복수의 프로세스의 종료 순서를 결정하는 단계; 및
상기 제 1 메모리에서 실행 중인 복수의 프로세스 중에서 적어도 하나의 프로세스를 종료시키는 단계를 포함하는, 방법.
According to claim 17,
If the available capacity for allocating a new process to the first memory is insufficient even after the second page is removed from the second memory,
calculating a required process driving time for each of a plurality of processes running in the first memory;
determining an order of termination of a plurality of processes running in the first memory based on the calculated time; and
and terminating at least one process among a plurality of processes running in the first memory.
제 19항에 있어서,
상기 프로세스 구동 시 소요 시간은 상기 프로세스의 페이지의 SO 심볼 탐색에 소요되는 시간과 XML 기반의 UI 프로세스 실행 시 소요되는 시간 중 적어도 하나를 포함하는 것인, 방법.
According to claim 19,
The time required for driving the process includes at least one of a time required for searching for an SO symbol of a page of the process and a time required for executing an XML-based UI process.
KR1020220075779A 2021-12-23 2022-06-21 Electronic device and mehtod for managing memory KR20230096811A (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP22911762.7A EP4357903A1 (en) 2021-12-23 2022-12-14 Method for managing memory and electronic device using same
PCT/KR2022/020344 WO2023121129A1 (en) 2021-12-23 2022-12-14 Method for managing memory and electronic device using same
US18/088,087 US20230214122A1 (en) 2021-12-23 2022-12-23 Memory management method and electronic device using the same

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
KR20210186591 2021-12-23
KR1020210186591 2021-12-23

Publications (1)

Publication Number Publication Date
KR20230096811A true KR20230096811A (en) 2023-06-30

Family

ID=86960116

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020220075779A KR20230096811A (en) 2021-12-23 2022-06-21 Electronic device and mehtod for managing memory

Country Status (1)

Country Link
KR (1) KR20230096811A (en)

Similar Documents

Publication Publication Date Title
US11106393B2 (en) Latency-based scheduling of command processing in data storage devices
US8972696B2 (en) Pagefile reservations
EP2791806B1 (en) Working set swapping using a sequentially ordered swap file
US8909853B2 (en) Methods and apparatus to share a thread to reclaim memory space in a non-volatile memory file system
US9268678B2 (en) Memory defragmentation in a hosted hypervisor
US11132143B2 (en) Universal flash storage (UFS) device and computing device and computing device including storage UFS device for reporting buffer size based on reuse time after erase
US8171206B2 (en) Avoidance of self eviction caused by dynamic memory allocation in a flash memory storage device
US11360884B2 (en) Reserved memory in memory management system
US20180150219A1 (en) Data accessing system, data accessing apparatus and method for accessing data
US20220413919A1 (en) User interface based page migration for performance enhancement
EP3812904B1 (en) Swap area in memory using multiple compression algorithms
US8972629B2 (en) Low-contention update buffer queuing for large systems
CN113805792A (en) Memory system and operating method thereof
CN117215485A (en) ZNS SSD management method, data writing method, storage device and controller
KR20230096811A (en) Electronic device and mehtod for managing memory
US10671526B2 (en) Electronic computing device, method for adjusting the trigger mechanism of a garbage collection function, and non-transitory computer readable storage medium thereof
EP4357903A1 (en) Method for managing memory and electronic device using same
US20100299672A1 (en) Memory management device, computer system, and memory management method
CN108319470A (en) Create method, apparatus, equipment and the readable storage medium storing program for executing of OS startup items
US20150347042A1 (en) Apparatus and method for controlling memory
US7757053B2 (en) Apparatus and method for managing stacks for efficient memory usage
US20230168822A1 (en) Memory management method and semiconductor device adjusting size of contiguous memory allocation area
KR102334237B1 (en) Methods and apparatuses for managing page cache for multiple foreground application
US11029863B2 (en) Using non-volatile random access memory as volatile random access memory
CN114610527A (en) Storage device, computer system, startup method, and storage medium