Allocation method and electronic device

By detecting memory performance data information and dynamically adjusting the number of IO operations, the problem of low IO operation efficiency in heterogeneous memory scenarios is solved, and more efficient data read and write speed is achieved.

WO2024244945A1PCT designated stage expired Publication Date: 2024-12-05HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/092585
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-05-29
Filing Date
2024-05-11
Publication Date
2024-12-05

AI Technical Summary

Technical Problem

In heterogeneous memory scenarios, existing disk integration technologies cannot effectively sense the performance and load state of the memory, resulting in inefficient read/write IO operation and affecting file read and write speed.

Method used

By detecting the performance data information of the memory, dynamically adjusting the number of IO operations, and allocating IO operations based on the busy state and average usage of the memory to ensure efficient allocation of IO operations.

Benefits of technology

It improves the speed and efficiency of data read and write operations, optimizes the memory load situation, and improves the overall file read and write performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024092585_05122024_PF_FP_ABST
    Figure CN2024092585_05122024_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are an allocation method and an electronic device. The method may be applied to an electronic device, and the electronic device may comprise a plurality of memories of different types. The method comprises: detecting a first operation, wherein the first operation is a data read operation or a data write operation; in response to the first operation, according to first performance data information of a plurality of memories, determining the numbers of times a first IO operation is executed on the plurality of memories; and according to different numbers of times, controlling the plurality of memories to execute the first IO operation. In the technical solution, since different types of memories have different performances and load states, when allocating an IO operation corresponding to a read / write operation, an electronic device may refer to performance data information of different memories, and then according to the performance data information of different memories, execute the IO operation on the memories different numbers of times, such that the IO operation corresponding to the read / write operation can be quickly allocated, thereby increasing the speed of the read / write operation.
Need to check novelty before this filing date? Find Prior Art

Description

Distribution method and electronic device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on May 29, 2023, with application number 202310619654.1 and application name “Distribution Method and Electronic Device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] Embodiments of the present application relate to the field of electronic technology, and more particularly, to a distribution method and electronic device. Background Art

[0003] Electronic devices may include multiple different types of memory. In such heterogeneous memory scenarios, disk consolidation technology may be used to consolidate different types of memory. When users perform read and write operations on files in electronic devices, disk consolidation technology randomly allocates read and write input and output (IO) to different types of memory and cannot perceive the current state of the memory. Due to the different performance and load conditions of different memories, the allocation of read / write IO operations may be inefficient, thereby affecting the read and write speed of files.

[0004] Summary of the Invention

[0005] The present application provides an allocation method and electronic device. This technical solution can refer to the performance data information of different memories when allocating IO operations corresponding to data read and write operations in an electronic device, and perform different numbers of IO operations on the memories based on the performance data information of the different memories, so that the IO operations corresponding to the data read and write operations can be quickly allocated, thereby improving the speed of data read and write operations.

[0006] In a first aspect, an allocation method is provided, which is applied to an electronic device, wherein the electronic device includes a first memory and a second memory of different types, and the method includes: detecting a first operation, where the first operation is a data read operation or a data write operation; in response to the first operation, determining a first number of times a first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory based on first performance data information of the first memory and first performance data information of the second memory, wherein the first IO operation corresponds to the first operation; controlling the first memory to perform the first IO operation based on the first number; and controlling the second memory to perform the first IO operation based on the second number.

[0007] Based on the embodiments of the present application, the electronic device may include multiple memories of different types, and the performance and load status of different types of memories are different. When the electronic device detects a data read or data write operation, it can determine the number of IO operations to be performed on the multiple memories based on the first performance data information of the multiple memories, and control the multiple memories to perform the first IO operation according to the corresponding number of times.

[0008] In this way, when allocating IO operations corresponding to data read and write operations, electronic devices can refer to the performance data information of different memories and perform different IO operations on the memories according to the performance data information of different memories, so that the IO operations corresponding to the data read and write operations can be quickly allocated and executed, thereby improving the speed of read and write operations.

[0009] In combination with the first aspect, in an implementation of the first aspect, during the process of the first memory and the second memory executing the first IO operation, second performance data information of the first memory and second performance data information of the second memory are obtained, and the second performance data information is used by the electronic device to determine the third number of times the second IO operation is executed on the first memory and the fourth number of times the second IO operation is executed on the second memory, wherein the second IO operation corresponds to the second operation, and the second operation is a data read operation or a data write operation.

[0010] Based on the embodiments of the present application, during the process of executing the first IO operation in the first memory and the second memory, performance data of the first memory and the second memory can be obtained in real time, so that the electronic device can refer to the performance data when allocating IO operations corresponding to subsequent data read and write operations, thereby improving the efficiency of allocating IO operations.

[0011] In combination with the first aspect, in an implementation of the first aspect, the first performance data information includes the average time taken by the first memory and the second memory to perform a single IO operation, wherein determining the first number of times the first IO operation is performed on the first memory and the second number of times the first IO operation is performed on the second memory includes: determining the busy status of the first memory and the second memory based on the average time taken by the first memory and the second memory to perform a single IO operation; and determining the first number of times the first IO operation is performed on the first memory and the second number of times the first IO operation is performed on the second memory based on the busy status.

[0012] Based on an embodiment of the present application, the first performance data information may include the average time taken by the first memory and the second memory to perform a single IO operation. The electronic device determines whether the first memory and the second memory are in a busy state based on the average time, and further determines the specific number of IO operations performed on the first memory and the second memory based on the busy state.

[0013] This technical solution can determine the current specific performance status of the first memory and the second memory, thereby facilitating decision-making and allocation by the electronic device.

[0014] In combination with the first aspect, in an implementation of the first aspect, determining the busy status of the first memory and the second memory based on the average time taken by the first memory and the second memory to perform a single IO operation includes: when it is determined that the average time taken by the first memory to perform a single IO operation is greater than a first preset value, determining that the first storage is in a busy state; when it is determined that the average time taken by the first memory to perform a single IO operation is less than or equal to the first preset value, determining that the first memory is in an idle state; or, when it is determined that the average time taken by the second memory to perform a single IO operation is greater than a second preset value, determining that the memory is in a busy state; when it is determined that the average time taken by the second memory to perform a single IO operation is less than or equal to the second preset value, determining that the second memory is in an idle state.

[0015] Based on the embodiment of the present application, when it is determined that the average time taken by the memory to perform a single IO operation is greater than a preset value, the memory can be determined to be in a busy state; otherwise, the memory can be determined to be in an idle state. This technical solution enables an electronic device to determine whether each memory is in a busy state.

