CN107678866B - Partition communication method and device based on embedded operating system - Google Patents

Partition communication method and device based on embedded operating system Download PDF

Info

Publication number
CN107678866B
CN107678866B CN201710867206.8A CN201710867206A CN107678866B CN 107678866 B CN107678866 B CN 107678866B CN 201710867206 A CN201710867206 A CN 201710867206A CN 107678866 B CN107678866 B CN 107678866B
Authority
CN
China
Prior art keywords
message
partition
identifier
operating system
embedded operating
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.)
Active
Application number
CN201710867206.8A
Other languages
Chinese (zh)
Other versions
CN107678866A (en
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.)
Kyland Technology Co Ltd
Original Assignee
Kyland Technology Co Ltd
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 Kyland Technology Co Ltd filed Critical Kyland Technology Co Ltd
Priority to CN201710867206.8A priority Critical patent/CN107678866B/en
Publication of CN107678866A publication Critical patent/CN107678866A/en
Application granted granted Critical
Publication of CN107678866B publication Critical patent/CN107678866B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Abstract

The invention relates to the technical field of embedded software, in particular to a partition communication method and device based on an embedded operating system, which are used for solving the problem of poor reliability in communication among partitions in the prior art. The embedded operating system can read the content of the message to be published in the subareas and store the content of the message in the local area, and then write the content of the message stored in the local area into the storage space of the subareas when the message subscription of the subareas is determined, so that the embedded operating system only accesses the storage space of each subarea, the subareas can be isolated from each other, and even if one of the subareas is abnormal, the interaction between other subareas and the embedded operating system can not be influenced, thereby ensuring the normal operation of other subareas and improving the reliability of the communication between the subareas.

Description

