Data reading method and device based on shared memory and electronic equipment

By using real-time channels and non-real-time channels to read real-time and non-real-time data respectively in shared memory, the queue waiting and link delay problems caused by traditional single-channel reading are solved, and the real-time data interaction of high-real-time systems is improved and efficiency.

CN118939443APending Publication Date: 2024-11-12BEIJING CO WHEELS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310524999.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-10
Publication Date
2024-11-12

AI Technical Summary

Technical Problem

In high-reality systems, the traditional single-channel shared memory data reading method leads to the queuing and waiting problem of real-time data, affecting real-time, and generates link delays during multi-service data interaction, reducing response speed.

Method used

At least one real-time channel and one non-real-time channel are used to read real-time data and non-real-time data from shared memory respectively, distinguish service types, avoid queueing, and read multiple service data in parallel, reducing data link delay.

Benefits of technology

It improves the real-time response and data reading efficiency of real-time services, reduces the data link delay between microprocessors and microcontrollers in shared memory, and improves the real-time data interaction between different cores.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118939443A_ABST
    Figure CN118939443A_ABST
Patent Text Reader

Abstract

The invention provides a data reading method and device based on a shared memory and electronic equipment, and the method comprises the steps: reading first real-time data from the shared memory through at least one real-time channel, and reading first non-real-time data from the shared memory through at least one non-real-time channel, the first real-time data and the first non-real-time data are data obtained after the microcontroller processes written second real-time data and second non-real-time data respectively, the second real-time data is generated by real-time service, and the second non-real-time data is generated by non-real-time service; and responding to the obtained first real-time data and first non-real-time data, respectively responding to the real-time service and the non-real-time service, and reading the data from the shared memory by using at least one real-time channel and non-real-time channel, thereby effectively reducing the data link delay of the microprocessor and the microcontroller in the memory sharing process, and improving the user experience. The effect of improving the data reading efficiency is achieved, and then the real-time performance of data interaction between different cores is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a data reading method, device and electronic device based on a shared memory. Background Art

[0002] Shared memory is a communication method between multiple processes, usually used in multi-processor computer systems. It can be accessed by different processors to enable multiple processors to transfer information through shared memory. It can also be used to transfer information between heterogeneous cores. For example, heterogeneous SoCs (microprocessors and microcontrollers) use shared memory for communication. Among them, the communication process between microprocessors and microcontrollers involves the microprocessor reading data from the shared memory. The relevant technology usually uses a single channel to read and write data from the shared memory. The microprocessor first writes the data to be processed generated by the task into the shared memory in sequence. The microcontroller further processes the data written by the microprocessor. The microprocessor reads the processed data in sequence through a single channel and responds to the service. However, in some high-real-time systems, such as car systems, the data generated by real-time services need to be processed in real time, and the traditional way of reading data from shared memory does not distinguish the timeliness of the data, that is, the data of real-time services and non-real-time services are read from shared memory in sequence, so the real-time data of real-time services will have a waiting problem during the reading process, which affects the real-time performance; in addition, in high-real-time systems, there is usually a need to read multiple service data from shared memory at the same time. Reading a large amount of data using a single channel will also cause link delays, further affecting the response speed requirements of real-time services. Therefore, the real-time performance of data interaction between different cores needs to be improved. Summary of the invention

[0003] The present disclosure proposes a data reading method, device and electronic device based on shared memory, aiming to solve one of the technical problems in the related art at least to a certain extent.

[0004] The first aspect of the present disclosure proposes a data reading method based on a shared memory, including: reading first real-time data from the shared memory through at least one real-time channel, and reading first non-real-time data from the shared memory through at least one non-real-time channel, wherein the first real-time data and the first non-real-time data are data processed by a microcontroller on written second real-time data and second non-real-time data, respectively, wherein the second real-time data is generated by a real-time service, and the second non-real-time data is generated by a non-real-time service; and in response to obtaining the first real-time data and the first non-real-time data, responding to the real-time service and the non-real-time service, respectively.

[0005] The second aspect of the present disclosure proposes a data reading device based on a shared memory, including: a reading module, used to read first real-time data from the shared memory through at least one real-time channel, and read first non-real-time data from the shared memory through at least one non-real-time channel, wherein the first real-time data and the first non-real-time data are data processed by the microcontroller on the written second real-time data and the second non-real-time data, respectively, wherein the second real-time data is generated by a real-time service, and the second non-real-time data is generated by a non-real-time service; and a response module, used to respond to the real-time service and the non-real-time service respectively in response to obtaining the first real-time data and the first non-real-time data.