[0016] In combination with the first aspect, in an implementation of the first aspect, determining the first number of times the first IO operation is performed on the first memory and the second number of times the first IO operation is performed on the second memory based on the busy state includes: when it is determined that the first memory is in a busy state and the second memory is in an idle state, the first number of times the electronic device performs the first IO operation on the first memory is less than the second number of times the first IO operation is performed on the second memory.

[0017] Based on the embodiment of the present application, the electronic device performs a first IO operation on the first memory in a busy state for a first number of times less than the second number of times it performs the first IO operation on the second memory in an idle state, thereby enabling the memory in the idle state to perform a greater number of IO operations and the memory in the busy state to perform a smaller number of IO operations, which is beneficial to improving the allocation efficiency of IO operations and thereby improving the speed of data reading and writing operations.

[0018] In combination with the first aspect, in an implementation of the first aspect, the first performance data information includes the average time taken by the first memory and the second memory to perform a single IO operation, wherein the determining the first number of times the first IO operation is performed on the first memory and the second number of times the first IO operation is performed on the second memory includes: when it is determined based on the first performance data information that the ratio of the average time taken by the first memory to perform a single IO operation to the average time taken by the second memory to perform a single IO operation is m:n, the ratio of the number of times the electronic device performs the first IO operation on the first memory to the number of times the first IO operation is performed on the second memory is n:m.

[0019] In an embodiment of the present application, the electronic device can dynamically determine the number of times IO operations are performed on each memory based on the ratio of the average time taken by each memory to perform a single IO operation, so that the electronic device can dynamically adjust the ratio of the number of times IO operations are performed on each memory to improve the allocation efficiency of IO operations.

[0020] In combination with the first aspect, in an implementation of the first aspect, the first performance data information includes the busy status of the first memory and the second memory, wherein determining the first number of times the first IO operation is performed on the first memory and the second number of times the first IO operation is performed on the second memory includes: determining the first number of times the first IO operation is performed on the first memory and the second number of times the first IO operation is performed on the second memory based on the busy status of the first memory and the second memory.

[0021] In an embodiment of the present application, the first performance data information can directly include the busy status of the first memory and the second memory, so that the electronic device can directly determine the busy status of each memory without calculation, thereby improving the speed of the electronic device in allocating IO operations.

[0022] In combination with the first aspect, in an implementation manner of the first aspect, the first performance data information is performance data information within a current statistical period.

[0023] In the embodiment of the present application, the first performance data information of the memory is the performance data information within the current statistical period, thereby ensuring the timeliness of the first performance data information and making the data more accurate.

[0024] In combination with the first aspect, in an implementation manner of the first aspect, the first performance data information further includes a maximum time taken by the first memory and the second memory to execute a single IO operation.

[0025] In an embodiment of the present application, the first performance data may also include the maximum time taken by each memory to execute a single IO operation, thereby facilitating the electronic device to determine the performance of the memory in multiple aspects and providing a reference for allocating IO operations.

[0026] In combination with the first aspect, in an implementation of the first aspect, the type of the first memory is one of universal flash storage UFS and embedded multimedia memory card EMMC, and the type of the second memory is the other of UFS and EMMC.

[0027] It should be understood that the number of the first memory and the second memory can be one or more, and the types of the first memory and the second memory can also be other types, which are not limited in this application.

[0028] In a second aspect, an electronic device is provided, comprising one or more processors; one or more memories; the one or more memories storing one or more computer programs, the one or more computer programs comprising instructions, which, when executed by one or more processors, enable the allocation method described in the first aspect and any possible implementation thereof to be executed.

[0029] In a third aspect, a distribution device is provided, comprising a module for implementing the distribution method as described in the first aspect and any possible implementation thereof.

[0030] In a fourth aspect, a chip is provided, comprising a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the allocation method described in the first aspect and any possible implementation thereof is executed.

[0031] In a fifth aspect, a readable storage medium is provided, characterized in that instructions are stored in the readable storage medium. When the instructions are run on an electronic device, the readable storage medium stores instructions so that the allocation method described in the first aspect and any possible implementation thereof is executed.

[0032] In a sixth aspect, a program product is provided, comprising a program code, wherein when the program code is run on an electronic device, the distribution method as described in the first aspect and any possible implementation thereof is executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] FIG1 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.

[0034] FIG2 is a schematic diagram of an electronic device according to an embodiment of the present application.

[0035] FIG3 is a schematic architecture diagram of an electronic device provided in an embodiment of the present application.

[0036] FIG4 is a schematic architecture diagram of another electronic device provided in an embodiment of the present application.

[0037] FIG5 is a schematic flowchart of an internal execution allocation method of an electronic device provided in an embodiment of the present application.

[0038] FIG6 is a schematic diagram of a data processing module provided in an embodiment of the present application.

[0039] FIG7 is a schematic flow chart of an allocation method provided in an embodiment of the present application.

[0040] FIG8 is a schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.

[0042] The allocation method in the embodiments of the present application can be applied to electronic devices such as smartphones, smart speakers, smart TVs, tablet computers, laptops, personal computers (PCs), ultra-mobile personal computers (UMPCs), netbooks, vehicle-mounted devices, wearable devices, foldable devices, and Internet of Things (IOT) devices.

[0043] 1 shows a schematic structural diagram of an electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identification module (SIM) card interface 195. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0044] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0045] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0046] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal based on the instruction operation code and the timing signal to complete the control of instruction fetching and execution.

[0047] The processor 110 may also include a memory for storing instructions and data.

[0048] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus interface.

[0049] The charging management module 140 is configured to receive charging input from a charger.

[0050] The power management module 141 is used to connect the battery 142 , the charging management module 140 and the processor 110 .

[0051] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0052] The mobile communication module 150 can provide wireless communication solutions including 2G / 3G / 4G / 5G applied on the electronic device 100.

[0053] The modulation and demodulation processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.

[0054] The wireless communication module 160 can provide wireless communication solutions for application on the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), Bluetooth low energy (BLE), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.

[0055] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 , and antenna 2 is coupled to wireless communication module 160 , so that electronic device 100 can communicate with the network and other devices through wireless communication technology.

[0056] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0057] The display screen 194 is used to display images, videos, etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.

[0058] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0059] The ISP is used to process data fed back by the camera 193. The camera 193 is used to capture still images or videos.

[0060] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals.

[0061] The video codec is used to compress or decompress digital video. The electronic device 100 may support one or more video codecs.

[0062] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.

[0063] The internal memory 121 may be used to store computer executable program codes, which include instructions. The processor 110 executes the instructions stored in the internal memory 121 to execute various functional applications and data processing of the electronic device 100.

