Electronic device, operating method of electronic device, and storage medium

The electronic device addresses memory reclamation delays by prioritizing high-memory usage processes and using a specialized queue to efficiently allocate CPU resources, ensuring rapid memory acquisition and system stability during shortages.

WO2026142219A1PCT designated stage Publication Date: 2026-07-02SAMSUNG ELECTRONICS CO LTD

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
SAMSUNG ELECTRONICS CO LTD
Filing Date
2025-12-22
Publication Date
2026-07-02

AI Technical Summary

Technical Problem

Existing systems face delays in memory reclamation during shortages due to kernel schedulers prioritizing processes based on non-memory usage criteria, leading to inefficient termination of memory-intensive processes and delays in acquiring memory, especially when processes are in file I/O states.

Method used

An electronic device and method that prioritizes memory reclamation by identifying and terminating processes with the highest memory usage, creating kernel threads for file I/O operations, and using a specialized run queue (oom_victim rq) to allocate CPU resources efficiently during memory shortages.

Benefits of technology

Rapidly secures memory resources by prioritizing and terminating high-memory usage processes, reducing delays associated with file I/O and exception handling, thereby stabilizing the system and ensuring timely memory allocation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure KR2025022470_02072026_PF_FP_ABST
    Figure KR2025022470_02072026_PF_FP_ABST
Patent Text Reader

Abstract

An electronic device according to an embodiment of the present disclosure may: select at least one process for memory recovery from among processes being executed in response to an out-of-memory event having occurred; add the at least one process to a first run queue managed by a first scheduler; and arrange processes to be terminated in the first run queue in the order of memory usage and sequentially terminate said processes.
Need to check novelty before this filing date? Find Prior Art

Description

Electronic device, method of operation of electronic device, and storage medium

[0001] The present disclosure relates to an electronic device, a method of operating the electronic device, and a storage medium.

[0002] A process is a unit of a program running in an operating system that can perform various tasks using memory provided by the operating system. Since all processes within the system use memory, a memory shortage situation may occur if the number of running processes increases or if some processes use an excessive amount of memory.

[0003] If a memory shortage persists or becomes severe, at least one of the running processes may be forcibly terminated to ensure system stability. Memory allocated to at least one forcibly terminated process may be released, and the released memory may be reclaimed and utilized as available resources within the system.

[0004] The information described above may be provided as related art for the purpose of aiding understanding of this document. None of the foregoing is to be claimed as prior art related to this document, nor is it to be used to determine prior art.

[0005] Delayed memory reclamation during memory shortages can affect system performance and stability. However, since kernel schedulers process processes based on priority (e.g., scheduling priority) without considering memory usage, there may be limitations in terminating memory-intensive processes for reclamation. For instance, if a primary process with high memory usage has a lower priority than a secondary process, the primary process cannot be terminated until the secondary process is processed, which can lead to a delay in memory reclamation. Another example is when a process with relatively low memory usage holds the highest priority among multiple processes seeking memory reclamation; in this case, a relatively smaller amount of memory is reclaimed first, making it difficult to quickly resolve memory shortages. Furthermore, since there is no immediate method to terminate processes involved in file I / O, delays may occur when memory acquisition is required. Therefore, there is a need for a method to rapidly acquire large amounts of memory without delay during memory shortage situations.

[0006] One embodiment of the present disclosure may provide an electronic device, a method of operating the electronic device, and a storage medium.

[0007] One embodiment of the present disclosure may provide an electronic device capable of rapidly securing memory resources in a memory shortage situation, a method of operating the electronic device, and a storage medium.

[0008] One embodiment of the present disclosure may provide an electronic device, a method of operating the electronic device, and a storage medium that solves a memory retrieval delay problem that may occur in a memory shortage situation.

[0009] One embodiment of the present disclosure may provide an electronic device, a method of operating the electronic device, and a storage medium that can secure a larger amount of memory by terminating the process with the highest memory usage among running processes.

[0010] One embodiment of the present disclosure may provide an electronic device, a method of operating the electronic device, and a storage medium that can prevent memory reclamation from being delayed due to a process state associated with file input / output.

[0011] One embodiment of the present disclosure may provide an electronic device, a method of operating the electronic device, and a storage medium that allow CPU resources to be preferentially allocated to a process to be terminated based on an exception event associated with a memory shortage situation.

[0012] An electronic device according to one embodiment of the present disclosure may include at least one processor comprising a memory and a processing circuit electrically connected to the memory and executing instructions of a program stored in the memory. Based on the occurrence of a memory shortage, the at least one processor may select at least one process for memory reclamation among the running processes, add the at least one process to a first run queue managed by a first scheduler, and sequentially terminate the processes to be terminated included in the first run queue by sorting them in order of memory usage.

[0013] According to one embodiment, the at least one processor identifies a first process with the highest memory usage among the aligned processes, and based on the fact that the first process is in a disk sleep state due to a read operation associated with file input / output, the read operation may be omitted and the first process terminated.

[0014] According to one embodiment, the at least one processor can identify the first process with the highest memory usage among the sorted processes, create a kernel thread based on the fact that the first process is in a disk sleep state due to a write operation associated with file input / output, assign the write operation to the kernel thread, and terminate the first process.

[0015] According to one embodiment, the at least one processor may generate an exception event associated with the memory shortage situation to preferentially allocate a central processing unit (CPU) resource to the first process among the processes to be terminated, and terminate the first process using the allocated CPU resource.

[0016] According to one embodiment, the first run queue is used with the highest priority among a plurality of run queues based on the occurrence of the memory shortage situation, and the plurality of run queues may include at least one of the first run queue, a second run queue managed by a deadline scheduler, a third run queue managed by a real-time (RT) scheduler, or a fourth run queue managed by a completely fair (CFS) scheduler.

[0017] According to one embodiment, the at least one processor identifies the priority and memory usage of each of the running processes based on the occurrence of the memory shortage situation, and can select the at least one process among the plurality of processes as the process to terminate for memory recovery based on the priority and memory usage of each of the processes.

[0018] According to one embodiment, the at least one processor identifies the priority and memory usage of each of the running processes based on the occurrence of the memory shortage situation, and can select the at least one process among the running processes as the process to terminate for memory reclamation based on the priority and memory usage of each of the running processes.

[0019] According to one embodiment, the at least one processor can transmit a termination instruction signal to the at least one process.

[0020] A method of operation of an electronic device according to one embodiment of the present disclosure may include: an operation of selecting at least one process for memory reclamation among running processes based on the occurrence of a memory shortage situation; an operation of adding the at least one process to a first run queue managed by a first scheduler; and an operation of sequentially terminating processes to be terminated included in the first run queue by sorting them in order of memory usage.

[0021] According to one embodiment, the sequential termination operation may include: an operation of identifying a first process with the highest memory usage among the sorted processes; and an operation of omitting the read operation and terminating the first process based on the fact that the first process is in a disk sleep state due to a read operation associated with file input / output.