Partition communication method and device based on embedded operating system
Technical Field
The invention relates to the technical field of embedded software, in particular to a partition communication method and device based on an embedded operating system.
Background
With the rapid development of embedded software technology, in some integrated modular embedded systems, the task of running subsystems with different functions on the same processor can be realized. Each subsystem can be regarded as a partition, and each partition is used as an independent application environment and can independently run an application program. Moreover, the embedded operating system can manage each partition, which is specifically embodied as: different storage spaces are distributed for each partition, so that space isolation among the partitions is realized; and a scheduling strategy of time slice rotation is adopted, a fixed time window is allocated to each partition in a periodic scheduling process, and each partition can run under the allocated time window, so that the running time of each partition is ensured not to conflict. Therefore, the isolation of the partitions in space and time is realized, and the conflict of different partitions in the running process is avoided, so that the running reliability of the partitions is improved. However, since the partitions need to communicate with each other during the operation of the system, it is necessary to ensure that data can be exchanged between the partitions normally while ensuring spatial and temporal isolation between the partitions as much as possible.
At present, data exchange between partitions is often realized by using a shared memory, where the shared memory is understood to be a part of a storage space that can be shared by the partitions, each partition may write data into the shared memory by using the same data structure, and if one of the partitions writes data into the shared memory, it is equivalent to send the data to the other partition, and the other partition may obtain the data immediately. However, in this way, the same storage area still exists between the partitions, and when one of the partitions operates abnormally, the partition may also write data in the shared memory abnormally, for example, the shared memory is written badly, so that other partitions cannot use the shared memory normally.
Therefore, complete isolation among the partitions cannot be realized by adopting a memory sharing mode, and when one partition is abnormal in operation, the operation of other partitions can still be influenced, so that the reliability of communication among the partitions is poor.
Disclosure of Invention
The invention relates to the technical field of embedded software, in particular to a partition communication method and device based on an embedded operating system, which are used for solving the problem of poor reliability in communication among partitions in the prior art.
The technical scheme provided by the invention is as follows:
in a first aspect, a partition communication method based on an embedded operating system includes:
the embedded operating system receives a release message request which is sent by a first partition in each partition and carries a first message identifier and the first partition identifier;
the embedded operating system determines a first storage position of the message content corresponding to the first message identifier and the first partition identifier in a first partition based on a corresponding relation among pre-stored message identifiers, partition identifiers and storage positions of the message content in the partition;
the embedded operating system reads message content from a first storage position in the first partition and stores the read message content locally;
after receiving a subscription message request which is sent by a second partition of the partitions and carries a first message identifier and a second partition identifier, the embedded operating system determines a second storage position of message content corresponding to the first message identifier and the second partition identifier in the second partition based on the corresponding relationship, and writes the locally stored message content into the second storage position.
Further, before the embedded operating system receives a request for a release message carrying a first message identifier and a first partition identifier sent by a first partition in each partition, the method further includes:
the embedded operating system receives message configuration information sent by each partition, wherein the message configuration information sent by any partition in each partition comprises a partition identifier of any partition, at least one message identifier and a storage position of message content corresponding to each message identifier in any partition;
and the embedded operating system establishes a corresponding relation among the message identifier, the partition identifier and the storage position of the message content in the partition according to the received message configuration information sent by each partition.
Further, the message configuration information sent by any one of the partitions also includes the message length corresponding to each message identifier;
after the embedded operating system receives the message configuration information sent by each partition, the method further comprises:
and the embedded operating system locally allocates a corresponding storage space for the message content corresponding to each message identifier based on the message length corresponding to each message identifier in the message configuration information.
Further, before the embedded operating system receives a request for a release message carrying a first message identifier and a first partition identifier sent by a first partition in each partition, the method further includes:
the embedded operating system generates a message configuration table containing at least one message identifier and the message length corresponding to each message identifier;
the embedded operating system locally allocates a corresponding storage space for the message content corresponding to each message identifier based on the message length corresponding to each message identifier in the message configuration table;
the embedded operating system receives message configuration information sent by each partition, wherein the message configuration information sent by any partition in each partition comprises a partition identifier of any partition, at least one message identifier and a storage position of message content corresponding to each message identifier in any partition;
the embedded operating system matches at least one message identifier in the message configuration table and the message length corresponding to each message identifier with at least one message identifier in the received message configuration information sent by each partition and the message length corresponding to each message identifier;
and after the embedded operating system determines that the matching is successful, establishing a corresponding relation among the message identifier, the partition identifier and the storage position of the message content in the partition.
Further, the embedded operating system reads message content from a first storage location in the first partition and stores the read message content locally, including:
the embedded operating system acquires the release type of the message content corresponding to the first message identifier;
if the embedded operating system determines that the issue type of the message content corresponding to the first message identifier is issued by taking a first preset time as a period, reading the message content from a first storage location in the first partition and storing the read message content locally at intervals of the first preset time;
the embedded operating system writes the locally stored message content into the second storage location, including:
the embedded operating system acquires the subscription type of the message content corresponding to the first message identifier;
and if the embedded operating system determines that the subscription type of the message content corresponding to the first message identifier is subscription in a period of a second preset time length, writing the locally stored message content into the second storage position every other second preset time length.
Further, the acquiring, by the embedded operating system, the publishing type of the message content corresponding to the first message identifier specifically includes:
the embedded operating system acquires the release type of the message content corresponding to the first message identifier carried in the message release request; or
The embedded operating system acquires the release type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the release type of the message content;
the acquiring, by the embedded operating system, the subscription type of the message content corresponding to the first message identifier specifically includes:
the embedded operating system acquires the subscription type of the message content corresponding to the first message identifier carried in the subscription message request; or
And the embedded operating system acquires the subscription type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the subscription type of the message content.
In a second aspect, an embedded operating system based partitioned communication apparatus includes:
the receiving module is used for receiving a release message request which is sent by a first partition in each partition and carries a first message identifier and the first partition identifier;
the first processing module is used for determining a first storage position of the message content corresponding to the first message identifier and the first partition identifier in a first partition based on a correspondence relation among the message identifier, the partition identifier and the storage position of the message content in the partition, which is established in advance; reading message content from a first storage location in the first partition and storing the read message content locally;
and the second processing module is configured to, after the receiving module receives a subscription message request which is sent by a second partition of the partitions and carries a first message identifier and a second partition identifier, determine, based on the correspondence, a second storage location of message content in the second partition, where the message content corresponds to the first message identifier and the second partition identifier, and write the locally stored message content into the second storage location.
Further, the apparatus further comprises:
a first initial configuration module, configured to receive message configuration information sent by each partition, where the message configuration information sent by any partition in each partition includes a partition identifier of the any partition, at least one message identifier, and a storage location of a message content corresponding to each message identifier in the any partition; and establishing a corresponding relation among the message identifier, the partition identifier and the storage position of the message content in the partition according to the received message configuration information sent by each partition.
Further, the message configuration information sent by any one of the partitions also includes the message length corresponding to each message identifier;
the first initial configuration module is further to:
after the receiving module receives the message configuration information sent by each partition, allocating a corresponding storage space for the message content corresponding to each message identifier based on the message length corresponding to each message identifier in the message configuration information.
Further, the apparatus further comprises:
a second initial configuration module, configured to generate a message configuration table including at least one message identifier and a message length corresponding to each message identifier; distributing corresponding storage space for the message content corresponding to each message identifier locally based on the message length corresponding to each message identifier in the message configuration table; receiving message configuration information sent by each partition, wherein the message configuration information sent by any partition in each partition comprises a partition identifier of any partition, at least one message identifier and a storage position of message content corresponding to each message identifier in any partition; matching at least one message identifier in the message configuration table and the message length corresponding to each message identifier with at least one message identifier in the received message configuration information sent by each partition and the message length corresponding to each message identifier; and after the matching is determined to be successful, establishing a corresponding relation among the message identification, the partition identification and the storage position of the message content in the partition.
Further, the first processing module is specifically configured to:
acquiring the release type of the message content corresponding to the first message identifier;
if the issue type of the message content corresponding to the first message identifier is determined to be issued by taking a first preset time as a period, reading the message content from a first storage location in the first partition and storing the read message content locally at intervals of the first preset time;
the second processing module is specifically configured to:
obtaining the subscription type of the message content corresponding to the first message identifier;
and if the subscription type of the message content corresponding to the first message identifier is determined to be subscription with a second preset time as a period, writing the locally stored message content into the second storage position every second preset time.
Further, the first processing module is further configured to:
acquiring the publishing type of the message content corresponding to the first message identifier carried in the publishing message request; or
Acquiring the publishing type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the publishing type of the message content;
the second processing module is further configured to:
obtaining the subscription type of the message content corresponding to the first message identifier carried in the subscription message request; or
And acquiring the subscription type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the subscription type of the message content.
In a third aspect, an electronic device includes: one or more processors; and
one or more computer readable media having stored thereon a program for performing a method of embedded operating system based partition communication, wherein the program when executed by the one or more processors implements the steps of the method as described in any of the first aspects above.
In a fourth aspect, one or more computer readable media having stored thereon a program for performing a method of embedded operating system based partition communication, wherein the program, when executed by one or more processors, causes the processors to perform the method of any of the first aspects above.
The embodiment of the invention has the following beneficial effects: each partition can realize communication among the partitions by interacting with the embedded operating system, wherein if a first partition in each partition needs to issue a message, the first partition can send a message issuing request carrying a first message identifier and the first partition identifier to the embedded operating system, and then the embedded operating system can determine a storage position of the message content in the first partition as a first storage position based on a pre-established corresponding relationship among the message identifier, the partition identifier and the storage position of the message content in the partition, and further read the message content from the first storage position and store the message content locally; if a second partition in each partition needs to subscribe to the message, the second partition can send a subscription message request carrying a second message identifier and a second partition identifier to the embedded operating system, and then the embedded operating system can determine the position of the message content, which should be stored in the second partition, to be a second storage position based on the pre-established corresponding relationship, and further write the locally stored message content into the second storage position. Therefore, the embedded operating system can read the message content to be published in the partition and store the message content in the local, and write the message content stored in the local into the storage space of the partition when determining that the partition needs to subscribe the message, so that the embedded operating system only accesses the storage space of each partition, the partitions can be isolated from each other, and even if one partition is abnormal, the interaction between other partitions and the embedded operating system cannot be influenced, thereby ensuring the normal operation among other partitions and improving the reliability of the communication among the partitions.
Drawings
Fig. 1 is a flowchart of a partition communication method based on an embedded operating system according to an embodiment of the present invention;
fig. 2 is a flowchart of a message configuration process and a communication process of each partition according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of interaction between partitions and an embedded operating system in a simple embedded system according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a partition communication apparatus based on an embedded operating system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
In order to improve reliability of communication between partitions, embodiments of the present invention provide a partition communication method and apparatus based on an embedded operating system, where the embedded operating system may access a storage space of each partition, read and store message content to be published in the partition locally, and write message content stored locally and subscribed by the partition into the storage space of the partition, so as to implement data exchange between the partitions on the premise that the storage spaces of the partitions are independent from each other.
The present invention will be described below with reference to specific examples, but the present invention is not limited to the following examples.
Referring to fig. 1, a flowchart of a partition communication method based on an embedded operating system according to an embodiment of the present invention specifically includes the following steps:
step 101: the embedded operating system receives a message issuing request which is sent by a first partition in each partition and carries a first message identifier and the first partition identifier.
Step 102: the embedded operating system determines a first storage position of the message content corresponding to the first message identifier and the first partition identifier in the first partition based on the pre-established correspondence between the message identifier, the partition identifier and the storage position of the message content in the partition.
Specifically, the embedded operating system may pre-establish a correspondence between the message identifier, the partition identifier, and a storage location of the message content in the partition before receiving a publish message request carrying the first message identifier and the first partition identifier sent by a first partition in each partition, where the establishment manner of the correspondence includes the following two manners:
the first method is as follows: the embedded operating system receives the message configuration information sent by each partition, wherein the message configuration information sent by any partition in each partition comprises a partition identifier of any partition, at least one message identifier and a storage position of message content corresponding to each message identifier in any partition;
and establishing a corresponding relation among the message identifier, the partition identifier and the storage position of the message content in the partition according to the received message configuration information sent by each partition.
The second method comprises the following steps: the embedded operating system generates a message configuration table containing at least one message identifier and the message length corresponding to each message identifier;
distributing corresponding storage space for the message content corresponding to each message identifier locally based on the message length corresponding to each message identifier in the message configuration table;
receiving message configuration information sent by each partition, wherein the message configuration information sent by any partition in each partition comprises a partition identifier of any partition, at least one message identifier and a storage position of message content corresponding to each message identifier in any partition;
matching at least one message identifier in the message configuration table and the message length corresponding to each message identifier with at least one message identifier in the received message configuration information sent by each partition and the message length corresponding to each message identifier;
and after the matching is determined to be successful, establishing a corresponding relation among the message identification, the partition identification and the storage position of the message content in the partition.
Step 103: the embedded operating system reads the message content from the first storage location in the first partition and stores the read message content locally.
The embedded operating system may pre-allocate a storage space for the message content corresponding to each message identifier, and the specific allocation manner of the storage space may include the following two manners:
the first method is as follows: and distributing corresponding storage space for the message content corresponding to each message identifier locally based on the message length corresponding to each message identifier included in the received message configuration information sent by any partition in the partitions.
The second method comprises the following steps: after the embedded operating system generates a message configuration table containing at least one message identifier and the message length corresponding to each message identifier, the embedded operating system locally allocates a corresponding storage space for the message content corresponding to each message identifier based on the message length corresponding to each message identifier in the message configuration table.
Further, after the embedded operating system reads the message content from the first storage location in the first partition, the embedded operating system may write the read message content into a storage space that is allocated in advance for the message content corresponding to the first message identifier.
Step 104: after receiving a subscription message request which is sent by a second partition in each partition and carries a first message identifier and a second partition identifier, the embedded operating system determines a second storage position of message content corresponding to the first message identifier and the second partition identifier in the second partition based on a pre-established corresponding relationship, and writes the locally stored message content into the second storage position.
In the embodiment of the present invention, considering that the messages published by the partitions or the subscribed messages may be messages that need to be published or subscribed periodically, the embedded operating system may determine the publication type or the subscription type of the message content first when reading the message content from the first partition and writing the message content into the second partition.
Specifically, in step 103, when the embedded operating system reads the message content from the first partition, the publishing type of the message content corresponding to the first message identifier may be obtained; and if the embedded operating system determines that the issuing type of the message content corresponding to the first message identifier is issuing by taking the first preset time as a period, reading the message content from the first storage position in the first partition and storing the read message content locally at intervals of the first preset time.
Specifically, when the embedded operating system writes the message content into the second partition in step 104, the subscription type of the message content corresponding to the first message identifier may be obtained; and if the embedded operating system determines that the subscription type of the message content corresponding to the first message identifier is subscription with a second preset time length as a period, writing the locally stored message content into a second storage position in the second partition at intervals of the second preset time length.
In specific implementation, the embedded operating system may obtain the publishing type of the message content corresponding to the first message identifier according to the following manner:
acquiring a publishing type of message content corresponding to a first message identifier carried in a publishing message request sent by a first partition; or
And acquiring the publishing type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the publishing type of the message content.
The embedded operating system can acquire the subscription type of the message content corresponding to the first message identifier according to the following modes:
acquiring a subscription type of message content corresponding to a first message identifier carried in a subscription message request sent by a second partition; or
And acquiring the subscription type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the subscription type of the message content.
Here, the embedded operating system may record a correspondence between the message identifier and a publish type or a subscribe type of the message content when establishing a correspondence between the message identifier, the partition identifier, and a storage location of the message content in the partition. The publishing type or the subscription type of the message content can be carried in the message configuration information sent by each partition and reported to the embedded operating system, and can also be determined by the embedded operating system when generating a message configuration table.
It should be noted that, in the description of the embodiments of the present invention, the terms "first", "second", and the like are used for distinguishing between the description and the drawings, and are not to be construed as indicating or implying any relative importance or order.
Moreover, there may be one or only one message publisher for a message to be published, that is, in the embodiment of the present invention, the embedded operating system receives a published message request carrying a first message identifier and a first partition identifier sent by a first partition, where the first partition may refer to any one of the partitions; for a message to be subscribed, there may be multiple message subscribers, that is, in the embodiment of the present invention, a subscription message request carrying a first message identifier and a second identifier sent by a second partition in each partition is received, where the second partition may refer to at least one partition except for the first partition in each partition.
Referring to fig. 2, a message configuration procedure and each partition communication procedure in the present invention are described in detail, but the embodiment of the present invention is not limited to this embodiment. The specific implementation process is as follows:
step 201: the embedded operating system generates a message configuration table in the initialization process.
Specifically, the information related to the messages that may be published or subscribed during communication of each partition, which is input by software staff according to the system configuration condition, may be received to generate a message configuration table.
The message configuration table comprises message identifiers, physical meanings corresponding to the message identifiers, message lengths, message types and other information. The message length refers to a storage space occupied by message content corresponding to the message identifier, the message type includes a publication type or a subscription type, the publication type includes periodic publication or non-periodic publication, and the subscription type includes periodic subscription or non-periodic subscription. If the publishing type is periodic publishing or the subscribing type is periodic subscribing, the message is a periodic message, and if the publishing type is non-periodic publishing or the subscribing type is non-periodic subscribing, the message is an event message. For periodic messages, the messages can be released or subscribed in a periodic cycle with a certain preset duration; for event type messages, only one publication or subscription is required.
Step 202: the embedded operating system allocates storage space for each message recorded in the message configuration table.
And allocating storage space for the message content corresponding to each message identifier according to the message length corresponding to each message identifier. The allocated storage space may be greater than or equal to the message length.
Step 203: and each partition sends message configuration information to the embedded operating system in the initialization process.
Specifically, for any partition in the partitions, the message configuration information of the message to be published may be sent to the embedded operating system by calling an Application Program Interface (API) Interface for message publishing initialization provided by the embedded operating system, and the message configuration information of the message to be subscribed may also be sent to the embedded operating system by calling an API Interface for message subscription initialization provided by the embedded operating system.
The message configuration information may include partition identifiers of any partition, at least one message identifier, and information such as a storage location of a message content corresponding to each message identifier in any partition. Of course, the message configuration information may also include a message length, a message type, and the like, which is not limited in this application.
Step 204: and the embedded operating system matches the related information recorded in the generated message configuration table with the received message configuration information sent by each partition, and establishes a corresponding relation among the message identifier, the partition identifier and the storage position of the message content in the partition after the matching is determined to be successful.
The matching aims at verifying whether the information recorded in the message configuration table generated in the embedded operating system is consistent with the message configuration information sent by each partition so as to ensure the reliability of the system operation. Specifically, whether the message identifier in the message configuration table is consistent with the message identifier carried in the message configuration information sent by each partition, whether the message length corresponding to each message identifier in the message configuration table is consistent with the message length corresponding to each message identifier carried in the message configuration information sent by each partition, and the like can be verified. If the message configuration table and the message configuration information sent by each partition all carry the message type of the message content corresponding to each message identifier, whether the message types recorded by the message configuration table and the message configuration information recorded by the partition are consistent or not can be verified.
In specific implementation, if the information recorded in the message configuration table is determined to be inconsistent with the message configuration information sent by each partition, the message configuration in the partition and the embedded operating system can be determined to be inconsistent, and the embedded operating system can perform error reporting processing to inform software workers that the system configuration is abnormal.
Naturally, in specific implementation, the above matching process may be omitted, and accordingly, the embedded operating system may not generate the message configuration table, and may establish the correspondence between the message identifier, the partition identifier, and the storage location of the message content in the partition according to the message configuration information sent by each partition. In addition, the embedded operating system does not need to allocate a fixed storage space for the message corresponding to each message identifier, and only needs to reserve enough storage space for storing the message content communicated among the partitions.
Step 205: when each partition operates according to the set scheduling policy, the embedded operating system can receive a message issuing request which is sent by a first partition in each partition and carries a first message identifier and the first partition identifier.
Here, the publish message request may also carry a publish type of the message content corresponding to the first message identifier. The publication types may include periodic or non-periodic publications. If the release type is periodic release, the message is a periodic message, and if the release type is non-periodic release, the message is an event message. And if the issue type is periodic issue, the issue message request may also carry a specific issue period, for example, issue with a first preset duration as a period.
Step 206: the embedded operating system determines a first storage position of the message content corresponding to the first message identifier and the first partition identifier in the first partition based on the pre-established correspondence between the message identifier, the partition identifier and the storage position of the message content in the partition.
Step 207: and the embedded operating system reads the message content from the first storage position in the first partition and writes the read message content into a third storage position which is distributed for the message content corresponding to the first message identifier in advance.
If the release type of the message content is determined to be that the message content is released by taking a first preset time as a period, the message content is read from a first storage position in the first partition and is stored locally every other first preset time.
Step 208: and the embedded operating system receives a subscription message request which is sent by a second partition in each partition and carries the first message identifier and the second partition identifier.
Here, the subscription message request may also carry a subscription type of the message content corresponding to the first message identifier. The subscription type may include a periodic subscription or a non-periodic subscription. If the subscription type is periodic subscription, the subscription message request may also carry a specific subscription period, for example, subscription is performed with a second preset duration as a period.
Step 209: and the embedded operating system determines a second storage position of the message content corresponding to the first message identifier and the second partition identifier in the second partition based on the pre-established corresponding relation.
Step 210: the embedded operating system writes the message content stored in the local third storage location to a second storage location in the second partition.
And if the subscription type of the message content is determined to be subscription with a second preset time as a period, writing the locally stored message content into a second storage position every second preset time.
According to the embodiment, the embedded operating system can read the message content to be published in the partition and store the message content in the local, and the message content stored in the local is written into the storage space of the partition when the partition is determined to need to subscribe the message, so that the storage space of each partition is accessed only by the embedded operating system, the partitions can be isolated from each other, and even if one partition is abnormal, the interaction between other partitions and the embedded operating system cannot be influenced, thereby ensuring the normal operation among other partitions and improving the reliability of the communication among the partitions.
In order to facilitate understanding of the embodiments of the present invention, a specific application scenario is listed to further describe the partition communication method provided by the embodiments of the present invention in detail.
With the development of comprehensive modularization of the embedded system, the requirements on the reliability and the safety of the software system are higher and higher, so that the partition corresponding to each subsystem in the embedded system can be accessed through the embedded operating system by adopting the embodiment of the application, and the data exchange among the partitions is realized.
First, reference may be made to the schematic diagram of the interaction of each partition with the embedded operating system in a simple embedded system as shown in fig. 3, which may include an input partition (partition 1), a system management partition (partition 2), a control partition (partition 3), and an output partition (partition 4). The input partition is mainly used for collecting various data (message identification 1) in an external environment, such as temperature data, air pressure data and the like, the system management partition is mainly used for voting monitoring and the like on the collected data to obtain effective data (message identification 2), the control partition is mainly used for calculating the effective data based on a control algorithm to obtain control command data (message identification 3), and the output partition is mainly used for outputting the control command data.
Wherein, each partition can be respectively provided with a cache for storing the data to be published and a cache for storing the data to be subscribed. The embedded operating system can be provided with a data pool for storing data communicated among the partitions.
In the partition initialization stage, the partition 1 needs to release the acquired data, so that the partition 1 sends message configuration information carrying the message identifier 1, the partition identifier 1 and the storage location 1 of the message content in the partition 1 to the embedded operating system, which can be simply expressed as [ message identifier 1, partition 1 and storage location 1 ]; the partition 2 needs to subscribe the acquired data and publish valid data, so the message configuration information sent by the partition 2 to the embedded operating system is as follows: [ message identifier 1, partition 2, storage location 2], [ message identifier 2, partition 2, storage location 3 ]; the partition 3 needs to subscribe valid data and issue control command data, so the message configuration information sent by the partition 3 to the embedded operating system is as follows: [ message identifier 2, partition 3, storage location 4], [ message identifier 3, partition 3, storage location 5 ]; the partition 3 needs to subscribe to the control command data, so the message configuration information sent by the partition 4 to the embedded operating system is as follows: [ message identification 3, partition 4, storage location 6 ].
For the messages needing to be published, each partition can call the message publishing initialization API interface of the embedded operating system to send the message configuration information of the messages needing to be published to the embedded operating system, and for the messages needing to be subscribed, each partition can call the message subscribing initialization API interface of the embedded operating system to send the message configuration information of the messages needing to be subscribed to the embedded operating system.
After receiving the message configuration information sent by each partition, the embedded operating system may establish a corresponding relationship between the message identifier, the partition identifier, and the storage location, which may specifically refer to table 1:
TABLE 1
Figure BDA0001416376270000161
Here, the embedded operating system may record other configuration information in addition to the correspondence between the message identifier, the partition identifier, and the storage location. For example, a "publish" or "subscribe" tag may be set for each message identifier by determining the type of interface when receiving the message configuration information, such as a message publishing initialization interface or a message subscription initialization interface; for another example, the message configuration information sent by each partition may further include a message length and a message type, so that the embedded operating system may correspondingly record information such as the message length and the message type corresponding to each message identifier.
Therefore, the configuration of message publishing and subscribing can be completed in the embedded operating system and the initialization stage of each partition.
When each partition operates according to a set scheduling policy, if an embedded operating system receives a message issuing request which carries a message identifier 1 and a partition identifier 1 and is sent by the partition 1, the embedded operating system can acquire the message content 1 from the storage position 1 of the partition 1 and store the message content in the local. Further, if receiving a message subscription request carrying the message identifier 1 and the partition identifier 2 sent by the partition 2, the embedded operating system may write the locally stored message content 1 into the storage location 2 of the partition 2, thereby implementing data exchange between the partition 1 and the partition 2. For the data exchange between the partition 2 and the partition 3, and between the partition 3 and the partition 4 shown in fig. 3, the above-mentioned flow may also be referred to, and details are not repeated here.
Based on the same inventive concept, the embodiment of the present invention further provides a partition communication device based on an embedded operating system, which corresponds to the partition communication method based on an embedded operating system.
Referring to fig. 4, a schematic structural diagram of a partition communication device based on an embedded operating system according to an embodiment of the present invention includes:
a receiving module 41, configured to receive a request for a release message, which is sent by a first partition of the partitions and carries a first message identifier and a first partition identifier;
a first processing module 42, configured to determine, based on a correspondence relationship between a pre-established message identifier, a partition identifier, and a storage location of a message content in a partition, a first storage location of the message content in a first partition, where the message content corresponds to the first message identifier and the first partition identifier; reading message content from a first storage location in the first partition and storing the read message content locally;
a second processing module 43, configured to, after the receiving module receives a subscription message request that is sent by a second partition of the partitions and carries a first message identifier and a second partition identifier, determine, based on the correspondence, a second storage location of a message content in the second partition, where the message content corresponds to the first message identifier and the second partition identifier, and write a locally stored message content in the second storage location.
Further, the apparatus further comprises:
a first initial configuration module 44, configured to receive message configuration information sent by each partition, where the message configuration information sent by any partition in each partition includes a partition identifier of the any partition, at least one message identifier, and a storage location of a message content corresponding to each message identifier in the any partition; and establishing a corresponding relation among the message identifier, the partition identifier and the storage position of the message content in the partition according to the received message configuration information sent by each partition.
Further, the message configuration information sent by any one of the partitions also includes the message length corresponding to each message identifier;
the first initial configuration module 44 is further configured to:
after the receiving module receives the message configuration information sent by each partition, allocating a corresponding storage space for the message content corresponding to each message identifier based on the message length corresponding to each message identifier in the message configuration information.
Further, the apparatus further comprises:
a second initial configuration module 45, configured to generate a message configuration table including at least one message identifier and a message length corresponding to each message identifier; distributing corresponding storage space for the message content corresponding to each message identifier locally based on the message length corresponding to each message identifier in the message configuration table; receiving message configuration information sent by each partition, wherein the message configuration information sent by any partition in each partition comprises a partition identifier of any partition, at least one message identifier and a storage position of message content corresponding to each message identifier in any partition; matching at least one message identifier in the message configuration table and the message length corresponding to each message identifier with at least one message identifier in the received message configuration information sent by each partition and the message length corresponding to each message identifier; and after the matching is determined to be successful, establishing a corresponding relation among the message identification, the partition identification and the storage position of the message content in the partition.
Further, the first processing module 41 is specifically configured to:
acquiring the release type of the message content corresponding to the first message identifier;
if the issue type of the message content corresponding to the first message identifier is determined to be issued by taking a first preset time as a period, reading the message content from a first storage location in the first partition and storing the read message content locally at intervals of the first preset time;
the second processing module 42 is specifically configured to:
obtaining the subscription type of the message content corresponding to the first message identifier;
and if the subscription type of the message content corresponding to the first message identifier is determined to be subscription with a second preset time as a period, writing the locally stored message content into the second storage position every second preset time.
Further, the first processing module 41 is further configured to:
acquiring the publishing type of the message content corresponding to the first message identifier carried in the publishing message request; or
Acquiring the publishing type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the publishing type of the message content;
the second processing module 42 is further configured to:
obtaining the subscription type of the message content corresponding to the first message identifier carried in the subscription message request; or
And acquiring the subscription type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the subscription type of the message content.
An embodiment of the present invention further provides an electronic device, including: one or more processors; and
one or more computer-readable media having stored thereon a program for performing a method for partition communication based on an embedded operating system, wherein the program, when executed by the one or more processors, performs the steps of a method for partition communication based on an embedded operating system as recited in any of the method embodiments above.
Embodiments of the present invention also provide one or more computer-readable media, on which programs for executing the method for partition communication based on an embedded operating system are stored, wherein when executed by one or more processors, the programs cause the processors to execute the method for partition communication based on an embedded operating system as described in any of the above method embodiments.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (12)

