An inter-core communication method and system based on embedded platform
By using the design of virtual channels and message channel queues in multi-core systems, the problems of low inter-core communication efficiency and insufficient robustness in the existing technology are solved, and efficient and robust inter-core communication is achieved, which is suitable for homogeneous or heterogeneous applications. Built-in embedded SOC multi-core system.
Patent Information
- Application Number
- CN202011440140.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-10
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2040-12-10
AI Technical Summary
Inter-core communication in existing multi-core systems has low efficiency and insufficient robustness, especially the efficiency and robustness issues caused by the inter-core lock overhead introduced by the message pool and the lack of a disconnection detection mechanism.
Using the inter-core communication method based on the embedded platform, the source core performs legality check and message encapsulation of the received request task parameters, queries the task registry to select the load-balanced destination core, and uses virtual channels and message channel queues to achieve communication. Ensure communication efficiency and robustness.
It achieves low-overhead, high-efficiency and high-robust inter-core communication, avoids the use of locks, ensures space and time efficiency, and can detect and restore communication in time after the receiving end goes offline.
Smart Images

Figure CN112463710B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer embedded systems, and in particular relates to an inter-core communication method and system based on an embedded platform. Background Art
[0002] In the era of the Internet of Things, the number of embedded terminal devices is growing, and the application scenarios of embedded systems are gradually enriched. From the simple industrial control and communication equipment at the beginning to today's smart cars, smart phones, and smart cities, the application field of embedded systems is becoming more and more extensive, and embedded products are constantly penetrating into all aspects of social production and human daily life. In the fields of communications, networks, industrial control, medical care, electronics, etc., embedded systems play an increasingly important role. Combined with the emerging big data and artificial intelligence technologies, the embedded industry has been given new vitality. The "National Integrated Circuit Industry Development Promotion Outline" has listed "smart cards, smart grids, smart transportation, satellite navigation, industrial control, financial electronics, automotive electronics, medical electronics and other key integrated circuits and embedded software" as the main tasks and development priorities. Embedded technology has become an important driving force for the progress of human society and the development of the national economy.
[0003] As the complexity of application scenarios increases, the scale of data that embedded devices need to process is also increasing, and embedded computing tasks have higher and higher performance requirements for processors. In order to obtain higher computing power, embedded systems have now moved from single-core structures to multi-core structures, and from homogeneous systems to heterogeneous systems.
[0004] The demand for market applications has promoted the development of multi-core processor technology, but many technologies have not yet been perfected. Among them is the inter-core communication technology that directly affects the performance of multi-core systems. Whether different task processes on different cores can communicate efficiently and robustly with low overhead is an important guarantee for the high performance of multi-core processors. Chinese invention patent CN200510087321.0 provides an inter-core communication method for multi-core processors in an embedded real-time operating system. The method uses an inter-core message queue to improve the efficiency of inter-core communication, and adopts a shared message pool and address copy method to make the length of each message transmitted unrestricted. However, at the same time, the introduction of the message pool brings the overhead of inter-core locks, which affects the efficiency of inter-core communication, and the lack of a disconnection detection mechanism makes it impossible to fully guarantee robustness. Summary of the invention
[0005] In response to the technical problems existing in the prior art, the present invention provides an inter-core communication method and system based on an embedded platform, which can enable low-overhead, high-efficiency and high-robustness communication between different task processes on different cores in a multi-core system.
[0006] In order to solve the above technical problems, the present invention is implemented by the following technical solutions:
[0007] An inter-core communication method based on an embedded platform comprises the following steps:
[0008] a) The source checks the received request task parameters for legitimacy and encapsulates the message to obtain a message in an internal format;
[0009] b) The source core queries the task registry to obtain a list of destination cores that can execute the requested task, uses a load balancing method to select a destination core from the list of destination cores to process the task, and adds the selection result to a message in an internal format;
[0010] c) The source core puts the message in the internal format into the corresponding message channel queue according to the selection result;
[0011] d) The destination core takes out the corresponding message from the message channel queue and performs task processing.
[0012] Furthermore, before step a), the method further includes:
[0013] The writing of the task registry opens a message channel queue from the source core to the destination core from the shared storage area.
[0014] Further, in step a):
[0015] The request task parameters include the request task number, task input parameters and task output parameters;
[0016] The internal format message includes a request task number, a virtual channel number, a task input parameter and a task output parameter;
[0017] The legality check includes checking the validity of the requested task number. The specific checking method is: if the requested task number is defined in the task registration table, it is determined to be legal, otherwise it is determined to be illegal.
[0018] Furthermore, the virtual channel is a data pipeline for communication between a process running on the source core and a process running on the destination core. It is a logical concept. The actual physical space uses the message channel queue between the source core and the destination core.
[0019] The virtual channel number is the number of the virtual channel, and is used to distinguish different virtual channels.
[0020] Furthermore, the task registration table includes three entries, namely, the task number, the mapping of the execution function address corresponding to the task, and the number of the destination core that can execute the task;
[0021] The message channel queue includes a queue head area and a queue body area; the queue head area includes a virtual channel index and an idle channel index; the queue body area is used to store specific internal format message items.
[0022] Further, in step b):
[0023] The selection result is expressed as the number of the target core.
[0024] Further, step c) is specifically:
[0025] The source core determines the message channel queue to be used according to the destination core specified in the message in the internal format;
[0026] The source core determines the virtual channel to be used according to the virtual channel number specified in the message in the internal format;
[0027] The source core puts the message in the internal format into the message channel queue according to the virtual channel index stored in the message channel queue header area, and maintains the correct pointing of the virtual channel index and the idle channel index position.
[0028] Furthermore, between step b) and step c), the following steps are also included:
[0029] The source checks the recycling of processed internal format message items in the message channel queue.
[0030] Further, step d) is specifically:
[0031] The destination core takes out the internal format message item from the corresponding message channel queue, maintains the pointing of the corresponding virtual channel index in the queue head area of the message channel queue, and executes the task specified in the internal format message item.
[0032] An inter-core communication system based on an embedded platform includes: an API interface module, a task module, a routing module and a channel module:
[0033] The API interface module is used to provide an inter-core message sending interface. The API interface module provides a unified API interface to the outside. Once the user calls the API interface to send an inter-core task request, the user parameters will be received and processed by the task module;
[0034] The task module is used to implement the legitimacy check of the received request task parameters and the message encapsulation, obtain the message in the internal format, and pass the message in the internal format to the routing module;
[0035] The routing module is used to query the task registry to obtain a list of destination cores that can execute the task, select a destination core for task processing from the list of destination cores using a load balancing method, and add the selection result to the message in the internal format, specifically, specifying the destination core number in the message in the internal format, and transferring the message in the internal format to the channel module for processing;
[0036] The channel module is used to realize the positioning of the message channel queue and the virtual channel; to fill the message in the internal format into the queue body area of the corresponding virtual channel; to recycle the read message items; to detect whether the message receiving program is offline; to maintain the corresponding index in the queue head area of the virtual channel; to trigger the interruption of the virtual channel binding of the destination core; and to notify the destination core to read the message and execute the task.
[0037] Compared with the prior art, the present invention has at least the following beneficial effects: the inter-core communication method based on the embedded platform provided by the present invention uses a message channel queue for unidirectional message sending and receiving between the dual cores, and the virtual channels used by different tasks running on the dual cores all rely on this message channel queue in physical space. The message channel queue is implemented using a circular queue, and the size of the space occupied is independent of the number of tasks, which ensures space efficiency; there is no lock between the cores, which ensures time efficiency and has high efficiency. For virtual channels that share a common physical space, there is no coupling dependency between the virtual channels in space, and they remain independent and will not interfere with each other. There will be no mutual blocking conditions between the virtual channels, which is efficient. For the message items that have been received, accurate recording and timely recovery can be guaranteed, and the possibility of queue congestion and space waste can be minimized, which is efficient. When the process using the virtual channel to receive messages is disconnected, the sender can perceive it in time and stop sending messages to avoid congestion; and after the disconnected process is reconnected, it can restore the communication state and continue to receive messages, so that the communication between the two parties returns to normal, which is robust. Different tasks can be registered on different cores and recorded by the task registry. When sending and receiving task messages, you only need to focus on the task itself, and the underlying details about which core to use are hidden. In addition, the task registry can be changed, which is flexible.
[0038] In summary, due to the channel queue, the messages of inter-core tasks can be stored, thereby realizing the message communication between multi-core tasks of the embedded platform. In addition, due to the design of the virtual channel sharing the message channel queue, the space efficiency of this method is independent of the number of tasks and has a high space utilization rate. In addition, there is no need to use locks between cores based on channel message communication; although different virtual channels on the same core share the message channel queue, they can remain independent in physical space and will not interfere with each other; the received messages can be accurately recorded and recovered; the above points guarantee the time efficiency to the greatest extent. In addition, the design of reconnecting after the receiving process is disconnected provides a guarantee of robustness. In addition, the introduction of the task register makes the communication task-oriented, hides the details related to the core, and ensures ease of use and flexibility. The inter-core communication method of the present invention can be applied to homogeneous or heterogeneous embedded SOC multi-core systems, so that the processors in these systems can communicate efficiently and maximize the multi-core performance.
[0039] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the specific implementation modes of the present invention, the drawings required for use in the description of the specific implementation modes will be briefly introduced below. Obviously, the drawings described below are some implementation modes of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1 4 is a system architecture diagram of multi-core communication in an embodiment of the present invention.
[0042] Figure 2 It is a structural block diagram of the channel implementation in the embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] As a specific implementation of the present invention, a method for inter-core communication based on an embedded platform includes the following steps:
[0045] a) The source core performs a validity check on the received request task parameters and encapsulates the message to obtain a message in an internal format.
[0046] Specifically, the request task parameters include the request task number, task input parameters and task output parameters.
[0047] The internal format message includes the requested task number, virtual channel number, task input parameters and task output parameters; the virtual channel is a data pipeline for communication between a process running on the source core and a process running on the destination core. It is a logical concept. The actual physical space uses the message channel queue between the source core and the destination core; the virtual channel number is the number of the virtual channel, which is used to distinguish different virtual channels.
[0048] The legality check includes checking the validity of the requested task number. The specific checking method is: if the requested task number is defined in the task registration table, it is judged to be legal, otherwise it is judged to be illegal.
[0049] b) The source core queries the task registry to obtain a list of destination cores that can execute the requested task, uses a load balancing method to select a destination core from the list of destination cores for task processing, and adds the selection result to the message in an internal format. Specifically, the selection result is expressed as the number of the destination core.
[0050] The task registration table includes three entries, namely the task number, the mapping of the execution function address corresponding to the task, and the number of the destination core that can execute the task.
[0051] The message channel queue includes a queue head area and a queue body area; the queue head area includes a virtual channel index and an idle channel index; the queue body area is used to store specific internal format message items.
[0052] c) The source core puts the message in the internal format into the corresponding message channel queue according to the selection result.
[0053] Specifically, the source core determines the message channel queue to be used according to the destination core specified in the message in the internal format.
[0054] The source core determines the virtual channel to be used based on the virtual channel number specified in the message in the internal format.
[0055] The source core puts the message in the internal format into the message channel queue according to the virtual channel index stored in the message channel queue header area, and maintains the correct pointing of the virtual channel index and the idle channel index position.
[0056] d) The destination core takes out the corresponding message from the message channel queue and performs task processing, specifically:
[0057] The destination core takes out the internal format message item from the corresponding message channel queue, maintains the pointing of the corresponding virtual channel index in the queue head area of the message channel queue, and executes the task specified in the internal format message item.
[0058] On the basis of the above implementation, preferably, before step a), it also includes: writing into the task registration table, and opening a message channel queue from the source core to the destination core from the shared storage area.
[0059] Preferably, between step b) and step c), the method further includes: the source checks the recovery of the processed internal format message items in the message channel queue.
[0060] The present invention discloses an inter-core communication system based on an embedded platform, comprising: an API interface module, a task module, a routing module and a channel module:
[0061] An API interface module is used to provide an inter-core message sending interface. The API interface module provides a unified API interface to the outside. Once a user calls the API interface to send an inter-core task request, the user parameters will be received and processed by the task module;
[0062] The task module is used to implement the legitimacy check of the received request task parameters and the message encapsulation, obtain the message in the internal format, and pass the message in the internal format to the routing module;
[0063] The routing module is used to query the task registry to obtain a list of destination cores that can execute the task, select a destination core for task processing from the list of destination cores using a load balancing method, and add the selection result to the message in the internal format. Specifically, the destination core number is specified in the message in the internal format, and the message in the internal format is transferred to the channel module for processing;
[0064] The channel module is used to realize the positioning of the message channel queue and the virtual channel; to fill the internal format message into the queue body area of the corresponding virtual channel; to recycle the read message items; to detect whether the message receiving program is offline; to maintain the corresponding index in the queue head area of the virtual channel; to trigger the interrupt of the virtual channel binding of the destination core; to notify the destination core to read the message and execute the task.
[0065] With the widespread application of multi-core technology in the embedded field, major processor manufacturers have proposed various multi-core architectures, such as IBM's Cell Broadband Engine, ARM's big.LITTLE, TI's KeyStone architecture, etc.
[0066] The present invention uses message passing in an embedded platform based on a multi-core architecture, establishes the concept of virtual channels and the principle of shared message channel queues, realizes efficient communication between multiple cores, and ensures the robustness of communication. This communication method can realize efficient and stable inter-core communication, ensure the real-time and reliability of message passing and task interaction in a multi-core system, and provide a basis for realizing the scheduling and parallelization of multi-core tasks.
[0067] For developers of multi-core tasks, the present invention provides them with a means of core-to-core interaction, thereby simplifying the programming of multi-core tasks and parallel tasks.
[0068] In order to make the technical means, creative features, objectives and effects achieved by the present invention easier to understand, the present invention is described in detail below in conjunction with embodiments and drawings.
[0069] Example
[0070] The system operation in this embodiment can be implemented on any embedded multi-core platform including homogeneous and heterogeneous structures.
[0071] like Figure 1 As shown, the multi-core communication system 100 includes an API interface module 1 , a task module 2 , a routing module 3 , and a channel module 4 .
[0072] In this embodiment, the multi-core communication system 100 adopts message-based communication.
[0073] Compared with the shared memory method, message-based communication avoids the use of locks between cores, so that processes running on different cores are independent of each other when sending and receiving messages through task module 2, routing module 3, and channel module 4, thereby improving communication efficiency.
[0074] Different task processes run on a core and communicate with a task process running on another core on the other end using a virtual channel. Specifically, the core may refer to any core in an embedded multi-core system.
[0075] In this embodiment, the task process running on the core calls API interface module 1 to issue a task request. After receiving the task request, task module 2 will parse the request and generate a message in an internal format, and at the same time, make a legality judgment on the task request according to the task registry. If the task request is an illegal request, the illegal request will be responded to directly (for example, rejection, alarm, etc.); if the legality meets the requirements, the message in the internal format will be further transferred to the routing module 3 for processing. Routing module 3 searches the task registry and selects from the cores that have registered the requested task. The specific selection strategy can adopt a load balancing method to select the core with the lowest task load to process the requested task.
[0076] In this embodiment, the main interaction mode between the user and the multi-core communication system 100 is to run a process that calls the task request interface on the core. For example, the user process calls the task request interface through the API interface module 1, specifies the user parameters, including the requested task number, task input parameters, and task output parameters, and sends a computing task request to the multi-core communication system 100. Once the task request interface function is executed, it enters the task module 2. When the task module 2 receives the computing request task, it will perform a legitimacy check on the user parameters. If the legitimacy check passes, the request is encapsulated into a message in a specific internal format and handed over to the routing module 3 for processing.
[0077] The routing module 3 identifies the received message in the internal format, selects the core with the lowest load among all the cores that have registered the requested task according to the task registration table, and designates the core to receive and process the task request.
[0078] In this embodiment, when the routing module 3 receives the message in the internal format sent by the task module 2, it records the task request. Then, by searching the task registration table, it selects from all the cores that have registered the requested task. The selection strategy can be a load balancing method, that is, selecting a core with the lowest current task load, further encapsulating the message (specifying the numbers of the message sending core and the message receiving core), and handing it over to the channel module 4.
[0079] The channel module 4 is used to manage the sending and receiving of inter-core messages. The main function of the channel module 4 is to realize the reading and writing of the inter-core message channel queue and the recovery of the read message items, so as to ensure the correctness, efficiency and reliability of inter-core communication. In this embodiment, in order to take into account time efficiency, space efficiency and robustness, the channel module 4 adopts a channel design based on the message channel queue multiplexing method.
[0080] In this embodiment, the channel module 4 maintains two message channel queues for bidirectional communication between each pair of cores. The message flow of each message channel queue is unidirectional, and the overall external performance is full-duplex. The implementation of a specific message channel queue is shown in message channel queue 200.
[0081] For the message channel queue 200, it is necessary to implement the functions of channel reading, channel writing, channel read item recycling, and message receiving end disconnection reconnection. The structural design of the message channel queue includes two parts: the message channel queue head area 1 and the message channel queue body area 2. In the message channel queue head area 1, three indexes are maintained for each virtual channel belonging to the channel queue: vx_head virtual channel head index, vx_tail virtual channel tail index, and vx_recover virtual channel recovery mark index (x represents the virtual channel number, such as the virtual channel head index of virtual channel 0 is recorded as v0_head), which is used to jointly manage a virtual channel; at the same time, the free_head and free_tail indexes are maintained to record the head and tail of the idle queue, and the recycle_start is maintained to record the recycling start position of the read message item. The message items between recycle_start and free_tail are the message items that need to be recycled. The queue body 2 is composed of item message items, which contain the specific content of the message (such as the request task number, the request task input parameters, the request task output parameters), and the next field. The next field indicates the index of the next message item after this message item in the message channel queue.
[0082] For the message channel queue 200, initially: the initial values of vx_head, vx_tail, and vx_recover are all -1, indicating that the virtual channels used by all virtual channels belonging to the message channel queue are empty; free_head points to the first item in the message channel queue, free_tail points to the last item in the message channel queue, and the items are sequentially connected through the next field, indicating that all items belong to the free queue; recycle_start points to the last item in the message channel queue (consistent with free_tail), indicating that no message item needs to be recycled.
[0083] For the message channel queue 200, when two message items are written to virtual channel 0, one message item is written to virtual channel 1, and another message item is written to virtual channel 0, the message channel queue status is as follows: v0_head points to item0 and v0_tail points to item3, indicating that the virtual channel corresponding to virtual channel 0 contains all message items (item0, item1, item3) starting from item0, ending at item3, and connected in series with the next field in the middle; v1_head and v1_tail both point to item1, indicating that the virtual channel corresponding to virtual channel 1 contains all message items (item1) starting from item1, ending at item1, and connected in series with the next field in the middle; free_head points to item4 and free_tail points to the last item, indicating that the free queue contains all message items starting from item4, ending at the last item, and connected in series with the next field in the middle.
[0084] For the message channel queue 200, before the virtual channel writes a message item, the message items between recycle_start and free_tail are recycled. Each time a message item is recycled, recycle_start is pointed to the next item of the recycled message item. When writing a message item, the message item pointed to by free_head is attached to the message item pointed to by vx_tail, and free_head and vx_tail are maintained to point to the next message item. The message item pointing change operation is realized by modifying the next value.
[0085] For the message channel queue 200, when the virtual channel reads a message item, it obtains the message item pointed to by vx_head. After the consumption of the message item is completed, the message item is hung after the message item pointed to by free_tail, and vx_head and free_tail are maintained to point to the next message item. At the same time, vx_recover is maintained to keep vx_recover consistent with vx_tail. The purpose of this is that the message sender can timely perceive whether the corresponding message receiving end is offline by comparing the values of vx_recover and vx_tail: when within a certain time window, the message sender finds that the values of vx_recover and vx_tail are inconsistent and there is unread data in the virtual channel, it can be considered that the message receiving end has been offline and cannot read the data in time. At this time, corresponding processing can be performed (such as closing the message sending end, or stopping sending data, waiting for the message receiving end to reconnect).
[0086] The following is a detailed description of the process of the multi-core communication system 100 in the embodiment of the present invention:
[0087] In this embodiment, the entry of the multi-core communication system 100 is the user process running on the core. The user process calls the task request interface through the API interface module 1, specifies the task number, task input parameters, and task output parameters, and sends the task request to the task module 2 for processing. After receiving the request, the task module 2 checks the legitimacy of the request. If it is an illegal request, it directly responds to the illegal request; if it is a legal request, it generates a message in the corresponding format and sends it to the routing module 3. The routing module 3 further encapsulates the received internal message, selects one of the cores as the task processor according to the registration status of the registry and the load status of each core, and hands the encapsulated message to the channel module 4. The channel module 4 writes the message to the virtual channel in the corresponding message channel queue according to the sender and receiver specified in the message, and maintains each index in the queue.
[0088] In this embodiment, the reception of messages uses an interrupt triggering method. For the interrupt method, the virtual channel number is bound to the interrupt vector number. When the channel module 4 writes a message, an interrupt belonging to the message receiving core will be triggered. After the interrupt arrives, in the interrupt handler, the routing module 3 determines the number of the virtual channel that needs to receive the message according to the interrupt vector number, and receives the message in the virtual channel of the corresponding message channel queue by calling the interface provided by the physical module 4. The routing module 3 performs a legitimacy check on the received message. If it is an illegal request, it directly responds to the illegal request; if it is a legal request, it generates a message in the corresponding format and sends it to the task module 2. The task module 2 parses the received task and performs a legitimacy check. If it is an illegal request, it directly responds to the illegal request; if it is a legal request, it processes the task. After the task processing is completed, the results are returned through the routing module 3 and the channel module 4 in turn.
[0089] In actual applications, third-party applications can deploy the multi-core communication system 100 of this embodiment in an embedded homogeneous or heterogeneous multi-core system, and call the task request interface through the API interface module 1 provided by the multi-core communication system 100 to request services located on other cores, so that third-party applications can conveniently and quickly implement multi-core communication, multi-core RPC call and other functions. For example, a heterogeneous multi-core system composed of ARM and DSP can implement the operator call function of ARM to DSP by deploying the multi-core communication system 100 of this embodiment.
[0090] The multi-core communication method based on the embedded platform provided in this embodiment adopts a virtual channel design based on message channel queue reuse in the channel module, so that the virtual channel is logically independent and spatially continuous, and has space efficiency; the inter-core access channel queue is lock-free, and has time efficiency; the virtual channel adopts a recovery flag design, which can detect the disconnection of the receiving end and has robustness. In addition, due to the existence of the task layer and the routing layer, it provides encapsulation and abstraction of the underlying details, is configurable, flexible and easy to use, and has the characteristics of security inspection, traffic load balancing, etc.
[0091] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. An inter-core communication method based on an embedded platform, characterized in that: The following steps are involved: a) The source checks the received request task parameters for legitimacy and encapsulates the message to obtain a message in an internal format; The request task parameters include the request task number, task input parameters and task output parameters; The message in the internal format includes a request task number, a virtual channel number, a task input parameter, and a task output parameter; The legality check includes checking the validity of the requested task number. The specific checking method is: if the requested task number is defined in the task registration table, it is determined to be legal, otherwise it is determined to be illegal; A virtual channel is a data pipeline for communication between a process running on a source core and a process running on a destination core. It is a logical concept. The actual physical space uses the message channel queue between the source core and the destination core. The virtual channel number is the number of the virtual channel, which is used to distinguish different virtual channels; The task registration table includes three entries, namely, the task number, the mapping of the execution function address corresponding to the task, and the number of the destination core that can execute the task; The message channel queue includes a queue head area and a queue body area; the queue head area includes a virtual channel index and an idle channel index; the queue body area is used to store specific internal format message items; b) The source core queries the task registry to obtain a list of destination cores that can execute the requested task, uses a load balancing method to select a destination core from the list of destination cores to process the task, and adds the selection result to a message in an internal format; c) The source core puts the message in the internal format into the corresponding message channel queue according to the selection result, specifically: The source core determines the message channel queue to be used according to the destination core specified in the message in the internal format; The source core determines the virtual channel to be used according to the virtual channel number specified in the message in the internal format; The source core puts the message in the internal format into the message channel queue according to the virtual channel index stored in the message channel queue header area, and maintains the correct pointing of the virtual channel index and the idle channel index position; d) The destination core takes out the corresponding message from the message channel queue and performs task processing.
2. The inter-core communication method based on an embedded platform according to claim 1, characterized in that: Before step a), the method further comprises: The writing of the task registry opens a message channel queue from the source core to the destination core from the shared storage area.
3. The inter-core communication method based on an embedded platform according to claim 1, characterized in that: In step b): The selection result is expressed as the number of the target core.
4. The inter-core communication method based on an embedded platform according to claim 1, characterized in that: Between step b) and step c), the method further comprises: The source checks the recycling of processed internal format message items in the message channel queue.
5. The inter-core communication method based on an embedded platform according to claim 1, characterized in that: Step d) is specifically: The destination core takes out the internal format message item from the corresponding message channel queue, maintains the pointing of the corresponding virtual channel index in the queue head area of the message channel queue, and executes the task specified in the internal format message item.
Citation Information
Patent Citations
Communication method and apparatus among cores for multi-core processor in embedded real-time operating system
CN100458757C
Communication method and system of multi-nuclear multi-operating system
CN101216814A
Communication scheduling system and method among cores of isomerization multi-core processor
CN101354693A