[0006] An embodiment of the third aspect of the present disclosure proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the shared memory-based data reading method of the embodiment of the present disclosure.

[0007] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the shared memory-based data reading method disclosed in the embodiment of the present disclosure.

[0008] A fifth aspect of the present disclosure provides a vehicle, wherein the vehicle includes an electronic device according to the first aspect.

[0009] In this embodiment, first real-time data is read from a shared memory through at least one real-time channel, and first non-real-time data is read from a shared memory through at least one non-real-time channel, wherein the first real-time data and the first non-real-time data are data processed by the microcontroller on the written second real-time data and the second non-real-time data, respectively, wherein the second real-time data is generated by a real-time service, and the second non-real-time data is generated by a non-real-time service, and in response to obtaining the first real-time data and the first non-real-time data, the real-time service and the non-real-time service are responded to respectively. Compared with the prior art of reading data from a shared memory using a single channel, this embodiment can distinguish between real-time services and non-real-time services. Real-time data is read from the shared memory using a real-time channel, and non-real-time data is read from the shared memory using a non-real-time channel. Therefore, real-time data does not need to wait in line during the reading process, thereby improving the real-time response of real-time service; and, this solution can use at least one real-time channel and non-real-time channel to read real-time data and non-real-time data from the shared memory in parallel. Therefore, when multiple service data are read from the shared memory at the same time, the technical effect of improving data reading efficiency is achieved, thereby effectively reducing the data link delay between the microprocessor and the microcontroller in the shared memory process, achieving the effect of improving data reading efficiency, and then improving the real-time performance of data interaction between different cores.

[0010] Additional aspects and advantages of the present disclosure will be given in part in the following description and in part will be obvious from the following description or learned through practice of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0012] Figure 1 is a flow chart of a data reading method based on a shared memory provided according to an embodiment of the present disclosure;

[0013] Figure 2 is a schematic diagram of a heterogeneous core communication system architecture based on shared memory provided according to an embodiment of the present disclosure;

[0014] Figure 3 It is a schematic diagram of a data reading heartbeat mechanism based on a shared memory provided according to an embodiment of the present disclosure;

[0015] Figure 4 is a flow chart of a data reading method based on a shared memory provided according to another embodiment of the present disclosure;

[0016] Figure 5 is a schematic diagram of a data reading device based on a shared memory provided according to another embodiment of the present disclosure;

[0017] Figure 6 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0018] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0019] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0020] It should be noted that the executor of the shared memory-based data reading method of this embodiment can be a shared memory-based data reading device, which can be implemented by software and / or hardware, and can be configured in an electronic device, which can include but is not limited to a terminal, a server, etc.

[0021] Figure 1 is a flow chart of a data reading method based on a shared memory provided according to an embodiment of the present disclosure, such as Figure 1 As shown, the method includes:

[0022] S101: Read first real-time data from a shared memory through at least one real-time channel, and read first non-real-time data from a shared memory through at least one non-real-time channel.

[0023] In order to implement a data reading method based on a shared memory, the embodiment of the present disclosure also provides a heterogeneous core communication system based on a shared memory. Figure 2 is a schematic diagram of a heterogeneous core communication system architecture based on shared memory provided according to an embodiment of the present disclosure, such as Figure 2 As shown, the heterogeneous core communication system can be applied to any possible scenario, for example, to a vehicle system. The system includes a microprocessor core (hereinafter referred to as "microprocessor") and a microcontroller core (hereinafter referred to as "microcontroller"), the microprocessor and the microcontroller communicate based on shared memory, and the data reading method based on shared memory in this embodiment can be executed by the microprocessor.

[0024] Specifically, Figure 2As shown, the microprocessor is configured with a user space, which provides users with time services, power management services, log services, micro-control services and other services. It is understandable that different systems provide different services. For example, in the car system, time services include services such as users setting the system time and timing of the car system, while power management services include users turning on the power of any device in the car, log services are users processing log data generated by the car system, and micro-control services are users controlling the vehicle, such as turning on the lights and wipers.