[0064] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0065] The audio module 170 is used to convert digital audio information into analog audio signals for output, and is also used to convert analog audio input into digital audio signals.

[0066] The speaker 170A, also called a "horn", is used to convert audio electrical signals into sound signals.

[0067] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals.

[0068] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals.

[0069] The headphone jack 170D is used to connect a wired headphone.

[0070] The pressure sensor 180A is used to sense pressure signals and convert the pressure signals into electrical signals. In some embodiments, the pressure sensor 180A can be disposed on the display screen 194 .

[0071] The gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .

[0072] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude using the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.

[0073] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).

[0074] The distance sensor 180F is used to measure distance.

[0075] The fingerprint sensor 180H is used to collect fingerprints.

[0076] The touch sensor 180K is also called a “touch panel.” The touch sensor 180K can be disposed on the display screen 194 . The touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen.”

[0077] The bone conduction sensor 180M can acquire vibration signals.

[0078] The buttons 190 include a power button, a volume button, and the like.

[0079] Motor 191 can generate vibration prompts.

[0080] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0081] The SIM card interface 195 is used to connect a SIM card.

[0082] Before introducing the technical solutions of the embodiments of the present application, some professional and technical terms that may be involved in the present application are briefly introduced as follows.

[0083] User space: Code runs at a lower privilege level, can only see some system resources, and cannot directly access kernel space and hardware devices. When a process runs in user space, it is said to be in user state (or simply user state).

[0084] Kernel space: Code runs at a higher privilege level, has full visibility into all system resources, and has full access to hardware devices. For example, when a task (process) executes a system call and falls into kernel code execution, the process is said to be in kernel running state (or simply kernel state).

[0085] Redundant arrays of independent disks (RAID): RAID technology can distribute or replicate the tasks of a single hard drive across multiple disks to improve performance or create data redundancy in case of drive failure. RAID technologies include RAID 0, RAID 1, RAID 5, and so on.

[0086] Block device: A device in the system that can randomly access fixed-size data pieces (chunks) is called a block device, and these data pieces are called blocks.

[0087] Driver: A special program that enables computers and devices to communicate, which is equivalent to the hardware interface. The operating system can control the operation of the hardware device through this interface.

[0088] FIG2 is a schematic diagram of the architecture of an electronic device. As shown in FIG2 , the electronic device 200 may include at least a user space 210 , a kernel space 220 , and a memory 230 .

[0089] Among them, the user space 210 may include a data partition 211 visible to the user. The kernel space 220 may include a file system, a block layer, and a driver layer. The memory 230 may include a universal flash storage (UFS) 231 and an embedded multimedia memory card (EMMC) 232. The UFS 231 and the EMMC 232 may use a redundant array of independent disks (RAID) 0 technology to form a disk array system. In the driver layer in the kernel space 220, there are a driver 226 corresponding to the UFS 231 and a driver 227 corresponding to the EMMC; in the block layer, there are a block device 224 corresponding to the driver 224 and a block device 225 corresponding to the driver 227.

[0090] For example, the user-visible data partition 211 may be a gallery, a data directory, etc.

[0091] The file system may include an IO allocator 221 , which may allocate read / write IO operations corresponding to read and write operations performed by users.

[0092] Exemplarily, a user performs a write operation A on a file in data partition 211. This write operation A may correspond to 100 write IOs. The IO allocator 221 can be used to allocate the 100 write IOs to the RAID0 array system 223. The RAID0 array system 223 can allocate the number of write IOs to the UFS 231 and the EMMC 232 in a random allocation manner. For example, the RAID0 array system 223 allocates 60 write IOs to the UFS 231, that is, the RAID0 array system 223 will perform 60 write operations on the UFS. Exemplarily, during the execution of the write operation, the instruction to control the write data and the data to be written can be sent to the UFS; the RAID0 array system 223 allocates 40 write IOs to the EMMC 232, that is, the RAID0 array system 223 will perform 40 write operations on the EMMC 232. Exemplarily, during the execution of the write operation, the instruction to control the write data and the data to be written can be sent to the EMMC.

[0093] In an embodiment of the present application, the RAID0 array system 223 can allocate the 60 write IOs to the block device 224. For example, the RAID0 array system 223 can perform 60 write operations on the block device 224. During the write operation, the instruction to control the write data and the data to be written or the address of the data to be written can be sent to the block device 224. The block device 224 can send 60 write IOs to the driver 226. For example, the block device 224 can perform 60 write operations on the driver 226. During the write operation, the instruction to control the writing of data and the data to be written or the address of the data to be written can be sent to the driver 226; the driver 226 can send the 60 write IOs to the UFS231 to write the corresponding data into the UFS231. For example, the driver 226 can perform 60 write operations on the UFS231. During the write operation, the driver 226 can send the instruction to control the writing of data and the data to be written to the UFS231. The driver 226 can also obtain the data to be written according to the address of the data to be written, and then send the instruction to control the writing of data and the data to be written to the UFS231.

[0094] Accordingly, the RAID0 array system 223 may allocate the remaining 40 write IOs to the block device 225. For example, the RAID0 array system 223 may perform 40 write operations on the block device 225. During the write operations, the instructions for controlling the write data and the data to be written or the address of the data to be written may be sent to the block device 225. The block device 225 may send the 40 write IOs to the driver 227. For example, the block device 225 may perform 40 write operations on the driver 227. During the write operations, the instructions for controlling the write data and the data to be written or the address of the data to be written may be sent to the driver 227. The driver 227 may send the 40 write IOs to the EMMC 232 to write the corresponding data into the EMMC 232. For example, the driver 227 may perform 40 write operations on the EMMC 232. During the write operations, the driver 227 may send a data write control instruction and the data to be written to the EMMC 232. The driver 227 may also obtain the data to be written according to the address of the data to be written, and then send the data write control instruction and the data to be written to the EMMC 232. Thus, the RAID 0 array system completes the allocation of 100 write IOs corresponding to the write operation A.

[0095] For example, for a data read operation B, it may correspond to 100 read IOs, and the IO allocator 221 may be used to allocate the 100 read IOs to the RAID0 array system 223. For example, the RAID0 array system 223 determines that 70 read operations need to be performed on the UFS 231 and 30 read operations need to be performed on the EMMC 232. For example, the RAID0 array system 223 may perform 40 read operations on the block device 224. During the execution of the read operation, the instruction to control the reading of data and the address of the data to be read may be sent to the block device 224. The block device 224 may send 70 read IOs to the driver 226. For example, the block device 224 may perform 70 read operations on the driver 226. During the execution of the read operation, the instruction to control the reading of data and the address of the data to be read may be sent to the driver 226. Driver 226 can send the 70 read IOs to UFS 231. For example, driver 226 can perform 70 read operations on UFS 231. During the read operations, driver 226 can send the instruction to control the reading of data and the address of the data to be read to UFS 231. For each read operation, UFS 231 sends the data to be read to driver 226. After that, driver 226 stores the read data in the running memory and sends the address of the data in the running memory to block device 224. Block device 224 reads the corresponding data according to the address and sends the read data to RAID 0 array system 223. RAID 0 array system 223 presents the read data to the user in the user-visible data partition 211 through the file system.

