CN112463710A - Inter-core communication method and system based on embedded platform - Google Patents

Inter-core communication method and system based on embedded platform Download PDF

Info

Publication number
CN112463710A
CN112463710A CN202011440140.2A CN202011440140A CN112463710A CN 112463710 A CN112463710 A CN 112463710A CN 202011440140 A CN202011440140 A CN 202011440140A CN 112463710 A CN112463710 A CN 112463710A
Authority
CN
China
Prior art keywords
message
task
core
channel
queue
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011440140.2A
Other languages
Chinese (zh)
Inventor
顾越
赵银亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Jiaotong University
Original Assignee
Xian Jiaotong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian Jiaotong University filed Critical Xian Jiaotong University
Priority to CN202011440140.2A priority Critical patent/CN112463710A/en
Publication of CN112463710A publication Critical patent/CN112463710A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/163Interprocessor communication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses an inter-core communication method and system based on an embedded platform.A source core carries out validity check and message encapsulation on received request task parameters to obtain messages with internal formats; a source core queries a task registry to obtain a target core list capable of executing a request task, selects a target core for task processing from the target core list by using a load balancing method, and adds a selection result in a message in an internal format; the source core puts the message with the internal format into a corresponding message channel queue according to the selection result; and the target core takes out the corresponding message from the message channel queue to perform task processing. The invention realizes the virtual channel communication mechanism of the multi-task among the cores, adopts the message channel queue multiplexing design, avoids the use of the lock among the cores, and ensures the high efficiency and the robustness of the communication among the cores.

Description