[0025] In practical applications, such as Figure 2 As shown, the microprocessor is configured with a user space, and the services provided by the user space to the user include, for example, time service, power management service, log service, micro-control service and any other possible service. It is understandable that different systems provide different services. For example, in the vehicle system, the time service is such as the user setting the system time and timing of the vehicle system, and the power management service is such as the user turning on the power of any device in the car, the log service is the user processing the log data generated by the vehicle system, and the micro-control service is the user's control of the vehicle, for example, turning on the lights, turning on the wipers, etc. In this embodiment, the services can be classified according to the requirements of the service for the response timeliness, wherein the service that requires real-time response is called real-time service, and the service that does not require real-time response is called non-real-time service. It is understandable that the real-time service and the non-real-time service can be one service or multiple services respectively, and there is no restriction on this. For example: if the micro-control service and the power management service require real-time response, the micro-control service and the power management service are regarded as real-time services, and the time service and the log service do not require real-time response, then the time service and the log service are regarded as non-real-time services.

[0026] Among them, the user triggering service will generate corresponding data to be processed, and the data to be processed generated by triggering the real-time service in this embodiment can be called second real-time data, and the data to be processed generated by triggering the non-real-time service is called second non-real-time data. The specific content of the second real-time data and the second non-real-time data is not limited to this.

[0027] In the embodiment of the present disclosure, when a user triggers one or more real-time services and non-real-time services, the microprocessor first acquires the second real-time data generated by the real-time service and the second non-real-time data generated by the non-real-time service.

[0028] In practical applications, the heterogeneous core communication system based on shared memory can be implemented based on the Inter Platform Shared Memory (IPSM) technology, such as Figure 2As shown, the microcontroller can provide an IPSM read-write interface for services, and the microprocessor obtains the second real-time data and the second non-real-time data through the interface.

[0029] In some embodiments, before performing heterogeneous core communication, it may also be determined whether the heterogeneous cores (microprocessor and microcontroller) can communicate normally. Specifically, Figure 3 Schematic diagram of a data reading heartbeat mechanism based on shared memory provided according to an embodiment of the present disclosure, such as Figure 3 As shown, in this embodiment, under the shared memory mechanism, the microcontroller and the microprocessor will send handshake information after startup, for example, the microcontroller sends handshake information to the microprocessor, or the microprocessor sends handshake information to the microcontroller, or the microcontroller and the microprocessor send handshake information to each other. In this embodiment, for example, the microprocessor receives the handshake information, and receiving the handshake information can indicate that the microprocessor and the microcontroller have successfully shaken hands under the shared memory mechanism; further, the heartbeat monitoring function is started, for example, the microprocessor side starts the heartbeat monitoring function, wherein the heartbeat monitoring function can be, for example, a timer (Timer) of a preset time (T0). If the microcontroller sends a new heartbeat packet (i.e., heartbeat information) within the preset time T0, it indicates that normal communication with the microcontroller is possible. In this case, the heartbeat packet reception count is cleared and the timer is restarted for heartbeat monitoring; if there is no heartbeat packet within T0, it indicates that communication with the microcontroller is disconnected. In this case, other cores (microcontroller or microprocessor) are restarted, and handshake information from other cores is waited for. In the embodiment of the present disclosure, when the microprocessor determines that the handshake with the microcontroller is successful and there is heartbeat information (i.e., a new heartbeat packet sent by the microcontroller) within the preset time T0, the microprocessor obtains the first real-time data and the first non-real-time data to be processed generated by the real-time service and the non-real-time service. Thus, the embodiment can ensure normal communication between heterogeneous cores through the heartbeat mechanism.

[0030] Furthermore, the microprocessor may write the second real-time data into the shared memory through at least one real-time channel, and write the second non-real-time data into the shared memory through at least one non-real-time channel.

[0031] Among them, the channel can also be called a data transmission link, which is used by the microprocessor to read and write data to the shared memory, while the channel used to transmit real-time data can be called a real-time channel, and the channel used to transmit non-real-time data can be called a non-real-time channel.

[0032] In the embodiment of the present disclosure, at least one real-time channel (IPSM real-time channel) and at least one non-real-time channel (IPSM non-real-time channel) can be configured for the microprocessor. Figure 2As shown, for example, this embodiment can configure 3 real-time channels (D0, D1, D2) and 4 non-real-time channels (D3, D4, D5, D6), wherein the number of real-time channels and non-real-time channels can be flexibly configured according to the actual application scenario, without limitation. In some embodiments, each service (real-time service or non-real-time service) corresponds to one channel (real-time channel or non-real-time channel), or multiple services correspond to one real-time channel or non-real-time channel, without limitation.