[0022] According to one embodiment, the sequential termination operation may include: an operation of identifying a first process with the highest memory usage among the sorted processes; an operation of creating a kernel thread based on the fact that the first process is in a disk sleep state due to a write operation associated with file input / output; and an operation of assigning the write operation to the kernel thread and terminating the first process.

[0023] According to one embodiment, the sequential termination operation may include: generating an exception event associated with the memory shortage situation to preferentially allocate CPU (central processing unit) resources to the first process among the processes to be terminated; and terminating the first process using the allocated CPU resources.

[0024] According to one embodiment, the first run queue is used with the highest priority among a plurality of run queues based on the occurrence of the memory shortage situation, and the plurality of run queues may include at least one of the first run queue, a second run queue managed by a deadline scheduler, a third run queue managed by a real-time (RT) scheduler, or a fourth run queue managed by a completely fair (CFS) scheduler.

[0025] According to one embodiment, the operation of selecting at least one process may include: an operation of identifying the priority and memory usage of each of the running processes based on the occurrence of the memory shortage situation; and an operation of selecting at least one process among the plurality of processes as a process to be terminated for memory recovery based on the priority and memory usage of each of the processes.

[0026] According to one embodiment, the operation of selecting at least one process may include: an operation of identifying the priority and memory usage of each of the running processes based on the occurrence of the memory shortage situation; and an operation of selecting at least one process among the running processes as a process to be terminated for memory reclamation based on the priority and memory usage of each of the running processes.

[0027] According to one embodiment, the operation of transmitting a termination instruction signal to at least one process may be further included.

[0028] A storage medium storing at least one instruction readable by a computer according to one embodiment of the present disclosure may include: the at least one instruction being used for at least one operation of the electronic device when executed by at least a part of at least one processor of the electronic device, and the at least one operation may include: an operation of selecting at least one process for memory reclamation among running processes based on the occurrence of a memory shortage situation; an operation of adding the at least one process to a first run queue managed by a first scheduler; and an operation of sequentially terminating processes to be terminated included in the first run queue by sorting them in order of memory usage.

[0029] According to one embodiment, the sequential termination operation may include: an operation of identifying a first process with the highest memory usage among the sorted processes; and an operation of omitting the read operation and terminating the first process based on the fact that the first process is in a disk sleep state due to a read operation associated with file input / output.

[0030] According to one embodiment, the sequential termination operation may include: an operation of identifying a first process with the highest memory usage among the sorted processes; an operation of creating a kernel thread based on the fact that the first process is in a disk sleep state due to a write operation associated with file input / output; and an operation of assigning the write operation to the kernel thread and terminating the first process.

[0031] According to one embodiment, the sequential termination operation may include: generating an exception event associated with the memory shortage situation to preferentially allocate CPU (central processing unit) resources to the first process among the processes to be terminated; and terminating the first process using the allocated CPU resources.

[0032] According to one embodiment, the first run queue is used with the highest priority among a plurality of run queues based on the occurrence of the memory shortage situation, and the plurality of run queues may include at least one of the first run queue, a second run queue managed by a deadline scheduler, a third run queue managed by a real-time (RT) scheduler, or a fourth run queue managed by a completely fair (CFS) scheduler.

[0033] According to one embodiment, the operation of selecting at least one process may include: an operation of identifying the priority and memory usage of each of the running processes based on the occurrence of the memory shortage situation; and an operation of selecting at least one process among the plurality of processes as a process to be terminated for memory recovery based on the priority and memory usage of each of the processes.

[0034] FIG. 1 is a block diagram of an electronic device according to one embodiment.

[0035] FIG. 2 is a diagram for explaining the state of a process according to one embodiment.

[0036] Figure 3 is a flowchart illustrating the memory acquisition operation of an electronic device.

[0037] Figure 4a is a diagram illustrating the operation of terminating a victim process without considering memory usage.

[0038] Figure 4b is a diagram illustrating the situation of delayed termination of the victim process.

[0039] FIG. 5a is a diagram illustrating run queues used in a kernel according to one embodiment.

[0040] FIG. 5b is a diagram illustrating a run queue added for a memory shortage situation according to one embodiment.

[0041] FIG. 6a is a diagram illustrating the memory acquisition operation of an electronic device in a first system environment according to one embodiment.

[0042] FIG. 6b is a diagram illustrating the memory acquisition operation of an electronic device in a second system environment according to one embodiment.

[0043] FIG. 7a is a flowchart illustrating the memory acquisition operation of an electronic device in a first system environment according to one embodiment.

[0044] FIG. 7b is a flowchart illustrating the memory acquisition operation of an electronic device in a second system environment according to one embodiment.

[0045] FIG. 8 is a flowchart illustrating the memory recovery operation of an electronic device according to one embodiment.

[0046] FIG. 9 is a flowchart illustrating the process termination operation of an electronic device based on an exception event according to one embodiment.

[0047] FIG. 10 is a flowchart illustrating the operation of an electronic device for preventing process termination delay caused by a file reading operation according to one embodiment.

[0048] FIG. 11 is a flowchart illustrating the operation of an electronic device for preventing process termination delay caused by a file writing operation according to one embodiment.

[0049] In the following description, the attached drawings are referenced, and specific examples of implementation are illustrated within the drawings. Additionally, other examples may be used and structural modifications may be made without departing from the scope of the various examples.

[0050] Hereinafter, embodiments of the present disclosure are described in detail with reference to the drawings so that those skilled in the art can easily practice them. However, the present disclosure may be embodied in various different forms and is not limited to the embodiments described herein. In relation to the description of the drawings, the same or similar reference numerals may be used for identical or similar components. Furthermore, in the drawings and related descriptions, descriptions of well-known functions and configurations may be omitted for clarity and brevity.

[0051] FIG. 1 is a block diagram of an electronic device according to one embodiment.

[0052] Referring to FIG. 1, the electronic device (100) may include a display (102), memory (104), and a processor (106). According to one embodiment, the electronic device (100) may include additional components (e.g., a user interface) in addition to the components shown, or at least one of the components shown (e.g., a display (102)) may be omitted.

[0053] The display (102) can perform various display operations according to the function of the electronic device (100). For example, the display (102) can display at least one of various service information, text information, or media information according to the execution of software (e.g., system software or application software) or an application.

[0054] The memory (104) can store various information or data related to the operation of the electronic device (100). The memory (104) can store at least one program. For example, the memory (104) can store at least one program for processing and controlling the processor (106), and can store input and / or output data.

[0055] The memory (104) may also store an artificial intelligence (AI) model. The memory (104) may include a storage medium comprising at least one of a flash memory type, a hard disk type, a multimedia card micro type, a card type memory (e.g., SD (secure digital) or XD (extreme digital) memory, etc.), RAM (random access memory), SRAM (static random access memory), ROM (read only memory), EEPROM (electrically erasable programmable read only memory), PROM (programmable read only memory), magnetic memory, a magnetic disk, and an optical disk.

