An inter-partition message subscription and publishing method based on shared memory

By adopting a shared memory-based segmented message subscription and publication method, the problem of low efficiency in segmented communication under the ARINC-653 standard is solved, achieving high real-time and deterministic segmented communication and simplifying the development process.

CN115640148BActive Publication Date: 2025-10-21XIAN AVIATION COMPUTING TECH RES INST OF AVIATION IND CORP OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211323974.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-26
Publication Date
2025-10-21
Estimated Expiration
2042-10-26

AI Technical Summary

Technical Problem

In the existing technology, the segmented communication method based on the ARINC-653 standard is inefficient in embedded operating systems, lacks real-time performance and determinism, resulting in complex communication and unsuitability for environments with strong real-time and high determinism requirements.

Method used

A segmented message subscription and publishing method based on shared memory is adopted. Message space is allocated through static configuration, authorized access attributes are set, message slots are bound, and message reading and writing are performed directly through pointers, avoiding system state switching and simplifying segmented communication.

Benefits of technology

It improves the real-time performance and determinism of inter-segment communication, reduces data copying operations, simplifies development and testing overhead, and meets the communication requirements of highly deterministic embedded systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115640148B_ABST
    Figure CN115640148B_ABST
Patent Text Reader

Abstract

The application provides a partition inter-message subscription and release method based on shared memory, which comprises the following steps: allocating a message space according to a static configuration mode; setting authorized access attributes of the message space for a release partition and a subscription partition; binding the release partition and the subscription partition with a message slot in the message space, and setting access permissions of the release partition and the subscription partition to the message slot; writing a message into the message slot by the release partition and reading the message by the subscription partition; releasing the message slot after writing the message and reading the message in a current cycle, and the message content in the message slot will be covered by a message in a next cycle, and the cycle is repeated. The above method can provide support for a partition inter-communication technology of an operating system in an embedded platform, ensures that the partition inter-communication can meet the requirements of strong real-time and high determinacy of the operating system, and solves a communication technology bottleneck problem of comprehensive implementation of the operating system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer system software, and in particular to a method for subscribing and publishing messages between partitions based on shared memory. Background Art

[0002] Currently, embedded partitioned operating systems are widely used in various embedded platforms. They effectively coordinate various software functions and ensure the reliable and secure operation of each software unit in the embedded platform. In embedded partitioned operating systems, inter-partition communication is the primary means of information exchange between operating system partitions. The efficiency of inter-partition communication directly affects the performance of the operating system and, in turn, the overall capabilities of the embedded platform.

[0003] However, currently, airborne computer systems widely utilize inter-partition communication methods that comply with the ARINC-653 standard. This inter-partition communication mechanism, defined in the ARINC-653 standard, primarily employs a port-based communication approach. Partitions with communication needs are required to configure their assigned ports, including queue ports and sampling ports, through configuration files. Channels are used to establish associations between destination and source ports. Inter-partition associations are established based on bindings between ports and partitions. Because these interfaces create the required ports through an API and write the intended messages into the system state's message space by calling a message-sending API, the message sending process requires a system call and a switch to the system state, resulting in low message sending efficiency. Similarly, when receiving messages, partitions call the receive message API to read the messages from the buffer. Under this mechanism, the mapping between partitions is complex, placing high demands on developers. Furthermore, the need for configuration file support complicates the overall communication mechanism, resulting in low real-time performance. Therefore, developing inter-partition communication methods for embedded operating systems in highly real-time and deterministic environments has important theoretical and practical implications. Summary of the Invention

[0004] In order to solve the problem that the inter-partition communication method that complies with the ARINC-653 standard cannot meet the strong real-time and high-determinism communication requirements of high-determinism, high-security embedded systems, the present invention designs an inter-partition message subscription and publishing method based on shared memory, which can meet the strong real-time and high-determinism communication requirements of high-determinism, high-security embedded systems.

[0005] The technical solution for achieving the purpose of the invention is as follows: A method for subscribing and publishing messages between partitions based on shared memory, comprising the following steps:

[0006] S1. Allocate message space to publishing partitions and subscription partitions with communication needs based on static configuration.

[0007] S2. Set the authorization access attributes of the publishing partition and the subscription partition to the message space;

[0008] S3. Bind the publishing partition and the subscription partition to the message slot in the message space, and set the publishing partition and subscription partition's access rights to the message slot.

[0009] S4. The publishing partition writes messages to the message slot bound to it, and the subscribing partition reads messages from the message slot;

[0010] S5. After writing and reading messages in the current cycle, the message publishing and subscription ends, the message slot is released, and the next message cycle is awaited.

[0011] In one embodiment, in step S2, the method for setting the authorized access attributes of the publishing partition and the subscribing partition with communication needs to the message space is: mapping the message space to the publishing partition and the subscribing partition with communication needs through the MMU mapping mechanism, and authorizing the publishing partition and the subscribing partition to have access rights to the message space.

[0012] Furthermore, in step S3, a plurality of message slots are provided in the message space, and each message slot has a unique message ID.

[0013] Furthermore, in step S3, the publishing partition has read and write permissions for the message slot bound to it, and the subscribing partition has read-only permissions for the message slot bound to it.

[0014] In one embodiment, in step S4, the method for the publishing partition to write a message to the message slot bound to it is: the publishing partition calls the message publishing interface service, and writes the message to the specified message slot according to the message ID and message content.

[0015] In one embodiment, in step S4, the publishing partition and the subscribing partition read and write messages through pointers, including: the publishing partition write pointer writes from the beginning of the message slot, and after writing is completed, the write pointer remains at the last character of the message content; the subscribing partition read pointer also starts reading the message from the beginning of the message slot. When the read pointer reaches the write pointer position, the message reading is completed, and this message publishing and subscription ends.

[0016] Compared with the prior art, the beneficial effects of the present invention are as follows: the inter-partition message subscription and publishing method designed by the present invention adopts a shared memory mechanism, and through the read-write control and space mapping mechanism of the authorized partition (publishing partition and subscribing partition) of the message space, the message space can be directly read and written without switching the system state. Compared with the traditional port-based inter-partition communication method, this mechanism can reduce the data copying operations between the message space and the partition application, and enhance the real-time performance of the communication. At the same time, the message subscription and publishing mechanism is used to establish the binding relationship between the partition and the message slot, and the access rights of the partition to the message space and the message slot are set by authorization, thereby improving the certainty of the message interaction. It is also possible to simplify the mapping relationship between the partition and the message space by reasonably allocating the inter-partition communication message cycle and the number of messages, thereby optimizing the overhead of operating system development and testing. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are merely for the purpose of more clearly illustrating the embodiments of the present invention or the technical solutions in the prior art. Those skilled in the art can also derive other drawings based on these drawings without inventive effort.

[0018] Figure 1 A schematic diagram of a publish-subscribe communication mechanism based on shared memory in a specific implementation manner;

[0019] Figure 2 The flowchart of the inter-partition message subscription and publishing method in a specific implementation manner. DETAILED DESCRIPTION

[0020] The present invention will be further described below with reference to specific embodiments, and the advantages and features of the present invention will become clearer as the description proceeds. However, these embodiments are merely exemplary and do not constitute any limitation to the scope of the present invention. It should be understood by those skilled in the art that the details and forms of the technical solutions of the present invention may be modified or replaced without departing from the spirit and scope of the present invention, and such modifications and replacements fall within the scope of protection of the present invention.

[0021] In the description of this embodiment, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship, are based on the orientation or position relationship shown in the accompanying drawings, and are only for the convenience of describing the invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the invention.

[0022] Furthermore, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature identified with "first," "second," etc., may explicitly or implicitly include one or more of such features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.

[0023] This specific embodiment discloses a method for subscribing and publishing messages between partitions based on shared memory. Figure 1 and Figure 2 As shown, the inter-partition message subscription and publishing method includes the following steps:

[0024] S1. Based on the static configuration method, message space is allocated to the publishing partition and subscription partition with communication needs.

[0025] Specifically, according to the static configuration mode, the message space is allocated for inter-partition communication in combination with the type of message cycle and the number of partitions requiring communication, thereby improving the certainty of communication.

[0026] In this step, different message spaces can be organized according to the length of the message cycle (ie, the time interval between two adjacent message releases), and the user can configure the size of the message cycle according to their needs.

[0027] S2. Set the authorization access attributes of the publishing partition and the subscription partition to the message space.

[0028] Specifically, the authorized access attribute can be set as follows: in the above step S1, all publishing partitions and subscription partitions allocated with message space that have communication needs can access the message space, while publishing partitions and subscription partitions not allocated with the message space cannot access the message space.

[0029] For example, the specific method for setting the authorized access attributes of the message space for the publishing partition and subscribing partition with communication needs is as follows: the message space is mapped to the publishing partition and subscribing partition with communication needs through the MMU mapping mechanism, and when the publishing service and subscription service interfaces are initialized, the access rights flag bit in the message attributes is set to authorize the publishing partition and subscribing partition to access the message space, and corresponding operations can be performed. The above mechanism can reduce data copy operations between the message space and partition applications, thereby greatly improving the real-time performance of communication. Through the MMU mechanism, it is ensured that within a given partition, the partition can access the message space mapped to another partition with which it has communication needs. By reasonably allocating the communication message cycle and number of messages between partitions, the mapping relationship between partitions and message spaces can be reduced.