[0033] After acquiring the second real-time data and the second non-real-time data, the microprocessor may further write the second real-time data into the shared memory through at least one real-time channel, and write the second non-real-time data into the shared memory through at least one non-real-time channel. More specifically, the second real-time data and the second non-real-time data are written into the memory space (i.e., the memory block cache) allocated to the microprocessor in the shared memory, wherein, Figure 2 As shown, the memory space allocated to the microprocessor may correspond to the real-time channel and the non-real-time channel, that is, it includes 3 real-time data memory spaces for storing real-time data and 4 non-real-time data memory spaces.

[0034] In some embodiments, before writing the second real-time data into the shared memory through at least one real-time channel and writing the second non-real-time data into the shared memory through at least one non-real-time channel, the embodiment may determine the number of real-time services (i.e., the number of real-time services) and the number of non-real-time services (i.e., the number of non-real-time services); further, calculate the ratio of the number of real-time services to the number of real-time channels, which ratio is referred to as the first ratio. Similarly, the embodiment also calculates the second ratio of the number of non-real-time services to the number of non-real-time channels; further, associate each real-time channel with a first ratio of real-time services, and associate each non-real-time channel with a second ratio of non-real-time services.

[0035] For example, if the number of real-time channels is 3 and the number of real-time services is 3, the first ratio is 1, that is to say, if 3 real-time services are associated with 3 real-time channels respectively, each real-time channel writes the second real-time data generated by the associated real-time service to the shared memory; for another example, if the number of real-time channels is 3 and the number of real-time services is 9, the first ratio is 3, that is to say, if 3 real-time services are associated with 1 real-time channel, each real-time channel writes the second real-time data generated by the associated 3 real-time services to the shared memory. The association method between non-real-time channels and non-real-time services is similar to that of real-time channels, which will not be repeated here.

[0036] Some embodiments, such as Figure 2As shown, in the operation of writing the second non-real-time data into the shared memory through at least one non-real-time channel, the second non-real-time data can first be stored in the cache configured by the non-real-time channel (i.e., the non-real-time channel cache), which can be called a sending cache, wherein a corresponding sending cache can be configured for each non-real-time channel; further, the second non-real-time data in the sending cache is sequentially written byte by byte into the data sending queue configured by the non-real-time channel, i.e., the IPSM sending queue; further, the second non-real-time data in the sending queue is written into the shared memory. Wherein, as Figure 2 As described, in the process of writing the second real-time data and the second non-real-time data into the shared memory, firstly, the second real-time data and the second non-real-time data are generated into a message (IPSM message), and then the main function is sent through IPSM to write into the shared memory.

[0037] Some other embodiments, such as Figure 2 As shown, when generating an IPSM message, the second non-real-time data and the second real-time data in the IPSM sending queue can be arbitrated to determine the sending priority, and the sending priority is used to indicate the sending order of the second real-time data and the second non-real-time data. Among them, the sending priorities of multiple second real-time data can be determined, or the sending priorities of multiple second non-real-time data can be determined, or the sending priorities of the second real-time data and the second non-real-time data can be determined, without limitation; further, based on the sending priority, the second real-time data is sequentially written into the shared memory through at least one real-time channel, and the second non-real-time data is written into the shared memory through at least one non-real-time channel. Thus, this embodiment can meet the real-time requirements of the service.

[0038] In the heterogeneous core communication process based on shared memory technology, after the microprocessor writes the second real-time data and the second non-real-time data to be processed into the shared memory, the microcontroller can read the second real-time data and the second non-real-time data from the shared memory for processing, and write the processed data into the shared memory. Figure 2As shown, this embodiment can allocate memory space for the microcontroller in the shared memory. The memory space of the microcontroller can be configured the same as the memory space of the microprocessor, that is, including 3 real-time data memory spaces and 4 non-real-time data memory spaces for storing real-time data. The microcontroller first obtains the second real-time data and the second non-real-time data from the shared memory (specifically, the memory space on the microprocessor side in the shared memory), and further processes the second real-time data and the second non-real-time data respectively, wherein the data obtained by the microcontroller from processing the second real-time data can be called the first real-time data, and the data obtained from processing the second non-real-time data can be called the first non-real-time data; further, the second real-time data and the second non-real-time data are written into the memory space allocated to the microcontroller in the shared memory. There is no restriction on the processing process of the second real-time data and the second non-real-time data by the microcontroller.

