# US 2021/0334140 A1 · Memory allocation method and multi-core concurrent memory allocation method

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2021/0334140 A1
- Document ID: US20210334140A1
- Status: Published application
- Kind: A1
- Application number: 16/325,119
- Filed: 2018-09-27
- Published: 2021-10-28
- Earliest claimed: 2017-10-11
- Assignees: Amlogic (Shanghai) Co., Ltd.
- Applicants: Amlogic (Shanghai) Co., Ltd.
- Inventors: Tao ZENG
- Web page: https://patentgrep.com/patent/US20210334140A1

## CPC

- G06F 9/5016: {the resource being the memory}
- G06F 9/5022: {Mechanisms to release resources}
- G06F 12/023: {Free address space management}
- G06F 2209/508: Monitor
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A memory/multi-core concurrent memory allocation method, which is applied to an embedded system, wherein a kernel module and a plurality of application programs are provided. The memory allocation method comprises: acquiring first memory allocation requests of the plurality of application programs; the kernel module determining whether preset screening marks exist in the first memory allocation requests; when screening marks exist in the first memory allocation requests, prohibiting allocating memory for the current application program managed by a contiguous memory allocator. By adopting the memory allocation method, the application programs which occupy contiguous memory allocated by the continuous memory allocator for a long time can be screened and removed, then contiguous memory allocation can be provided for the drivers in a shorter time, and the corresponding contiguous continuous memory can be allocated for the drivers through a plurality of processing units at the same time with a higher efficiency.

## Claims

### Claim 1

A memory allocation method, applied to an embedded system, wherein a kernel module and a plurality of application programs are provided; wherein the memory allocation method comprises steps of:
Step S1, acquiring first memory allocation requests of the plurality of application programs;
Step S2, the kernel module determining whether preset screening marks exist in the first memory allocation requests;
Step S3, when screening marks exist in the first memory allocation requests, prohibiting allocating memory for the current application program managed by a contiguous memory allocator.

### Claim 2 (depends on 1)

The memory allocation method as claimed in claim 1, wherein the screening marks comprises:
a first mark, configured to indicate that the plurality of application devices provide data to block devices for processing;
a second mark, configured to represent a write operation performed by one of the plurality of application programs.

### Claim 3 (depends on 1)

The memory allocation method as claimed in claim 1, wherein the memory allocation request is a mark set, and the mark set is configured to specify marks for the memory allocation and a behavior for control of the memory allocation.

### Claim 4 (depends on 1)

The memory allocation method as claimed in claim 1, further comprising a plurality of drivers, when the kernel module acquires second memory allocation requests of the driver modules, performing steps of:
Step A1, determining whether the contiguous memory allocated by the contiguous memory allocator being occupied by other application programs;
if the result shows “YES”, turning to Step A2;
if the result shows “NO”, turning to Step A3;
Step A2, migrating the plurality of application programs from the contiguous memory to a newly-allocated memory; and
Step A3, allocating the contiguous memory for the driver modules by the kernel module according to the memory allocation requests of the driver modules.

### Claim 5

A multi-core concurrent memory allocation method, comprising a memory allocation method applied to an embedded system, wherein a kernel module and a plurality of application programs are provided; wherein the memory allocation method comprises steps of:
Step S1, acquiring first memory allocation requests of the plurality of application programs;
Step S2, the kernel module determining whether preset screening marks exist in the first memory allocation requests;
Step S3, when screening marks exist in the first memory allocation requests, prohibiting allocating memory for the current application program managed by a contiguous memory allocator;
wherein the multi-core concurrent memory allocation method specifically comprises steps of:
M processing units being provided in the embedded system, when
the second memory allocation requests sent by the driver module are received, performing steps of:
Step B1, acquiring the quantity of contiguous memory that needs to be allocated according to the second memory allocation requests;
Step B2, dividing the quantity of the contiguous memory allocated into N parts;
Step B3, sending the second memory allocation requests to each of the processing units; and
Step B4, allocating the quantity of the contiguous memory corresponding to each of the N parts by the each of the processing units according to the second memory allocation requests.

### Claim 6 (depends on 5)

The multi-core concurrent memory allocation method as claimed in claim 5, wherein M is equal to N.

### Claim 7 (depends on 5)

The multi-core concurrent memory allocation method as claimed in claim 5, wherein M=4, N=4.

### Claim 8 (depends on 5)

The multi-core concurrent memory allocation method as claimed in claim 5, wherein the screening marks comprises:
a first mark, configured to indicate that the plurality of application devices provide data to block devices for processing;
a second mark, configured to represent a write operation performed by one of the plurality of application programs.

### Claim 9 (depends on 8)

The multi-core concurrent memory allocation method as claimed in claim 8, wherein M is equal to N.

### Claim 10 (depends on 8)

The multi-core concurrent memory allocation method as claimed in claim 8, wherein M=4, N=4.

### Claim 11 (depends on 5)

The multi-core concurrent memory allocation method as claimed in claim 5, wherein the memory allocation request is a mark set, and the mark set is configured to specify marks for the memory allocation and a behavior for control of the memory allocation.

### Claim 12 (depends on 11)

The multi-core concurrent memory allocation method as claimed in claim 11, wherein M is equal to N.

### Claim 13 (depends on 11)

The multi-core concurrent memory allocation method as claimed in claim 11, wherein M=4, N=4.

### Claim 14 (depends on 5)

The multi-core concurrent memory allocation method as claimed in claim 5, wherein the memory allocation method further comprising a plurality of drivers, when the kernel module acquires second memory allocation requests of the driver modules, performing steps of:
Step A1, determining whether the contiguous memory allocated by the contiguous memory allocator being occupied by other application programs;
if the result shows “YES”, turning to Step A2;
if the result shows “NO”, turning to Step A3;
Step A2, migrating the plurality of application programs from the contiguous memory to a newly-allocated memory; and
Step A3, allocating the contiguous memory for the driver modules by the kernel module according to the memory allocation requests of the driver modules.

### Claim 15 (depends on 14)

The multi-core concurrent memory allocation method as claimed in claim 14, wherein M is equal to N.

### Claim 16 (depends on 14)

The multi-core concurrent memory allocation method as claimed in claim 14, wherein M=4, N=4.