[0096] Accordingly, the RAID0 array system 223 may perform 30 read operations on the block device 225. During the read operations, the block device 225 may send an instruction to control the reading of data and the address of the data to be read to the block device 225. The block device 225 may send the 30 read IOs to the driver 227. For example, the block device 225 may perform 30 read operations on the driver 227. During the read operations, the block device 225 may send an instruction to control the reading of data and the address of the data to be read to the driver 227. The driver 227 may send the 30 read IOs to the EMMC 232. For example, the driver 227 may perform 30 read operations on the EMMC 232. During the read operations, the driver 227 may send an instruction to control the reading of data and the address of the data to be read to the EMMC 232. For each read operation, EMMC232 sends the data to be read to the driver 227. After that, the driver 227 stores the read data in the running memory and sends the address of the data in the running memory to the block device 225. The block device 225 reads the corresponding data according to the address and sends the read data to the RAID0 array system 223. The RAID0 array system 223 presents the read data to the user in the user-visible data partition 211 through the file system.

[0097] However, since different types of memories have different performance and load conditions, this method of allocating read / write IO operations does not take into account the performance of different memories and the current load conditions of the memories. It is possible that a memory with poor performance and high load will be allocated a larger number of read / write IO operations, which will cause the electronic device to be inefficient when performing specific read / write IO operations, reducing the speed of file reading and writing.

[0098] In view of this, embodiments of the present application provide a distribution method and an electronic device, so as to improve the speed of data reading and writing operations when performing data reading and writing operations on the electronic device.

[0099] The following will introduce the technical solution of this application in conjunction with Figures 3-7.

[0100] 3 and 4 are schematic diagrams of an electronic device according to an embodiment of the present application. As shown in FIG3 , the electronic device 300 may include at least a user space 310 , a kernel space 320 , and a memory 330 .

[0101] In some embodiments, the user space 310 may include a user-visible data partition 311. The kernel space 320 may include at least a file system, a block layer, and a driver layer. The file system may be a flash-friendly file system (F2FS) or a fourth-generation extended file system (EXT4).

[0102] Memory 330 may be composed of multiple memories of different types. For example, memory 330 may be composed of a first type of memory A and a second type of memory B. Memory A may include n memories, namely, memory A1, memory A2, ..., memory An; and memory B may include n memories, namely, memory B1, memory B2, ..., memory Bn.

[0103] For example, the memory A may be UFS, and the memory B may be EMMC; or the memory A may be EMMC, and the memory B may be UFS. The memory A and the memory B may also be other types of memory.

[0104] It should be understood that the embodiment of the present application uses the example of memory 330 being composed of two different types of memory for illustration, but this should not limit the use scenarios of the present application. In other implementations, the embodiment of the present application does not limit the number of memory types.

[0105] The driver layer in the kernel space 320 may include drivers A1 to An corresponding to memories A1 to An, and drivers B1 to Bn corresponding to memories B1 to Bn.

[0106] In addition, each driver also corresponds to a data processing module. Driver A1 corresponds to data processing module A1, driver A2 corresponds to data processing module A2, ..., driver An corresponds to data processing module An, driver B1 corresponds to data processing module B1, driver B2 corresponds to data processing module B2, ..., driver Bn corresponds to data processing module Bn.

[0107] In some embodiments, as shown in Figure 4 , the data processing module can also be located in the driver corresponding to the memory, that is, the driver A1 includes the data processing module A1. In this case, the data processing module can be a functional module in the driver. It should be understood that when the electronic device is powered on, a corresponding data processing module can be created for each memory; alternatively, the data processing module can be a functional module that is already present in the electronic device when it leaves the factory.

[0108] In some embodiments, the data processing module can be used to obtain the performance data information of the corresponding memory, and can send the performance data information of the memory to the corresponding block device, and the block device sends the performance data information of the memory to the IO allocator. Afterwards, when the user performs read and write operations on the files of the data partition, the IO allocator can allocate the read / write IO operation times corresponding to the read and write operations according to the performance data information of each memory. For example, if memory A1 is currently busy, the IO allocator can allocate fewer read / write IO operations to memory A1; if memory B1 is idle, the IO allocator can allocate more read / write IO operations to memory B1. Alternatively, the IO allocator can also allocate different proportions of read / write IO operation times to each memory according to the performance data information of each memory. In this way, the read / write IO operation times corresponding to the read and write operations can be efficiently allocated to improve the reading and writing speed.

[0109] Exemplarily, for a memory A1, after the IO allocator 321 allocates a target number of write IOs to it based on the performance data information of the memory A1, the IO allocator can send the target number of write IOs to the corresponding block device A1, that is, the IO allocator 321 needs to perform a target number of write operations on the block device A1, for example, the IO allocator can send the instruction to control the writing of data and the data to be written or the address of the data to be written to the block device 1; the block device A1 sends the target number of write IOs to the corresponding driver A1, that is, the block device A1 needs to perform a target number of write operations on the driver A1, for example, the block device A1 can send the instruction to control the writing of data and the data to be written or the address of the data to be written to the driver A1; the driver A1 sends the target number of write IOs to the memory A1, that is, the driver A1 needs to perform a target number of write operations on the memory A1, for example, the driver A1 sends the instruction to control the writing of data and the data to be written or the address of the data to be written to the memory A1, so as to write the corresponding data into the memory A1. During this process, the data processing module A1 can obtain various performance data information when the memory A1 executes each write IO, and send the performance data information to the block device A1. The block device A1 sends the performance data information to the IO distributor 321, so that the IO distributor 321 can determine the current performance status and load status of the memory A1.

[0110] It is understandable that the process of the IO allocator 321 allocating read / write IO operations to other memories can refer to the relevant description of the memory A1.

[0111] In some embodiments, the performance data information may include the cumulative number of read / write IO operations, the cumulative time of read / write IO operations, and the maximum time of read / write IO operations; or, the performance data information may also include the average time of read / write IO operations and the busy status of read / write IO operations calculated based on the cumulative number of read / write IO operations and the cumulative time of read / write IO operations.

