Interaction method and device for real-time operating system and non-real-time operating system of multi-core processor
By employing interrupt triggering and shared memory in heterogeneous multi-core processor systems, efficient and low-latency communication between real-time and non-real-time operating systems is achieved, solving system performance and reliability issues. This method is suitable for interaction between real-time and non-real-time operating systems on multi-core processors.
Patent Information
- Application Number
- CN202511610080.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-05
- Publication Date
- 2026-03-17
Smart Images

Figure CN121680968A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of embedded operating systems and multi-core processors, and in particular to a method and apparatus for interaction between real-time and non-real-time operating systems on a multi-core processor. Background Technology
[0002] As the complexity of embedded systems increases, asymmetric multiprocessing (AMP) has become widely used due to its ability to balance general-purpose processing power with real-time performance for specific tasks. In this architecture, one or more general-purpose processor cores typically run a fully functional non-real-time operating system (such as Linux) to provide a rich software ecosystem and flexibility; simultaneously, dedicated processor cores run a real-time operating system (RTOS) or bare-metal programs to ensure hard real-time performance for critical tasks.
[0003] However, in such heterogeneous systems environments, achieving efficient, low-latency, and deterministic communication between two independent operating systems becomes a technical challenge. Existing technologies often focus only on establishing static communication channels, lacking overall optimization of dynamic interaction processes, resulting in the system's performance and reliability not being fully realized. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide a method and apparatus for interaction between real-time and non-real-time operating systems of multi-core processors, which can effectively resolve the contradiction between software flexibility and system real-time performance.
[0005] The technical solution adopted by this invention to solve its technical problem is: to provide an interaction method between a real-time and a non-real-time operating system for a multi-core processor, applied to a non-real-time operating system, comprising the following steps:
[0006] In response to a real-time task request sent by the task sender, the daemon process calls the task interface to write the real-time task request and related data to a specified location in the shared memory area.
[0007] Trigger an inter-core interrupt to notify the real-time operating system;
[0008] In response to a reverse inter-kernel interrupt triggered by the real-time operating system, the daemon process reads the result data obtained by the real-time operating system after processing the real-time task request from the shared memory area, and returns the result data to the task sending end.
[0009] The method for interaction between real-time and non-real-time operating systems in a multi-core processor also includes a non-real-time operating system initialization step, specifically:
[0010] The memory address space is divided into a real-time operating system runtime space and a shared memory area;
[0011] Load and start the daemon process, which is responsible for loading and monitoring the subsequent real-time operating system;
[0012] Configure an inter-core interrupt controller to establish an interrupt channel with the processor core where the real-time operating system resides.
[0013] The interaction method between the real-time and non-real-time operating systems of the multi-core processor also includes a real-time operating system loading step, specifically:
[0014] The daemon process writes the executable file of the real-time operating system into the runtime space of the real-time operating system;
[0015] The daemon sends a startup command to the processor core where the real-time operating system resides through the remote driver module, and configures the hardware peripheral resources that the real-time operating system can access.
[0016] The technical solution adopted by this invention to solve its technical problem is: to provide an interaction method between a real-time and a non-real-time operating system for a multi-core processor, applied to a real-time operating system, comprising the following steps:
[0017] In response to an inter-core interrupt triggered by a non-real-time operating system, the message engine reads real-time task requests and related data from the shared memory area and sends the real-time task requests and related data to the real-time task scheduler for real-time task execution.
[0018] After the real-time task scheduler completes the task, it writes the result data into the response area of the shared memory area.
[0019] Trigger a reverse inter-core interrupt to notify the non-real-time operating system.
[0020] The shared memory area is allocated by the non-real-time operating system within its own memory address space during initialization.
[0021] The method for interaction between real-time and non-real-time operating systems on a multi-core processor also includes a real-time operating system startup step, specifically:
[0022] Retrieve the startup command sent by the non-real-time operating system;
[0023] Initialize the message engine and monitor messages from the non-real-time operating system in the shared memory area through the message engine.
[0024] The technical solution adopted by this invention to solve its technical problem is: to provide an interaction device between a multi-core processor's real-time and non-real-time operating system, applied to a non-real-time operating system, comprising:
[0025] The real-time task request and response module is used to respond to real-time task requests sent by the task sender. The daemon process calls the task interface to write the real-time task request and related data to a specified location in the shared memory area.
[0026] The first triggering module is used to trigger inter-core interrupts and notify the real-time operating system.
[0027] The reverse inter-core interrupt response module is used to respond to the reverse inter-core interrupt triggered by the real-time operating system. The daemon process reads the result data obtained by the real-time operating system after processing the real-time task request from the shared memory area and returns the result data to the task sending end.
[0028] The interaction device between the multi-core processor's real-time and non-real-time operating systems further includes an initialization module, which comprises:
[0029] A partitioning unit is used to divide the memory address space into a real-time operating system runtime space and a shared memory area;
[0030] The loading and startup unit is used to load and start the daemon process, which is responsible for loading and monitoring the subsequent real-time operating system.
[0031] The configuration unit is used to configure the inter-core interrupt controller and establish an interrupt channel with the processor core where the real-time operating system is located.
[0032] The aforementioned multi-core processor real-time and non-real-time operating system interaction device further includes a real-time operating system loading module, which includes:
[0033] An executable file writing unit is used to write the executable file of the real-time operating system into the running space of the real-time operating system using a daemon process;
[0034] The startup configuration unit is used to send a startup command to the processor core where the real-time operating system resides via a remote driver module using a daemon process, and to configure the hardware peripheral resources that the real-time operating system can access.
[0035] The technical solution adopted by this invention to solve its technical problem is: to provide an interaction device between a real-time and non-real-time operating system for a multi-core processor, applied to a real-time operating system, comprising:
[0036] The inter-core interrupt response module is used to respond to inter-core interrupts triggered by non-real-time operating systems. It reads real-time task requests and related data from the shared memory area through the message engine and sends the real-time task requests and related data to the real-time task scheduler for real-time task execution.
[0037] The result data writing module is used to write the obtained result data into the response area of the shared memory area after the real-time task scheduler has completed the task.
[0038] The second trigger module is used to trigger a reverse inter-core interrupt to notify the non-real-time operating system.
[0039] The shared memory area is allocated by the non-real-time operating system within its own memory address space during initialization.
[0040] The aforementioned interaction device between a multi-core processor's real-time and non-real-time operating system further includes a startup module, which comprises:
[0041] The acquisition unit is used to acquire the startup command sent by the non-real-time operating system;
[0042] The monitoring unit is used to initialize the message engine and monitor messages from the non-real-time operating system in the shared memory area through the message engine.
[0043] The technical solution adopted by the present invention to solve its technical problem is: to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-mentioned interaction method between a multi-core processor and a non-real-time operating system.
[0044] The technical solution adopted by the present invention to solve its technical problem is: to provide a computer-readable storage medium on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the above-mentioned interaction method between a multi-core processor and a non-real-time operating system.
[0045] Beneficial effects
[0046] Due to the adoption of the above technical solution, the present invention has the following advantages and positive effects compared with the prior art: The present invention uses the "interrupt trigger + shared memory" method for interaction, which has low overhead and low message transmission latency, fully meeting the response requirements of real-time tasks. The main operating system (i.e., non-real-time operating system) and the real-time operating system interact through a predefined message interface, which has high independence from each other and is easy to extend to a scenario of one master and multiple slaves (multiple real-time operating systems). Attached Figure Description
[0047] Figure 1 This is a flowchart of the interaction method between a real-time and non-real-time operating system for a multi-core processor according to the first embodiment of the present invention. Detailed Implementation
[0048] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.
[0049] The first embodiment of the present invention relates to an interaction method between a real-time and a non-real-time operating system on a multi-core processor. This method covers the entire process of dual-system collaborative operation, from system startup initialization to runtime task requests and responses, and specifically includes:
[0050] (1) Non-real-time operating system initialization and resource reservation:
[0051] 1) First, start the non-real-time operating system and divide the memory address space of the non-real-time operating system into the running space of the real-time operating system and the shared memory area;
[0052] 2) The non-real-time operating system loads and starts a daemon process, which is responsible for loading and monitoring the subsequent real-time operating system;
[0053] 3) Configure the inter-core interrupt controller for the non-real-time operating system to establish an interrupt channel with the processor core where the real-time operating system resides.
[0054] (2) Loading and starting of real-time operating system
[0055] 1) The daemon process on the main real-time operating system writes the executable file of the real-time operating system into the real-time operating system's runtime space;
[0056] 2) The daemon process on the main real-time operating system sends a startup command to the processor core where the real-time operating system resides through the remote driver module, and configures the hardware peripheral resources that the real-time operating system can access.
[0057] 3) After receiving the startup command from the non-real-time operating system, the real-time operating system starts the real-time operating system;
[0058] 4) The real-time operating system initializes the message engine and monitors messages from the non-real-time operating system in the shared memory area through the message engine.
[0059] (3) Runtime task request and response interaction, see Figure 1 Specifically, it includes:
[0060] 1) Task dispatch: When a task sender (e.g., an application) on a non-real-time operating system needs to perform real-time task processing, the task sender will send a real-time task request to the non-real-time operating system. In response to the real-time task request, the non-real-time operating system will have its daemon process call the task interface to write the real-time task request and related data to a specified location in the shared memory area. After completion, an inter-core interrupt will be triggered to notify the real-time operating system.
[0061] 2) Task processing: After receiving the inter-core interrupt, the real-time operating system responds to the inter-core interrupt by reading the real-time task request and related data from the shared memory area through the message engine, and sends the real-time task request and related data to the real-time task scheduler, which then executes the real-time task.
[0062] 3) Result return: After the real-time task scheduler completes the task, it obtains the result data, which is written to the response area of the shared memory area. The message engine of the real-time operating system triggers a reverse inter-core interrupt to notify the non-real-time operating system.
[0063] 4) Result reception: After receiving the reverse inter-core interrupt, the non-real-time operating system responds to the reverse inter-core interrupt. The daemon process reads the result data obtained by the real-time operating system after processing the real-time task request from the shared memory area and returns the result data to the task sender.
[0064] The above process achieves decoupled and efficient interaction between the two systems. The entire process uses interrupts as synchronization signals and shared memory as the data carrier, ensuring timely communication with low overhead. Furthermore, hardware resources are uniformly managed by the main operating system and dynamically allocated to the real-time operating system, avoiding resource access conflicts. This process clearly defines each step from system startup to runtime interaction, reducing uncertainty and improving the overall stability of the system.
[0065] The present invention is further illustrated below with a specific embodiment. This embodiment employs the method of this implementation in an embedded network gateway device. The embedded network gateway device uses a dual-core asymmetric processor, where core A runs a Linux system (i.e., a non-real-time operating system) and is responsible for non-real-time tasks such as network management, user interface, and configuration management; core B runs a real-time operating system (such as FreeRTOS) specifically responsible for high-speed data packet encryption / decryption. The interaction process between the Linux system and FreeRTOS is as follows:
[0066] Initialization: After the Linux system starts, it reserves memory space and shared memory area for FreeRTOS and loads the monitoring daemon.
[0067] Loading: The daemon loads the FreeRTOS image file into the reserved memory space and starts the B core.
[0068] Interaction: When the Linux system receives a data packet that needs to be encrypted, it passes the packet to the B core via the shared memory area and triggers an inter-core interrupt. FreeRTOS on the B core responds immediately, executes the encryption algorithm, and upon completion, sends the result back via the shared memory area and triggers a reverse inter-core interrupt to notify the Linux system. The Linux system then sends the encrypted data packet out.
[0069] This embodiment fully demonstrates the advantages of the present invention in separating high real-time tasks (encryption) from high-complexity tasks (network protocol stack), ensuring the efficiency and determinism of data processing. It is easy to see that the present invention, through a clearly defined end-to-end interactive mechanism for system startup, task requests, and response feedback, ensures low latency, high reliability, and determinism in communication between the two systems, thereby effectively resolving the contradiction between software flexibility and system real-time performance.
[0070] The second embodiment of the present invention relates to an interaction device between a real-time and a non-real-time operating system for a multi-core processor, applied to a non-real-time operating system, comprising:
[0071] The real-time task request and response module is used to respond to real-time task requests sent by the task sender. The daemon process calls the task interface to write the real-time task request and related data to a specified location in the shared memory area.
[0072] The first triggering module is used to trigger inter-core interrupts and notify the real-time operating system.
[0073] The reverse inter-core interrupt response module is used to respond to the reverse inter-core interrupt triggered by the real-time operating system. The daemon process reads the result data obtained by the real-time operating system after processing the real-time task request from the shared memory area and returns the result data to the task sending end.
[0074] The interaction device between the multi-core processor's real-time and non-real-time operating systems further includes an initialization module, which comprises:
[0075] A partitioning unit is used to divide the memory address space into a real-time operating system runtime space and a shared memory area;
[0076] The loading and startup unit is used to load and start the daemon process, which is responsible for loading and monitoring the subsequent real-time operating system.
[0077] The configuration unit is used to configure the inter-core interrupt controller and establish an interrupt channel with the processor core where the real-time operating system is located.
[0078] The aforementioned multi-core processor real-time and non-real-time operating system interaction device further includes a real-time operating system loading module, which includes:
[0079] An executable file writing unit is used to write the executable file of the real-time operating system into the running space of the real-time operating system using a daemon process;
[0080] The startup configuration unit is used to send a startup command to the processor core where the real-time operating system resides via a remote driver module using a daemon process, and to configure the hardware peripheral resources that the real-time operating system can access.
[0081] The third embodiment of the present invention relates to an interaction device between a real-time and non-real-time operating system for a multi-core processor, applied to a real-time operating system, comprising:
[0082] The inter-core interrupt response module is used to respond to inter-core interrupts triggered by non-real-time operating systems. It reads real-time task requests and related data from the shared memory area through the message engine and sends the real-time task requests and related data to the real-time task scheduler for real-time task execution.
[0083] The result data writing module is used to write the obtained result data into the response area of the shared memory area after the real-time task scheduler has completed the task.
[0084] The second trigger module is used to trigger a reverse inter-core interrupt to notify the non-real-time operating system.
[0085] The shared memory area is allocated by the non-real-time operating system within its own memory address space during initialization.
[0086] The aforementioned interaction device between a multi-core processor's real-time and non-real-time operating system further includes a startup module, which comprises:
[0087] The acquisition unit is used to acquire the startup command sent by the non-real-time operating system;
[0088] The monitoring unit is used to initialize the message engine and monitor messages from the non-real-time operating system in the shared memory area through the message engine.
[0089] The fourth embodiment of the present invention relates to an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the interaction method of a multi-core processor real-time and non-real-time operating system of the first embodiment.
[0090] The fifth embodiment of the present invention relates to a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the interaction method between a multi-core processor and a non-real-time operating system of the first embodiment.
[0091] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0092] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can 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, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0093] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction methods implemented in a process. Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0094] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0095] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for interacting between a real-time and a non-real-time operating system of a multi-core processor, the method comprising: The application is applied to a non-real-time operating system and comprises the following steps: In response to a real-time task request sent by a task sending end, a daemon calls a task interface to write the real-time task request and related data into a specified position of a shared memory area; An inter-core interrupt is triggered to notify a real-time operating system; In response to a reverse inter-core interrupt triggered by the real-time operating system, the daemon reads result data obtained after the real-time operating system processes the real-time task request from the shared memory area and returns the result data to the task sending end.
2. The method of claim 1, wherein, The non-real-time operating system further comprises an initialization step, specifically comprising: A real-time operating system running space and a shared memory area are divided in a memory address space; A daemon is loaded and started, and the daemon is used to be responsible for loading and monitoring a subsequent real-time operating system; An inter-core interrupt controller is configured to establish an interrupt channel with a processor core where the real-time operating system is located.
3. The method of claim 2, wherein, The real-time operating system further comprises a loading step, specifically comprising: The daemon writes an executable file of the real-time operating system into the real-time operating system running space; The daemon sends a start command to the processor core where the real-time operating system is located through a remote drive module and configures hardware peripheral resources accessible by the real-time operating system.
4. A method for interaction of a real-time and a non-real-time operating system of a multi-core processor, characterized in that, The application is applied to a real-time operating system and comprises the following steps: In response to an inter-core interrupt triggered by a non-real-time operating system, a message engine reads a real-time task request and related data from a shared memory area and sends the real-time task request and related data to a real-time task scheduler for real-time task execution; After the real-time task scheduler finishes executing a task, the real-time task scheduler writes result data obtained to a response area of the shared memory area; A reverse inter-core interrupt is triggered to notify the non-real-time operating system.
5. The method of claim 4, wherein, The shared memory area is divided by the non-real-time operating system in a memory address space during initialization.
6. The method of claim 4, wherein, The real-time operating system further comprises a start step, specifically comprising: A start command sent by the non-real-time operating system is obtained; The message engine is initialized, and the message engine is used to monitor a message from the non-real-time operating system in the shared memory area.
7. An interactive device for real-time and non-real-time operating systems of a multi-core processor, characterized in that, The application is applied to a non-real-time operating system and comprises: A real-time task request response module is configured to, in response to a real-time task request sent by a task sending end, call a task interface by a daemon to write the real-time task request and related data into a specified position of a shared memory area; A first triggering module is configured to trigger an inter-core interrupt to notify a real-time operating system; A reverse inter-core interrupt response module is configured to, in response to a reverse inter-core interrupt triggered by the real-time operating system, read result data obtained after the real-time operating system processes the real-time task request from the shared memory area by the daemon and return the result data to the task sending end.
8. The apparatus of claim 7, wherein, The application further comprises an initialization module, and the initialization module comprises: A division unit is configured to divide a real-time operating system running space and a shared memory area in a memory address space; A loading and starting unit is configured to load and start a daemon, and the daemon is used to be responsible for loading and monitoring a subsequent real-time operating system; and An inter-core interrupt controller is configured to establish an interrupt channel with a processor core where the real-time operating system is located. The configuration unit is configured to configure an inter-core interrupt controller to establish an interrupt channel with the processor core where the real-time operating system is located.
9. The apparatus of claim 7, wherein, The real-time operating system loading module comprises: An executable file writing unit configured to write, by a daemon process, an executable file of the real-time operating system into a real-time operating system running space. A start configuration unit configured to send, by a daemon process, a start command to the processor core where the real-time operating system is located through a remote drive module, and configure hardware peripheral resources accessible by the real-time operating system.
10. An interactive device for real-time and non-real-time operating systems of a multi-core processor, characterized in that, The application is applied to a real-time operating system, and comprises: An inter-core interrupt response module configured to, in response to an inter-core interrupt triggered by a non-real-time operating system, read, by a message engine, a real-time task request and related data from a shared memory area, and send the real-time task request and related data to a real-time task scheduler for real-time task execution. A result data writing module configured to, after the real-time task scheduler executes a task, write obtained result data into a response area of the shared memory area. A second triggering module configured to trigger a reverse inter-core interrupt to notify the non-real-time operating system.
11. The apparatus of claim 10, wherein, The shared memory area is divided in a memory address space of the non-real-time operating system during initialization.
12. The apparatus for interaction of real-time and non-real-time operating systems of a multi-core processor according to claim 10, wherein, The start module comprises: An acquisition unit configured to acquire a start command sent by a non-real-time operating system. A monitoring unit configured to initialize the message engine, and monitor, by the message engine, a message from the non-real-time operating system in the shared memory area.
13. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The computer program is executed by the processor to implement the steps of the method for interacting between a real-time operating system and a non-real-time operating system of a multi-core processor according to any one of claims 1-6.
14. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method for interacting between a real-time operating system and a non-real-time operating system of a multi-core processor according to any one of claims 1-6.