[0056] The processor (106) can control the overall operation of the electronic device (100). According to one embodiment, the processor (106) can perform memory management operations and / or process management operations based on an operating system. According to one embodiment, the memory management operations may include operations to allocate or reclaim memory (e.g., storage space contained in memory (104)) to at least one process. According to one embodiment, the process management operations may include operations to create, execute, or terminate a process, operations to perform process scheduling, operations to manage information about the process state (e.g., creation, ready, execution, waiting, or termination), or operations to support synchronization or communication between processes.

[0057] The processor (106) can be electrically connected to the display (102) and the memory (104), respectively, and can execute instructions of a program stored in the memory (104). The processor (106) may be one or more and may include a processing circuit that executes instructions of a program stored in the memory (104).

[0058] The processor (106) may include at least one of a CPU (central processing unit), NPU (neural processing unit), GPU (graphics processing unit), MPU (micro processing unit), MCU (micro controller unit), AP (application processor), CP (communication processor), SoC (system on chip), or IC (integrated circuit) sensor hub, supplementary processor, communication processor, ASIC (application specific integrated circuit), or FPGA (field programmable gate arrays), and may have multiple cores.

[0059] The electronic device (100) configured as described above may be any one of a home appliance (e.g., TV (television)), a computing device (e.g., desktop, PC (personal computer), or laptop), a mobile device (e.g., smartphone or tablet), or a wearable device (e.g., smart watch or HMD (head mounted display)), but is not limited thereto, and may be various types of embedded devices.

[0060] According to one embodiment, the electronic device (100) may be able to quickly secure memory in a memory shortage situation. The memory described below may correspond to the memory (104) of the electronic device (100) or represent a storage space included in the memory (104). Various terms are defined as follows to explain the operation of the electronic device (100) related to securing memory.

[0061] According to one embodiment, 'memory reclamation' may refer to returning memory used by a process (e.g., an application or a daemon) running on the system back to the system. When memory is reclaimed, the process's virtual address may remain intact, and the connection between the virtual address and physical memory may be severed. Data in physical memory separated from the virtual address may be copied to a storage device (e.g., swap space within memory (104) or a disk). Based on the fact that the data has been copied to the storage device, the physical memory may be used for other purposes. When the process accesses the virtual address, new physical memory may be allocated, and data from the storage device may be copied to the allocated physical memory. Based on this, the virtual address may be reconnected to the physical memory. For example, in a Linux operating system, if the system runs out of physical memory, a configured daemon (e.g., kswapd) may be run or activated, and the daemon may initiate the reclamation and allocation of the process's memory.

[0062] According to one embodiment, 'OOM' stands for 'out of memory' and may indicate a situation where there is insufficient available memory in the system. For example, OOM may occur when many programs are running simultaneously or when at least one program requests an excessive amount of memory. When OOM occurs, the system may prioritize terminating some of the currently running programs to reclaim memory. This process may be performed, for example, by a mechanism called an 'OOM Killer'. The OOM Killer may forcibly terminate selected processes by considering the priority and memory usage of the running processes. If memory remains insufficient despite the forced termination of processes, the system load may increase, and a system panic may occur. A system panic may be a protection mechanism that occurs when the operating system cannot function normally. For example, a system panic may include actions such as stopping the system and transitioning to a suspended state if the system load increases due to a lack of memory.

[0063] According to one embodiment, a 'scheduler' may be utilized to support the efficient use of the system and to perform various tasks fairly. The operating system may support multitasking, which executes one or more processes simultaneously. The scheduler may distribute limited CPU resources and time slices among multiple processes, taking into account process priority, time sharing, or response speed. The system may be utilized efficiently through the decisions of the scheduler. Multiple schedulers may be utilized in the kernel (e.g., the Linux kernel). For example, multiple schedulers may include a stop scheduler, a deadline scheduler, an idle task scheduler, a completely fair scheduler (CFS) scheduler, or a real-time (RT) scheduler.

[0064] According to one embodiment, a 'stop scheduler' may be used to temporarily suspend processes running on all CPUs in a multicore environment where multiple CPU cores perform tasks simultaneously. For example, the stop scheduler may temporarily suspend the work of all CPUs for system state changes, interrupt handling, or synchronization.

[0065] According to one embodiment, a 'deadline scheduler' can be used to ensure that a specific task is completed within a set time.

[0066] According to one embodiment, the 'idle task scheduler' is a scheduler that runs when the CPU is in an idle state and can be used to optimize system resources and save power.

[0067] According to one embodiment, a 'CFS scheduler' can be used for the fair distribution of CPU resources. The CFS scheduler can allocate a ratio of CPU processing time (or CPU usage time), called virtual runtime (vruntime), to each task. vruntime can be calculated based on the nice value assigned to each task. Processes with smaller vruntimes may have higher priority. Through this method, the CFS scheduler can improve system performance by distributing CPU processing time fairly to all processes.

[0068] According to one embodiment, an 'RT scheduler' can be used for a real-time system. The RT scheduler is intended for handling time-constrained tasks and can guarantee that the task is completed within a limited time. Processes of the RT scheduler may have a higher priority than processes of the CFS scheduler and may be executed first. The priority-based process execution behavior of the RT scheduler may be similar to that of the CFS scheduler.

[0069] According to one embodiment, 'priority' can be assigned to each process and may be associated with the process execution order. Real-time tasks managed by an RT scheduler may have static priority values ​​within a first range (e.g., 0 to 99), and general tasks managed by a CFS scheduler may have priority values ​​within a second range (e.g., 100 to 139). A lower priority value may indicate a higher priority and allow for the allocation of more time slices. The priority value of a general task may be determined based on a nice value within a set range (e.g., -20 to 19).

[0070] According to one embodiment, an "exception" (hereinafter referred to as "Exception") may represent a situation where, while the CPU is executing a program, an event or exceptional situation caused by an external hardware device (e.g., an I / O hardware device) occurs and requires processing, thereby allowing the CPU to stop the currently executing task and be notified to handle it. For example, when the CPU detects an Exception, it may stop the currently executing operation (e.g., machine code execution) and perform exception handling through a configured program. The configured program may include an exception handler. After handling the exceptional situation associated with the Exception, the exception handler may resume the operation that was executing before the Exception occurred. Generally, an Exception may occur as an exception event outside the CPU core, but it may also occur inside the CPU core. For example, cases such as division by zero when executing a DIV instruction or accessing a virtual address not mapped to a physical address may be included in exceptional situations. An Exception may include a system call, an interrupt, or an abort.

[0071] FIG. 2 is a diagram for explaining the state of a process according to one embodiment.