Inter-core communication method and system based on embedded platform
Technical Field
The invention belongs to the field of computer embedded systems, and particularly relates to an inter-core communication method and system based on an embedded platform.
Background
In the era of internet of things, the number of embedded terminal devices is increasing, and the application scenes of an embedded system are gradually enriched. From simple industrial control and communication equipment at the beginning of birth to smart vehicles, smart phones and smart cities nowadays, the embedded application field is increasingly wide, and embedded products continuously permeate all aspects of social production and human daily life. The embedded type optical fiber has more and more important functions in the fields of communication, network, industrial control, medical treatment, electronics and the like. The embedded type industrial robot has new vitality through combination with the unprecedented big data and artificial intelligence technology. The compendium for the development of the national integrated circuit industry has listed key integrated circuits and embedded software, such as smart cards, smart power grids, intelligent transportation, satellite navigation, industrial control, financial electronics, automotive electronics, medical electronics and the like, as main tasks and development focuses. The embedded technology has become an important driving force for promoting the progress of human society and the development of national economy.
With the increase of the complexity of application scenarios, the size of data to be processed by the embedded device is gradually increased, and the performance requirement of the embedded computing task on the processor is higher and higher. In order to achieve higher computing power, embedded systems have been advanced from single-core structures to multi-core structures, and developed from homogeneous systems to heterogeneous systems.
The demands of market applications have driven the development of multi-core processor technology, but many of the technologies have not been perfected. Inter-core communication techniques are included that directly impact the performance of multi-core systems. Whether efficient and robust communication can be carried out among different task processes of different cores with lower expenditure is an important guarantee for exerting the high performance of the multi-core processor. In chinese patent CN200510087321.0, a method for inter-core communication of a multi-core processor in an embedded real-time operating system is provided. The method improves the efficiency of inter-core communication by using the inter-core message queue, and the length of each transmission message is not limited by adopting a method of sharing a message pool and address copying. However, the introduction of the message pool brings overhead of inter-core lock, thereby affecting the efficiency of inter-core communication, and the lack of a disconnection detection mechanism makes robustness not sufficiently guaranteed.
Disclosure of Invention
Aiming at the technical problems in the prior art, the invention provides an inter-core communication method and system based on an embedded platform, which can enable the inter-core communication between different task processes on different cores in a multi-core system to be low in overhead, high in efficiency and high in robustness.
In order to solve the technical problems, the invention is realized by the following technical scheme:
an inter-core communication method based on an embedded platform comprises the following steps:
a) the source core carries out validity check and message encapsulation on the received request task parameters to obtain messages with internal formats;
b) a source core queries a task registry to obtain a target core list capable of executing a request task, selects a target core for task processing from the target core list by using a load balancing method, and adds a selection result in a message in an internal format;
c) the source core puts the message with the internal format into a corresponding message channel queue according to the selection result;
d) and the target core takes out the corresponding message from the message channel queue to perform task processing.
Further, step a) is preceded by:
and writing the task registry, and opening up a message channel queue from the source core to the destination core from the shared storage area.
Further, in step a):
the request task parameters comprise a request task number, a task input parameter and a task output parameter;
the internal format message comprises a request task number, a virtual channel number, a task input parameter and a task output parameter;
the validity check comprises checking the validity of the request task number, and the specific checking method comprises the following steps: if the request task number is defined in the task registry, the request task number is judged to be legal, otherwise, the request task number is judged to be illegal.
Furthermore, the virtual channel is a data pipeline for communication between a certain process running on the source core and a certain process running on the destination core, belongs to a logic concept, and uses a message channel queue between the source core and the destination core in an actual physical space;
the virtual channel number is the number of the virtual channel and is used for distinguishing different virtual channels.
Further, the task registry comprises three table entries, namely a task number, a mapping of a task corresponding to an execution function address and a number of a destination core capable of executing the task;
the message channel queue comprises a queue head area and a queue body area; the queue head area comprises a virtual channel index and an idle channel index; the queue area is used for storing specific internal format message items.
Further, in step b):
the selection result is expressed as the number of the destination core.
Further, the step c) is specifically as follows:
the source core determines a used message channel queue according to a specified target core in the message with the internal format;
the source core determines a virtual channel to use according to the virtual channel number specified in the message of the internal format;
and the source core puts the message with the internal format into the message channel queue according to the virtual channel index stored in the head area of the message channel queue and maintains the correct direction of the positions of the virtual channel index and the idle channel index.
Further, between step b) and step c), further comprising:
the source core recycles processed internal format message items in the message channel queue.
Further, the step d) is specifically as follows:
the target core takes out the internal format message item from the corresponding message channel queue, maintains the direction 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.
An embedded platform based inter-core communication system comprising: API interface module, task module, route module and passageway module:
the API interface module is used for providing an inter-core message sending interface, and the API interface module provides a uniform API interface for the outside, wherein once a user calls the API interface to send an inter-core task request, user parameters are received and processed by the task module;
the task module is used for carrying out validity check and message encapsulation on the received request task parameters to obtain messages in an internal format and transmitting the messages in the internal format to the routing module;
the routing module is used for querying the task registry to obtain a target core list capable of executing the task, selecting a target core for task processing from the target core list by using a load balancing method, and adding a selection result into the message in the internal format, specifically, specifying a target core number in the message in the internal format, and transferring the message in the internal format to the channel module for processing;
the channel module is used for realizing the positioning of the message channel queue and the virtual channel; the queue area is used for filling the message in the internal format into the queue area of the corresponding virtual channel; for reclaiming read message items; detecting whether a message receiving program is disconnected; a corresponding index in a queue head region for maintaining a virtual channel; an interrupt for triggering a destination core virtual channel binding; for informing the destination core to read the message and execute the task.
Compared with the prior art, the invention has at least the following beneficial effects: according to the method for the communication between the cores based on the embedded platform, the two cores transmit and receive messages in a one-way mode by using a message channel queue, and virtual channels used by different tasks running on the two cores are all based on the message channel queue in a physical space. The message channel queue is realized by using a ring queue, the size of the occupied space is irrelevant to the number of tasks, and the space efficiency is ensured; no lock exists between the cores, so that the time efficiency is ensured, and the efficiency is high. For virtual channels sharing a common physical space, the virtual channels are not in a coupling dependency relationship in space, are independent and do not interfere with each other, and the virtual channels are not blocked with each other, so that the method has high efficiency. The received message items can be accurately recorded and timely recovered, the possibility of queue congestion and space waste is reduced to the maximum extent, and the method has high efficiency. When the process of receiving the message by using the virtual channel is disconnected, the sender can sense the disconnection in time, stop sending the message and avoid congestion; and after the disconnected process is reconnected, the communication state can be recovered, and the message is continuously received, so that the communication between the two parties is recovered to be normal, and the robustness is realized. Different tasks can be registered on different cores, the task registry records the tasks, when receiving and sending task messages, only the tasks need to be concerned, the bottom-layer details of which core is specifically used are hidden, and the task registry can be changed and has flexibility.
In summary, due to the channel queue, the message of the inter-core task can be stored, so that the message communication between the multi-core tasks of the embedded platform is realized. In addition, due to the design that the virtual channels share the message channel queues, the method has no relation with the number of tasks in the aspect of space efficiency and has high space utilization rate. In addition, a lock is not required to be used between cores based on channel message communication; although different virtual channels on the same core share the message channel queue, the virtual channels can be kept independent in physical space and cannot interfere with each other; the received message can be accurately recorded and recovered; the time efficiency is guaranteed to the greatest extent through the above points. In addition, the design of reconnection after the disconnection of the receiving process provides the guarantee of robustness. In addition, the introduction of the task registry enables the communication to be task-oriented, details related to the core are hidden, and the usability and the flexibility are guaranteed. The inter-core communication method can be applied to isomorphic or heterogeneous embedded SOC multi-core systems, so that processors in the systems can efficiently communicate and exert multi-core performance to the maximum extent.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a system architecture diagram of multi-core communication in an embodiment of the present invention.
Fig. 2 is a block diagram of a channel implementation according to an embodiment of the present invention.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As a specific embodiment of the present invention, an inter-core communication method based on an embedded platform includes the following steps:
a) and the source core carries out validity check and message encapsulation on the received request task parameters to obtain the message with the internal format.
Specifically, the request task parameters include a request task number, a task input parameter, and a task output parameter.
The internal format message comprises a request task number, a virtual channel number, a task input parameter and a task output parameter; the virtual channel is a data pipeline for communication between a certain process running on a source core and a certain process running on a destination core, belongs to a logic concept, and uses a message channel queue between the source core and the destination core on an actual physical space; the virtual channel number is the number of the virtual channel and is used for distinguishing different virtual channels.
The validity check comprises checking the validity of the request task number, and the specific checking method comprises the following steps: if the request task number is defined in the task registry, the request task number is judged to be legal, otherwise, the request task number is judged to be illegal.
b) The source core queries the task registry to obtain a target core list capable of executing the request task, selects a target core for task processing from the target core list by using a load balancing method, and adds a selection result into the message in the internal format, wherein the selection result is expressed as the number of the target core.
The task registry comprises three table entries, namely a task number, a mapping of an execution function address corresponding to the task and a number of a destination core capable of executing the task.
The message channel queue comprises a queue head area and a queue body area; the queue head area comprises a virtual channel index and an idle channel index; the queue area is used for storing specific internal format message items.
c) And the source core puts the message with the internal format into a corresponding message channel queue according to the selection result.
Specifically, the source core determines the message channel queue to use according to the destination core specified in the message in the internal format.
And the source core determines the used virtual channel according to the virtual channel number specified in the message of the internal format.
And the source core puts the message with the internal format into the message channel queue according to the virtual channel index stored in the head area of the message channel queue and maintains the correct direction of the positions of the virtual channel index and the idle channel index.
d) The target core takes out corresponding information from the information channel queue to perform task processing, and the task processing specifically comprises the following steps:
the target core takes out the internal format message item from the corresponding message channel queue, maintains the direction 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.
In addition to the above embodiment, step a) preferably further includes: and writing the task registry, and opening up a message channel queue from the source core to the destination core from the shared storage area.
Preferably, between step b) and step c), further comprising: the source core recycles processed internal format message items in the message channel queue.
The invention relates to an inter-core communication system based on an embedded platform, which comprises: API interface module, task module, route module and passageway module:
the API interface module is used for providing an inter-core message sending interface and providing a uniform API interface for the outside, wherein once a user calls the API interface to send an inter-core task request, user parameters are received and processed by the task module;
the task module is used for carrying out validity check and message encapsulation on the received request task parameters to obtain messages in an internal format and transmitting the messages in the internal format to the routing module;
the routing module is used for inquiring the task registry to obtain a target core list capable of executing the task, selecting a target core for task processing from the target core list by using a load balancing method, adding a selection result into the message in the internal format, specifically, designating a target core number in the message in the internal format, and transferring the message in the internal format to the channel module for processing;
the channel module is used for realizing the positioning of the message channel queue and the virtual channel; the queue area is used for filling the message in the internal format into the queue area of the corresponding virtual channel; for reclaiming read message items; detecting whether a message receiving program is disconnected; a corresponding index in a queue head region for maintaining a virtual channel; an interrupt for triggering a destination core virtual channel binding; for informing the destination core to read the message and execute the task.
With the wide application of multi-core technology in the embedded field, various large processor manufacturers have proposed various multi-core architectures, such as Cell Broad-band Engine of IBM, big-ARM, and KeyStone architecture of TI.
The invention realizes the high-efficiency communication among the multiple cores by utilizing a message transmission mode and through the concept of establishing a virtual channel and the principle of sharing a message channel queue under the embedded platform based on the multi-core architecture, and ensures the robustness of the communication. The communication method can realize efficient and stable inter-core communication, guarantee the real-time performance and reliability of message transmission and task interaction in the multi-core system, and provide a basis for realizing the scheduling and the parallel of multi-core tasks.
For developers of multi-core tasks, the invention provides a means for the developers to interact with cores from core to core, and simplifies the programming of the multi-core tasks and the parallel tasks.
In order to make the technical means, the creation features, the achievement purposes and the effects of the invention easy to understand, the invention is specifically described below by combining the embodiment and the attached drawings.
Examples
The system operation in this embodiment may be implemented in any embedded multi-core platform including homogeneous and heterogeneous structures.
As shown in fig. 1, 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.
In this embodiment, the multi-core communication system 100 employs message-based communication.
Compared with the mode of sharing the memory, the communication based on the message avoids the use of locks between the cores, so that the communication is operated between the processes of different cores and mutually independent when the messages are received and sent through the task module 2, the routing module 3 and the channel module 4, and the communication efficiency is improved.
And different task processes are run on the cores, and the virtual channel is used for communicating with the task process run on the other core at the opposite end. Specifically, the core may refer to any core in an embedded multi-core system.
In this embodiment, a task process running on a core calls the API interface module 1 to send a task request, and after receiving the task request, the task module 2 parses the request and generates a message in an internal format, and at the same time, performs validity judgment on the task request according to a task registry. If the task request is an illegal request, directly responding to the illegal request (such as refusing, alarming and the like); if the legitimacy meets the requirements, the message in the internal format will be further forwarded to the routing module 3 for processing. The routing module 3 selects among the cores that registered the requesting task by looking up the task registry. The specific selection strategy can adopt a load balancing method to select the core with the lowest task load to process the request task.
In this embodiment, the main interaction manner between the user and the multi-core communication system 100 is to run a process that calls a task request sending interface on the core. For example, in the user process, the API interface module 1 calls a task request interface, specifies user parameters including a request task number, a task input parameter, and a task output parameter, and sends a computation task request to the multi-core communication system 100. Once the task request interface function executes, and enters the task module 2, the task module 2 receives the calculation request task, and then the user parameter is checked for validity. If the validity check is passed, the request is encapsulated into a message with a specific internal format and then is delivered to the routing module 3 for processing.
The routing module 3 identifies the received message with the internal format, selects the core with the lowest load from all the cores registered with the request task according to the task registry, and designates the core to receive and process the task request.
In this embodiment, the routing module 3 records the task request when receiving the message in the internal format sent by the task module 2. A selection is then made among all cores registered for the requesting task by looking up a task registry. The selection policy may be a load balancing method, that is, one core with the lowest load of the current task is selected, the message is further encapsulated (the numbers of the message sending core and the message receiving core are specified), and the message is delivered to the channel module 4.
The channel module 4 is used for managing the sending and receiving of the inter-core messages. The channel module 4 has the main functions of reading and writing the inter-core message channel queue, recovering the read message items, and ensuring the correctness, the high efficiency and the reliability of the inter-core communication. In this embodiment, in order to take time efficiency, space efficiency, and robustness into consideration, the channel module 4 adopts a channel design based on a message channel queue multiplexing mode.
In this embodiment, the channel module 4 maintains two message channel queues for bidirectional communication between each pair of cores, where the message flow of each message channel queue is unidirectional, and the whole outward appearance is full duplex. The specific implementation of a particular message channel queue is shown as message channel queue 200.
For the message channel queue 200, the functions of channel reading, channel writing, channel read item recovery, and message receiving end disconnection reconnection need to be realized. The structure design of the message channel queue comprises a message channel queue head area 1 and a message channel queue body area 2. Three indexes are maintained in the message channel queue head area 1 for each virtual channel belonging to the channel queue: a vx _ head virtual channel head index, a vx _ tail virtual channel tail index, and a vx _ receiver virtual channel recovery mark index (x represents a virtual channel number, for example, the virtual channel head index of virtual channel number 0 is denoted as v0_ head), which are used to collectively manage one virtual channel; meanwhile, the head and the tail of the free queue are recorded by two indexes of free _ head and free _ tail, the recovery starting position of the read message item recorded by the recycle _ start is maintained, and the message item needing to be recovered is between the recycle _ start and the free _ tail. The queue body 2 is composed of item message items, and the message items comprise specific contents of the message (such as a request task number, a request task input parameter and a request task output parameter) and a next field. Where the next field indicates the index in the message channel queue for the next message entry after the message entry.
For the message channel queue 200, initially: the initial values of the vx _ head, the vx _ tail and the vx _ receiver are-1, which means that all virtual channels used by all virtual channels belonging to the message channel queue are empty; the free _ head points to the first item in the message channel queue, the free _ tail points to the last item in the message channel queue, and the items are sequentially connected in series through a next field, which represents that all the items belong to an idle queue; recycle _ start points to the last item in the message channel queue (consistent with free _ tail), representing no message items to be recycled.
For the message channel queue 200, after the virtual channel 0 writes two message entries, the virtual channel 1 writes one more message entry, and the virtual channel 0 writes one more message entry, the message channel queue status is as follows: v0_ head points to item0, v0_ tail points to item3, which means that the virtual channel 0 corresponds to a virtual channel containing all message items (item0, item1, item3) which start from item0, end from item3 and are connected in series by a next field in the middle; v1_ head and v1_ tail both point to item1, which means that the virtual channel corresponding to virtual channel 1 contains all message items (item1) which start from item1, end from item1 and are connected in series by a next field in the middle; free _ head points to item4 and free _ tail to the last entry, representing that the free queue contains all message entries beginning with item4, ending with the last entry, concatenated with a next field in between.
For the message channel queue 200, before the virtual channel writes a message item, recovering the message item from recycle _ start to free _ tail, and pointing recycle _ start to the next item of the recovered message item when one message item is recovered; when writing the message item, the message item pointed by the free _ head is hung behind the message item pointed by the vx _ tail, and the free _ head and the vx _ tail are maintained and pointed to the next message item. The point change operation of the message item is realized by modifying the next value.
For the message channel queue 200, when reading a message item, the virtual channel obtains the message item pointed to by the vx _ head, and after completing consumption of the message item, the message item is hung behind the message item pointed to by the free _ tail, and maintains the vx _ head and the free _ tail to point to the next message item. Meanwhile, the vx _ receiver is maintained, and the vx _ receiver and the vx _ tail are kept consistent. The purpose of this is that the message sender can timely sense whether the corresponding message receiver is disconnected or not by comparing the values of vx _ receiver and vx _ tail: when the message sender finds that the values of vx _ receiver and vx _ tail are not consistent and data is not read in the virtual channel within a certain time window, the message receiver can be considered to be disconnected and cannot read the data in time, and corresponding processing can be performed at the moment (for example, the message sender is closed, or the data sending is stopped, and the message receiver is waited to reconnect).
The following specifically describes the flow of the multi-core communication system 100 in the embodiment of the present invention:
in this embodiment, an entry of the multi-core communication system 100 is a user process running on a core. The user process calls a task request interface through the API interface module 1, specifies a task number, a task input parameter and a task output parameter, and sends the task request to the task module 2 for processing. The task module 2 checks the legality of the request after receiving the request, and directly responds to the illegal request if the request is the illegal request; if the request is a legal request, a message with a corresponding format is generated and sent to the routing module 3. The routing module 3 further encapsulates the received internal message, selects one of the cores as a task handler according to the registry registration condition and the load condition of each core, and delivers the encapsulated message to the channel module 4. The channel module 4 writes the message into the virtual channel in the corresponding message channel queue according to the sender and the receiver specified in the message, and maintains each index in the queue.
In this embodiment, the reception of the message uses an interrupt trigger mode. For the interrupt mode, the virtual channel number is bound to the interrupt vector number, and when the channel module 4 writes a message, it triggers an interrupt belonging to the message receiving core. After the interrupt arrives, in the interrupt processing program, the routing module 3 determines the number of the virtual channel needing to receive the message according to the interrupt vector number, and receives the message in the virtual channel corresponding to the message channel queue by calling the interface provided by the physical module 4. The routing module 3 checks the validity of the received message, and directly responds to the illegal request if the received message is the illegal request; and if the request is a legal request, generating a message with a corresponding format and sending the message to the task module 2. The task module 2 analyzes the received task, checks the validity, and directly responds to the illegal request if the received task is the illegal request; and if the request is a legal request, processing the task. After the task processing is finished, the result is returned through the routing module 3 and the channel module 4 in sequence.
In practical application, the multi-core communication system 100 of this embodiment may be deployed in an embedded homogeneous or heterogeneous multi-core system by a third-party application, and the third-party application calls a task request interface to request services located on other cores through the API interface module 1 provided by the multi-core communication system 100, so that the third-party application can conveniently and quickly implement functions such as multi-core communication and multi-core RPC calling. For example, a heterogeneous multi-core system composed of an ARM and a DSP can implement an operator calling function of the DSP by the ARM by deploying the multi-core communication system 100 of this embodiment.
In the multi-core communication method based on the embedded platform provided by the embodiment, because the channel module adopts the virtual channel design based on message channel queue multiplexing, the virtual channels are logically independent and spatially continuous, and have space efficiency; the inter-core access channel queue has no lock and has time efficiency; the virtual channel adopts the design of a recovery mark, can realize the offline detection of a receiving end and has robustness. In addition, due to the existence of the task layer and the routing layer, the packaging and abstraction of bottom layer details are provided, and the method has the characteristics of configurability, flexibility, usability, safety inspection, flow load balancing and the like.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present invention, which are used for illustrating the technical solutions of the present invention and not for limiting the same, and the protection scope of the present invention is not limited thereto, although the present invention is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the embodiments of the present invention, and they should be construed as being included therein. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. An inter-core communication method based on an embedded platform is characterized by comprising the following steps:
a) the source core carries out validity check and message encapsulation on the received request task parameters to obtain messages with internal formats;
b) a source core queries a task registry to obtain a target core list capable of executing a request task, selects a target core for task processing from the target core list by using a load balancing method, and adds a selection result in a message in an internal format;
c) the source core puts the message with the internal format into a corresponding message channel queue according to the selection result;
d) and the target core takes out the corresponding message from the message channel queue to perform task processing.
2. The method according to claim 1, wherein step a) further comprises, before:
and writing the task registry, and opening up a message channel queue from the source core to the destination core from the shared storage area.
3. The method according to claim 1, wherein in step a):
the request task parameters comprise a request task number, a task input parameter and a task output parameter;
the internal format message comprises a request task number, a virtual channel number, a task input parameter and a task output parameter;
the validity check comprises checking the validity of the request task number, and the specific checking method comprises the following steps: if the request task number is defined in the task registry, the request task number is judged to be legal, otherwise, the request task number is judged to be illegal.
4. The embedded platform-based inter-core communication method according to claim 3,
the virtual channel is a data pipeline for communication between a certain process running on a source core and a certain process running on a destination core, belongs to a logic concept, and uses a message channel queue between the source core and the destination core on an actual physical space;
the virtual channel number is the number of the virtual channel and is used for distinguishing different virtual channels.
5. The embedded platform-based inter-core communication method according to claim 3,
the task registry comprises three table entries, namely a task number, mapping of a task corresponding to an execution function address and a number of a target core capable of executing the task;
the message channel queue comprises a queue head area and a queue body area; the queue head area comprises a virtual channel index and an idle channel index; the queue area is used for storing specific internal format message items.
6. The method according to claim 1, wherein in step b):
the selection result is expressed as the number of the destination core.
7. The method according to claim 5, wherein the step c) is specifically as follows:
the source core determines a used message channel queue according to a specified target core in the message with the internal format;
the source core determines a virtual channel to use according to the virtual channel number specified in the message of the internal format;
and the source core puts the message with the internal format into the message channel queue according to the virtual channel index stored in the head area of the message channel queue and maintains the correct direction of the positions of the virtual channel index and the idle channel index.
8. The method according to claim 1, wherein between steps b) and c), the method further comprises:
the source core recycles processed internal format message items in the message channel queue.
9. The method according to claim 5, wherein the step d) is specifically as follows:
the target core takes out the internal format message item from the corresponding message channel queue, maintains the direction 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.
10. An inter-core communication system based on an embedded platform, comprising: API interface module, task module, route module and passageway module:
the API interface module is used for providing an inter-core message sending interface, and the API interface module provides a uniform API interface for the outside, wherein once a user calls the API interface to send an inter-core task request, user parameters are received and processed by the task module;
the task module is used for carrying out validity check and message encapsulation on the received request task parameters to obtain messages in an internal format and transmitting the messages in the internal format to the routing module;
the routing module is used for querying the task registry to obtain a target core list capable of executing the task, selecting a target core for task processing from the target core list by using a load balancing method, and adding a selection result into the message in the internal format, specifically, specifying a target core number in the message in the internal format, and transferring the message in the internal format to the channel module for processing;
the channel module is used for realizing the positioning of the message channel queue and the virtual channel; the message channel queue area is used for filling the messages with the internal format into the corresponding virtual channel; for reclaiming read message items; detecting whether a message receiving program is disconnected; a corresponding index in a message channel queue head region for maintaining a virtual channel; an interrupt for triggering a destination core virtual channel binding; for informing the destination core to read the message and execute the task.
CN202011440140.2A 2020-12-10 2020-12-10 Inter-core communication method and system based on embedded platform Pending CN112463710A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011440140.2A CN112463710A (en) 2020-12-10 2020-12-10 Inter-core communication method and system based on embedded platform

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011440140.2A CN112463710A (en) 2020-12-10 2020-12-10 Inter-core communication method and system based on embedded platform

