A resource allocation system, comprising a memory management unit, a memory allocation unit, a memory storage unit, a switch, and at least two hosts;
- wherein the at least two hosts are connected to the switch based on a network, and the at least two hosts are respectively connected to at least two host memory interfaces in the memory allocation unit in one-to-one correspondence based on a compute express link (CXL) bus;
- memory device interfaces in the memory allocation unit are connected to the memory storage unit based on the CXL bus;
- the memory management unit is connected to the switch based on the network;
- the memory management unit is connected to a status obtaining interface in the memory allocation unit based on a universal asynchronous receiver/transmitter (UART), the memory management unit is connected to a configuration interface in the memory allocation unit based on a two-wire serial bus, and the memory management unit is further connected to a memory resource interface in the memory allocation unit based on a high-speed serial computer expansion bus;
- wherein the memory management unit is configured to:
- in response to a memory obtaining request forwarded by the switch in the resource allocation system, obtain a required memory capacity and a memory start address carried by the memory obtaining request, wherein the memory obtaining request is sent by any target host of the at least two hosts comprised in the resource allocation system to the switch;
- the memory management unit is further configured to select a target memory module that matches the required memory capacity from at least two memory modules in the resource allocation system based on the memory allocation unit in the resource allocation system;
- the memory management unit is further configured to perform address translation on the target memory module based on a memory address router in the memory allocation unit and the memory start address, and allocate the target memory module after the address translation to the target host;
- the memory management unit is further configured to:
- obtain memory allocation status corresponding to respective memory modules in the resource allocation system based on the memory allocation unit in the resource allocation system;
- determine one or more memory modules to be allocated and free memory sizes corresponding to the one or more memory modules to be allocated based on the memory allocation status corresponding to the respective memory modules;
- and
- in response to a free memory size of a first memory module in the one or more memory modules to be allocated being greater than or equal to the required memory capacity, determine the first memory module as the target memory module;
- the memory management unit is further configured to:
- in response to a memory size of any one of the one or more memory modules to be allocated being less than the required memory capacity, determine designated memory modules as the target memory module, wherein the designated memory modules comprise at least two memory modules to be allocated;
- the memory management unit is further configured to:
- obtain an initial start address, an initial end address, and a target memory size corresponding to the target memory module;
- determine a target end address based on the target memory size and the memory start address through the memory address router;
- and
- translate the initial start address to the memory start address, and translate the initial end address to the target end address.