1. A partition communication method based on an embedded operating system is characterized by comprising the following steps:
the embedded operating system receives a release message request which is sent by a first partition in each partition and carries a first message identifier and the first partition identifier;
the embedded operating system determines a first storage position of the message content corresponding to the first message identifier and the first partition identifier in a first partition based on a corresponding relation among pre-stored message identifiers, partition identifiers and storage positions of the message content in the partition;
the embedded operating system reads message content from a first storage position in the first partition and stores the read message content locally;
after receiving a subscription message request which is sent by a second partition of the partitions and carries a first message identifier and a second partition identifier, the embedded operating system determines a second storage position of message content corresponding to the first message identifier and the second partition identifier in the second partition based on the corresponding relationship, and writes the locally stored message content into the second storage position.
2. The method of claim 1, wherein before the embedded operating system receives a request for a publish message carrying a first message identifier and a first partition identifier sent by a first partition of the partitions, the method further comprises:
the embedded operating system receives message configuration information sent by each partition, wherein the message configuration information sent by any partition in each partition comprises a partition identifier of any partition, at least one message identifier and a storage position of message content corresponding to each message identifier in any partition;
and the embedded operating system establishes a corresponding relation among the message identifier, the partition identifier and the storage position of the message content in the partition according to the received message configuration information sent by each partition.
3. The method of claim 2, wherein the message configuration information sent by any one of the partitions further includes a message length corresponding to each message identifier;
after the embedded operating system receives the message configuration information sent by each partition, the method further comprises:
and the embedded operating system locally allocates a corresponding storage space for the message content corresponding to each message identifier based on the message length corresponding to each message identifier in the message configuration information.
4. The method of claim 1, wherein before the embedded operating system receives a request for a publish message carrying a first message identifier and a first partition identifier sent by a first partition of the partitions, the method further comprises:
the embedded operating system generates a message configuration table containing at least one message identifier and the message length corresponding to each message identifier;
the embedded operating system locally allocates a corresponding storage space for the message content corresponding to each message identifier based on the message length corresponding to each message identifier in the message configuration table;
the embedded operating system receives message configuration information sent by each partition, wherein the message configuration information sent by any partition in each partition comprises a partition identifier of any partition, at least one message identifier and a storage position of message content corresponding to each message identifier in any partition;
the embedded operating system matches at least one message identifier in the message configuration table and the message length corresponding to each message identifier with at least one message identifier in the received message configuration information sent by each partition and the message length corresponding to each message identifier;
and after the embedded operating system determines that the matching is successful, establishing a corresponding relation among the message identifier, the partition identifier and the storage position of the message content in the partition.
5. The method of claim 1, wherein the embedded operating system reading message content from a first storage location in the first partition and storing the read message content locally comprises:
the embedded operating system acquires the release type of the message content corresponding to the first message identifier;
if the embedded operating system determines that the issue type of the message content corresponding to the first message identifier is issued by taking a first preset time as a period, reading the message content from a first storage location in the first partition and storing the read message content locally at intervals of the first preset time;
the embedded operating system writes the locally stored message content into the second storage location, including:
the embedded operating system acquires the subscription type of the message content corresponding to the first message identifier;
and if the embedded operating system determines that the subscription type of the message content corresponding to the first message identifier is subscription in a period of a second preset time length, writing the locally stored message content into the second storage position every other second preset time length.
6. The method of claim 5, wherein the acquiring, by the embedded operating system, the publication type of the message content corresponding to the first message identifier specifically includes:
the embedded operating system acquires the release type of the message content corresponding to the first message identifier carried in the message release request; or
The embedded operating system acquires the release type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the release type of the message content;
the acquiring, by the embedded operating system, the subscription type of the message content corresponding to the first message identifier specifically includes:
the embedded operating system acquires the subscription type of the message content corresponding to the first message identifier carried in the subscription message request; or
And the embedded operating system acquires the subscription type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the subscription type of the message content.
7. An embedded operating system based partitioned communication apparatus, the apparatus comprising:
the receiving module is used for receiving a release message request which is sent by a first partition in each partition and carries a first message identifier and the first partition identifier;
the first processing module is used for determining a first storage position of the message content corresponding to the first message identifier and the first partition identifier in a first partition based on a correspondence relation among the message identifier, the partition identifier and the storage position of the message content in the partition, which is established in advance; reading message content from a first storage location in the first partition and storing the read message content locally;
and the second processing module is configured to, after the receiving module receives a subscription message request which is sent by a second partition of the partitions and carries a first message identifier and a second partition identifier, determine, based on the correspondence, a second storage location of message content in the second partition, where the message content corresponds to the first message identifier and the second partition identifier, and write the locally stored message content into the second storage location.
8. The apparatus of claim 7, wherein the apparatus further comprises:
a first initial configuration module, configured to receive message configuration information sent by each partition, where the message configuration information sent by any partition in each partition includes a partition identifier of the any partition, at least one message identifier, and a storage location of a message content corresponding to each message identifier in the any partition; establishing a corresponding relation among the message identification, the partition identification and the storage position of the message content in the partition according to the received message configuration information sent by each partition;
the message configuration information sent by any one of the partitions further includes the message length corresponding to each message identifier;
the first initial configuration module is further to:
after the receiving module receives the message configuration information sent by each partition, allocating a corresponding storage space for the message content corresponding to each message identifier based on the message length corresponding to each message identifier in the message configuration information.
9. The apparatus of claim 7, wherein the apparatus further comprises:
a second initial configuration module, configured to generate a message configuration table including at least one message identifier and a message length corresponding to each message identifier; distributing corresponding storage space for the message content corresponding to each message identifier locally based on the message length corresponding to each message identifier in the message configuration table; receiving message configuration information sent by each partition, wherein the message configuration information sent by any partition in each partition comprises a partition identifier of any partition, at least one message identifier and a storage position of message content corresponding to each message identifier in any partition; matching at least one message identifier in the message configuration table and the message length corresponding to each message identifier with at least one message identifier in the received message configuration information sent by each partition and the message length corresponding to each message identifier; and after the matching is determined to be successful, establishing a corresponding relation among the message identification, the partition identification and the storage position of the message content in the partition.
10. The apparatus of claim 7, wherein the first processing module is specifically configured to:
acquiring the release type of the message content corresponding to the first message identifier;
if the issue type of the message content corresponding to the first message identifier is determined to be issued by taking a first preset time as a period, reading the message content from a first storage location in the first partition and storing the read message content locally at intervals of the first preset time;
the second processing module is specifically configured to:
obtaining the subscription type of the message content corresponding to the first message identifier;
if the subscription type of the message content corresponding to the first message identifier is determined to be subscription with a second preset time as a period, writing the locally stored message content into the second storage position every second preset time;
the first processing module is further configured to:
acquiring the publishing type of the message content corresponding to the first message identifier carried in the publishing message request; or
Acquiring the publishing type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the publishing type of the message content;
the second processing module is further configured to:
obtaining the subscription type of the message content corresponding to the first message identifier carried in the subscription message request; or
And acquiring the subscription type of the message content corresponding to the first message identifier according to the corresponding relation between the pre-stored message identifier and the subscription type of the message content.
11. An electronic device, comprising: one or more processors; and
one or more computer-readable media having stored thereon a program for performing a method of embedded operating system based partition communication, wherein the program, when executed by the one or more processors, performs the steps of the method of any of claims 1-6.
12. One or more computer-readable media having stored thereon a program for performing a method for embedded operating system based partition communication, wherein the program, when executed by one or more processors, causes the processors to perform the method of any of claims 1-6.
CN201710867206.8A 2017-09-22 2017-09-22 Partition communication method and device based on embedded operating system Active CN107678866B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710867206.8A CN107678866B (en) 2017-09-22 2017-09-22 Partition communication method and device based on embedded operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710867206.8A CN107678866B (en) 2017-09-22 2017-09-22 Partition communication method and device based on embedded operating system

Publications (2)

Publication Number Publication Date
CN107678866A CN107678866A (en) 2018-02-09
CN107678866B true CN107678866B (en) 2020-02-21

Family

ID=61137892

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710867206.8A Active CN107678866B (en) 2017-09-22 2017-09-22 Partition communication method and device based on embedded operating system

Country Status (1)

Country Link
CN (1) CN107678866B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114297109A (en) * 2021-12-28 2022-04-08 中汽创智科技有限公司 Data processing method and device based on subscription and publishing mode, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127685A (en) * 2007-09-20 2008-02-20 中兴通讯股份有限公司 An inter-process communication device and inter-process communication method
CN101467130A (en) * 2006-06-12 2009-06-24 惠普开发有限公司 Sharing data between partitions in a partitionable system
CN101770508A (en) * 2009-12-29 2010-07-07 中兴通讯股份有限公司 Data access method in mobile communication terminal and equipment thereof
CN106230922A (en) * 2016-07-28 2016-12-14 上海斐讯数据通信技术有限公司 A kind of news subscribing method, message production unit and message reception units
CN106375462A (en) * 2016-09-13 2017-02-01 北京百度网讯科技有限公司 Method and device for realizing message persistence in distributed message system
CN106603711A (en) * 2016-12-30 2017-04-26 上海擎感智能科技有限公司 Communication method and system and message server

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080141280A1 (en) * 2006-12-04 2008-06-12 Bea Systems, Inc. Method for handling communication without centralized component within a fully distributed network

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101467130A (en) * 2006-06-12 2009-06-24 惠普开发有限公司 Sharing data between partitions in a partitionable system
CN101127685A (en) * 2007-09-20 2008-02-20 中兴通讯股份有限公司 An inter-process communication device and inter-process communication method
CN101770508A (en) * 2009-12-29 2010-07-07 中兴通讯股份有限公司 Data access method in mobile communication terminal and equipment thereof
CN106230922A (en) * 2016-07-28 2016-12-14 上海斐讯数据通信技术有限公司 A kind of news subscribing method, message production unit and message reception units
CN106375462A (en) * 2016-09-13 2017-02-01 北京百度网讯科技有限公司 Method and device for realizing message persistence in distributed message system
CN106603711A (en) * 2016-12-30 2017-04-26 上海擎感智能科技有限公司 Communication method and system and message server

Also Published As

Publication number Publication date
CN107678866A (en) 2018-02-09

Similar Documents

Publication Publication Date Title
CN110941481A (en) Resource scheduling method, device and system
CN113037794B (en) Method, device and system for computing resource allocation scheduling
EP2998862A1 (en) Method, device, and system for memory management
CN106385377B (en) Information processing method and system
US20180188990A1 (en) Method, apparatus and system for inserting disk
CN103049328A (en) Distribution method of internal memory resources in computer system
CN111694658A (en) CPU resource allocation method, device, electronic equipment and storage medium
US20170286140A1 (en) Java-based offload service in a mainframe environment
CN113794764A (en) Request processing method and medium for server cluster and electronic device
CN115576716A (en) Memory management method based on multiple processes
CN115629882A (en) Method for managing memory in multiple processes
CN105677481B (en) A kind of data processing method, system and electronic equipment
CN107678866B (en) Partition communication method and device based on embedded operating system
CN103197950B (en) Plug-in virtual machine implementation method
CN107967305A (en) Image file upload method, server and readable storage medium storing program for executing
CN109324764B (en) Method and device for realizing distributed exclusive lock
CN116860391A (en) GPU computing power resource scheduling method, device, equipment and medium
CN103488606A (en) Node controller based request response method and device
CN110879748A (en) Shared resource allocation method, device and equipment
CN105512091A (en) Memory allocation method and device
US20130014123A1 (en) Determination of running status of logical processor
KR101227885B1 (en) Channel multiplexing method and apparatus in shared memory
CN110839068B (en) Service request processing method and device, electronic equipment and readable storage medium
CN109634721B (en) Method and related device for starting communication between virtual machine and host
CN108073453B (en) Method and device for scheduling CPU (Central processing Unit) resources in distributed cluster

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
GR01 Patent grant
GR01 Patent grant
EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20180209

Assignee: Kedong (Guangzhou) Software Technology Co., Ltd

Assignor: Beijing Dongtu Technology Co., Ltd.|Beijing keyin Jingcheng Technology Co., Ltd

Contract record no.: X2020980000255

Denomination of invention: Embedded operation system-based partition communication method and apparatus

License type: Exclusive License

Record date: 20200218