[0030] It is important to note that: See Figure 1 As shown, partition 1 can be a publishing partition in one of its allocated message spaces (also called a message pool), and can also be a subscription partition in another of its allocated message spaces. The same applies to partition 2.

[0031] S3. Bind the publishing partition and the subscription partition to the message slot in the message space, and set the access rights of the publishing partition and the subscription partition to the message slot.

[0032] In this step, a plurality of message slots are provided in the message space, and each message slot has a unique message ID.

[0033] Furthermore, the publishing partition has read and write permissions for the message slots bound to it, while the subscribing partition has read-only permissions for the message slots bound to it. At the same time, within the message space, for message slots that are not bound to the publishing partition or the subscribing partition, the publishing partition and the subscribing partition have no access permissions to them.

[0034] S4. The publishing partition writes messages to the message slot bound to it, and the subscribing partition reads messages from the message slot.

[0035] In one embodiment, in step S4, the method for the publishing partition to write a message to the message slot bound to it is: the publishing partition calls the message publishing interface service, and writes the message to the designated message slot according to the message ID and message content. Since the authorized message slot has been mapped to the current partition, the partition application layer can directly operate the corresponding message slot without switching to the core operating system space for message writing operations through system calls, which can significantly improve the real-time performance of message sending and shorten the time consumed in message sending.

[0036] In one embodiment, in step S4, the publishing partition and the subscribing partition read and write messages through pointers, including: the publishing partition write pointer writes from the beginning of the message slot, and after writing is completed, the write pointer remains at the last character of the message content; the subscribing partition read pointer also starts reading the message from the beginning of the message slot. When the read pointer reaches the write pointer position, the message reading is completed, and this message publishing and subscription ends.

[0037] S5. After writing and reading messages, this message publishing and subscription ends, the message slot is released, and the next message cycle is awaited.

[0038] In this step, after the communication is completed, if the communication does not continue, the partition's access attribute to the message slot is updated, and the message slot is released for use by other partitions.

[0039] The inter-partition message subscription and publishing method designed by the present invention adopts a shared memory mechanism. By authorizing partitions (publishing partitions and subscribing partitions) to control the read and write of the message space and the space mapping mechanism, the message space can be directly read and written without switching the system state. Compared with the traditional port-based inter-partition communication method, this mechanism can reduce the data copying operations between the message space and the partition application, and enhance the real-time performance of the communication. At the same time, a message subscription and publishing mechanism is used to establish a binding relationship between the partition and the message slot. By means of authorization, the access rights of the partition to the message space and the message slot are set, thereby improving the certainty of the message interaction. The mapping relationship between the partition and the message space can also be simplified by reasonably allocating the inter-partition communication message cycle and the number of messages, thereby optimizing the overhead of operating system development and testing.

[0040] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

[0041] In addition, it should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.

Claims

1. A method for subscribing and publishing messages between partitions based on shared memory, characterized in that: The following steps are involved: S1. Allocate message space to the publishing partition and subscription partition with communication needs based on a static configuration method. The message space is provided with multiple message slots, and each message slot has a unique message ID. S2. Set the authorization access attributes of the publishing partition and the subscription partition to the message space; S3. Bind the publishing partition and the subscription partition to the message slot in the message space, and set the publishing partition and subscription partition's access rights to the message slot. The publishing partition has read and write permissions to the message slot bound to it, and the subscription partition has read-only permissions to the message slot bound to it. S4. The publishing partition calls the message publishing interface service and writes the message to the message slot bound to it according to the message ID and message content, and the subscribing partition reads the message from the message slot; S5. After completing writing and reading messages in the current cycle, this message publishing and subscription ends, the message slot is released, and the next message cycle is awaited.

2. The shared memory-based inter-partition message subscription and publishing method according to claim 1, characterized in that: In step S2, the method for setting the authorized access attributes of the publishing partition and subscribing partition with communication needs to the message space is: mapping the message space to the publishing partition and subscribing partition with communication needs through the MMU mapping mechanism, and authorizing the publishing partition and subscribing partition to have access rights to the message space.

3. The shared memory-based inter-partition message subscription and publishing method according to claim 1, characterized in that: In step S4, the publishing partition and the subscribing partition read and write messages through pointers, including: The write pointer of the publishing partition is written from the beginning of the message slot. After writing is completed, the write pointer remains at the last character of the message content; The subscription partition read pointer also starts reading messages from the beginning of the message slot. When the read pointer reaches the write pointer position, the message reading is completed and the message publishing and subscription ends.

Citation Information

Patent Citations

  • Distributed storage system and data release method

    CN112235405A

  • Operating system partition memory sharing method and system

    CN114661497A