[0072] Referring to FIG. 2, the process may be in any one of a plurality of states. For example, the plurality of states may include an R state (210) indicating a running or runnable state, a D state (220) indicating an uninterruptible sleep state, an S state (230) indicating an interruptible sleep state, a T state (240) indicating a stopped state, or a Z state (250) indicating a zombie state.

[0073] According to one embodiment, the R state (210) may indicate a state in which a process is running or is runnable, and may be entered by process created (202).

[0074] According to one embodiment, the D state (220) may indicate a state in which a process is suspended due to disk input / output (I / O) or is waiting for disk I / O. For example, a process may be in the D state when a read or write operation on a file is performed on a disk. The D state may indicate that the process is in a disk sleep state while performing an I / O operation. While the process is performing an I / O operation, other processes cannot occupy the CPU. If the resulting waiting time is prolonged, system performance may be degraded. According to one embodiment, the process may enter the D state (220) from the R state (210) to wait for resources and signals (222) for an I / O operation. According to one embodiment, the process may enter the R state (210) from the D state (220) when it is woke up (224) via a specific hardware event.

[0075] According to one embodiment, the S state (230) may be entered when a process is waiting for an event or condition unrelated to an I / O operation. For example, a process in the R state (210) may enter the S state (230) for waiting for system resources (232), and a process in the S state (230) may enter the R state when woke up by a signal (234).

[0076] According to one embodiment, the T state (240) may indicate a stopped state of the process. For example, a process in the R state (210) may enter the T state (240) when a process stop signal (e.g., SIGSTOP (242)) is input, and a process in the T state may enter the R state (210) when a process restart signal (e.g., SIGCONT (244)) is input.

[0077] According to one embodiment, the Z state (250) may represent a zombie state in which a process has terminated but the termination status has not been handled by the parent process. For example, a process in the R state (210) may enter the Z state (250) based on a process termination signal (e.g., exit() or termination signals (252)).

[0078] According to one embodiment, multitasking is supported in the electronic device (100) so that multiple software programs can be operated, and a large amount of memory may be required due to the execution of high-spec services. Since the memory (104) of the electronic device (100) has a limited size, a memory shortage situation may occur depending on the operation of the electronic device (100). To resolve the memory shortage situation, a memory acquisition operation as shown in FIG. 3 may be performed.

[0079] Figure 3 is a flowchart illustrating the memory acquisition operation of an electronic device.

[0080] Referring to FIG. 3, in operation 302, the electronic device (100) can determine whether available memory on the system is below a threshold. For example, the threshold may be defined by the LMF (low memory framework) and may be used to identify a memory shortage situation.

[0081] In operation 304, the electronic device (100) can perform a first process termination operation by LMF. The first process termination operation may represent an operation to select a process to be terminated (hereinafter referred to as a 'victim process') based on process priority, and to terminate the selected victim process to secure memory. Process priority may represent the state priority (or termination priority) of a process based on a set parameter (e.g., oom_score_adj). For example, oom_score_adj may be a natural number within a set range (e.g., -1000 to 1000), and may indicate that the closer it is to a specific value (e.g., 1000), the higher the probability that the process will be terminated.

[0082] In operation 306, the electronic device (100) can determine whether available memory has been secured based on whether the first process termination operation has been performed. If available memory has been secured, the electronic device (100) can terminate all operations, and if available memory has not been secured, it can perform operation 308.

[0083] In operation 308, the electronic device (100) may perform a second process termination operation by the OOM killer when available memory is not secured. The electronic device (100) may execute the OOM killer based on the fact that available memory is not secured. The OOM killer may be activated to forcibly terminate a process in a memory shortage situation and perform a second process termination operation. For example, the second process termination operation may include selecting and terminating a victim process to terminate based on process priority (e.g., oom_score_adj-based state priority) and memory usage (e.g., resident set size (RSS) in RAM (random access memory), SWAP area, or memory usage of the page table). The OOM Killer may terminate the victim process by sending a termination instruction signal (e.g., SIGKILL (9)) to the selected victim process.

[0084] In operation 310, the electronic device (100) can determine whether available memory has been secured based on whether the second process termination operation has been performed. If available memory has been secured, the electronic device (100) can terminate all operations, and if available memory has not been secured, it can perform operation 312.

[0085] In operation 312, the electronic device (100) can determine whether the number of repetitions corresponds to N. The number of repetitions may represent the number of times operations 302 to 310 have been performed, and N may be a natural number greater than or equal to 1. For example, if N is 8, the electronic device (100) may re-perform operations 302 to 310 based on the number of repetitions not being 8 (or less than 8), and perform operation 314 based on the number of repetitions being 8.

[0086] In operation 314, the electronic device (100) may stop the system by generating a system panic event based on the fact that memory has not been secured despite N repetitions (e.g., 8 times).

[0087] FIGS. 4a and FIGS. 4b are diagrams illustrating situations that may occur in connection with memory allocation operations.

[0088] Figure 4a is a diagram illustrating the operation of terminating a victim process without considering memory usage.

[0089] Referring to FIG. 4a, the operating system may include a kernel space and a user space. The kernel space and the user space are respectively referred to as Kernel (410) and User (440) in FIG. 4a, and below, the kernel space and the user space will be referred to as kernel space (410) and user space (440).

[0090] The kernel space (410) is an area where the kernel runs and can be used for hardware control or system resource management. The kernel space (410) may include components for performing memory management, CPU management, or process management. For example, the kernel space (410) may include an OOM Killer (420) that is activated in a memory shortage situation and a CPU scheduler (e.g., CFS scheduler) (430).

[0091] User space (440) is an area where an application or application is executed, and processes that interact with the user may operate or be executed. For example, multiple processes (e.g., Process A (441), Process B (442), Process C (443), or Process D (444)) may be running in user space (440).

[0092] In operation 401, an event indicating a memory shortage situation (e.g., Low Memory Event) may occur. The generated event may be transmitted to the Memory Status Checker (424) of the OOM Killer (420) or detected by the Memory Status Checker (424).

[0093] In operation 402, the memory status check unit (424) can output a signal indicating memory reclamation to the VICTIM selector (422) based on the generated event. The VICTIM selector (422) can select a victim process for memory reclamation based on the output signal. The VICTIM selector (422) can select at least one process based on the oom_score_adj (or status priority based on oom_score_adj) and memory usage of each of the multiple processes running in user space (440). For example, the VICTIM selector (422) can select Process B (442) and Process C (443) as victim processes among Process A (441), Process B (442), Process C (443), or Process D (444). Process B (442) and Process C (443) may have different scheduling priorities based on nice values. For example, Process B (442) may have a higher scheduling priority than Process C (443).

[0094] In operation 403, the VICTIM selector (422) can send SIGKILL to Process B (442), which has a higher scheduling priority. The CPU scheduler (430) in kernel space (410) can process processes (e.g., allocate CPU resources or execute) based on scheduling priority. Based on this, the VICTIM selector (422) can send SIGKILL to Process B (442) so that Process B (442) is entered into the run queue (432) before Process C (443).

[0095] In operation 404, Process B (442) may be Schedule Enqueued into the run queue (432) of the CPU scheduler (430) based on receiving SIGKILL. Schedule Enqueuing may represent an action in which a process based on scheduling priority is added, inserted, or input into the run queue (432) of the CPU scheduler (430).

[0096] In operation 405, the VICTIM selection unit (422) can send SIGKILL to Process C (443) after Process B (442) is scheduled enqueued.

[0097] In operation 406, Process C (443) can be scheduled into the run queue (432) of the CPU scheduler (430) based on receiving SIGKILL.

[0098] In operation 407, Process B (442) and Process C (443) included in the run queue (432) can be terminated sequentially. For example, Process C (443) can be terminated after Process B (442), which was entered into the run queue (432) first, is terminated.

[0099] Process B (442) and Process C (443) included in the run queue (432) may have different memory usage. For example, Process B (442) may have a memory usage of 300MB and Process C (443) may have a memory usage of 500MB, so Process B (442) may have less memory usage than Process C (443). However, Process B (442), which has less memory usage, may be terminated before Process C (443) by the CPU scheduler (430) (450). This is because the CPU scheduler (430) terminates the processes in the run queue (432) according to scheduling priority without considering memory usage.

[0100] In the environment illustrated in FIG. 4a, a problem may occur where termination is delayed due to the low scheduling priority of the victim process. This will be explained with reference to FIG. 4b.

[0101] Figure 4b is a diagram illustrating the situation of delayed termination of the victim process.

[0102] Referring to FIG. 4b, in operation 461, an event indicating that a memory shortage situation has occurred (e.g., Low Memory Event) may occur. The generated event may be transmitted to the memory status check unit (424) of the OOM Killer (420) or detected by the memory status check unit (424).

[0103] In operation 462, the memory status check unit (424) can output a signal indicating memory reclamation to the VICTIM selector (422) based on the generated event. The VICTIM selector (422) can select a victim process for memory reclamation based on the output signal. The VICTIM selector (422) can select at least one process as a victim process based on the oom_score_adj and memory usage of each of the multiple processes running in user space (440). For example, the VICTIM selector (422) can select Process B (442) as the victim process among Process A (441), Process B (442), Process C (443), or Process D (444).

[0104] In operation 463, the VICTIM selection unit (422) can transmit SIGKILL to Process B (442), which is selected as the victim process.

[0105] In operation 464, Process C (443) and Process D (444), which have higher scheduling priorities than Process B (442), can be scheduled into the run queue (432) of the CPU scheduler (430). For example, if the scheduling priorities are higher in the order of Process D (444), Process C (443), and Process B (442), Process D (444), which has the highest scheduling priority, can be scheduled into first, and then Process C (443) can be scheduled into.

[0106] In operation 465, Process B (442) can be scheduled into the run queue (432) of the CPU scheduler (430) after both Process C (443) and Process D (444) have been scheduled into the queue. Because Process B (442) has a low scheduling priority, it may not be possible to schedule into the queue immediately even if it receives a SIGKILL.

[0107] In operation 466, Process D (444) and Process C (443) included in the run queue (432) can be executed sequentially. Process B (442) can be terminated after the execution of Process D (444) and Process C (443), which were entered into the run queue (432) first, is completed. For example, Process B (442) can be terminated after releasing resources following CPU allocation. Process B (442) may be selected as the victim process, but may be terminated late due to a low scheduling priority (470). As such, the more processes with a higher scheduling priority than the victim process exist in the run queue (432), the more CPU resource allocation for the victim process may be delayed, and consequently, a delay in memory allocation may be caused. If such a situation persists, the operating system may detect that a situation has occurred where memory cannot be allocated and may stop the system by generating a system panic event.

[0108] In addition to the situations described in FIGS. 4a and 4b, delays in memory allocation may occur for various reasons. For example, a process performing file I / O may not be terminated (or forcibly terminated or killed). A process performing file I / O may be in state D, but the operating system has no way to immediately terminate a process in state D. Even if SIGKILL is sent to a process in state D, the process in state D cannot receive SIGKILL. Since a process in state D can only be terminated after transitioning to another state (e.g., state R) after the file I / O operation is completed, delays may occur in situations where rapid memory allocation is required.

[0109] Another reason for the delay in memory allocation is that scheduling priority resulting from exception handling in memory shortage situations is not taken into account. A process that receives a SIGKILL signal due to an OutOfMemoryError may wait for CPU resource allocation. If an exception occurs while a process is waiting in the run queue, exception handling actions must be performed through the exception handler, which can lead to a persistent memory shortage.

[0110] Considering the various problems mentioned above, a method for the operating system to quickly secure memory resources and stabilize the system is explained below.

[0111] FIG. 5a is a diagram illustrating run queues used in a kernel according to one embodiment.

[0112] Referring to FIG. 5a, the kernel scheduler (501) used in the kernel may include a plurality of schedulers. For example, the plurality of schedulers may include a stop scheduler, an idle task scheduler, a deadline scheduler, an RT scheduler, and a CFS scheduler. The stop scheduler and the idle task scheduler may be used only in the kernel, and the deadline scheduler, the RT scheduler, and the CFS scheduler may be selected by a scheduling policy as schedulers used for user tasks. The processing priority of the schedulers may be higher in the order of the deadline scheduler, the RT scheduler, and the CFS scheduler.

[0113] A CPU core (e.g., CPU0) (500) may contain run queues associated with the deadline scheduler, RT scheduler, and CFS scheduler, respectively, such as deadline rq (530), rt rq (520), and cfs rq (510). When a memory shortage occurs, a victim process may be registered in cfs rq (510). After the victim process is registered in cfs rq (510), it may need to be allocated CPU resources from the CFS scheduler to be able to clean up resources. However, if there is at least one process in the run queue (e.g., deadline rq (530) and / or rt rq (520)) of a scheduler with a higher priority than the CFS scheduler (e.g., deadline scheduler and / or rt scheduler), or if there is a process in cfs rq (510) with a higher scheduling priority than the victim process, memory may be delayed. To prevent this, the OOM_VICTIM scheduler and oom_victim rq can be used to allow the victim process to terminate faster.

[0114] FIG. 5b is a diagram illustrating a run queue added for a memory shortage situation according to one embodiment.

[0115] Referring to FIG. 5b, a CPU core (e.g., CPU0) (500) may include a deadline rq (530), an rt rq (520), and a cfs rq (510), and additionally, an oom_victim rq (540), which is a run queue associated with the OOM_VICTIM scheduler. The oom_victim rq (540) may be used for fast memory acquisition based on the occurrence of a memory shortage. According to one embodiment, when a memory shortage occurs, the processing priority of the schedulers may be higher in the order of the OOM_VICTIM scheduler, the deadline scheduler, the RT scheduler, and the CFS scheduler. Based on this, the run queues may be used in the order of oom_victim rq (540), deadline rq (530), rt rq (520), and cfs rq (510).

[0116] Referring to FIGS. 6a and 6b below, it is explained that rapid memory allocation is achieved by using oom_victim rq (540) by comparing the case where oom_victim rq (540) is not used and the case where it is used.

[0117] FIG. 6a is a diagram illustrating the memory acquisition operation of an electronic device in a first system environment according to one embodiment.

[0118] Referring to FIG. 6a, the first system environment may represent an environment in which the deadline rq (530), rt rq (520), and cfs rq (510) included in the CPU core (e.g., CPU0) (500) are utilized. According to one embodiment, when a memory shortage occurs, the OOM Killer (420) in kernel space (410) may select Process B (620) as the victim process among Process A (610), Process B (620), or Process C (630) running in user space (440). For example, the OOM Killer (420) may select Process B (620), which has the largest oom_score_adj and the most memory usage, based on the oom_score_adj and memory usage (Task Memory) of each of Process A (610), Process B (620), or Process C (630). OOM Killer (420) can send SIGKILL (9) (603) to Process B (620).

[0119] Process B (620) may have a higher memory usage than at least one other process, but a lower scheduling priority. For example, Process B (620) has a nice value of 10, which may be lower than Process C (640) which has a nice value of 0. Accordingly, Process B (620) may be incubated in the cfs rq (510) later than Process C (640), which has a higher scheduling priority, and CPU resources may be allocated later. Therefore, the termination of the victim process, Process B (620), may be delayed, and memory may be freed later.

[0120] FIG. 6b is a diagram illustrating the memory acquisition operation of an electronic device in a second system environment according to one embodiment.

[0121] Referring to FIG. 6b, the second system environment may represent an environment in which oom_victim rq (540), deadline rq (530), rt rq (520), and cfs rq (510) included in a CPU core (e.g., CPU0) (500) are utilized. According to one embodiment, as in FIG. 6a, when a memory shortage occurs, Process B (620) may be selected as the victim process and receive SIGKILL (9) (603). In FIG. 6b, based on the occurrence of a memory shortage, Process B (620) may be incubated in oom_victim rq (540).

[0122] According to one embodiment, oom_victim rq (540) may include Process B (620) and Process C (640), which has a higher scheduling priority than Process B (620). The Task Memory of Process C (640) is 2500, and the Task Memory of Process B (620) is 3000, so Process C (640) may have less memory usage than Process B (620). The OOM_VICTIM scheduler can sort the processes within oom_victim rq (540) in order of memory usage. For example, the OOM_VICTIM scheduler can perform a process sorting operation so that Process B (620), which has relatively high memory usage, is dequeued before Process C (640). Based on this, Process B (620), which has the highest memory usage, is terminated first, thereby securing a larger amount of memory without delay.

[0123] In the first system environment illustrated in FIG. 6a, processes within cfs rq (510) are sorted based on nice values ​​(or scheduling priorities), so the victim process, Process B (620), may become a lower-priority process that cannot be processed first. In contrast, in the second system environment illustrated in FIG. 6b, processes within oom_victim rq (540) are sorted based on memory usage, so the victim process, Process B (620), may be processed first, allowing for faster memory allocation.

[0124] With reference to FIGS. 7a and 7b, memory acquisition operations that can be performed in a first system environment and memory acquisition operations that can be performed in a second system environment will be described in detail below. The operations of the electronic device (100) described below can be understood as being performed by the processor of the electronic device (100) (e.g., the processor (106) of FIG. 1). The operations shown in each of the following figures may be performed in various orders, not limited to the order shown. For example, at least some of the operations shown in each figure may be omitted, or more operations than those shown in each figure may be performed.

[0125] FIG. 7a is a flowchart illustrating the memory acquisition operation of an electronic device in a first system environment according to one embodiment.

[0126] Referring to FIG. 7a, in operation 702, the electronic device (100) can identify that an Out of Memory (OOM) has occurred, indicating a memory shortage situation. For example, an OOM may occur when multiple programs (or processes) are running simultaneously, or when at least one program requests a large amount of memory.

[0127] In operation 704, the electronic device (100) may select a victim process based on the occurrence of an OutOfMemory error. For example, the electronic device (100) may select a victim process from running processes using an OOM Killer (e.g., the OOM Killer (420) of FIG. 4a or FIG. 6a). According to one embodiment, the electronic device (100) may select a victim process based on the priority of each running process (e.g., a state priority based on oom_score_adj) and memory usage. For example, the electronic device (100) may select the process corresponding to the largest oom_score_adj and the largest memory usage among the running processes as the victim process.

[0128] In operation 706, the electronic device (100) may transmit SIGKILL to the victim process based on the victim process being selected. According to one embodiment, SIGKILL may be a termination signal, which is a signal to indicate the termination of the victim process.

[0129] In operation 708, the electronic device (100) may add (or enqueue) the victim process to a cfs rq (e.g., cfs rq (510) of FIG. 5a or FIG. 6a) based on the fact that it transmitted SIGKILL to the victim process.

[0130] In operation 710, the electronic device (100) can determine whether there is at least one process in a deadline rq or rt rq that has a higher priority than the cfs rq (e.g., the deadline rq (530) or rt rq (520) of FIG. 5a or FIG. 6a).

[0131] In operation 712, the electronic device (100) may remove (or dequeue) at least one process from the deadline rq or rt rq if at least one process exists in the deadline rq or rt rq. For example, the electronic device (100) may remove at least one process from the deadline rq or rt rq to execute at least one process or to allocate CPU resources to at least one process.

[0132] According to one embodiment, the electronic device (100) may repeat operations 710 and 712 until no process exists in the deadline rq or rt rq. When it is identified that no process exists in the deadline rq or rt rq, the electronic device (100) may perform operation 714.

[0133] In operation 714, the electronic device (100) can determine whether the victim process has been terminated. For example, if the electronic device (100) identifies that the victim process has used CPU resources, it can determine that the victim process has been removed from the cfs rq and terminated. The CPU resources allocated to the victim process may be used to perform cleanup operations (e.g., memory release, or state transition) necessary for the termination of the process.

[0134] In operation 716, the electronic device (100) can perform memory reclamation based on the fact that the victim process has been terminated. For example, the electronic device (100) can reclaim memory released from the victim process and use it as available memory.

[0135] FIG. 7b is a flowchart illustrating the memory acquisition operation of an electronic device in a second system environment according to one embodiment.

[0136] Referring to FIG. 7b, operations 722 to 726 correspond to operations 702 to 706 of FIG. 7a, so a detailed description will be omitted.

[0137] In operation 728, the electronic device (100) may add (or enqueue) the victim process to oom_victim rq (e.g., oom_victim rq (540) in FIG. 4b or FIG. 6b) based on the fact that it sent SIGKILL to the victim process.

[0138] In operation 730, the electronic device (100) may allocate CPU resources to the victim process through an OOM Exception in an exception handler based on the victim process being added to the oom_victim rq. According to one embodiment, the electronic device (100) may sort the processes in the oom_victim rq in order of memory usage and, based on the OOM Exception, allocate CPU resources to the victim process among the sorted processes with the highest priority. In the embodiment of FIG. 7a, the victim process in the cfs rq must wait until it is allocated CPU resources, but in the embodiment of FIG. 7b, CPU resources can be allocated quickly to the victim process through an OOM Exception.

[0139] In operation 732, the electronic device (100) can determine whether the victim process is a D-state process.

[0140] In operation 734, the electronic device (100) can terminate the victim process using allocated CPU resources and perform a memory recovery operation based on the fact that the victim process is not a D-state process. According to one embodiment, since the victim process can be terminated by being allocated CPU resources with the highest priority, memory recovery can be performed more quickly.

[0141] In operation 736, the electronic device (100) can determine whether the file access type associated with file I / O is read or write based on whether the victim process is a D state process. According to one embodiment, if the electronic device (100) identifies that the file access type is read, it can skip or omit the read operation (or disk access operation) of reading data from the file. That is, by performing operation 734 based on the fact that the file access type is read, the electronic device (100) can prevent memory reclamation from being delayed due to the D state associated with the read operation.

[0142] According to one embodiment, if the electronic device (100) identifies that the file access type is write, it may perform operation 738. In operation 738, the electronic device (100) may create a kernel thread (or kernel thread worker) to perform a write operation (or disk write operation) to write data to a file based on the fact that the file access type is write. The electronic device (100) may delegate the write operation to the kernel thread and perform victim process termination and memory reclamation operations in operation 734.

[0143] Based on the method described above, even if the victim process is in state D, delays caused by file I / O operations can be reduced and faster memory reclamation can be achieved.

[0144] FIG. 8 is a flowchart illustrating the memory recovery operation of an electronic device according to one embodiment.

[0145] Referring to FIG. 8, in operation 802, the electronic device (100) may select at least one process among running processes for memory reclamation based on the occurrence of a memory shortage situation (e.g., OOM). According to one embodiment, the electronic device (100) may select at least one process among running processes (e.g., Process A (610), Process B (620), or Process D (630) of FIG. 6b) as the victim process to terminate for memory reclamation based on process priority (e.g., oom_score_adj-based status priority) and memory usage. According to one embodiment, the electronic device (100) may use an OOM Killer (e.g., OOM Killer (420) of FIG. 6b) to send a termination instruction signal (e.g., SIGKILL (9) (603) of FIG. 6b) to at least one process.

[0146] In operation 804, the electronic device (100) may add at least one process to a first run queue (e.g., oom_victim rq (540) in FIG. 6b) managed by a first scheduler (e.g., OOM_VICTIM scheduler). According to one embodiment, the first run queue may be used with the highest priority among a plurality of run queues based on the occurrence of a memory shortage situation. According to one embodiment, the plurality of run queues may include at least one of the first run queue, a second run queue managed by a deadline scheduler (e.g., deadline rq (530) in FIG. 6b), a third run queue managed by an RT scheduler (e.g., rt rq (520) in FIG. 6b), or a fourth run queue managed by a CFS scheduler (e.g., cfs rq (510) in FIG. 6b).

[0147] In operation 806, the electronic device (100) can sequentially terminate processes to be terminated (e.g., Process B (620) and Process C (640) of FIG. 6b) included in the first run queue by sorting them in order of memory usage.

[0148] Referring to FIGS. 9 to 11 below, a process termination operation that can be performed in conjunction with operation 806 of FIG. 8 will be described.

[0149] FIG. 9 is a flowchart illustrating the process termination operation of an electronic device based on an exception event according to one embodiment.

[0150] Referring to FIG. 9, in operation 902, the electronic device (100) may generate an exception event (e.g., OOM Exception) associated with a memory shortage situation.

[0151] In operation 904, the electronic device (100) may preferentially allocate CPU resources to the first process among the processes targeted for termination in the first run queue based on an exception event.

[0152] In operation 906, the electronic device (100) may terminate the first process using allocated CPU resources. According to one embodiment, the allocated CPU resources may be used to perform cleanup operations (e.g., memory release, or state transition) necessary for terminating the first process. When the first process is terminated, the electronic device (100) may reclaim the memory released by the first process and use it as available memory.

[0153] FIG. 10 is a flowchart illustrating the operation of an electronic device for preventing process termination delay caused by a file reading operation according to one embodiment.

[0154] Referring to FIG. 10, in operation 1002, the electronic device (100) can identify the first process with the most memory usage in the first run queue.

[0155] In operation 1004, the electronic device (100) can identify that the first process is in a disk sleep state (or D state or uninterruptible sleep state) due to a read operation associated with file input / output.

[0156] In operation 1006, the electronic device (100) may omit the read operation and terminate the first process to prevent memory reclamation delay. According to one embodiment, the electronic device (100) may perform the operation illustrated in FIG. 9 to terminate the first process. For example, the electronic device (100) may support the rapid termination of the first process by preferentially allocating CPU resources to the first process based on an exception event.

[0157] FIG. 11 is a flowchart illustrating the operation of an electronic device for preventing process termination delay caused by a file writing operation according to one embodiment.

[0158] Referring to FIG. 11, in operation 1102, the electronic device (100) can identify the first process with the most memory usage in the first run queue.

[0159] In operation 1104, the electronic device (100) can identify that the first process is in a disk sleep state (or D state or uninterruptible sleep state) due to a write operation associated with file input / output.

[0160] In operation 1106, the electronic device (100) may create a kernel thread. According to one embodiment, the kernel thread may include a kernel thread worker for performing write operations.

[0161] In operation 1108, the electronic device (100) may assign (or delegate) a write operation to a created kernel thread and terminate the first process. According to one embodiment, the electronic device (100) may perform the operation illustrated in FIG. 9 to terminate the first process. For example, the electronic device (100) may support the rapid termination of the first process by preferentially allocating CPU resources to the first process based on an exception event.

[0162] According to the various embodiments described above, in a memory shortage situation, memory can be quickly secured by prioritizing the termination of processes with high memory usage. If memory securing is delayed, a system panic may occur in the worst-case scenario. A system panic is a forced shutdown state of the system that can be perceived by the user of the electronic device (100), and the occurrence of a system panic should be minimized to improve stability. According to the various embodiments described above, since rapid memory securing is possible in a memory shortage situation, the occurrence of a system panic can be reduced, and this can contribute to system stability and improved user usability.

[0163] The various embodiments of this document and the terms used therein are not intended to limit the technical features described in this document to specific embodiments, and should be understood to include various modifications, equivalents, or substitutions of said embodiments. In connection with the description of the drawings, similar reference numerals may be used for similar or related components. The singular form of a noun corresponding to an item may include one or more of said items unless the relevant context clearly indicates otherwise. In this document, phrases such as "A or B," "at least one of A and B," "at least one of A or B," "A, B or C," "at least one of A, B and C," and "at least one of A, B, or C" may each include any one of the items listed together in the corresponding phrase, or all possible combinations thereof. Terms such as "first," "second," or "first" or "second" may be used simply to distinguish said components from other said components and do not limit said components in any other aspect (e.g., importance or order). Where any (e.g., 1st) component is referred to as “coupled” or “connected” to another (e.g., 2nd) component, with or without the terms “functionally” or “communicationly,” it means that said any component may be connected to said other component directly (e.g., via a wire), wirelessly, or through a third component.

[0164] The term “module” as used in the various embodiments of this document may include a unit implemented in hardware, software, or firmware, and may be used interchangeably with terms such as logic, logic block, component, or circuit, for example. A module may be a component formed integrally, or a minimum unit of said component or a part thereof that performs one or more functions. For example, according to one embodiment, a module may be implemented in the form of an application-specific integrated circuit (ASIC).

[0165] According to various embodiments, each component (e.g., module or program) of the components described above may include a singular or multiple entities, and some of the multiple entities may be separated and placed in other components. According to various embodiments, one or more of the components or operations of the aforementioned components may be omitted, or one or more other components or operations may be added. Generally or additionally, multiple components (e.g., module or program) may be integrated into a single component. In this case, the integrated component may perform one or more functions of each of the multiple components in the same or similar manner as those performed by the corresponding component among the multiple components prior to integration. According to various embodiments, operations performed by the module, program, or other components may be executed sequentially, in parallel, iteratively, or heuristically, or one or more of the operations may be executed in a different order, omitted, or one or more other operations may be added.

Claims

1. In an electronic device, Memory; and It includes at least one processor electrically connected to the memory and including a processing circuit that executes instructions of a program stored in the memory, and The above at least one processor is: Based on the occurrence of a memory shortage situation, select at least one process among the running processes for memory reclamation, and Add the above at least one process to a first run queue managed by a first scheduler, and An electronic device that sequentially terminates processes targeted for termination included in the first run queue by sorting them in order of highest memory usage.

2. In Paragraph 1, The above-mentioned at least one processor is, Identify the first process with the highest memory usage among the above-mentioned aligned processes, and An electronic device that terminates the first process by omitting the read operation based on the fact that the first process is in a disk sleep state due to a read operation associated with file input / output.

3. In Paragraph 1, The above-mentioned at least one processor is, Identify the first process with the highest memory usage among the above-mentioned aligned processes, and Based on the fact that the above first process is in a disk sleep state due to a write operation related to file I / O, a kernel thread is created, and An electronic device that assigns the write operation to the kernel thread and terminates the first process.

4. In Paragraph 2 or 3, The above-mentioned at least one processor is, By generating an exception event associated with the above memory shortage situation, CPU (central processing unit) resources are preferentially allocated to the first process among the processes targeted for termination, and An electronic device that terminates the first process using the allocated CPU resources.

5. In Paragraph 1, The above-mentioned first run queue is used with the highest priority among multiple run queues based on the occurrence of the above-mentioned memory shortage situation, and An electronic device comprising at least one of the plurality of run queues, the first run queue, the second run queue managed by a deadline scheduler, the third run queue managed by a real-time (RT) scheduler, or the fourth run queue managed by a completely fair (CFS) scheduler.

6. In Paragraph 1, The above-mentioned at least one processor is, Based on the occurrence of the above memory shortage situation, identify the priority and memory usage of each of the above running processes, and An electronic device that selects at least one process among the running processes as a process to terminate for memory reclamation based on the priority and memory usage of each of the running processes.

7. In Paragraph 1 or 6, The above-mentioned at least one processor is, An electronic device that transmits a termination instruction signal to at least one of the above processes.

8. In a method of operating an electronic device, An operation to select at least one process among running processes for memory reclamation based on the occurrence of a memory shortage situation; The operation of adding at least one process to a first run queue managed by a first scheduler; and A method of operation of an electronic device comprising terminating processes to be terminated included in the first run queue in order of memory usage and terminating them sequentially.

9. In Paragraph 8, The above sequentially terminated operations are, An operation to identify the first process with the highest memory usage among the above-mentioned aligned processes; and A method of operation of an electronic device comprising omitting the read operation and terminating the first process based on the fact that the first process is in a disk sleep state due to a read operation associated with file input / output.

10. In Paragraph 8, The above sequentially terminated operations are, An operation to identify the first process with the highest memory usage among the above-mentioned aligned processes; An operation to create a kernel thread based on the fact that the above-mentioned first process is in a disk sleep state due to a write operation associated with file input / output; and A method of operation of an electronic device comprising the operation of assigning the write operation to the kernel thread and terminating the first process.

11. In Paragraph 9 or 10, The above sequentially terminated operations are, An operation to generate an exception event associated with the above-mentioned memory shortage situation to preferentially allocate CPU (central processing unit) resources to the first process among the processes targeted for termination; and A method of operation of an electronic device comprising terminating the first process using the allocated CPU resources.

12. In Paragraph 8, The above first run queue is used with the highest priority among multiple run queues based on the occurrence of the above memory shortage situation, and A method of operation of an electronic device, wherein the plurality of run queues comprises at least one of the first run queue, a second run queue managed by a deadline scheduler, a third run queue managed by a real-time (RT) scheduler, or a fourth run queue managed by a completely fair (CFS) scheduler.

13. In Paragraph 8, The operation of selecting at least one process mentioned above is, An operation to identify the priority and memory usage of each of the running processes based on the occurrence of the above-mentioned memory shortage situation; and A method of operation of an electronic device comprising, based on the priority and memory usage of each of the processes currently running, selecting at least one process among the processes currently running as the process to be terminated for memory recovery.

14. In Paragraph 8 or Paragraph 13, A method of operating an electronic device, further comprising the operation of transmitting a termination instruction signal to at least one of the above processes.

15. A storage medium storing at least one instruction readable by a computer, wherein the at least one instruction is used for at least one operation of the electronic device when executed by at least a part of at least one processor of the electronic device, and The above at least one operation is: An operation to select at least one process among running processes for memory reclamation based on the occurrence of a memory shortage situation; The operation of adding at least one process to a first run queue managed by a first scheduler; and A storage medium comprising the operation of sequentially terminating processes to be terminated included in the first run queue by sorting them in order of memory usage.