[0039] Some embodiments, such as Figure 2 As shown, after the microprocessor writes the second real-time data and the second non-real-time data into the shared memory, it can send an interrupt instruction (interrupt) to the microcontroller, and the interrupt instruction is used for the microcontroller to interrupt the currently running task to process the second real-time data and the second non-real-time data. In this case, the microcontroller can respond to the interrupt instruction, stop the currently running task, read the second real-time data and the second non-real-time data from the shared memory and process them. Thus, the data processing delay can be reduced, and the real-time performance of data interaction between hetero-cores can be further improved.

[0040] In this case, the microprocessor of this embodiment can read the first real-time data from the shared memory through the at least one real-time channel, and read the first non-real-time data from the shared memory through the at least one non-real-time channel.

[0041] Specifically, Figure 2 As shown, the microprocessor can execute the IPSM receiving main task, and read the first real-time data and the first non-real-time data by byte from the shared memory (specifically the memory space on the microcontroller side) through the real-time channel and the non-real-time channel respectively (i.e., IPSM data reception).

[0042] In some embodiments, the first real-time data corresponding to the associated real-time service can be read from the shared memory through each real-time channel, and the first non-real-time data corresponding to the associated non-real-time service can be read from the shared memory through each non-real-time channel. The specific process is similar to the above-mentioned process of writing data to the shared memory, and will not be repeated here.

[0043] S102: In response to acquiring the first real-time data and the first non-real-time data, respond to the real-time service and the non-real-time service respectively.

[0044] That is to say, after the microprocessor reads the first real-time data and the first non-real-time data, the read data can be fed back to the microprocessor user space through the IPSM read-write interface, so that the microprocessor can respond to the real-time service and the non-real-time service in response to obtaining the first real-time data and the first non-real-time data, that is, in response to the service triggered by the user, for example, controlling the modification time, executing operations such as turning on the car lights, etc., thereby completing the heterogeneous core communication process based on shared memory.

[0045] In this embodiment, the microprocessor reads the first real-time data from the shared memory through at least one real-time channel, and reads the first non-real-time data from the shared memory through at least one non-real-time channel, wherein the first real-time data and the first non-real-time data are data processed by the microcontroller on the written second real-time data and the second non-real-time data, respectively, wherein the second real-time data is generated by the real-time service, and the second non-real-time data is generated by the non-real-time service, and in response to obtaining the first real-time data and the first non-real-time data, the real-time service and the non-real-time service are responded to respectively. Compared with the prior art of using a single channel to read data from the shared memory, this embodiment can combine the real-time service with the non-real-time service. Distinguish, use the real-time channel to read real-time data from the shared memory, and use the non-real-time channel to read non-real-time data from the shared memory, so the real-time data does not need to wait in line during the reading process, thereby improving the real-time response of the real-time service; and, this solution can use at least one real-time channel and non-real-time channel to read real-time data and non-real-time data from the shared memory in parallel, so when reading multiple service data from the shared memory at the same time, the technical effect of improving the data reading efficiency is achieved, thereby effectively reducing the data link delay between the microprocessor and the microcontroller in the shared memory process, achieving the effect of improving the data reading efficiency, and then improving the real-time performance of data interaction between different cores.

[0046] Figure 4 is a flow chart of a data reading method based on a shared memory provided according to another embodiment of the present disclosure, such as Figure 4 As shown, the method includes:

[0047] S401: Receive an interrupt instruction from the microcontroller.

[0048] Specifically, after the microcontroller of the disclosed embodiment writes the first real-time data and the first non-real-time data into the shared memory, it can send an interrupt instruction to the microprocessor, and the interrupt instruction is used to interrupt the task currently being run by the microprocessor. In this case, the microprocessor of the present embodiment can receive the second interrupt instruction.

[0049] S402: Responding to an interrupt instruction to interrupt a currently running task, and reading first real-time data from a shared memory through at least one real-time channel, and reading first non-real-time data from a shared memory through at least one non-real-time channel.

[0050] Furthermore, the microprocessor can respond to the interrupt instruction, stop the currently running task (i.e., the current task), and read the first real-time data from the shared memory through at least one real-time channel, and read the first non-real-time data from the shared memory through at least one non-real-time channel. Thus, the present implementation can interrupt the task currently being executed by the microprocessor through the interrupt instruction to quickly read data from the shared memory, thereby further improving the real-time performance of data interaction between heterogeneous cores.

[0051] In some embodiments, before executing the IPSM receiving main task, the microprocessor may first determine whether the current real-time channel and non-real-time channel are not empty, that is, determine whether the channel is currently occupied; when it is determined that the real-time channel and the non-real-time channel are empty (not occupied), read the first real-time data through the real-time channel, and read the first non-real-time data through the non-real-time channel.

[0052] Some embodiments, such as Figure 2 As shown, when reading the first real-time data, the first real-time data is first read from the shared memory through the real-time channel; further, the first real-time data is cached, and the cache can be called a first receiving cache (i.e., a real-time channel cache). In this embodiment, for example, the first receiving cache can be configured for each real-time channel respectively. In this case, the first real-time data read from each real-time channel can be stored in the first receiving cache corresponding to the real-time channel.

[0053] Some other embodiments, such as Figure 2As shown, in the process of reading the first non-real-time data, the present embodiment first reads the first non-real-time data from the shared memory through the non-real-time channel; further, writes the first non-real-time data into the data receiving queue (IPSM receiving queue) configured by the non-real-time channel; further, caches the first non-real-time data in the data receiving queue, which can be referred to as the second receiving cache. Wherein, the present embodiment can, for example, configure the second receiving cache for each non-real-time channel respectively. In this case, the present embodiment can store the first non-real-time data read from each non-real-time channel respectively into the second receiving cache corresponding to the non-real-time channel. Wherein, when reading the first non-real-time data, the present embodiment can first determine whether the second receiving cache is not empty, and when determining that the second receiving cache is empty, store the first non-real-time data in the data receiving queue into the second receiving cache. Thus, the present embodiment can cache the second real-time data and the second non-real-time data, ensure that the shared memory will not be occupied for a long time, and save the storage space of the shared memory.

[0054] S403: In response to acquiring the first real-time data and the first non-real-time data, respond to the real-time service and the non-real-time service respectively.

[0055] like Figure 2 As shown, that is, the microprocessor can read the real-time data of each address from the first receiving buffer and read the non-real-time data of each address from the second receiving buffer to respond to the real-time service and the non-real-time service.

[0056] In this embodiment, the microprocessor reads first real-time data from the shared memory through at least one real-time channel, and reads first non-real-time data from the shared memory through at least one non-real-time channel, wherein the first real-time data and the first non-real-time data are data processed by the microcontroller on the written second real-time data and the second non-real-time data, respectively, wherein the second real-time data is generated by the real-time service, and the second non-real-time data is generated by the non-real-time service; and in response to obtaining the first real-time data and the first non-real-time data, responding to the real-time service and the non-real-time service respectively. Compared with the prior art of using a single channel to read data from the shared memory, this embodiment can combine the real-time service with the non-real-time service. Differentiate, use the real-time channel to read real-time data from the shared memory, and use the non-real-time channel to read non-real-time data from the shared memory, so the real-time data does not need to wait in line during the reading process, thereby improving the real-time response of the real-time service; and, this solution can use at least one real-time channel and non-real-time channel to read real-time data and non-real-time data from the shared memory in parallel, so when reading multiple service data from the shared memory at the same time, the technical effect of improving the data reading efficiency is achieved, thereby effectively reducing the data link delay between the microprocessor and the microcontroller in the shared memory process, achieving the effect of improving the data reading efficiency, and then improving the real-time of data interaction between heterogeneous cores. In addition, this implementation can interrupt the task currently being executed by the microprocessor through an interrupt instruction to quickly read data from the shared memory, thereby further improving the real-time of data interaction between heterogeneous cores.

[0057] In practical applications, by opening up specific real-time channels and non-real-time channels on the shared memory between heterogeneous SoCs (microprocessors and microcontrollers), and adding real-time IPSM logic frameworks on the microcontroller and microprocessor sides, it has been verified that a heterogeneous SoC only takes 600us to complete an end-to-end task interaction between the microcontroller core and the microprocessor core.

[0058] In order to implement the above embodiment, the present disclosure also proposes a data reading device based on a shared memory.

[0059] Figure 5 is a schematic diagram of a data reading device based on a shared memory provided according to another embodiment of the present disclosure.

[0060] like Figure 5 As shown, the data reading device 50 based on shared memory includes:

[0061] a reading module 501, configured to read first real-time data from a shared memory through at least one real-time channel, and read first non-real-time data from a shared memory through at least one non-real-time channel, wherein the first real-time data and the first non-real-time data are data processed by the microcontroller on written second real-time data and second non-real-time data, respectively, wherein the second real-time data is generated by a real-time service, and the second non-real-time data is generated by a non-real-time service; and

[0062] The response module 502 is used to respond to the real-time service and the non-real-time service respectively in response to obtaining the first real-time data and the first non-real-time data.

[0063] In some embodiments, the reading module 501 is specifically used to: receive an interrupt instruction from a microcontroller, wherein the interrupt instruction is used to interrupt a currently running task; and respond to the interrupt instruction to interrupt the currently running task, and read first real-time data from a shared memory through at least one real-time channel, and read first non-real-time data from a shared memory through at least one non-real-time channel.

[0064] In some embodiments, the reading module 501 is specifically used to: read the first real-time data from the shared memory through the real-time channel, and store the first real-time data in a first receiving buffer configured by the real-time channel.

[0065] In some embodiments, the reading module 501 is specifically used to: read first non-real-time data from a shared memory through a non-real-time channel, and write the first non-real-time data into a data receiving queue configured by the non-real-time channel; and store the first non-real-time data in the data receiving queue into a second receiving cache configured by the non-real-time channel.

[0066] In some embodiments, the reading module 501 is specifically used to: store the first real-time data in the first receiving buffer corresponding to the real-time channel respectively.

[0067] In some embodiments, the reading module 501 is specifically used to: store the first non-real-time data in the data receiving queue into the second receiving buffer corresponding to the non-real-time channel respectively.

[0068] The reading module 501 is specifically used to: determine whether the second receiving buffer is not empty; and if the second receiving buffer is empty, store the first non-real-time data in the data receiving queue into the second receiving buffer.

[0069] In some embodiments, the device also includes a determination module, which is specifically used to: determine the number of real-time services and the number of non-real-time services; calculate a first ratio of the number of real-time services to a preset number of real-time channels, and calculate a second ratio of the number of non-real-time services to a preset number of non-real-time channels; and associate a first ratio of real-time services with each real-time channel, and associate a second ratio of non-real-time services with each non-real-time channel; and a reading module 501, which is specifically used to: read the first real-time data corresponding to the associated real-time service from the shared memory through each real-time channel, and read the first non-real-time data corresponding to the associated non-real-time service from the shared memory through each non-real-time channel.

[0070] In this embodiment, first real-time data is read from a shared memory through at least one real-time channel, and first non-real-time data is read from a shared memory through at least one non-real-time channel, wherein the first real-time data and the first non-real-time data are data processed by the microcontroller on the written second real-time data and the second non-real-time data, respectively, wherein the second real-time data is generated by a real-time service, and the second non-real-time data is generated by a non-real-time service; and in response to obtaining the first real-time data and the first non-real-time data, the real-time service and the non-real-time service are responded to respectively. Compared with the prior art of using a single channel to read data from a shared memory, this embodiment can distinguish between real-time services and non-real-time services. In this way, real-time data is read from the shared memory using a real-time channel, and non-real-time data is read from the shared memory using a non-real-time channel. Therefore, real-time data does not need to wait in line during the reading process, thereby improving the real-time performance of real-time service response. Moreover, this solution can use at least one real-time channel and a non-real-time channel to read real-time data and non-real-time data from the shared memory in parallel. Therefore, when multiple service data are read from the shared memory at the same time, the technical effect of improving data reading efficiency is achieved, thereby effectively reducing the data link delay between the microprocessor and the microcontroller in the shared memory process, achieving the effect of improving data reading efficiency, and then improving the real-time performance of data interaction between different cores.

[0071] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0072] In order to implement the above embodiments, the present disclosure further proposes a computer program product. When an instruction processor in the computer program product executes, the shared memory-based data reading method proposed in the above embodiments of the present disclosure is executed.

[0073] Figure 6 A block diagram of an exemplary electronic device suitable for implementing embodiments of the present disclosure is shown. Figure 6 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0074] like Figure 6 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).

[0075] The bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnection (PCI) bus.

[0076] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.

[0077] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 Not shown, often called a "hard drive").

[0078] although Figure 6Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a compact disc read only memory (CD-ROM), a digital versatile disc read only memory (DVD-ROM), or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the various embodiments of the present disclosure.

[0079] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0080] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0081] The processing unit 16 executes various functional applications by running programs stored in the system memory 28, such as implementing the data reading method based on the shared memory mentioned in the above embodiment.

[0082] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0083] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

[0084] It should be noted that, in the description of the present disclosure, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present disclosure, unless otherwise specified, the meaning of "plurality" is two or more.

[0085] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.

[0086] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0087] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.

[0088] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0089] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.

[0090] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0091] Although the embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present disclosure. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present disclosure.

Claims

1. A data reading method based on shared memory, It is characterized in that The method comprises: Reading first real-time data from a shared memory through at least one real-time channel, and reading first non-real-time data from the shared memory through at least one non-real-time channel, wherein the first real-time data and the first non-real-time data are data processed by the microcontroller on written second real-time data and second non-real-time data, respectively, wherein the second real-time data is generated by a real-time service, and the second non-real-time data is generated by a non-real-time service; and In response to acquiring the first real-time data and the first non-real-time data, responding to the real-time service and the non-real-time service respectively.

2. The method according to claim 1, It is characterized in that Reading first real-time data from a shared memory through at least one real-time channel, and reading first non-real-time data from the shared memory through at least one non-real-time channel, comprising: receiving an interrupt instruction from the microcontroller, wherein the interrupt instruction is used to interrupt a currently running task; and Responding to the interrupt instruction to interrupt the currently running task, the first real-time data is read from the shared memory through at least one real-time channel, and the first non-real-time data is read from the shared memory through at least one non-real-time channel.

3. The method according to claim 1, It is characterized in that The step of reading the first real-time data from the shared memory through at least one real-time channel comprises: The first real-time data is read from the shared memory through the real-time channel, and the first real-time data is stored in a first receiving buffer configured by the real-time channel.

4. The method according to claim 1, It is characterized in that The step of reading the first non-real-time data from the shared memory through at least one non-real-time channel comprises: Reading first non-real-time data from the shared memory through the non-real-time channel, and writing the first non-real-time data into a data receiving queue configured by the non-real-time channel; and The first non-real-time data in the data receiving queue is stored in a second receiving buffer configured by the non-real-time channel.

5. The method according to claim 4, It is characterized in that The storing the first non-real-time data in the data receiving queue to the second receiving buffer configured by the non-real-time channel includes: Determining whether the second receiving buffer is not empty; and When the second receiving buffer is empty, the first non-real-time data in the data receiving queue is stored in the second receiving buffer.

6. The method according to claim 1, It is characterized in that Before the first real-time data is read from the shared memory through at least one real-time channel and the first non-real-time data is read from the shared memory through at least one non-real-time channel, the method further includes: Determine the number of real-time services and the number of non-real-time services; Calculating a first ratio of the number of real-time services to the number of preset real-time channels, and calculating a second ratio of the number of non-real-time services to the number of preset non-real-time channels; and Associating each real-time channel with a first proportion of real-time services, and associating each non-real-time channel with a second proportion of non-real-time services; Furthermore, the step of reading the first real-time data from the shared memory through at least one real-time channel, and reading the first non-real-time data from the shared memory through at least one non-real-time channel, comprises: The first real-time data corresponding to the associated real-time service is read from the shared memory through each real-time channel, and the first non-real-time data corresponding to the associated non-real-time service is read from the shared memory through each non-real-time channel.

7. A data reading device based on shared memory, It is characterized in that include: a reading module, configured to read first real-time data from a shared memory through at least one real-time channel, and read first non-real-time data from the shared memory through at least one non-real-time channel, wherein the first real-time data and the first non-real-time data are data processed by the microcontroller on written second real-time data and second non-real-time data, respectively, wherein the second real-time data is generated by a real-time service, and the second non-real-time data is generated by a non-real-time service; and The response module is used to respond to the real-time service and the non-real-time service respectively in response to obtaining the first real-time data and the first non-real-time data.

8. An electronic device, include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium storing computer instructions, in, The computer instructions are used to cause the computer to execute the method according to any one of claims 1-6.

10. A vehicle, It is characterized in that The vehicle includes the electronic device as claimed in claim 6.