[0112] In some implementations, the performance data information may include the read / write IO operation busy status and the average read / write IO operation time, or the performance data information may only include the read / write IO operation busy status.

[0113] For example, for a read / write IO operation, its duration can be obtained as follows: The read / write IO operation duration here can be the time it takes for the memory to execute a single read / write IO operation.

[0114] For the case where the driver and the data processing module are two separate modules. Referring to Figure 3, when the driver sends a read / write IO operation to the corresponding memory, it records the time T1 at which the sending starts. When the memory completes the read / write IO operation, it returns a message indicating that the execution is complete to the driver. The driver records the time T2 at which the execution is complete. The time T for the read / write IO operation can be expressed as T=T2-T1. The driver can send T1 and T2 to the data processing module. The data processing module can calculate the time T for the read / write IO operation based on T using the formula T=T2-T1.

[0115] In the case where the data processing module is a functional module of the driver, as shown in FIG4 , the data processing module can record T1 and T2 and calculate the time T of the read / write IO operation. In this case, the driver sends the performance data information to the IO distributor 321 via the block device.

[0116] It should be understood that for each read / write IO operation, its duration can be determined using the above method.

[0117] The accumulated time of the read / write IO operation can be understood as the sum of the times of all the read / write IO operations in the current statistical period. The accumulated time of the read / write IO operation can be calculated by the data processing module.

[0118] The maximum duration of the read / write IO operation may be the maximum duration of all read / write IO operations in the current statistical period, and the maximum duration of the read / write IO operation may be determined by the data processing module.

[0119] The embodiment of the present application does not limit the specific duration of the statistical period. For example, the statistical period may be 10 milliseconds (ms), 100 ms, or 150 ms.

[0120] The average time taken for a read / write IO operation can be obtained by dividing the cumulative time taken for the read / write IO operation by the cumulative number of read / write IO operations. The average time taken for the read / write IO operation can be calculated by the data processing module.

[0121] The read / write IO operation busy status can be determined based on the average read / write IO operation duration. For example, if the average read / write IO operation duration is greater than or equal to a preset duration, the read / write IO operation busy status can be determined to be busy; otherwise, the read / write IO operation busy status is idle. The read / write IO operation busy status can be calculated by the data processing module.

[0122] It should be understood that the embodiment of the present application does not limit the specific value of the preset time length. For example, the preset time length can be 10ms or 20ms.

[0123] In this way, for each read / write operation, the data processing module can obtain the performance data of the memory executing the read / write IO operation and feed it back to the IO distributor. As a result, the IO distributor can obtain the performance and current busy status of each memory. When allocating new read / write IO operations, the IO distributor can make dynamic decisions and allocations based on the performance and busy status of each memory, ensuring that the read / write IO operations corresponding to the current read / write operation can be efficiently allocated to each memory, thereby improving the speed of read / write operations.

[0124] In addition, in the embodiment of the present application, the IO allocator of the file system dynamically determines the proportion or quantity allocated to each storage for each read / write IO operation, and does not add an additional software layer architecture, thereby avoiding additional processing overhead between layers.

[0125] The above text, in combination with Figures 3 and 4, introduces the schematic architecture of an electronic device that can be applied in the embodiment of the present application. The following text, in combination with Figure 5, introduces the process of dynamic decision-making and allocation of the electronic device according to the performance data of the memory in the embodiment of the present application.

[0126] FIG5 is a schematic flow chart of a distribution method provided by an embodiment of the present application. As shown in FIG5 , the method 400 may include steps 410 to 480 .

[0127] 410. The IO allocator allocates the read / write IO operation corresponding to the read / write operation to the block device corresponding to the memory.

[0128] In some implementations, after an electronic device is powered on, suppose the user's first operation is to perform a write operation A on file A. This write operation A may correspond to 100 write IOs. Since the electronic device has just been powered on, the file system's IO allocator cannot access the data from each memory. In this case, the IO allocator can randomly allocate the 100 write IOs to the block devices corresponding to each memory; alternatively, the IO allocator can evenly distribute the 100 write IOs to the block devices corresponding to each memory.

[0129] For example, an electronic device includes two types of storage, UFS1 and EMMC1. For the 100 write IOs corresponding to write operation A, the IO allocator can randomly allocate them to the block devices corresponding to UFS1 and EMMC1, or evenly allocate them to the block devices corresponding to UFS1 and EMMC1.

[0130] It should be understood that the specific implementation method of the electronic device allocating the write IO to the memory UFS1 and EMMC1 can be found in the relevant description in the previous text, and for the sake of brevity, it will not be repeated here.

[0131] In some embodiments, after write operation A, the IO allocator obtains the memory performance status sent by the data processing module of each memory via the block device. If a new read or write operation occurs, such as another write operation B, which corresponds to 200 write IOs, the IO allocator can dynamically adjust the ratio or number of write IOs allocated to each memory based on the performance status of each memory. In other words, the IO allocator can dynamically determine the number of write IOs to be executed for each memory.

[0132] For example, if the electronic device includes two types of memory, UFS1 and EMMC1, for the 200 write IOs corresponding to write operation B, if the memory performance status obtained by the IO allocator indicates that UFS1 is idle and EMMC1 is busy, then a larger number of write IOs can be allocated to UFS1 and a smaller number of write IOs can be allocated to EMMC1, such as 150 write IOs to UFS1 and 50 write IOs to EMMC1.

[0133] In an embodiment of the present application, allocating 150 write IOs to UFS1 can be understood as writing the corresponding data into UFS1 through 150 write IO operations, that is, 150 write operations need to be performed on UFS1; allocating 50 write IOs to EMMC1 can be understood as writing the corresponding data into EMMC1 through 50 write IO operations, that is, 50 write operations need to be performed on EMMC1.

[0134] Alternatively, if the electronic device includes two types of memory, namely UFS1 and EMMC1. For the 200 write IOs corresponding to the write operation B, if the IO allocator determines, based on the acquired memory performance status, that the ratio of the average write IO time of UFS1 to the average write IO time of EMMC1 is 1:9, then the IO allocator can allocate write IOs to UFS1 and to EMMC1 in a ratio of 9:1. This allows the write operation B to be executed faster.

[0135] 420. The block device sends a read / write IO operation to a driver corresponding to the memory.

[0136] The specific process of the block device sending read / write IO operations to the driver can be found in the description above.

[0137] It should be understood that the block device corresponding to each memory can send the read / write IO operation allocated by the IO allocator to the driver corresponding to the memory.

[0138] 430 , the driver sends a read / write IO operation to the memory.

[0139] The specific process of the driver sending read / write IO operations to the memory can be found in the description above.

[0140] Each driver can send the read / write IO operations allocated by the IO allocator to the corresponding storage.

[0141] 440. The driver obtains first performance data information of the memory.

[0142] In some implementations, a driver corresponding to each memory may include a data processing module, which may acquire the first performance data information of the memory.

[0143] It should be understood that the first performance data information may be the performance data information mentioned above. For details on how to obtain the first performance data information, please refer to the relevant descriptions in the above text. For the sake of brevity, it will not be repeated here.

[0144] 450. The driver determines a performance status of the memory according to the first performance data information.

[0145] In some embodiments, the driver may include a data processing module, and the performance status may be a busy status of the memory, which may be determined by the data processing module. A specific method for determining the busy status may be described in detail above.

[0146] 460. The driver sends the performance status of the memory to the corresponding block device.

[0147] It should be understood that each driver may send the performance status of the memory determined by it to the corresponding block device.

[0148] In some embodiments, when the data processing module is not included in the driver, the data processing module may determine the performance status of the memory according to the first performance data information, and send the performance status to the corresponding block device.

[0149] 470. The block device sends the performance status of the memory to the IO allocator.

[0150] Each block device can send the performance status of the memory it receives to the IO allocator.

[0151] 480. When allocating a new read / write IO operation, the IO allocator allocates the read / write IO operation to each memory according to the performance status of each memory.

[0152] In some implementations, when performing new read / write IO operation allocation, the IO allocator may allocate a ratio or quantity of read / write IO operations to each memory according to the performance status of each memory.

[0153] It is understandable that when a user performs a read operation, the read operation may correspond to multiple files. When the IO allocator allocates multiple read IOs to multiple files, when it is determined that a certain memory is busy based on the performance status of each memory, it can give priority to reading files on other idle memories.

[0154] For example, when an electronic device detects that a user has opened a gallery application, this is considered a read operation. The gallery may contain multiple images, which the electronic device needs to present to the user. If the electronic device determines that memory A is busy, it can prioritize reading images from other memories and presenting them to the user, thereby speeding up the presentation of images.

[0155] Through the technical solution provided by the embodiments of the present application, for each read / write operation, the driver can obtain the performance data of the memory executing the read / write IO operation and feed it back to the IO distributor. As a result, the IO distributor can obtain the performance and current busy status of each memory. When allocating new read / write IO operations, the IO distributor can make dynamic decisions and allocations based on the performance and busy status of each memory, ensuring that the read / write IO operations corresponding to the current read / write operation can be efficiently allocated to each memory, thereby improving the speed of read / write operations.

[0156] The data processing module in the embodiment of the present application will be introduced below in conjunction with Figure 6.

[0157] For example, Figure 6 is a schematic diagram of a data processing module provided in an embodiment of the present application. As shown in Figure 6, the data processing module 500 may include an initialization module 561, a data acquisition module 562, a calculation module 563, a storage module 564 and a data reporting module 565.

[0158] When the electronic device detects that it is powered on, it can traverse the memory of the electronic device and create a corresponding data processing module for each memory at the driver layer. Alternatively, the data processing module can also exist when the electronic device leaves the factory.

[0159] The initialization module 561 may be used to initialize the data processing module 500 and to set a statistical period of the data processing module.

[0160] In some embodiments, the data collection module 562 can be used to collect various performance data information of the memory and store the performance data information in the storage module 564. For example, the data collection module can collect the cumulative number of read / write IO operations, the cumulative duration of read / write IO operations, and the maximum duration of read / write IO operations, and store the collected data in the data collection field of the storage module 564.

[0161] In some embodiments, the calculation module 563 may be configured to calculate the performance data information collected by the data collection module within a statistical period and store the calculation results in the storage module 564. For example, the calculation module 563 may be configured to read data from the data collection field of the memory 564 and calculate the average read / write IO operation time and the busy status of the memory based on the read data. The calculation module 563 may also store the calculated average read / write IO operation time and the busy status of the memory in the data reporting field of the memory.

[0162] In some embodiments, the storage module 564 can be used to store various data collected by the data collection module 562 and result data calculated by the calculation module 563.

[0163] In some embodiments, the data reporting module 565 can be used to read the calculation results stored in the data reporting field in the memory 564 and send the results to the IO allocator, thereby facilitating the IO allocator to dynamically decide and allocate read / write IO operations to each memory.

[0164] It will be appreciated that the various functional modules included in the data processing module 500 are merely illustrative. In other examples, the data acquisition module 562 and the data reporting module 565 may be located in a single module; alternatively, the initialization module 561, the data acquisition module 562, the calculation module 563, and the data reporting module 565 may be located in a single processing module; alternatively, one or more of the initialization module 561, the data acquisition module 562, the calculation module 563, the storage module 564, and the data reporting module 565 may not be present. This embodiment of the present application is not limited to this.

[0165] In the embodiment of the present application, assuming that the memory of the electronic device includes UFS1 and EMMC1, the technical solution in the embodiment of the present application is adopted. Compared with the memory of the electronic device including only UFS1 or the memory of the electronic device including only EMMC1, when the memory is in an idle state and a busy state, the speed of performing read / write IO operations in the present application is faster and more efficient. The technical solution in the embodiment of the present application is compared with the solution in which the memory of the electronic device includes UFS1 and EMMC1 but the read / write IO operations are distributed evenly or in a fixed ratio. The electronic device in the present application performs read / write IO operations in a shorter time, at a faster speed, and with higher efficiency.

[0166] FIG7 is a schematic flow chart of an allocation method provided in an embodiment of the present application. As shown in FIG7 , the method 600 can be applied to an electronic device, which can include a first memory and a second memory of different types. The method 600 can include steps 610 to 620.

[0167] 610 , the electronic device detects a first operation, where the first operation is a data read operation or a data write operation.

[0168] Exemplarily, the first operation may be a data writing operation, and the data writing operation may include performing data writing through a plurality of write IO operations, so as to write the data corresponding to the write operation into the memory of the electronic device.

[0169] Exemplarily, the first operation may also be a data reading operation, which may be an operation of reading multiple files, and may include reading data through several read IO operations to read the data corresponding to the read operation from the memory of the electronic device.

[0170] 620. The electronic device determines, in response to the first operation, a first number of times the first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory based on the first performance data of the first memory and the first performance data information of the second memory, wherein the first IO operation corresponds to the first operation.

[0171] For example, the first operation may correspond to 100 IO operations. Then, when allocating the number of first IO operations to the first memory and the second memory, the electronic device may determine the number of times the first IO operation is performed on the first memory and the specific number of times the first IO operation is performed on the second memory based on the performance data information of the first memory and the performance data information of the second memory. For example, if the first number is 60, 60 IO operations are performed on the first memory, and the second number is 40, 40 IO operations are performed on the second memory.

[0172] Allocating 60 IOs to the first memory can be understood as writing data to the first memory through 60 write IOs, or reading data from the first memory through 60 read IOs.

[0173] 630. The electronic device controls the first memory to execute the first IO operation according to the first number; and controls the second memory to execute the first IO operation according to the second number.

[0174] After the electronic device allocates a specific number of first IOs to the first memory and the second memory, the electronic device can write data to the first memory and the second memory for write IOs corresponding to write operations, and read corresponding data from the first memory or the second memory for read IOs corresponding to read operations.

[0175] It should be understood that the specific process of the electronic device controlling the memory to perform the first IO operation can be found in the relevant description above.

[0176] In some embodiments, the first memory may be the UFS mentioned above, and the second memory may be the EMMC mentioned above. Alternatively, the first memory may be the EMMC mentioned above, and the second memory may be the UFS mentioned above.

[0177] It should be understood that the first memory and the second memory may also be other types of memories, which are not limited in the embodiments of the present application.

[0178] In some examples, the number of the first memories may be one or more, which is not limited in the embodiments of the present application.

[0179] Based on the embodiments of the present application, the electronic device may include multiple memories of different types, and the performance and load status of different types of memories are different. When the electronic device detects a data read or data write operation, it can determine the number of times IO is performed on the multiple memories based on the first performance data information of the multiple memories, and control the multiple memories to perform the first IO operation.

[0180] In this way, when allocating IO operations corresponding to read and write operations, electronic devices can refer to the performance data information of different memories and perform different numbers of IO operations on the memories according to the performance data information of different memories, so that the IO corresponding to the read and write operations can be quickly allocated and executed, thereby improving the speed of read and write operations.

[0181] In some embodiments, the method 600 may further include:

[0182] During a process in which a first IO operation is performed on a first memory and a second memory, second performance data information of the first memory and second performance data information of the second memory are obtained, where the second performance data information is used by the electronic device to determine a third number of times the second IO operation is performed on the first memory and a fourth number of times the second IO operation is performed on the second memory, where the second IO operation corresponds to a second operation, and the second operation is a data read operation or a data write operation.

[0183] For example, the second operation is a data write operation, and the data write operation corresponds to 100 write IOs. Then, the third number may be 60, and the fourth number may be 40.

[0184] Based on the embodiments of the present application, during the process of executing IO operations in the first memory and the second memory, the performance data of the first memory and the second memory can be obtained in real time, so that the electronic device can refer to the performance data when allocating IO operations corresponding to subsequent read and write operations, thereby improving the efficiency of IO allocation.

[0185] In some embodiments, the first performance data information includes average times taken by the first memory and the second memory to perform a single IO operation, wherein determining a first number of times the first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory includes:

[0186] Determine the busy status of the first memory and the second memory according to the average time taken by the first memory and the second memory to perform a single IO operation;

[0187] A first number of times the first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory are determined according to the busy state.

[0188] The average time taken by the first memory and the second memory to perform a single IO operation may be the average time taken by the read / write IO operation mentioned above. The specific calculation method may refer to the description above.

[0189] Based on an embodiment of the present application, the first performance data information may include the average time taken by the first memory and the second memory to perform a single IO operation. The electronic device determines whether the first memory and the second memory are in a busy state based on the average time, and further determines the specific number of IO operations performed on the first memory and the second memory based on the busy state.

[0190] This technical solution can determine the current specific performance status of the first memory and the second memory, thereby facilitating decision-making and allocation by the electronic device.

[0191] In some embodiments, determining the busy status of the first memory and the second memory according to the average time taken by the first memory and the second memory to perform a single IO operation includes:

[0192] When it is determined that the average time taken by the first memory to execute a single IO operation is greater than a first preset value, determining that the first memory is in a busy state;

[0193] When it is determined that the average time taken by the first memory to execute a single IO operation is less than or equal to a first preset value, it is determined that the first memory is in an idle state; or,

[0194] When it is determined that the average time taken by the second memory to execute a single IO operation is greater than a second preset value, determining that the memory is in a busy state;

[0195] When it is determined that the average time taken by the second memory to execute a single IO operation is less than or equal to a second preset value, it is determined that the second memory is in an idle state.

[0196] Exemplarily, the first preset value may be 100ms or 50ms, etc. The embodiment of the present application does not limit the specific value of the first preset value.

[0197] Exemplarily, the second preset value may be 50ms or 60ms, etc. The embodiment of the present application does not limit the specific value of the first preset value.

[0198] Based on the embodiment of the present application, when it is determined that the average time taken by the memory to perform a single IO operation is greater than a preset value, the memory can be determined to be in a busy state; otherwise, the memory can be determined to be in an idle state. This technical solution enables an electronic device to determine whether each memory is in a busy state.

[0199] In some embodiments, determining a first number of times the first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory according to a busy state includes:

[0200] When it is determined that the first memory is in a busy state and the second memory is in an idle state, the electronic device performs the first IO operation on the first memory a first number of times less than the second number of times the electronic device performs the first IO operation on the second memory.

[0201] It is understandable that when the electronic device determines that the first memory is in an idle state and the second memory is in a busy state, the electronic device performs the first IO operation on the second memory less times than the first memory.

[0202] Based on the embodiments of the present application, the electronic device performs a first IO operation on a first memory in a busy state for a first number of times less than the second number of times it performs the first IO operation on a second memory in an idle state, thereby enabling the memory in the idle state to perform more IO operations and the memory in the busy state to perform fewer IO operations, which is beneficial to improving the allocation efficiency of IO operations and thereby improving the speed of data reading and writing operations.

[0203] In some embodiments, the first performance data information includes average times taken by the first memory and the second memory to perform a single IO operation, wherein determining a first number of times the first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory includes:

[0204] When it is determined based on the first performance data information that the ratio of the average time taken for the first memory to perform a single IO operation to the average time taken for the second memory to perform a single IO operation is m:n, the ratio of the number of times the electronic device performs the first IO operation on the first memory to the number of times it performs the first IO operation on the second memory is n:m.

[0205] For example, the m:n ratio may be 1:9 or 1:3, etc.

[0206] In an embodiment of the present application, the electronic device can dynamically determine the number of times IO operations are executed on each memory based on the ratio of the average time taken by each memory to execute a single IO operation, so that the electronic device can dynamically adjust the ratio of the number of times IO operations are executed on each memory to improve the allocation efficiency of IO operations.

[0207] In some embodiments, the first performance data information includes busy states of the first memory and the second memory, wherein determining a first number of times the first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory includes:

[0208] A first number of times the first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory are determined according to busy states of the first memory and the second memory.

[0209] In an embodiment of the present application, the first performance data information can directly include the busy status of the first memory and the second memory, so that the electronic device can directly determine the busy status of each memory without calculation, thereby improving the speed of the electronic device in allocating IO operations.

[0210] In some embodiments, the first performance data information is performance data information within a current statistical period.

[0211] Exemplarily, the statistical period may be 10ms, 100ms, or 150ms, etc. This application does not limit the specific value of the statistical period.

[0212] In the embodiment of the present application, the first performance data information of the memory is the performance data information within the current statistical period, thereby ensuring the timeliness of the first performance data information and making the data more accurate.

[0213] In some embodiments, the first performance data information further includes a maximum time taken by the first memory and the second memory to execute a single IO operation.

[0214] The first performance data information may also include other data, such as the accumulated time of read / write IO operations.

[0215] In an embodiment of the present application, the first performance data information may also include the maximum time taken by each memory to execute a single IO operation, thereby facilitating the electronic device to determine the performance of the memory in multiple aspects and providing a reference for allocating IO operations.

[0216] Figure 8 is a schematic block diagram of an electronic device provided in an embodiment of the present application. As shown in Figure 8, the electronic device 700 may include one or more processors 710; one or more memories 720; the one or more memories 720 storing one or more computer programs, each of which includes instructions that, when executed by the one or more processors 710, enable the allocation method described in any of the possible implementations described above to be executed.

[0217] Exemplarily, the electronic device 700 may be the electronic device 100, the electronic device 300, etc. mentioned above.

[0218] An embodiment of the present application also provides a chip, which includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the allocation method described in any possible implementation method described above is executed.

[0219] This embodiment further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the allocation method in the above-mentioned embodiment.

[0220] This embodiment further provides a computer program product. When the computer program product is run on a computer, it enables the computer to execute the above-mentioned related steps to implement the allocation method in the above-mentioned embodiment.

[0221] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor can execute the computer-executable instructions stored in the memory to enable the chip to execute the allocation method in the above-mentioned method embodiments.

[0222] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0223] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0224] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0225] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0226] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0227] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0228] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A distribution method, characterized in that: The method is applied to an electronic device, the electronic device includes a first memory and a second memory of different types, and the method includes: detecting a first operation, where the first operation is a data read operation or a data write operation; In response to the first operation, determining a first number of times a first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory according to first performance data information of the first memory and first performance data information of the second memory, wherein the first IO operation corresponds to the first operation; The first memory is controlled to execute the first IO operation according to the first number of times; and the second memory is controlled to execute the first IO operation according to the second number of times.

2. The method according to claim 1, characterized in that The method further comprises: During the process of the first memory and the second memory performing the first IO operation, second performance data information of the first memory and second performance data information of the second memory are obtained, and the second performance data information is used by the electronic device to determine the third number of times the second IO operation is performed on the first memory and the fourth number of times the second IO operation is performed on the second memory, and the second IO operation corresponds to the second operation, and the second operation is a data read operation or a data write operation.

3. The method according to claim 1 or 2, characterized in that: The first performance data information includes average time taken by the first memory and the second memory to perform a single IO operation, wherein determining a first number of times the first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory includes: Determine the busy status of the first memory and the second memory according to the average time taken by the first memory and the second memory to perform a single IO operation; A first number of times a first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory are determined according to the busy state.

4. The method according to claim 3, characterized in that The determining the busy status of the first memory and the second memory according to the average time taken by the first memory and the second memory to perform a single IO operation includes: When it is determined that the average time taken by the first memory to execute a single IO operation is greater than a first preset value, determining that the first memory is in a busy state; When it is determined that the average time taken by the first memory to execute a single IO operation is less than or equal to a first preset value, it is determined that the first memory is in an idle state; or, When it is determined that the average time taken by the second memory to execute a single IO operation is greater than a second preset value, determining that the memory is in a busy state; When it is determined that the average time taken by the second memory to execute a single IO operation is less than or equal to a second preset value, it is determined that the second memory is in an idle state.

5. The method according to claim 4, characterized in that The determining, according to the busy state, a first number of times of executing the first IO operation on the first memory and a second number of times of executing the first IO operation on the second memory comprises: When it is determined that the first memory is in a busy state and the second memory is in an idle state, the first number of times the electronic device performs a first IO operation on the first memory is less than the second number of times the electronic device performs the first IO operation on the second memory.

6. The method according to claim 1 or 2, characterized in that: The first performance data information includes average time taken by the first memory and the second memory to perform a single IO operation, wherein determining a first number of times the first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory includes: When it is determined based on the first performance data information that the ratio of the average time taken by the first memory to execute a single IO operation to the average time taken by the second memory to execute a single IO operation is m:n, the ratio of the number of times the electronic device executes the first IO operation on the first memory to the number of times it executes the first IO operation on the second memory is n:m.

7. The method according to claim 1 or 2, characterized in that: The first performance data information includes busy states of the first memory and the second memory, wherein determining a first number of times a first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory includes: A first number of times a first IO operation is performed on the first memory and a second number of times the first IO operation is performed on the second memory are determined according to busy states of the first memory and the second memory.

8. The method according to any one of claims 1 to 7, characterized in that The first performance data information is the performance data information within the current statistical period.

9. The method according to claim 6 or 7, characterized in that: The first performance data information also includes a maximum time taken by the first memory and the second memory to execute a single IO operation.

10. The method according to any one of claims 1 to 9, characterized in that The type of the first memory is one of a universal flash storage UFS and an embedded multimedia memory card EMMC, and the type of the second memory is the other of UFS and EMMC.

11. An electronic device, characterized in that: include: one or more processors; One or more memories; the one or more memories store one or more computer programs, the one or more computer programs include instructions, when the instructions are executed by one or more processors, the allocation method according to any one of claims 1-10 is executed.

12. A chip, characterized in that: The chip includes a processor and a communication interface, wherein the communication interface is used to receive a signal and transmit the signal to the processor, and the processor processes the signal so that the allocation method according to any one of claims 1 to 10 is executed.

13. A readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed on an electronic device, the distribution method according to any one of claims 1 to 10 is executed.

Citation Information

Patent Citations

  • Methods and systems for managing heterogeneous memories

    CN104572496A

  • Main memory device having heterogeneous memories, computer system and data management method

    CN111414132A

  • Scheduling memory requests with non-uniform latencies

    CN111742305A

  • System and method for load balancing in heterogeneous memory system

    CN115617503A

  • Memory device, memory device operating method, and electronic device including memory device

    US20230100573A1