Publications (1)

Publication Number Publication Date
CN112463710A true CN112463710A (en) 2021-03-09

Family

ID=74801872

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011440140.2A Pending CN112463710A (en) 2020-12-10 2020-12-10 Inter-core communication method and system based on embedded platform

Country Status (1)

Country Link
CN (1) CN112463710A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115934385A (en) * 2023-02-08 2023-04-07 苏州浪潮智能科技有限公司 Method, system, equipment and storage medium for communication among multiple cores
WO2024119869A1 (en) * 2022-12-09 2024-06-13 上海寒武纪信息科技有限公司 Method for executing inter-chip communication task, and related product

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2024119869A1 (en) * 2022-12-09 2024-06-13 上海寒武纪信息科技有限公司 Method for executing inter-chip communication task, and related product
CN115934385A (en) * 2023-02-08 2023-04-07 苏州浪潮智能科技有限公司 Method, system, equipment and storage medium for communication among multiple cores

Similar Documents

Publication Publication Date Title
WO2019042312A1 (en) Distributed computing system, data transmission method and device in distributed computing system
US8321876B2 (en) System and method of dynamically loading and executing module devices using inter-core-communication channel in multicore system environment
CN112784989B (en) Inference system, inference method, electronic device, and computer storage medium
CN112463710A (en) Inter-core communication method and system based on embedded platform
CN112671760A (en) Socket-based client cross-platform network communication method and related equipment thereof
US20100186024A1 (en) System and Method of Invoking Multiple Remote Operations
CN105187327A (en) Distributed message queue middleware
JP2002351854A (en) Program execution device and portable information processing device
US11016769B1 (en) Method and apparatus for processing information
KR101558289B1 (en) Composing message processing pipelines
CN110430142A (en) Method and apparatus for controlling flow
CN107977260B (en) Task submitting method and device
CN114296646B (en) Caching method and device based on IO service, server and storage medium
CN108829530B (en) Image processing method and device
CN113127775B (en) Page loading method, device, equipment and storage medium
WO2024037629A1 (en) Data integration method and apparatus for blockchain, and computer device and storage medium
CN113296979A (en) Data communication method for unreal engine and external program
CN116680209A (en) WASM-based multi-intelligent contract instance management method
CN101976206B (en) A kind of interruption processing method and device
CN112540839B (en) Information changing method, device, electronic equipment and storage medium
CN114462388A (en) Handle management or communication method, electronic device, storage medium, and program product
Ayres et al. Stage: Python with actors
Chen et al. A semantic unit for timed automata based modeling languages
CN117917643A (en) Task processing method and device and electronic equipment
CN102520622A (en) Vehicle embedded real-time control system performance modeling language

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination