Operation control method and device for operating system, embedded system and chip

By using two operating systems in embedded systems to run on the same processor, the problem of low operating system efficiency caused by the increase in hardware devices is solved, and more efficient resource management and operating efficiency are achieved.

WO2024221465A1PCT designated stage expired Publication Date: 2024-10-31INSPUR SUZHOU INTELLIGENT TECH CO LTD

Patent Information

Application Number
PCT/CN2023/091864
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-04-28
Publication Date
2024-10-31

AI Technical Summary

Technical Problem

The operating efficiency of existing operating systems is low, mainly due to the increase in hardware logic devices, which leads to high system costs and complex interactions, which affects efficiency.

Method used

Embedded system design is adopted, which includes two operating systems running on the same processor, communicating through a high-bandwidth bus, and controlling the hardware controller through another bus, avoiding the increase of hardware devices and realizing dynamic changes in processor resources. manage.

Benefits of technology

It reduces system costs, improves the operating efficiency of the operating system, rationally utilizes processor resources, and supports efficient operation between systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023091864_31102024_PF_FP_ABST
    Figure CN2023091864_31102024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an operation control method and device for an operating system, an embedded system and a chip. The embedded system comprises: a chip and at least two operating systems, wherein the chip comprises a processor, a hardware controller, a first bus and a second bus, the bandwidth of the first bus is higher than that of the second bus, the first bus is configured to be in a multi-master and multi-slave mode, and the second bus is configured to be in a single-master and multi-slave mode; the at least two operating systems run on the basis of the processor; the at least two operating systems communicate with each other by means of the first bus; and the at least two operating systems control the hardware controller by means of the second bus. The present application solves the problem of low operation efficiency of an operating system, and then achieves the effect of improving the operation efficiency of the operating system.
Need to check novelty before this filing date? Find Prior Art

Description

Operating system operation control method and device, as well as embedded system and chip Technical Field

[0001] The embodiments of the present application relate to the field of computers, and in particular to a method and device for controlling the operation of an operating system, as well as an embedded system and chip. Background Art

[0002] Current servers, personal computers, industrial computers, and other devices often rely on a system architecture that combines an operating system with hardware components, such as CPLDs (Complex Programmable Logic Devices), embedded controllers (ECs), or control chips. However, the use of hardware logic components like CPLDs, ECs, and control chips inevitably increases system costs. Furthermore, the increased number of these hardware logic components requires cross-device interaction between systems, significantly impacting the efficiency of the operating system.

[0003] In view of the problems in related technologies such as low operating efficiency of the operating system, no effective solutions have been proposed yet.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide an operating system operation control method and device, as well as an embedded system and chip, to at least solve the problem of low operating efficiency of the operating system in the related art.

[0006] According to a first aspect, an embedded system is provided, comprising: a chip and at least two operating systems, wherein:

[0007] The chip includes a processor, a hardware controller, a first bus, and a second bus, wherein the bandwidth of the first bus is higher than that of the second bus, and the first bus is configured in a multi-master-multi-slave mode, and the second bus is configured in a single-master-multi-slave mode; at least two operating systems run based on the processor; at least two operating systems communicate through the first bus; and at least two operating systems control the hardware controller through the second bus.

[0008] According to a second aspect, another embedded system is provided, comprising: a first operating system, a second operating system, a controller and a processor, wherein the first operating system and the second operating system are run based on the processor, and the controller is configured to detect the running status of the first operating system during operation and control the processor resources used by the first operating system according to the running status.

[0009] According to a third aspect, a method for controlling operation of an operating system is provided, comprising:

[0010] detecting an operating state of the first operating system during operation, wherein the first operating system and the second operating system are operated based on a processor;

[0011] Processor resources used by the first operating system are controlled according to the operating state.

[0012] According to a fourth aspect, there is provided an operation control device for an operating system, comprising:

[0013] a first detection module configured to detect an operating state of the first operating system during operation, wherein the first operating system and the second operating system are operated based on a processor;

[0014] The control module is configured to control the processor resources used by the first operating system according to the running state.

[0015] According to the fifth aspect, a chip is also provided, wherein the chip includes at least one of a programmable logic circuit and an executable instruction, and the chip runs in an electronic device and is configured to implement the steps of any of the above method embodiments.

[0016] According to the sixth aspect, a BMC chip is further provided, which includes: a storage unit and a processing unit connected to the storage unit, the storage unit is configured to store a program, and the processing unit is configured to run the program to execute the steps in any of the above method embodiments.

[0017] According to the seventh aspect, a mainboard is also provided, which includes: at least one processor; at least one memory configured to store at least one program; when the at least one program is executed by the at least one processor, the at least one processor implements the steps of any one of the above method embodiments.

[0018] According to the eighth aspect, a server is also provided, which includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is configured to store computer programs; and the processor is configured to implement the steps of any of the above method embodiments when executing the program stored in the memory.

[0019] According to the ninth aspect, a non-volatile readable storage medium is further provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.

[0020] According to the tenth aspect, an electronic device is also provided, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0021] Through this application, the first operating system and the second operating system are run based on the processor, the operating status of the first operating system during operation is detected, and the processor resources used by the first operating system are controlled based on the operating status. Because the first operating system and the second operating system are both run based on the same processor, the addition and deployment of hardware devices are avoided, reducing system costs. In addition, the processor resources used by the operating system can be controlled during its operation, thereby rationally utilizing processor resources to support operation between systems. Therefore, the technical problem of low operating efficiency of the operating system can be solved, achieving the technical effect of improving the operating efficiency of the operating system. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] FIG1 is a schematic diagram of a hardware environment of an operating system operation control method according to an embodiment of the present application;

[0023] FIG2 is a flowchart of a method for controlling the operation of an operating system according to an embodiment of the present application;

[0024] FIG3 is a schematic diagram of an operation service takeover process according to an embodiment of the present application;

[0025] FIG4 is a schematic diagram of a processor core occupation process according to an embodiment of the present application;

[0026] FIG5 is a first schematic diagram of a processor resource control process according to an embodiment of the present application;

[0027] FIG6 is a second schematic diagram of a processor resource control process according to an embodiment of the present application;

[0028] FIG7 is a schematic diagram of a business data interaction process according to an embodiment of the present application;

[0029] FIG8 is a first schematic diagram of the operation process of a first operating system according to an embodiment of the present application;

[0030] FIG9 is a second schematic diagram of the operation process of a first operating system according to an embodiment of the present application;

[0031] FIG10 is a schematic diagram of a system abnormality monitoring process according to an embodiment of the present application;

[0032] FIG11 is a first schematic diagram of an embedded system according to an embodiment of the present application;

[0033] FIG12 is a block diagram of an optional BMC chip according to an embodiment of the present application;

[0034] FIG13 is a schematic diagram of a service data communication process between operating systems according to an optional implementation manner of the present application;

[0035] FIG14 is a schematic diagram of a service management process in an embedded system according to an optional embodiment of the present application;

[0036] FIG15 is a schematic diagram of a task scheduling process according to an optional implementation manner of the present application;

[0037] FIG16 is a second schematic diagram of an optional embedded system according to an embodiment of the present application;

[0038] FIG17 is a structural block diagram of an operation control device of an operating system according to an embodiment of the present application. DETAILED DESCRIPTION

[0039] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0040] It should be noted that the terms "first", "second", etc. in the description and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0041] The method embodiments provided in the embodiments of the present application can be executed in a server, a computer terminal, an equipment terminal or a similar computing device. Taking operation on a server as an example, FIG1 is a hardware environment diagram of an operation control method of an operating system according to an embodiment of the present application. As shown in FIG1 , the server may include one or more (only one is shown in FIG1 ) processors 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 configured to store data. In an exemplary embodiment, the above-mentioned server may also include a transmission device 106 and an input / output device 108 configured to have a communication function. It will be understood by those skilled in the art that the structure shown in FIG1 is for illustration only and does not limit the structure of the above-mentioned server. For example, the server may also include more or fewer components than those shown in FIG1 , or have different configurations with equivalent functions as shown in FIG1 or more functions than those shown in FIG1 .

[0042] The memory 104 can be configured to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the operation control method of the operating system in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implementing the above-mentioned method. The memory 104 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may include a memory remotely located relative to the processor 102, and these remote memories may be connected to a server via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0043] The transmission device 106 is configured to receive or transmit data via a network. Optional examples of the aforementioned network may include a wireless network provided by the server's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 can be a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.

[0044] In this embodiment, a method for controlling the operation of an operating system is provided, which is applied to the above-mentioned hardware environment. FIG2 is a flow chart of the method for controlling the operation of an operating system according to an embodiment of the present application. As shown in FIG2 , the flow chart includes the following steps:

[0045] Step S202, detecting the running state of the first operating system during operation, wherein the first operating system and the second operating system are run based on a processor;

[0046] Step S204: Control the processor resources used by the first operating system according to the running state.

[0047] Through the above steps, the first operating system and the second operating system run on the processor, the operating status of the first operating system during operation is detected, and the processor resources used by the first operating system are controlled based on the operating status. Because the first and second operating systems both run on the same processor, the addition and deployment of hardware components is avoided, reducing system costs. Furthermore, the processor resources used by the operating systems can be controlled during their operation, thereby rationally utilizing processor resources to support operations between systems. Therefore, the technical problem of low operating efficiency of the operating systems can be resolved, achieving the technical effect of improving the operating efficiency of the operating systems.

[0048] The execution subject of the above steps may be a server, a device, a motherboard, a chip, a processor, an embedded system, etc., but is not limited thereto.

[0049] Optionally, in this embodiment, the first operating system and the second operating system may be, but are not limited to, two heterogeneous or homogeneous operating systems, that is, the first operating system and the second operating system may be of the same or different types.

[0050] For example, if the first and second operating systems are heterogeneous, the first and second operating systems may have different sensitivities to response time, e.g., the first operating system is more sensitive to response time than the second. Alternatively, the first and second operating systems may have different resource usage, e.g., the first operating system may use less resources for its services than the second operating system.

[0051] The above-mentioned first operating system and second operating system can be, but are not limited to, two heterogeneous operating systems deployed on the processor of the embedded system, i.e., embedded operating systems. Embedded operating systems can be divided into real-time operating systems (RTOS) and non-real-time operating systems according to their sensitivity to response time. Real-time operating systems can include, but are not limited to, Free RTOS (Free Real-Time Operating System) and RT Linux (Real Time Linux). Non-real-time operating systems can include, but are not limited to, contiki (Contiki Operating System), HeliOS (Helix Operating System) and Linux (Linux Operating System), etc.

[0052] An embedded system is a specialized computer system designed to control, monitor, or assist in the operation of machinery and equipment. Embedded systems are application-centric, based on computer technology, and their software and hardware can be customized to meet the stringent requirements of the application system for functionality, reliability, cost, size, and power consumption. Defined by the application target, an embedded system is a combination of software and hardware, and can also include ancillary devices such as machinery.

[0053] From a hardware perspective, an embedded system may include, but is not limited to, hardware devices such as a processor, memory, and peripheral circuits. The first and second operating systems described above are run on the embedded system's processor. From a software perspective, it may include, but is not limited to, low-level drivers, an operating system, and application programs. The first and second operating systems described above are the operating systems within the embedded system.

[0054] Optionally, in this embodiment, the operation control method of the above-mentioned operating system can be executed but is not limited to being executed by the control logic implemented in the embedded system, which realizes the control, allocation and scheduling of heterogeneous dual operating systems, processors, memories and other hardware and software resources in the embedded system.

[0055] The above operating system operation control method can be, but is not limited to, executed by the first operating system, or by a functional module for resource control provided on the first operating system.

[0056] In the technical solution provided in step S202 above, during the operation of the first operating system, its operating status may include, but is not limited to, its operating status. This operating status may be, but is not limited to, a single dimension, or may be, but is not limited to, a comprehensive consideration of multiple dimensions. For example, the operating status may include, but is not limited to, the usage of software and hardware resources, the execution of instructions, the operation status of operating services, and the like.

[0057] Optionally, in this embodiment, the running process of the first operating system may refer to, but is not limited to, the entire process from power-on to power-off. During this process, the first operating system may be, but is not limited to, always awake, or may have both an awakening stage and a sleeping stage.

[0058] In the technical solution provided in the above step S204, the processor resources used by the first operating system may include but are not limited to operating services, processor cores, storage space on the processor (such as memory, cache), timers, registers, input and output interfaces, etc.

[0059] Optionally, in this embodiment, the control of processor resources may be a separate control of one of them, or may be, but is not limited to, a coordinated control of multiple processor resources.

[0060] Optionally, in this embodiment, the control of processor resources may include, but is not limited to, release, occupation, allocation, and recycling operations. By performing reasonable control operations on the processor resources used by the first operating system based on its operating state during operation, resource utilization can be improved, thereby enhancing the operating efficiency of the operating system.

[0061] In one exemplary embodiment, the detected operating state can determine the processor resources to be controlled. For example, detecting service status can control the adjustment of operating services, while detecting system status can control the use of processor cores. Different detection targets can also be set based on the processor resources to be controlled. For example, if the operating service needs to be adjusted, the service status can be detected, while if the use of processor cores needs to be controlled, the system status can be detected.

[0062] On the one hand, the service status of the operating service executed by the first operating system can reflect the operational status of the first operating system. Alternatively, if it is necessary to control the operating service on the operating system, the service status of the operating service can be detected. For example, in the above step S202, the service status of the target operating service executed by the first operating system based on the processor can be detected, but is not limited to the detection of the service status, where the operational status includes the service status.

[0063] Optionally, in this embodiment, the target operation business can be, but is not limited to, an operation business that has certain requirements on the system's operating performance or operating environment, such as: a fan control business that has certain requirements on the operating time, a log backtracking business that has certain requirements on the data storage space, an interface switching business that has certain requirements on the response speed, and a hardware interface waveform signal simulation business, etc.

[0064] Optionally, in this embodiment, the business status of the operating business can be, but is not limited to, indicating the operating status of the operating business in various dimensions, such as: whether it is interrupted, whether it runs to a certain extent (for example: whether the running time reaches a threshold, whether the running result reaches a preset result), etc.

[0065] If the service state reaches the target service state, that is, the operating service has run to a certain extent, a control operation matching the target service state can be executed on the service, thereby enabling the operation of the operating service to be transferred from one operating system to another, and enabling control adapted to the current service state, such as starting and stopping the operating service, suspending and resuming the operating service. For example, in step S204 above, if the service state is detected to be the target service state, the target operating service is released, wherein the processor resources include the target operating service, and the second operating system is used to run the target operating service.

[0066] Optionally, in this embodiment, if the target operating service reaches a target service state, such as being interrupted or running to a certain extent (e.g., the running time reaches a threshold, the running result reaches a predetermined result), the target operating service on the first operating system is released and the second operating system continues to run the target operating service. This allows the operating service to alternate between operating systems, allowing the operating service to run on an operating system that is more suitable for its operation.

[0067] The first operating system's business status reaching the target business state when executing the target business may be caused by, for example, the first operating system interrupting the target business when executing the target business. For example, upon receiving a first interrupt request sent by the second operating system to the first operating system, the first operating system determines that the business state has reached the target business state, wherein the first interrupt request is used to request takeover of the target business. Alternatively, the business attributes of the target business may reach the target business attributes. For example, upon receiving a first interrupt request sent by the second operating system to the first operating system, the first interrupt request is used to request takeover of the target business.

[0068] Optionally, in this embodiment, when the target operating business performs the operating system conversion can be determined by, but is not limited to, the second operating system. When the second operating system decides to take over the target operating business, it can send a first interrupt request to the first operating system to instruct it to take over the target operating business. When the first interrupt request is obtained, it can be considered that the business status of the first operating system for the operation of the target operating business has reached the target business status. The target operating business can be released in response to the first interrupt request, and the operation of the target operating business can be taken over by the second operating system.

[0069] Optionally, in this embodiment, the service attributes of the target operation service may include, but are not limited to, running time, running results, running load, and the like. The running time reaching the target service attribute may include, but is not limited to, the running time reaching a preset time, the running result reaching the target service attribute may include, but is not limited to, the target operation service achieving a preset running result, and the running load reaching the target service attribute may include, but is not limited to, the running resources occupied by the target operation service exceeding or about to exceed the range that can be handled by the first operating system.

[0070] Optionally, in this embodiment, when the target operating business switches the operating system may also be determined by, but not limited to, the business attributes of the target operating business itself. If the target operating business runs to the extent that the business attributes reach the target business attributes, it can be considered that the business status of the first operating system for the target operating business has reached the target business status, and the second operating system can take over the operation of the target operating business.

[0071] In an exemplary embodiment, a determination mechanism may be established for the eligibility of the second operating system to take over the target operating service, but is not limited to the following: for example, upon receiving a first interrupt request, responding to the first interrupt request, determining whether the second operating system should take over the target operating service; and releasing the target operating service if the second operating system should take over the target hardware controller.

[0072] Optionally, in this embodiment, when the first interrupt request is obtained, the target operation business run by the first operating system may not be released immediately. Instead, it is determined whether the second operating system takes over the target operation business, thereby determining the qualification of the second operating system to take over the target operation business. If it is determined that the second operating system takes over the target operation business, the target operation business run by the first operating system is released.

[0073] In the mechanism for determining the eligibility of the second operating system to take over the target operating service, if the second operating system does not have the eligibility to take over the target operating service, the second operating system may be denied permission to take over the target operating service. For example, after determining whether the second operating system is to take over the target operating service, if the second operating system is not to take over the target operating service, a second interrupt request is sent to the second operating system, wherein the second interrupt request is used to indicate that the second operating system is denied permission to take over the target operating service.

[0074] Optionally, in this embodiment, the rejection of the second operating system from taking over the target operation service may be indicated or notified to the second operating system by, but not limited to, sending an interrupt request between systems.

[0075] Optionally, in this embodiment, if the second operating system does not take over the target operation service, the second interrupt request may not be sent, the first operating system does not release the target operation service, and continues to run the target operation service, and the second operating system cannot take over the target operation service.

[0076] After sending a second interrupt request to the second operating system to reject the second operating system from taking over the target operation business, the first operating system can continue to run the target operation business until the conditions for the second operating system to take over the target operation business are met (for example, the business attributes reach the target attributes). The first operating system releases the target operation business to the second operating system and notifies the second operating system to take over the operation.

[0077] After releasing the target operating service running on the first operating system, the second operating system can proactively sense that the target operating service has been released and take over the target operating service. Alternatively, if the second operating system proactively sends a first interrupt request to request takeover of the target operating service, the second operating system can default to directly taking over the target operating service as long as it does not receive a second interrupt request to reject its takeover of the target operating service within a certain period of time, thereby improving the efficiency of taking over the target operating service.

[0078] If the target operating service running on the first operating system is released, an interrupt request may be proactively sent to the second operating system to notify the second operating system that the target operating service has been released. For example, a third interrupt request is sent to the second operating system, where the third interrupt request is used to indicate that the target operating service has been released, and the second operating system is used to run the target operating service in response to the third interrupt request.

[0079] When the business attributes of the target operation business reach the target business attributes, if the first operating system actively releases the target operation business, it can send a third interrupt request to the second operating system to notify the second operating system that the target operation business has been released. After receiving the third interrupt request, the second operating system takes over the subsequent operation of the target operation business.

[0080] FIG3 is a schematic diagram of an operation service takeover process according to an embodiment of the present application. As shown in FIG3 , the second operating system sends a first interrupt request to the first operating system to request to take over the target operation service running on the first operating system. If the first operating system allows the second operating system to take over the target operation service, the target operation service is released and the second operating system takes over the target operation service, and the target operation service runs on the second operating system. If the first operating system does not allow the second operating system to take over the target operation service, a second interrupt request is sent to the second operating system to refuse it from taking over the target operation service, and the target operation service continues to run on the first operating system.

[0081] On the other hand, the system state of the first operating system can reflect the operational state of the first operating system. Based on the system state of the first operating system, it is possible, but not limited to, to reasonably control the processor core used by the first operating system. Alternatively, if it is necessary to control the processor core used by the operating system, the system state of the operating system can be detected. For example, in the above step S202, it is possible, but not limited to, to detect the system state of the first operating system, where the operational state includes the system state, and the first operating system is running based on the target processor core in the processor.

[0082] Optionally, in this embodiment, the target processor core may be, but is not limited to, a processor core in the processor allocated to the first operating system and configured to run the first operating system, and the number of the target processor cores may be, but is not limited to, one or more.

[0083] Optionally, in this embodiment, the system status of the operating system may be, but is not limited to, indicating the operating status of the operating system in various dimensions, such as: whether it is interrupted, whether it runs to a certain extent (for example: whether the running time reaches a threshold, whether the running result reaches a preset result), etc.

[0084] If the system state reaches the target system state, that is, the operating system has run to a certain extent, control operations that match the target system state can be executed on the processor cores used by the operating system, thereby achieving reasonable allocation and utilization of the processor cores. For example, in the above step S204, if it is detected that the system state is the target system state, the target processor core is released, where the processor resources include the target processor core, and the second operating system is used to add the target processor core to the scheduling resource pool of the second operating system, where the scheduling resource pool includes the processor cores allocated to the second operating system.

[0085] Optionally, in this embodiment, if the system state of the first operating system reaches the target system state, such as being interrupted, or running to a certain extent (for example, the running time reaches a threshold, the running result reaches a certain preset result, the running load is lower than a preset value), the target processor core used by the first operating system is released and used by the second operating system. This enables the alternating use of processor cores between operating systems, making more reasonable use of processor cores.

[0086] The first operating system's system state reaching the target system state may occur when the first operating system is interrupted by the second operating system. For example, upon receiving a fourth interrupt request sent by the second operating system to the first operating system, the system state is determined to be the target system state, wherein the fourth interrupt request is used to request occupation of the target processor core. Alternatively, the first operating system's system attributes may reach the target system attributes. For example, upon receiving a fourth interrupt request sent by the second operating system to the first operating system, the system state is determined to be the target system state.

[0087] Optionally, in this embodiment, when the target processor core performs the operating system switch can be determined by, but is not limited to, the second operating system. When the second operating system decides to take over the target processor core, it can send a fourth interrupt request to the first operating system to instruct it to take over the target processor core. When the fourth interrupt request is obtained, it can be considered that the system state of the first operating system has reached the target system state. In response to the fourth interrupt request, the target processor core can be released, and the second operating system takes over the target processor core and adds it to the scheduling resource pool for use.

[0088] Optionally, in this embodiment, after obtaining the fourth interrupt request sent by the second operating system to the first operating system, the data currently running by the first operating system can be pushed into the stack, the first operating system enters a sleep state, and the second operating system occupies the target processor core for scheduling and use.

[0089] Optionally, in this embodiment, the second operating system may, but is not limited to, initiate a fourth interrupt request based on its own demand for processor core resources. For example, the second operating system detects whether the resource occupancy rate of the core allocated to it is higher than a certain threshold, or detects whether the remaining amount of resources of the core allocated to it is sufficient to run the next process. If the resource occupancy rate is higher than a certain threshold or the remaining amount is insufficient to run the next process, it can be considered that the second operating system needs an additional processor core. The second operating system can actively send a fourth interrupt request to the first operating system to request to occupy the target processor core, thereby reducing its operating pressure, or supporting the running of the next process.

[0090] In an optional embodiment, when the second operating system (such as Linux) detects that the resource occupancy rate of the core allocated to it is high (for example, the occupancy rate is higher than 95% of the total resources), it can send a fourth interrupt request to the first operating system (such as RTOS). After receiving the fourth operating system, the first operating system (RTOS) saves its running business scene (for example: pushes the running data into the stack) and releases the target processor core it is using. The second operating system (Linux) occupies the target processor core and allocates the thread to be run to the target processor core, or schedules the threads on other processor cores with higher occupancy rates to run on the target processor core.

[0091] Optionally, in this embodiment, the system attributes of the operating system may include, but are not limited to, the system's operating time, operating results, operating load, and the like. The system's operating time reaching a target system attribute may include, but is not limited to, the system's operating time reaching a preset time, the system's operating results reaching a target system attribute may include, but is not limited to, the operating system achieving a preset operating result, and the system's operating load reaching a target system attribute may include, but is not limited to, the operating system's resource usage being below or about to fall below a set lower limit of its resource usage.

[0092] Optionally, in this embodiment, when the target processor core performs the operating system switch may also be determined by, but not limited to, the system properties of the operating system itself. If the operating system runs to the extent that the system properties reach the target system properties, it can be considered that the system state of the operating system has reached the target system state, and the target processor core can be occupied by the second operating system.

[0093] In an exemplary embodiment, a determination mechanism may be established for the eligibility of the second operating system to occupy the target processor core, but is not limited to the following: for example, upon receiving a fourth interrupt request, responding to the fourth interrupt request, determining whether the target processor core is occupied by the second operating system; and if the target processor core is occupied by the second operating system, releasing the target processor core.

[0094] Optionally, in this embodiment, when the fourth interrupt request is obtained, the target processor core may not be released immediately. Instead, it is determined whether the target processor core is occupied by the second operating system, thereby determining the qualification of the second operating system to occupy the target processor core. If it is determined that the target processor core is occupied by the second operating system, the target processor core is released to be occupied by the second operating system.

[0095] In the mechanism for determining the eligibility of the second operating system to occupy the target processor core, if the second operating system does not have the eligibility to occupy the target processor core, the second operating system may be denied occupation of the target processor core. For example, if the second operating system does not occupy the target processor core, a fifth interrupt request is sent to the second operating system, where the fifth interrupt request is used to indicate that the second operating system is denied occupation of the target processor core.

[0096] Optionally, in this embodiment, the rejection of the second operating system from occupying the target processor core may be indicated or notified to the second operating system by, but not limited to, sending an interrupt request between systems.

[0097] Optionally, in this embodiment, if the target processor core is not occupied by the second operating system, the second interrupt request may not be sent, the first operating system does not release the target processor core and continues to occupy the target processor core, and the second operating system cannot occupy the target processor core.

[0098] After sending the fifth interrupt request to the second operating system to deny the second operating system from occupying the target processor core, the first operating system can continue to use the target processor core to process operating services until the conditions for the second operating system to occupy the target processor core are met (for example: the system properties reach the target system properties). The first operating system releases the target operating business to the second operating system and notifies the second operating system to take over the operation.

[0099] FIG4 is a schematic diagram of a processor core occupation process according to an embodiment of the present application. As shown in FIG4 , a first operating system runs based on a target processor core. During the operation, a second operating system sends a second interrupt request to the first operating system requesting the first operating system to occupy the target processor core. If the second operating system is allowed to occupy the target processor core, the target processor core is released, and the second operating system occupies the target processor core and adds it to the resource scheduling pool. If the second operating system is not allowed to occupy the target processor core, a fifth interrupt request rejection is sent to the second operating system.

[0100] After the target processor core used by the first operating system is released, the second operating system can proactively sense that the target processor core has been released and occupy the target processor core. Alternatively, if the second operating system proactively sends a fourth interrupt request to request occupation of the target processor core, the second operating system can default to directly occupying the target processor core as long as it does not receive a fifth interrupt request to deny occupation of the target processor core within a certain period of time, thereby improving the efficiency of target processor core occupation.

[0101] If the first operating system proactively releases the target processor core it is using, it can proactively send an interrupt request to the second operating system to notify the second operating system that the target processor core has been released. For example, the first operating system sends a sixth interrupt request to the second operating system, where the sixth interrupt request is used to indicate that the first operating system has released the target processor core. The second operating system responds to the sixth interrupt request and adds the target processor core to the scheduling resource pool.

[0102] When the system properties reach the target system properties, the first operating system actively releases the target processor core and can send a sixth interrupt request to the second operating system to notify the second operating system that the target processor core has been released. After receiving the sixth interrupt request, the second operating system occupies the target processor core to schedule and use resources.

[0103] In an optional embodiment, when the first operating system (such as RTOS) determines that no thread needs to be scheduled during operation (for example, the resource occupancy rate of the operating system is lower than or is about to be lower than its set lower limit of occupancy), the active sleep of the first operating system (RTOS) can be triggered. The first operating system (RTOS) sends a sixth interrupt request to the second operating system (such as Linux), saves its running scene (for example: pushes the running data into the stack) and then sleeps. After receiving the sixth interrupt request, the second operating system (Linux) adds the target processor core to its resource scheduling pool for scheduling and use.

[0104] In an optional application scenario, the chip is equipped with a dual operating system running on a multi-core processor CPU. The first operating system can be but not limited to RTOS, and the second operating system can be but not limited to Linux. CPU core 0 is allocated to RTOS for use, and the remaining cores are allocated to Linux for use. Figure 5 is a schematic diagram of a processor resource control process according to an embodiment of the present application. As shown in Figure 5, the RTOS is periodically awakened and runs, and the RTOS and Linux alternately occupy and schedule CPU core 0. In the time slice (T4, T5) when the RTOS schedules CPU core 0, Linux generates an interrupt to take over CPU core 0 at T4-1 (equivalent to the above-mentioned fourth interrupt request), causing the RTOS to have to sleep. At this time, the RTOS saves the scene in the stack and sleeps, and then releases CPU core 0 to Linux to take over. After waiting for Linux scheduling to complete, an interrupt will be generated at T5-1 to preempt the RTOS from CPU core 0 to wake up the RTOS. From T5-1, the RTOS enters the round-robin mode to occupy and schedule CPU core 0.

[0105] In this embodiment, the inter-system operation service takeover and the processor core occupation can be, but are not limited to, separate, for example, only the operation service is taken over, or only the processor core is occupied. They can also be occupied together, that is, both the operation service and the processor core are taken over.

[0106] In an optional embodiment, taking the operating service as a device control service as an example, a second operating system takes over the processor resources of the first operating system. In this embodiment, a startup control process of an operating system is provided, which includes the following steps:

[0107] In step A, a first operating system running on a first processor core of a processor controls a hardware controller of a target device via a first bus to control an operating state of the target device.

[0108] Devices such as servers, personal computers, and industrial computers can be equipped with specific devices to perform operations related to their operation. In related technologies, these specific devices typically begin operating after the system is powered on. However, after powering on, the operating system running on the processor takes some time to properly take over and control the operating status of the specific device. During the operating system startup process, the specific device is uncontrollable.

[0109] For example, the fan starts working after the system is powered on. Since it takes some time for the operating system running on the CPU to take over the fan and set the fan speed, the fan cannot be controlled during the operating system startup process.

[0110] For example, in order to control the fan during the startup of the operating system, the server adopts the control method of BMC combined with CPLD, the personal computer adopts the control method of EC chip (EC chip has the function of adjusting the fan speed according to temperature), and the industrial computer adopts the control method of customized chip. During the startup of the server, personal computer, and industrial computer operating system, CPLD, EC chip, and customized chip will intervene to control the fan speed. After the operating system is fully started, the control of the fan will be handed over to the application in the operating system.

[0111] In order to at least partially solve the above technical problems, a multi-core multi-system (for example, a multi-core dual system) startup control method can be adopted to run different operating systems of the embedded system on different processor cores of the processor. Different operating systems have different response speeds. If the second operating system is not started, restarted, or otherwise unable to control the operating status of a specific device, the operating status of the specific device can be controlled by the first operating system with a higher response speed than the second operating system. This can reduce the situation where the operating status of the specific device is uncontrollable. At the same time, since no additional cost is required, it also has good scalability.

[0112] In this embodiment, when the second operating system is not started, restarted or otherwise unable to control the operating state of the target device, the hardware controller of the target device can be controlled via the first bus by the first operating system to control the operating state of the target device. The target device here can be a fan, or other equipment that needs to be running when the system is started. For the fan, its corresponding hardware controller is a fan controller, for example, a PWM (Pulse Width Modulation) controller or a FanTach (fan speed) controller. Here, the first operating system (for example, an RTOS system) is used to replace traditional CPLD, EC chip, and custom chip. On the one hand, hardware cost is saved, and on the other hand, since the device control is implemented by software, scalability is high.

[0113] For example, dual systems, RTOS system and Linux system, are implemented based on the BMC dual-core, and fans are implemented based on the multi-core dual system. By utilizing the high real-time performance of the RTOS system, during the startup of the Linux system, the RTOS system can replace the CPLD, EC chip, or customized chip to control the fan, that is, take over the fan control and control the fan's operating status at a sufficiently fast speed.

[0114] Step B: booting a second operating system on a second processor core of the processor.

[0115] When the system is powered on or the second operating system is restarted, the second operating system can be booted on the second processor core of the processor so that the second operating system runs on the second processor core. Here, booting the second operating system on the second processor core means scheduling the second processor core to the second operating system. The system files or image files of the operating system can be stored in a memory on the chip where the processor is located or outside the chip, for example, in an external RAM (Random Access Memory).

[0116] Step C: After the second operating system is started, the second operating system takes over the hardware controller via the first bus to take over the control of the target device.

[0117] After the second operating system is started, the first operating system can always control the running state of the target device. Taking into account that running multiple operating systems on a multi-core processor requires data interaction between multiple operating systems, and it is convenient for one operating system to perform overall control of the device, the second operating system can also take over the control of the target device. For example, the hardware controller can be taken over by the second operating system via the first bus. The way in which the second operating system takes over the control of the target device can be: after the second operating system is started, the second operating system sends a device takeover request to the first operating system, for example, sends an interrupt request via the second bus to request to take over the hardware controller of the target device. The first operating system can receive the device takeover request sent by the second operating system, transfer the control of the target device to the second operating system, and can also perform operations related to the handover of control of the target device, for example, stop running the business (process) used to control the running state of the target device.

[0118] For example, after the Linux system is fully booted, the RTOS system transfers control of the fan to the Linux system, which then controls the fan. This process can be performed after the system is powered on. That is, using a multi-core dual-system boot method, the RTOS system is booted first, facilitating earlier fan control. After the Linux system is fully booted, the RTOS system transfers control of the fan to the Linux system.

[0119] In an exemplary embodiment, before the first operating system running on the first processor core of the processor controls the hardware controller of the target device via the first bus, it also includes: waking up the first processor core through the processor after the chip where the processor is located is powered on; running the boot loader of the first operating system through the first processor core to guide the first operating system to start on the first processor core.

[0120] The entire system can be divided into two phases based on operating time: an initial startup phase and a real-time operation phase. The startup control method in this embodiment can be executed during either the initial startup phase or the real-time operation phase. The initial startup phase begins when the system is powered on, i.e., when the chip containing the processor is powered on. After the system is powered on, one core is awakened to execute the operating system boot process, while the remaining cores are temporarily dormant. The awakened core can be the first processor core.

[0121] Optionally, after power-on, the system will first execute a preset core scheduling policy (boot strategy), that is, a processor core of the processor executes the core scheduling policy. The core scheduling policy can be stored in RAM or Norflash (non-volatile flash memory) on the SOC chip (System on Chip). The scheduling policy can be flexibly configured according to different design requirements. Its main functions include: specifying the initial processing resources (processor cores) required to run different operating systems, and determining the boot process of heterogeneous operating systems. Chip power-on can refer to power-on at the SOC chip level.

[0122] After the first processor core wakes up, the first operating system can be booted and run on the first processor core through a boot loader program: Yes, the first processor core can boot the first operating system on the first processor core through a boot loader program. A boot loader program can be located on a computer or other computer application. It refers to a program used to load an operating system, for example, a native program in a Boot Rom. The native program refers to the code that boots the operating system and belongs to the Boot Loader program. The Boot Rom is a small mask ROM (Read-Only Memory) or write-protected flash memory embedded in the processor chip on the CPU chip.

[0123] In the initial startup phase, the boot loader is used to guide the operating system to start on the corresponding processor core, which can improve the success rate of the operating system startup and prepare for the real-time operation phase.

[0124] In an exemplary embodiment, a hardware controller of a target device is controlled via a first bus by a first operating system running on a first processor core of a processor, including: executing a first control task of the first operating system on the first processor core, wherein the first control task is used to control the hardware controller; reading sensor data of a designated sensor corresponding to the target device via the first processor core; and sending a device control instruction to the hardware controller via the first bus based on the sensor data of the designated sensor by the first control task, so that the hardware controller controls the operating state of the target device according to the device control instruction.

[0125] The operating system may control the hardware controller of the target device by a control task (service) on the processor core running the operating system. The control task herein may refer to a corresponding control task. For the hardware controller of the target device, a first control task (first control process) of a first operating system may be executed on a first processor core, and the first control task may control the hardware controller.

[0126] The control of the hardware controller can be based on the sensor data of the sensor. For different target devices, the parameters that affect their operation may be different, and correspondingly, the sensor data that needs to be obtained may also be different. For the target device, it can be a device that runs after the chip is powered on, and the sensor corresponding to it is the designated sensor. There can be many types of designated sensors, which may include but are not limited to at least one of the following: temperature sensor, humidity sensor, noise sensor, etc. Since the first control task runs on the first processor core, the sensor data of the designated sensor can be read by the first processor core. The sensor data of the designated sensor can be stored in the storage space within the designated sensor, and can be transmitted from the designated sensor to the designated storage space. In this embodiment, there is no limitation on the reading location of the sensor data of the designated sensor.

[0127] The sensor data read from the designated sensor may be sensor data within a time period, all sensor data since the target device was started, or sensor data that meets other time constraints. After acquiring the sensor data from the designated sensor, the first control task may control the operating state of the target device based on the sensor data from the designated sensor. Controlling the operating state of the target device may be achieved by sending a device control instruction to a hardware controller of the target device via the first control task, so that the hardware controller controls the operating state of the target device in accordance with the device control instruction.

[0128] Optionally, the first control task can determine an expected operating state of the target device based on sensor data from a designated sensor; if the current operating state of the target device differs from the expected operating state, the device control instruction can be generated, which can control the operating state of the target device to be adjusted to the expected operating state. The device control instruction can be sent to a hardware controller of the target device via a first bus. The first bus is similar to that in the previous embodiment and is not further described here.

[0129] By reading the sensor data of the specified sensor and controlling the target device according to the sensor data, the target device's operating status is controlled, thereby improving resource utilization.

[0130] In an exemplary embodiment, a device control instruction is sent to a hardware controller via a first bus according to sensor data of a designated sensor through a first control task, including: determining a target parameter value of a device operating parameter of a target device according to sensor data of a designated sensor through the first control task, wherein the device operating parameter is a parameter for controlling the operating state of the target device; and sending a device control instruction carrying the target parameter value to the hardware controller via the first bus through the first control task.

[0131] The first control task can determine the expected operating state of the target device based on the sensor data of the designated sensor. The expected operating state can be represented by a parameter value of a device operating parameter. The device operating parameter can be a parameter that controls the operating state of the target device. The corresponding device operating parameter can be different for different types of devices. For example, for a fan, the corresponding device operating parameter can be the rotational speed, while for other types of devices, the device operating parameter can be other operating parameters. The expected operating state can correspond to a target parameter value of the device operating parameter of the target device.

[0132] After determining the target parameter value of the device operating parameter of the target device, the target parameter value can be carried in the above-mentioned device control instruction, that is, the device control instruction carrying the target parameter value is sent to the hardware controller through the first control task. The method of sending the device control instruction to the hardware controller can be similar to that in the aforementioned embodiment and will not be repeated here.

[0133] By determining the parameter values ​​of the device operating parameters of the target device based on the sensor data and carrying the determined parameter values ​​in the device control instructions, the accuracy of the device control can be improved.

[0134] In an exemplary embodiment, a target parameter value of a device operating parameter of a target device is determined based on sensor data of a specified sensor through a first control task, including: when the target device is a fan, a target parameter value of a fan operating parameter of the fan is determined based on sensor data of a specified sensor through the first control task.

[0135] The target device may be a fan, which may be configured to dissipate heat from a server or other device, i.e., a cooling fan. In this case, the device operating parameter may be a fan operating parameter. The fan operating parameter may include one or more parameters, including but not limited to at least one of the following: rotation speed, rotation cycle, cycle switching time, and other operating parameters. This is not limited in this embodiment.

[0136] Correspondingly, determining the target parameter value of the device operating parameter of the target device based on the sensor data of the designated sensor by the first control task may include determining the target parameter value of the fan operating parameter of the fan by the first control task based on the sensor data of the designated sensor. After obtaining the target parameter value, the first control task sends a device control instruction carrying the target parameter value to the hardware controller of the fan via the first bus, thereby controlling the operating state of the fan.

[0137] By controlling the operating status of the fans, you can quickly control the operating status of the fans in scenarios such as system power-on, system restart, or other situations, thereby improving the timeliness of fan control.

[0138] In an exemplary embodiment, when the target device is a fan, a target parameter value of a fan operating parameter of the fan is determined according to sensor data of a designated sensor through a first control task, including: when the target device is a fan and the designated sensor is a temperature sensor, a target speed value of the fan speed is determined according to sensor data of the temperature sensor through a first control task, wherein the speed of the fan is positively correlated with the temperature detected by the temperature sensor.

[0139] For scenarios where the target device is a fan, the designated sensor can be a temperature sensor. The number of temperature sensors can be one or more, and the location of the temperature sensors can be configured as needed, with different temperature sensors being placed in different locations. Optionally, the sensor data of the temperature sensor represents the temperature detected by the temperature sensor. In this regard, the first control task can determine a target speed value for the fan based on the sensor data of the temperature sensor. Here, the fan speed is positively correlated with the temperature detected by the temperature sensor.

[0140] If there are multiple temperature sensors, the highest temperature detected by the multiple temperature sensors can be determined based on the sensor data from each temperature sensor. The fan speed can then be determined based on the highest temperature detected by the multiple temperature sensors. This ensures safe device operation compared to determining the fan speed based on the average temperature detected by the multiple temperature sensors. For scenarios with multiple fans, the speed of each fan can also be determined based on the highest or average temperature detected by the temperature sensor that matches each fan.

[0141] For example, the first operating system (for example, RTOS system) can be used to replace the processing units such as CPLD, EC chip, custom chip to control the fan speed (BMC fan control can be performed in real time). When the system is just powered on, the first processor core (for example, CPU0, the first processor core can be awakened by hardware), the first processor core runs the boot loader (for example, the specified program in Boot Rom), loads the first operating system to start, and the first processor core will read various temperature-related sensor data to perform fan control (for example, fan speed control), completely simulating the above-mentioned processing unit to complete the fan regulation function. When performing fan speed control, the first operating system can calculate the PWM value according to the temperature sensor, and then adjust the fan speed. In the above manner, the fan speed can be controlled by the first operating system during the startup of the second operating system.

[0142] In an exemplary embodiment, booting a second operating system on a second processor core of a processor includes: executing a secondary program loader through a first processor core to wake up the second processor core by the secondary program loader; and running a universal boot loader of the second operating system through the second processor core to boot the second operating system on the first processor core.

[0143] In this embodiment, when the operating system is started, the Second Program Loader (SPL) can be loaded into the internal memory, for example, the Static Random-Access Memory (SRAM) inside the SOC, and the SPL can be responsible for loading the Universal Boot Loader (U-Boot) into the Random-Access Memory (RAM). The Second Program Loader can boot the second operating system and can also boot the first operating system.

[0144] For the second operating system, the second program loader can be executed by the first processor core to wake up the second processor core through the second program loader; the second processor core can run the universal boot loader (universal boot loader) of the second operating system, thereby guiding the second operating system to start on the first processor core. Here, the boot program of the second operating system is loaded by the second program loader, and the boot program of the second operating system may include the universal boot loader.

[0145] It's important to note that the second-stage program loader is the code executed by the first stage of the universal boot loader. It is responsible for transferring the second-stage code of the universal boot loader to system RAM (also known as off-chip memory) for execution. The universal boot loader is open source software licensed under the GPL (General Public License) and can be considered a bare-metal synthesis example.

[0146] For example, after the system is powered on, the processor will first wake up the CPU0 core so that the RTOS system can run as quickly as possible; then use the program in the Boot Rom to boot the RTOS system; during the startup of the RTOS system, it will continue to load U-Boot through SPL, and U-Boot will boot the second operating system on CPU1 until the Linux system starts normally.

[0147] It should be noted that Boot Rom is the internal ROM program of a chip (e.g., a SoC chip) and is the boot code of U-Boot. Boot Rom reads the startup information of the hardware (e.g., the DIP switch settings) and reads the uboot-spl code (i.e., SPL) from the specified startup medium (e.g., SD, MMC, etc.). SPL is mainly responsible for initializing the external RAM and environment and loading the actual U-Boot image into the external RAM for execution. The external RAM can be DDR (Double Data Rate Synchronous Dynamic Random-Access Memory) or other RAM.

[0148] The second processor core is awakened by the secondary program loader, and then the second processor core runs the universal boot loader to boot the second operating system on the corresponding processor core, which can improve the convenience and success rate of operating system startup.

[0149] As an optional example, the following explains the startup process of a multi-core dual system by taking an RTOS system and a Linux system as examples.

[0150] In order to take over fan management as quickly as possible, the RTOS system can be started as soon as possible. After the Linux system is started, the Linux system takes over the control of the fans. The startup process of a multi-core dual system may include the following steps:

[0151] Step 1: Wake up CPU0 when the system is just powered on.

[0152] Step 2: CPU0 runs the specified program in Boot Rom and loads the RTOS system to start;

[0153] Step 3: During the RTOS system startup process, wake up CPU1 to boot U-Boot and start the fan control program (FanCtrl_RTOS_APP) in the first operating system;

[0154] Step 4: CPU1 boots U-Boot, which may include the SPL stage and the U-Boot stage, and enters the SPL stage by calling SPL;

[0155] Step 5: In the SPL stage, SPL guides U-Boot to start;

[0156] Step 6: In the U-Boot stage, the Linux kernel (CPU1 to CPUN) is loaded, and the BMC service program and the fan control program (FanCtrl_Linux_APP) in the second operating system are started.

[0157] Through this optional example, during the dual-system startup and operation process, the fan is controlled by first starting the RTOS system, and after the Linux system is started, the second operating system takes over the control of the fan. This can ensure that the fan is quickly controlled when the system is powered on, thereby improving the efficiency of fan control.

[0158] In an exemplary embodiment, after the second operating system takes over the hardware controller via the first bus, it also includes: when the second operating system is to be restarted, the second operating system wakes up the first operating system via the second bus, and the first operating system takes over the hardware controller via the first bus to take over control of the target device; and controls the second operating system to restart the system.

[0159] When a system needs to be restarted due to reasons such as a system crash or receiving a reboot command, the second operating system can first wake up the first operating system, and the first operating system can take over the hardware controller to take over control of the target device. Waking up the first operating system can be performed via the second bus, and the first operating system can take over the hardware controller via the first bus.

[0160] When the second operating system is restarted, the reliability of device control can be improved by waking up the first operating system to take over the control of the target device.

[0161] In an exemplary embodiment, when the second operating system is to be restarted, waking up the first operating system via the second bus by the second operating system includes: when the second operating system is to be restarted, initiating a system wake-up interrupt to the first operating system via the second bus by the second operating system, wherein the system wake-up interrupt is used to wake up the first operating system.

[0162] Waking up the first operating system can be achieved through an inter-core interrupt. If the second operating system is to be restarted (for example, the system crashes, receives a reboot command), the second operating system can initiate a system wake-up interrupt to the first operating system to wake up the first operating system. The system wake-up interrupt can be an active wake-up interrupt. After the first operating system takes over the hardware controller, it can control the second operating system to restart the system. After the second operating system restarts, it can take over the hardware controller again. The process of taking over the hardware controller is similar to that in the aforementioned embodiment and will not be repeated here.

[0163] In an exemplary embodiment, the first operating system may, but is not limited to, enjoy a higher priority in occupying the processor core allocated to it, or the processor core allocated to the first operating system may be currently used by which operating system through negotiation between the operating systems. If the target processor core allocated for use by the first operating system is already occupied by the second operating system, when the first operating system is awakened and running, it can detect whether the target processor core has been released. If it has been released, the first operating system runs based on the target processor core. If it has not been released, a seventh interrupt request can be sent to the second operating system to request the second operating system to release the target processor core. After the second operating system releases the target processor core in response to the seventh interrupt request, the first operating system runs based on the target processor core. For example: if the target processor core in the processor has been added to the scheduling resource pool of the second operating system, and the first operating system is awakened and running, it is detected whether the target processor core has been released, wherein the scheduling resource pool includes the processor core allocated to the second operating system in the processor; if it is detected that the second operating system has released the target processor core when the first operating system is awakened, the first operating system runs based on the target processor core.

[0164] Optionally, in this embodiment, the fact that the target processor core has been added to the scheduling resource pool of the second operating system may, but is not limited to, indicate that the target processor core has been occupied by the second operating system. If the first operating system is awakened and running in this situation, the second operating system may proactively release the target processor core. Alternatively, the second operating system may continue to occupy the target processor core until the first operating system proactively requests it to release the target processor core.

[0165] Optionally, in this embodiment, the first operating system detects whether the target processor core has been released. If it is detected that the target processor core has not been released, the first operating system may request the second operating system to release the target processor core through an interrupt request. For example, if it is detected that the target processor core has not been released, the first operating system may send a seventh interrupt request to the second operating system, wherein the seventh interrupt request is used to request the second operating system to release the target processor core, and the second operating system may release the target processor core in response to the seventh interrupt request.

[0166] Optionally, in this embodiment, the second operating system may, but is not limited to, directly release the target processor core upon receiving the seventh interrupt request, and may also, but is not limited to, judging whether to release the target processor core, and then deciding whether to immediately release the target processor core to the first operating system, or continue running to obtain the running results and then release the target processor core to the first operating system.

[0167] In the above optional application scenario, Figure 6 is a second schematic diagram of a processor resource control process according to an embodiment of the present application. As shown in Figure 6, within the time slice (T3, T4) when Linux schedules CPU core 0, the RTOS is in a dormant state. At T3-1, the RTOS may be awakened due to an interrupt event reported by the hardware. Linux will retain the process running on CPU core 0 on site, and the RTOS occupies CPU core 0. After processing the interrupt event reported by the hardware, it enters a dormant state again at T4-1. At this time, the RTOS reports the release of the interrupt of CPU core 0 to Linux, and Linux continues to schedule CPU core 0 according to the set cycle to resume the running process on site.

[0168] During the operation of an operating system, business data can be exchanged. This interaction can be implemented, but is not limited to, through the coordinated transmission of storage space and interrupt requests. Operating systems transfer data through storage space and communicate instructions to each other through interrupt requests. For example, a first operating system may obtain business data generated during the operation of a processor; store the business data in the storage space on the processor; and send an eighth interrupt request to a second operating system, where the eighth interrupt request is used to request the second operating system to read the business data from the storage space. The second operating system then responds to the eighth interrupt request and reads the business data from the storage space.

[0169] Optionally, in this embodiment, the business data generated by the first operating system during the operation of the processor is stored in the storage space on the processor, and the second operating system is notified through the eighth interrupt request, and the second operating system reads the business data from the storage space, thereby realizing the interaction of business data.

[0170] Optionally, in this embodiment, the business data exchanged between operating systems may be, but is not limited to, any data that needs to be transmitted between systems during the process of the operating system running the business, such as business process data, business result data, etc.

[0171] Optionally, in this embodiment, the storage space on the processor can be, but is not limited to, configuring a dedicated storage location for the interaction process between operating systems, which can be called shared memory. The shared memory can be, but is not limited to, further allocated according to the operating system, that is, each operating system corresponds to a dedicated shared memory.

[0172] The information of the shared memory corresponding to the first operating system (for example, the storage address) can be carried in the eighth interrupt request for requesting the second operating system to read business data from the storage space. The second operating system responds to the eighth interrupt request to read business data from the shared memory indicated by it.

[0173] In this embodiment, each interrupt request can be transmitted between systems via, but not limited to, a software protocol, or can be transmitted via a hardware module. For example, using a hardware module mailbox as an example, a mailbox channel can be established between the first operating system and the second operating system, with service data read and written via the storage space and interrupt requests transmitted via the mailbox channel.

[0174] In an optional embodiment, a method for inter-core communication is provided. The method includes the following steps:

[0175] In step a, the first operating system sends target data (which may be the above-mentioned business data) to a target virtual channel (which may be the above-mentioned storage space) in the processor memory.

[0176] Optionally, the first operating system and the second operating system can be real-time operating systems or non-real-time operating systems. The first operating system and the second operating system can be single-core operating systems or multi-core operating systems. The target data is the data to be sent, and the target virtual channel is a section of free storage space in the memory. The first operating system sends the target data to the target virtual channel in the processor memory, which means that the CPU core of the first operating system writes the data to be sent into the target virtual channel.

[0177] Step b: Send an interrupt notification message (which may be the eighth interrupt request) to the second operating system.

[0178] Optionally, the CPU core of the first operating system sends an interrupt notification message to the CPU core of the second operating system. The interrupt notification message can carry the address of the target virtual channel, which is used to notify the second operating system to obtain target data from the target virtual channel. The interrupt notification message can be triggered by software or hardware.

[0179] Step c: The second operating system responds to the interrupt notification message and obtains target data from the target virtual channel in the memory.

[0180] Optionally, the CPU core of the second operating system responds to the interrupt notification message, parses the address of the target virtual channel from the interrupt notification message, then locates the target virtual channel in the memory according to the parsed address, obtains the target data from the target virtual channel, and realizes data interaction between the first operating system and the second operating system.

[0181] Through the above steps, when multiple operating systems running on the processor need to transmit data to each other, the first operating system sending the data sends the target data to the target virtual channel in the processor memory, and sends an interrupt notification message to the second operating system. The second operating system receiving the data responds to the interrupt notification message to obtain the target data from the target virtual channel, which solves the problem of waste of resources and strong dependence on the operating system in the inter-core communication process, and achieves the effect of reducing the waste of resources and dependence on the operating system in the inter-core communication process.

[0182] In an exemplary embodiment, the memory includes a data storage area and a metadata storage area. The data storage area is divided into multiple storage units, each storage unit is configured to store business data, and the metadata storage area is configured to store the size and occupancy status of each storage unit in the data storage area.

[0183] Optionally, the target virtual channel is composed of one or more storage units in the data storage area, and the metadata storage area can be divided into storage slices with the same number as the storage units. Each storage slice is configured to record the size and occupied status of a storage unit. The size of the storage unit can be represented by the first address and the last address of the storage unit, or by the first address and the length of the storage unit. The occupied status includes the occupied state and the unoccupied state, and can be represented by the value of the idle flag.

[0184] In an exemplary embodiment, the first operating system sends target data to a target virtual channel in the processor memory, including: the first operating system reads records in the metadata storage area, determines at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data based on the read records, and obtains the target virtual channel; sets the state of at least one storage unit corresponding to the target virtual channel in the metadata storage area to an occupied state, and stores the target data in the target virtual channel.

[0185] It should be noted that in order to ensure that the target data can be written continuously into the memory, the target virtual channel to be written needs to be idle and have storage space that is greater than or equal to the length of the target data. Since the memory is divided into a metadata storage area and a data storage area, the occupancy status of each storage unit recorded in the metadata storage area can be read to find the idle storage unit that can meet the data storage requirements.

[0186] For example, the size of each storage unit is equal. If the length of the target data is greater than the length of a storage space, the number of required storage units is determined based on the length of the target data, and multiple storage units that are idle, continuous, and meet the data storage requirements are found to form a target virtual channel.

[0187] For another example, each storage unit is of equal size, and the data storage area has pre-combined the storage units to obtain multiple virtual channels of different sizes. Each virtual channel is composed of one or more storage units. The occupancy status of each virtual channel recorded in the metadata storage area can be read to find the virtual channel that is in an idle state and has a length greater than the length of the target data, that is, the target virtual channel. It should be noted that when the system software needs to apply for shared memory space, it will determine whether the length of the data to be applied for is greater than the maximum length of the data stored in the virtual channel. If it is greater than the maximum length of the data stored in the virtual channel, the system software can send the data to be sent in multiple times to ensure that the length of the data sent each time is less than or equal to the maximum length of the data stored in the virtual channel, thereby ensuring smooth communication.

[0188] In an exemplary embodiment, the second operating system responds to the interrupt notification message and obtains target data from the target virtual channel in the memory, including: the second operating system reads a record in the metadata storage area, determines the target virtual channel based on the read record; obtains the target data from at least one storage unit corresponding to the target virtual channel, and sets the state of the at least one storage unit to an idle state.

[0189] That is, after extracting target data from the storage unit corresponding to the target virtual channel, the second operating system sets the state of the storage unit corresponding to the target virtual channel to an idle state in order not to affect the use of the target virtual channel by other systems or tasks.

[0190] In an exemplary embodiment, the first operating system sends target data to a target virtual channel in a processor memory, including: a driver layer of the first operating system receives the target data, determines a virtual channel in an idle state in the memory, and obtains the target virtual channel; sets the state of the target virtual channel to an occupied state, and stores the target data in the target virtual channel.

[0191] Optionally, both the real-time operating system and the non-real-time operating system have a driver layer. After the driver layer receives the target data to be sent, it calls the interface to search for the target virtual channel in the memory. To avoid other systems applying to use the target virtual channel during the data writing process, after finding the target virtual channel, the state of the target virtual channel is set to occupied, and then the target data is written to the target virtual channel.

[0192] In an exemplary embodiment, when the first operating system includes an application layer, the application layer is provided with a human-computer interaction interface. Before the driver layer of the first operating system determines a virtual channel in an idle state in the memory, it also includes: the application layer of the first operating system receives the data to be sent input by the user through the human-computer exchange interface, encapsulates the data to be sent in a preset format, obtains the target data, and calls the data write function to pass the target data to the driver layer through the preset communication interface, wherein the preset communication interface is set on the driver layer.

[0193] Optionally, the application layer fills the data to be sent according to the preset format to obtain the target data, and then generates a device file ipidev in the system's / dev path. When the application layer needs to read and write data from the driver layer, it can first use the system's built-in open function to open the device file / dev / ipidev, and then use the system's built-in write function to send the target data from the application layer to the driver layer. The driver layer then places the data in the target virtual channel in the shared memory, and then triggers an interrupt to notify the second operating system to fetch the data.

[0194] In an exemplary embodiment, the second operating system responds to the interrupt notification message and obtains target data from the target virtual channel in the memory, including: the second operating system triggers an interrupt processing function based on the interrupt notification message, determines the target virtual channel from the memory through the interrupt processing function, and obtains the target data from the target virtual channel.

[0195] In an exemplary embodiment, determining the target virtual channel from the memory through the interrupt processing function and obtaining target data from the target virtual channel includes: calling the target task through the interrupt processing function, and the target task determining the target virtual channel from the memory and obtaining target data from the target virtual channel.

[0196] Optionally, the interrupt processing function sends a task notification to wake up the target task responsible for data extraction. The target task first searches for the target virtual channel in the shared memory by calling the interface, and then reads the target data from the target virtual channel and performs data parsing.

[0197] In an exemplary embodiment, when the second operating system includes an application layer, a function identifier is stored in the memory, the function identifier indicates a target function, and a target virtual channel is determined from the memory through an interrupt processing function, and target data is obtained from the target virtual channel, including: determining the function identifier and the target virtual channel from the memory through the interrupt processing function, and sending the address information of the target virtual channel to a target application matched by the function identifier, wherein the target application is a target application in the application layer; the target application calls a data reading function to pass the address information to the driver layer through a preset communication interface, the driver layer obtains the target data from the target virtual channel, and passes the target data to the target application layer program, wherein the preset communication interface is set in the driver layer, and the target application processes the target data according to the processing function matched by the function identifier to execute the target function.

[0198] Optionally, after the second application system receives the interrupt notification message, the application layer calls the corresponding interrupt handling function to search the target virtual channel from the memory, obtains the address information of the target virtual channel, and then generates a device file ipidev in the system's / dev path. When the application layer needs to read and write data from the driver layer, it can first use the system's own open function to open the device file / dev / ipidev, and then use the system's own read function to read the target data in the target virtual channel. That is, the driver layer finds the corresponding target data in the shared memory according to the address information of the target virtual channel, and returns the target data and the length of the target data to the application layer. In an exemplary embodiment, the state of the target virtual channel is set to idle.

[0199] It should be noted that different applications in the application layer can use the target data to implement different functions. Function identifiers are stored in the memory to indicate the target functions implemented by the application through the target data. Optionally, the function identifier can be Net or Cmd. When the system is initialized, Net, Cmd and the application PID will be registered to the driver. The driver layer can find the PID of the application based on the received NetFn and Cmd, and send the data to the corresponding application based on the PID.

[0200] For example, if NetFn=1 and Cmd=1, the first and second operating systems send "hello" messages to each other. At system startup, an array is initialized with three columns: NetFn in the first column, Cmd in the second, and the corresponding processing functions for NetFn and Cmd in the third column, denoted as xxCmdHandler. For example, when the second operating system receives a message from the first operating system, it obtains NetFn and Cmd from the message, determines that NetFn=1 and Cmd=1, and executes the processing function HelloCmdHandler corresponding to the "hello" message to complete the corresponding function.

[0201] In an exemplary embodiment, a data storage area includes multiple memory channels, each memory channel is composed of one or more storage units, a metadata storage area stores multiple records, each record is used to record metadata of a memory channel, and the metadata of each memory channel includes at least a channel ID of the memory channel, the size of the memory channel, and the occupied status of the memory channel. A first operating system reads the records in the metadata storage area, and determines at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data based on the read records. Obtaining the target virtual channel includes: traversing the records stored in the metadata storage area, and determining whether there is a first target record indicating that the memory channel is in an idle state and the size of the memory channel is greater than or equal to the length of the target data; if the first target record exists, determining the memory channel indicated by the channel ID recorded in the first target record as the target virtual channel.

[0202] It should be noted that the data storage area can be divided into n virtual memory channels, and the size of each memory channel can be different. That is, the sizes of the n virtual channels are 20*m, 21*m, 22*m, 23*m...2n-1*m, where m is the size of a storage unit. The following structure is set as metadata to manage the memory channels:

[0203] typedef struct{

[0204] uint32_t Flag;

[0205] uint16_t ChannelId;

[0206] uint8_t SrcId;

[0207] uint8_t NetFn;

[0208] uint8_t Cmd;

[0209] uint32_t Len;

[0210] uint32_t ChannelSize;

[0211] uint8_t* pData;

[0212] uint8_t CheckSum;

[0213] }IpiHeader_T

[0214] Among them, uint32_t Flag represents the status of the memory channel. For example, 0xA5A5A5A5 indicates that this channel is not empty, otherwise it is empty; uint16_t ChannelId represents the channel ID; uint8_t SrcId represents the source CPU ID, which is the CPU that writes data to the memory channel; uint8_t NetFn and uint8_t Cmd are function parameters; uint32_t Len is the length of the data stored in the memory channel; uint32_t ChannelSize represents the size of the memory channel; uint8_t *pData is the starting address of the memory channel; uint8_t CheckSum is a checksum. When the first operating system needs to send data, it calculates a checksum value for the sent data using a checksum algorithm and sends the checksum value to the second operating system. When the second operating system receives the data and the checksum value, it calculates a checksum value based on the received data using the same checksum algorithm and compares the calculated checksum value with the received checksum value. If they are consistent, the received data is valid. If they are inconsistent, the received data is invalid. Each virtual memory channel corresponds to a structure record. This structure record will be stored in the starting position of the shared memory in ascending order according to the channel ID. After the system is powered on, these structure records will be initialized. The initialization Flag is 0 to indicate that this channel is empty. The initialization ChannelId is 0, 1, 2...n-1 in sequence. The initialization ChannelSize is the size of the corresponding virtual memory channel. The initialization pData points to the first address of the corresponding virtual memory channel.

[0215] In an exemplary embodiment, when determining the target virtual channel, the first operating system uses the interface GetEmptyChannel to search for a virtual channel that meets the following two conditions in all memory channels based on the size of the target data to be sent: the idle flag Flag in the channel structure IpiHeader is not equal to 0xA5A5A5A5 (that is, the channel is in an idle state), and the channel size ChannelSize in the channel structure IpiHeader is greater than or equal to the size of the target data (that is, the memory size can meet the storage requirements of the target data). After finding the target virtual channel that meets the above conditions, the state of the channel is set to non-empty, that is, the idle flag Flag in the channel structure IpiHeader is set to 0xA5A5A5A5, and then the target data is copied to the target virtual channel.

[0216] In an exemplary embodiment, when a memory channel is occupied, the metadata of the memory channel also includes the ID of the source CPU core of the target data and the ID of the destination CPU core of the target data. The second operating system reads the records in the metadata storage area, and determines the target virtual channel based on the read records, including: traversing the records stored in the metadata storage area, and judging whether there is a second target record, wherein the second target record indicates that the memory channel is in an occupied state, and the ID of the destination CPU core is the ID of the CUP core of the second operating system, and the ID of the source CPU core is not the ID of the CUP core of the second operating system; when the second target record exists, the memory channel indicated by the channel ID recorded in the second target record is determined as the target virtual channel.

[0217] That is, the target virtual channel is a virtual channel among all channels that meets the following three conditions: first, the idle flag Flag in the channel structure IpiHeader is equal to 0xA5A5A5A5 (that is, indicating that the channel is occupied); second, the TargetId in the channel structure is equal to the ID of the current CPU (that is, indicating that the destination CUP of the target data is the CPU of the second operating system); third, the TargetId in the channel structure is not equal to SrcId (that is, indicating that the target data is not sent by the CPU of the second operating system).

[0218] It should be noted that if a 1-bit idle flag is used, 0 indicates channel empty, and 1 indicates channel not empty, if the flag is originally 0 and then suddenly changes to 1, the system will believe the channel is not empty after reading the flag, resulting in communication anomalies. In this embodiment, the idle flag is set to a multi-bit special character, for example, 0xA5A5A5A5. Since the probability of multiple bits simultaneously changing to special characters is much lower than the probability of a single bit changing, this prevents storage medium bit changes from affecting the flag value, thereby improving communication security.

[0219] In an exemplary embodiment, a metadata storage area stores a mapping table, wherein the mapping table contains multiple records, each record being used to record the occupied status of a storage unit. A first operating system reads the records in the metadata storage area, and determines, based on the read records, at least one storage unit in the data storage area that is in an idle state and whose total space is greater than or equal to the length of the target data, to obtain a target virtual channel, comprising: determining a preset number of storage units to be occupied by the target data; scanning each record in sequence from an initial position in the mapping table; when a preset number of consecutive target records are scanned, determining the consecutive storage units indicated by the preset number of target records, wherein the target records indicate that the storage unit is in an idle state; and determining the consecutive storage units as the target virtual channel.

[0220] It should be noted that in order to facilitate data storage and retrieval, since the operating system needs to occupy continuous storage units in the memory when transferring business data, it is necessary to first determine the number of storage units in the memory request instruction. Since the memory space of each storage unit is the same, the preset number of continuous storage units required can be calculated according to the required memory space size, which is recorded as numb.

[0221] Optionally, the first operating system traverses the records from the index position in the mapping table, which may be the starting position of the mapping table. Starting from the starting position of the mapping table, each record of the mapping table is queried in turn to determine whether there are continuous records with free memory pages greater than or equal to numb. If there are records that meet the above conditions, the continuous storage unit in the processor is determined through the correspondence between the record and the memory page, and the continuous storage unit is determined as the target virtual channel to write data to the target virtual channel.

[0222] In an exemplary embodiment, the interrupt notification message includes the starting address and a preset number of continuous storage units, the second operating system reads the records in the metadata storage area, and determines the target virtual channel based on the read records, including: scanning each record in sequence from the initial position of the mapping table; when the starting address of the continuous storage unit is scanned, the storage unit indicated by the scanned address and the preset number of continuous storage units minus one are determined as the target virtual channel.

[0223] Optionally, the continuous storage unit refers to a number of continuous storage units equal to numb. Each record in the mapping table also records the starting address of the corresponding storage unit. When the second operating system scans a number of records of the starting addresses of continuous storage units equal to numb in the mapping table, it indicates that the starting address of the target virtual channel has been scanned. The storage unit indicated by the first address and the numb-1 continuous storage units after the storage unit constitute the target virtual channel. The second operating system obtains data from the target virtual channel to complete data interaction with the first operating system.

[0224] In an exemplary embodiment, the scanned continuous target records are recorded by a counter. In the process of scanning each record in sequence from the initial position of the mapping table according to the number of storage units, when the target record is currently scanned, the control counter is increased by one, and when the non-target record is currently scanned, the control counter is cleared.

[0225] Optionally, the relationship between the value of the counter and the number of required storage units is used to determine whether there are a preset number of continuous target records, that is, whether there are a preset number of continuous storage units. Optionally, the count of the counter is recorded as cntr. If a scanned storage unit is empty, cntr is added by 1. If the scanned storage unit is not empty, the accumulated number of continuous and idle storage units cntr is cleared to zero, and the search for continuous and idle storage units continues from the address after the storage unit; until cntr is equal to numb, it means that continuous and idle storage units that meet the memory requirements have been found; if after scanning the entire mapping table, there is no cntr greater than or equal to numb, it indicates that this dynamic memory application has failed and the preset number of continuous storage units does not exist.

[0226] In an exemplary embodiment, before the first operating system reads records in the metadata storage area and determines, based on the read records, at least one storage unit in the data storage area that is in an idle state and has a total space greater than or equal to the length of the target data, and obtains the target virtual channel, the method further includes: the first operating system sends a memory request instruction and performs a locking operation on the processor's memory, wherein the memory request instruction is used to request the use of the processor's memory; and when the memory is successfully locked, reads the records in the mapping table.

[0227] Optionally, the memory request instruction is an instruction issued by the operating system running on the processor to request the use of the processor's memory. It should be noted that in order to prevent application conflicts caused by multiple operating systems applying to use the processor's memory at the same time, when the operating system sends the memory request instruction, it first performs a locking operation on the processor's memory. Only when the locking is successful can the memory be applied for. The locking operation refers to an exclusive operation of memory application. After the current operating system successfully locks, if the lock is not released, other servers do not have the permission to apply for the use of the processor's memory.

[0228] In an exemplary embodiment, performing a locking operation on the memory of a processor includes: determining whether the memory is currently in a locked state, wherein the locked state indicates that the memory is in a state where it is requested for use; if the memory is not currently in a locked state, performing a locking operation on the memory; if the memory is currently in a locked state, determining that locking the memory has failed, and applying to lock the memory of the processor again after a preset time, until the memory is successfully locked, or until the number of lock applications is greater than a preset number.

[0229] Before the processor runs, it is necessary to initialize the metadata storage area and the data storage area in the processor. Optionally, the records stored in the mapping table in the metadata storage area are initialized, and the memory management information is initialized.

[0230] Before applying for memory, configure the memory management information as follows:

[0231] typedef struct{

[0232] uint32_t MemReady;

[0233] uint32_t MemLock;

[0234] }MallocMemInfo_T;

[0235] Among them, the member variable MemLock of the structure MallocMemInfo_T indicates whether the shared memory has been initialized. The variable MemReady is 0xA5A5A5A5, indicating that the initialization operation is completed and the memory can be dynamically allocated and released normally. The member variable MemReady of the structure MallocMemInfo_T indicates whether it is locked.

[0236] Optionally, if the variable MemLock is read as 0, it indicates that no system or task is currently requesting memory, meaning the memory is not currently locked. If the variable MemLock is read as 0xA5A5A5A5, it indicates that a system or task is currently requesting memory and needs to wait until the current request is completed before retrying. The current lock request has failed.

[0237] In an exemplary embodiment, if a lock fails during a memory lock operation, the memory lock is applied again after waiting for a preset time until the lock is successful. For example, the preset time may be 100 microseconds.

[0238] In one exemplary embodiment, if a lock request fails and the number of repeated requests exceeds a preset number, indicating that the memory in the processor is unallocatable during the current time period, the request is terminated. For example, the preset number of times may be three. If the number of lock requests exceeds three, a message indicating that the current memory is unavailable may be returned to the operating system that sent the request.

[0239] Optionally, after a target virtual channel exists in the memory space of the processor for use by the first operating system, the first operating system stores the target data to be transmitted in the corresponding target virtual channel. In an exemplary embodiment, the occupancy status of the processor's memory space is updated according to the data writing status of the first operating system, that is, the target continuous memory space is changed from an unoccupied state to an occupied state. At the same time, in order to allow other systems or tasks to apply for memory, the lock on the memory is released.

[0240] In an exemplary embodiment, the method further includes: releasing the lock on the memory when a preset number of consecutive target records are not scanned.

[0241] Optionally, after scanning the records in the mapping table, no preset number of continuous, idle storage units are detected, indicating that there is not enough space memory pages in the processor's memory for the first operating system to use. This dynamic memory application fails and the memory lock is released.

[0242] In an exemplary embodiment, the interrupt notification message is sent to the second operating system in a software interrupt manner.

[0243] In an exemplary embodiment, sending an interrupt notification message to the second operating system via a software interrupt includes: writing the interrupt number and the ID of the CPU core of the second operating system into a preset register of the processor, and generating an interrupt notification message based on the interrupt number and the ID of the CPU core of the second operating system.

[0244] Optionally, a soft interrupt is a software-generated interrupt. Software can send an interrupt to the CPU core executing it, or to other CPU cores. The default register can be the GICD_SGIR register. Software can write the SGI (Software Generated Interrupts) interrupt number and the destination CPU ID to the GICD_SGIR register to generate a software interrupt. The SGI interrupt number is a soft interrupt number reserved for inter-core communication.

[0245] In a multi-core heterogeneous operating system, to maximize compatibility with current resource allocation methods, interrupts 8 to 15 (a total of 8 interrupts) are used to represent the inter-core interrupt vector table. When the first operating system is an RTOS operating system and the second operating system is a Linux operating system, a feasible allocation scheme for the vector table is shown in Table 1:

[0246] Table 1

[0247] In an exemplary embodiment, the interrupt notification message is sent to the second operating system via a hardware interrupt.

[0248] Optionally, a hardware interrupt refers to an interrupt generated by a hardware device, which can be a private peripheral interrupt or a shared peripheral interrupt. It should be noted that a hard interrupt is an interrupt introduced by hardware outside the CPU and is random. A soft interrupt is an interrupt introduced by the execution of an interrupt instruction by the software running in the CPU and is pre-set. This embodiment does not limit the method of generating an interrupt notification message.

[0249] In an optional embodiment, a shared memory method is provided. The method includes the following steps:

[0250] Step 101: Receive a memory request instruction and perform a locking operation on the memory of the processor, wherein the memory request instruction is used to request the use of the memory of the processor.

[0251] Optionally, the memory request instruction is an instruction issued by the operating system running on the processor to request the use of the processor's memory. It should be noted that in order to prevent application conflicts caused by multiple operating systems applying to use the processor's memory at the same time, when the operating system sends the memory request instruction, it first performs a locking operation on the processor's memory. Only when the locking is successful can the memory be applied for. The locking operation refers to an exclusive operation of memory application. After the current operating system successfully locks, if the lock is not released, other servers do not have the permission to apply for the use of the processor's memory.

[0252] In the shared memory method provided in an embodiment of the present application, before performing a locking operation on the memory of the processor, the method also includes: determining whether the memory is currently in a locked state, wherein the locked state indicates that the memory is in a state where it is requested for use; and if the memory is not currently in a locked state, performing a locking operation on the memory.

[0253] Optionally, since multiple systems or multiple tasks may cause application conflicts when applying to use memory at the same time, the processor's memory can only be locked by one system or task within the same time period. Therefore, the current operating system can only perform a locking operation on the memory when it detects that the current memory is not in a locked state.

[0254] Optionally, whether the memory is in a locked state is determined by determining whether the preset variable stored in the memory is a preset value. If the preset variable is not a preset parameter value, it indicates that the memory is not in a locked state and no other system or task is applying for memory space, and the locking is successful; otherwise, if the preset variable is a preset parameter, it indicates that the memory is in a locked state at the current moment, and there are other systems or tasks other than the operating system applying for memory space, and the locking fails.

[0255] In the shared memory method, after determining whether the memory is currently in a locked state, it also includes: if the memory is currently in a locked state, determining that locking the memory has failed; if locking the memory has failed, applying to lock the processor's memory again after a preset time period until the memory is successfully locked, or until the number of lock applications is greater than a preset number.

[0256] Optionally, if a memory lock fails, the memory lock is applied again after waiting for a preset time until the lock is successful. For example, the preset time may be 100 microseconds.

[0257] In one exemplary embodiment, if a lock request fails and the number of repeated requests exceeds a preset number, indicating that the memory in the processor is unallocatable during the current time period, the request is terminated. For example, the preset number of times may be three. If the number of lock requests exceeds three, a message indicating that the current memory is unavailable may be returned to the operating system that sent the request.

[0258] Step 102, when the memory is locked successfully, read the memory occupied state, and determine whether there is free target memory space in the memory according to the memory occupied state, wherein the size of the target memory space is greater than or equal to the size of the memory requested by the memory request instruction.

[0259] After the lock application is successful, the operating system applies for the memory in the processor and, optionally, scans the information used to record the memory occupation status to determine whether the target memory space exists, that is, whether there is unoccupied, continuous memory space in the processor that can meet the memory usage requirements. Meeting the memory usage requirements means that the size of the memory space is greater than or equal to the memory size applied for by the operating system.

[0260] It should be noted that discontinuous memory space can be used when applying for memory. A pointer can be added after a non-minimum memory block to point to the next minimum memory block obtained by the application. At the same time, when reading and writing data, data can be read and written across data blocks based on the storage address and pointer. This embodiment does not limit the form of the target memory space.

[0261] Step 103: If the target memory space exists in the memory, the address information of the target memory space is fed back to the sending end of the memory request instruction, the occupied state of the memory is updated, and the lock on the memory is released.

[0262] The sending end refers to the operating system that sends the memory request instruction. It should be noted that since the operating system sends and receives data by using shared memory when communicating between cores, and uses the address returned by the requested memory to access data during the data sending and receiving process, it is necessary to determine the address information of the requested memory space.

[0263] Optionally, after there is a target memory space available for the operating system in the memory space of the processor, the address information of the target continuous space is sent to the operating system, and the operating system stores the data to be transferred in the corresponding memory space according to the address information.

[0264] In an exemplary embodiment, the occupancy status of the processor's memory space is updated according to the data writing status of the operating system, that is, the target memory space is changed from an unoccupied state to an occupied state, and the locking operation before the dynamic memory application is released so that other operating systems can apply to use the processor's memory space.

[0265] Through the above steps: receiving a memory request instruction and performing a locking operation on the processor's memory, wherein the memory request instruction is used to request the use of the processor's memory; when the memory is locked successfully, reading the memory's occupied state, and judging whether there is free target memory space in the memory based on the memory's occupied state, wherein the size of the target memory space is greater than or equal to the size of the memory requested by the memory request instruction; when the target memory space exists in the memory, feeding back the address information of the target memory space to the sending end of the memory request instruction, updating the memory's occupied state, and releasing the lock on the memory, the problems of low utilization efficiency, poor flexibility and over-reliance on the operating system of shared memory among multiple cores are solved, thereby achieving the effect of improving the flexibility and utilization efficiency of shared memory and reducing dependence on the operating system.

[0266] In the shared memory method, the memory includes a metadata storage area and a data storage area, the data storage area is configured to store business data, the metadata storage area stores a mapping table, the mapping table is configured to record the occupied status of the data storage area, reading the occupied status of the memory, and judging whether there is free target memory space in the memory according to the occupied status of the memory, including: reading records in the mapping table from the metadata storage area, and judging whether there is target memory space in the data storage area according to the records in the mapping table.

[0267] The memory occupancy status is queried by querying the records in the mapping table. Optionally, the metadata storage area stored in the processor is obtained, and the mapping table in the metadata storage area is identified. By traversing the records in the mapping table, the occupancy status of the data storage area is read to determine whether there is continuous, idle memory space in the data storage area that meets the memory usage requirements.

[0268] In the shared memory method provided in an embodiment of the present application, a data storage area is composed of multiple memory pages, a mapping table contains multiple records, each record is used to record the occupied status of a memory page, the records in the mapping table are read from the metadata storage area, and it is judged whether there is a target memory space in the data storage area based on the records in the mapping table, including: determining a preset number of memory pages requested by the memory request instruction; scanning each record in sequence from the initial position of the mapping table; when a continuous preset number of target records are scanned, determining that the target memory space exists in the memory, wherein the target record indicates that the memory page is in an idle state.

[0269] It should be noted that the data storage area is divided into multiple allocation units according to the same memory size, and each allocation unit is recorded as a memory page. For example, the memory space of the data storage area is A bytes, and the divided allocation unit is B bytes. Then the data storage area contains a total of A / B memory pages. The records in the mapping table are also memory page records. Each memory page record is used to record the occupied status of a memory page. The number of memory page records in the mapping table is the same as the number of memory pages in the data storage area.

[0270] The data storage area is a dynamically allocated memory block area, and the metadata storage area includes a dynamically allocated memory mapping table area, wherein the mapping table area is divided into the same number of records according to the number of memory pages divided in the data storage area, and the record is recorded as a memory page record, and all memory page records are combined into a mapping table. There is a one-to-one correspondence between all memory page records in the mapping table and all memory pages in the data storage area. Each memory page record indicates the allocation status of the corresponding memory page, that is, whether the memory page is occupied.

[0271] Optionally, since the business data for collaboration with the operating system needs to occupy continuous memory pages in the processor, it is necessary to first determine the preset number of memory pages in the memory request instruction. Since the memory space of each memory page is the same, the preset number of required continuous memory pages can be calculated based on the required memory space size, which is recorded as numb.

[0272] In an exemplary embodiment, after obtaining the mapping table in the metadata storage area of ​​the processor, the memory page records are traversed from the index position in the mapping table. The index position can be the starting position of the mapping table. Starting from the starting position of the mapping table, each memory page record of the mapping table is queried in turn to determine whether there are continuous memory page records with a number of free memory pages greater than or equal to numb. If there are memory page records that meet the above conditions, the correspondence between the memory page records and the memory pages is used to determine whether the target memory space exists in the processor.

[0273] In the shared memory method provided in an embodiment of the present application, after scanning each record in sequence from the initial position of the mapping table, the method also includes: after scanning all records in the mapping table and there are no continuous preset number of target records, determining that there is no target memory space in the memory.

[0274] Optionally, starting from the starting position of the mapping table, query the memory page records of the mapping table to determine whether there is continuous space with a number of memory pages greater than or equal to numb. If no continuous, preset number of free memory pages are found after scanning the entire mapping table, it indicates that the target memory space does not exist.

[0275] In the shared memory method provided in an embodiment of the present application, the number of scanned target records is recorded by a counter. In the process of scanning each record in sequence from the initial position of the mapping table, when the target record is currently scanned, the control counter is added by one. When the non-target record is currently scanned, the control counter is cleared to zero, wherein the non-target record indicates that the memory page is in an occupied state.

[0276] Optionally, by using the relationship between the value of the counter and the number of required memory pages, it is determined whether there are a continuous preset number of target records, that is, whether there is a target memory space. Optionally, the count of the counter is recorded as cntr. If a scanned memory page is empty, cntr is incremented by 1. If the scanned memory page is not empty, the accumulated number of continuous and idle memory pages cntr is cleared to zero, and the search for continuous empty memory pages continues from the address after the memory page; until cntr is equal to numb, it means that continuous and idle memory pages that meet the memory requirements have been found; if cntr is less than numb in the process of scanning the entire mapping table, it indicates that this dynamic memory application has failed and the target memory space does not exist.

[0277] In the shared memory method provided in an embodiment of the present application, when the initial position is the last position in the mapping table, the address information of the target memory space is fed back to the sending end of the memory application instruction, including: determining the last scanned target record among a continuous preset number of target records, and feeding back the first address of the memory page indicated by the last scanned target record to the sending end.

[0278] Optionally, when scanning the mapping table, the scanning method can be selected to scan from the first position of the mapping table or from the last position of the mapping table. When the scanning method is to scan from the last position of the mapping table, when the value cntr displayed by the counter is greater than or equal to the preset number numb, the first address of the memory page corresponding to the last memory page scanned will be recorded, and the status of these memory pages will be set to non-empty in the memory page record, and the first address will be used as the first address of the entire continuous memory page of this memory request instruction.

[0279] In an exemplary embodiment, the address is fed back to the operating system that issues the memory request instruction, and the operating system performs a data write operation on the memory according to the address information.

[0280] In the shared memory method provided in an embodiment of the present application, the initial position is the first position in the mapping table, and the address information of the target memory space is fed back to the sender of the memory request instruction, including: determining the first scanned target record among a continuous preset number of target records, and feeding back the first address of the memory page indicated by the first scanned target record to the sender.

[0281] Optionally, when the scanning method is to scan from the first position of the mapping table, when the value cntr displayed by the counter is greater than or equal to the preset number numb, the address of the first memory page record scanned is used as the first address and sent to the operating system that issues the memory request instruction. The operating system writes data to the memory according to the address information.

[0282] In the shared memory method provided in the embodiment of the present application, in the process of sequentially scanning each record from the initial position of the mapping table, the first target record in the scanned continuous target records is stored through a preset variable.

[0283] Optionally, the preset variable refers to the variable in the mapping table used to store the address information of the initial position, and it is recorded as offset. Every time a free, continuous memory page is scanned, the value cntr displayed by the counter is increased by 1. When the value cntr displayed by the counter is greater than or equal to the preset number numb, the address information currently stored in offset is used as the address of the first target record.

[0284] In the shared memory method provided in an embodiment of the present application, after reading the occupied status of the memory and determining whether there is free target memory space in the memory based on the occupied status of the memory, the method also includes: releasing the lock on the memory if there is no free target memory space in the memory.

[0285] Optionally, after scanning the memory page records in the mapping table, if it is detected that the preset number of continuous and free memory pages is not included, that is, the target memory space is not included, it indicates that there is not enough space in the processor's memory for the operating system to use the memory page, the dynamic memory request fails, and the memory lock is released.

[0286] In the shared memory method provided in an embodiment of the present application, the memory includes a metadata storage area and a data storage area, the data storage area is set to store business data, and the metadata storage area stores memory management information. Determining whether the memory is currently in a locked state includes: reading the memory management information stored in the metadata storage area, and determining whether the memory management information contains preset information, wherein the preset information indicates that the memory is in a locked state; if the memory management information contains the preset information, determining that the memory is not currently in a locked state; if the memory management information does not contain the preset information, determining that the memory is currently in a locked state.

[0287] To determine whether the processor's memory is in a locked state, it is necessary to use the memory management information in the metadata storage area to make a judgment. Optionally, when obtaining the memory management information in the metadata storage area, it is used to determine whether the memory management information contains preset information, wherein the preset information is used to indicate whether the memory is in a locked state; if the memory management information does not contain the preset information, it indicates that the current memory is in an unlocked state, otherwise it is in a locked state.

[0288] In the shared memory method provided in an embodiment of the present application, the memory management information includes first field information and second field information. The first field information is used to describe whether the memory is in a locked state, and the second field information is used to describe whether the memory is initialized. Before receiving the memory application instruction, the method also includes: initializing the first field information and the second field information stored in the data storage area.

[0289] Before the embedded system runs, the metadata storage area and data storage area in the processor need to be initialized. Optionally, the memory page records stored in the mapping table in the metadata storage area are initialized, and the memory management information is initialized.

[0290] Optionally, the memory management information consists of a first field and a second field. That is, the first field indicates whether the memory is locked, and the second field indicates whether initialization is complete. Before applying for memory, the memory management information is configured as follows:

[0291] typedef struct{

[0292] uint32_t MemReady;

[0293] uint32_t MemLock;

[0294] }MallocMemInfo_T;

[0295] Among them, the member variable MemLock (second field information) of the structure MallocMemInfo_T indicates whether the shared memory has been initialized, and the member variable MemReady (first field information) of the structure MallocMemInfo_T represents whether it is locked. Among them, the variable MemLock is 0, indicating that no system or task is applying for memory at this time, that is, it is not locked. MemLock is 0xA5A5A5A5, indicating that a system or task is applying for memory, and other systems or tasks will wait until this application is completed before applying; the variable MemReady is 0xA5A5A5A5, indicating that the initialization operation has been completed, and memory can be dynamically applied and released normally.

[0296] In the shared memory method provided in an embodiment of the present application, updating the occupied state of the memory includes: changing the state of the memory page corresponding to the target memory space recorded in the mapping table to an occupied state.

[0297] Optionally, when the operating system needs to occupy the target memory space, by identifying the address information of multiple memory pages of the target memory space, the memory page records in the mapping table area of ​​the metadata storage area are updated according to the correspondence between the memory pages and the memory page records, so that the state changes from an unoccupied state to an occupied state.

[0298] In an optional embodiment, a communication method between operating systems is provided. The method includes the following steps:

[0299] Step 201: Receive a memory request instruction from a first operating system and perform a locking operation on the memory of a processor, wherein the memory request instruction is used to request the use of the memory of the processor;

[0300] It should be noted that in order to prevent multiple operating systems from applying for the processor's memory space at the same time, resulting in application failure, the first operating system applies for a lock operation to the processor memory when sending a memory application instruction. Only when the lock application is successful can the memory be applied.

[0301] Optionally, whether the locking is successful is determined by judging whether the preset variable stored in the memory is a preset value. If the preset variable is not a preset parameter number, it indicates that no other system or task is applying for memory space, and the locking is successful; otherwise, if the preset variable is a preset parameter, it indicates that at the current moment, there are other systems or tasks other than the operating system applying for memory space, and the locking fails.

[0302] Step 202: If the memory is locked successfully, the memory occupancy status is read, and based on the memory occupancy status, it is determined whether there is free target memory space in the memory, wherein the size of the target memory space is greater than or equal to the size of the memory requested by the memory request instruction;

[0303] Optionally, when the lock application is successful, according to the memory request instruction issued by the operating system, the information used to record the memory occupation status is scanned to determine whether the target memory space exists, that is, to determine whether there is an unoccupied and continuous memory space in the processor. In an exemplary embodiment, it is determined whether the size of the unoccupied and continuous memory space is greater than or equal to the memory size requested by the operating system to obtain a judgment result.

[0304] Step 203: If the target memory space exists in the memory, the address information of the target memory space is fed back to the first operating system, the occupied state of the memory is updated, and the lock on the memory is released;

[0305] Optionally, after the judgment result indicates that there is a target memory space in the processor's memory space that can be used by the operating system, the address information of the target continuous space is sent to the operating system, and the operating system stores the data to be transferred in the corresponding memory space according to the address information.

[0306] Optionally, the occupancy status of the processor's memory space is updated according to the data writing status of the operating system, that is, the target memory space is changed from an unoccupied state to an occupied state, and the locking operation before the dynamic memory application is released.

[0307] Step 204 , in response to the storage operation of the first operating system, storing the target data in the target memory space, and sending the address information of the continuous memory space to the second operating system;

[0308] Optionally, after successfully applying for memory, the first operating system will apply for the target memory space for the target data storage value to be transferred, and send the address information of the target memory space to the second operating system cooperating with the first operating system, notifying the second operating system to obtain data.

[0309] Step 205: Receive an acquisition instruction sent by the second operating system based on the address information, and send the target data stored in the target memory space to the second operating system.

[0310] Optionally, after receiving the address information of the target memory space, the second operating system issues a data acquisition instruction, and the embedded system receives the instruction and sends the target data stored in the target memory space to the second operating system.

[0311] Through the above steps: receiving a memory request instruction from the first operating system and performing a locking operation on the memory of the processor, wherein the memory request instruction is used to request the use of the processor's memory; when the memory is locked successfully, reading the occupied state of the memory, and judging whether there is free target memory space in the memory according to the occupied state of the memory, wherein the size of the target memory space is greater than or equal to the size of the memory requested by the memory request instruction; when the target memory space exists in the memory, feeding back the address information of the target memory space to the sending end of the memory request instruction, updating the occupied state of the memory, and releasing the lock on the memory; responding to the storage operation of the first operating system, storing the target data in the target memory space, and sending the address information of the continuous memory space to the second operating system; receiving the acquisition instruction sent by the second operating system based on the address information, and sending the target data stored in the target memory space to the second operating system, thereby solving the problems of low utilization efficiency, poor flexibility and over-reliance on the operating system of shared memory among multiple cores, thereby improving the flexibility and utilization efficiency of shared memory and reducing the dependence on the operating system.

[0312] In an exemplary embodiment, when the first operating system uses physical addresses to perform data read and write operations and the second operating system uses virtual addresses to perform data read and write operations, the second operating system converts the address information of the target memory space into a virtual address, and uses the virtual address to access the memory to read the target data from the target memory space.

[0313] When using shared memory to send and receive data between cores, the address returned by dynamically requested memory is used. However, different systems may use different address systems. For example, a real-time operating system is the first operating system, and a non-real-time operating system is the second operating system. In a real-time operating system, physical addresses can be used directly to access shared memory, but in a non-real-time operating system, physical addresses cannot be used directly to access shared memory. A mapped virtual address is required. After the second operating system receives the address information of the target memory space, it converts it using the address information offset, maps it to a virtual address, and operates based on the virtual address. Optionally, the shared memory virtual base address vBase in a non-real-time operating system (the real physical address of the shared memory is assumed to be 0x96000000); the shared memory physical base address pBase in a real-time operating system (i.e., 0x96000000).

[0314] The address returned by the dynamically requested memory in the non-real-time operating system is also the virtual address vData. In the non-real-time operating system, Offset = vData - vBase. When data is sent from the non-real-time operating system to the real-time operating system, the real-time operating system uses the address pData to access the dynamically requested shared memory pData = pBase + Offset.

[0315] The address returned by the dynamically requested memory in the real-time operating system is the physical address pData, and Offset in the real-time operating system is pData-pBase. Data is sent from the real-time operating system to the non-real-time operating system, and the non-real-time operating system uses address vData to access the dynamically requested shared memory vData=vBase+Offset.

[0316] In an exemplary embodiment, the memory includes a metadata storage area and a data storage area, the data storage area is composed of multiple memory pages, each memory page is used to store business data, the metadata storage area stores a mapping table, the mapping table contains multiple records, each record is used to record the occupied status of a memory page, reading the occupied status of the memory, and judging whether there is free target memory space in the memory based on the occupied status of the memory includes: determining a preset number of memory pages requested by the memory request instruction; scanning each record in sequence from the initial position of the mapping table; when a continuous preset number of target records are scanned, determining that there is target memory space in the memory, wherein the target record indicates that the memory page is in an idle state.

[0317] Optionally, obtain the metadata storage area stored in the processor, identify the mapping table in the metadata storage area, traverse each memory page record starting from the index position in the mapping table, query each memory page record in the mapping table in turn, and determine whether there are continuous memory page records that record free memory pages greater than or equal to a preset number. When there are memory page records that meet the above conditions, determine that the target memory space exists in the processor through the correspondence between the memory page records and the memory pages.

[0318] In an exemplary embodiment, when the initial position is the last position in the mapping table, feeding back the address information of the target memory space to the sending end of the memory request instruction includes: determining the last scanned target record among a continuous preset number of target records, and feeding back the first address of the memory page indicated by the last scanned target record to the sending end.

[0319] Optionally, when scanning the mapping table, the scanning method can be selected to scan from the first position of the mapping table or from the last position of the mapping table. When scanning from the last position of the mapping table, the first address of the corresponding memory page is recorded for the last memory page scanned, and these memory pages are set to non-empty. The first address is used as the first address of the entire continuous memory page of this memory request instruction. In an exemplary embodiment, this address is fed back to the operating system that issued the memory request instruction, and the operating system performs a data write operation on the memory based on the address information.

[0320] In this embodiment, a method for sharing memory is also provided, which includes: before the operating system issues a memory request instruction, in order to prevent multiple operating systems from applying for the processor's memory space at the same time, a locking operation needs to be applied, and it is determined whether the locking is successful; if the judgment result indicates that the dynamic memory lock application is successful, the number of consecutive memory pages that need to be allocated is calculated according to the memory size in the issued memory request instruction, and recorded as nmemb; if the judgment result indicates that the lock application fails, the application is reissued after waiting for a period of time (which can be 100 microseconds) until the application is successful. If the number of lock application failures is greater than a preset number (the preset number can be three times), the memory application is exited.

[0321] In an exemplary embodiment, after the lock application is successful, the metadata storage area of ​​the processor is initialized, and the last position of the mapping table is recorded as offset. The number of required continuous memory pages is calculated according to the required memory space size in the memory application instruction, and the number of memory pages is recorded as nmemb. A counter for recording the number of memory pages is set, recorded as cmemb, and then the mapping table of the metadata storage area in the processor is obtained. The entire mapping table is scanned starting from the offset position of the mapping table, and the continuous empty memory is found through the correspondence between the memory page records stored in the mapping table and the memory pages in the data storage area. Page, if the current memory page being scanned is in an occupied state, offset = offset - cmemb, and then the data cmemb of the continuous empty memory pages accumulated in the counter is cleared to zero, and the search for continuous empty memory pages is restarted from the new offset position; if the scanned memory page is empty, that is, in an idle state, the counter value cmemb is increased by 1, and offset = offset - 1, and the next memory page is continued to be judged until cmemb is equal to nmemb, that is, when the counter data is equal to the required memory space size, it means that the scan has found a continuous memory page that meets the requirements.

[0322] In an exemplary embodiment, the memory pages that meet the requirements are marked as occupied in the corresponding mapping table, the first address of the last memory page found is used as the first address of the entire continuous memory page dynamically applied for, the lock of the dynamically applied memory is released, and this dynamic memory application is successful.

[0323] If the offset value is less than 0 during the scanning of the entire mapping table, it indicates that there is no memory page that meets the requirements for use by the operating system, and the lock for the dynamic memory application is released, and this dynamic memory application fails.

[0324] In addition, after dynamically applying for space, if it is found that the space is insufficient, the size can be dynamically adjusted. Optionally, an updated memory application instruction can be issued again, and a locking operation can be performed on the memory. If the locking is successful, if the memory space required by the updated memory application instruction is increased, it is determined whether the required memory space exists after the applied target continuous memory. If so, the application is successful. If the memory space required by the updated memory application instruction is reduced, part of the memory space is released.

[0325] This embodiment divides the storage area into multiple storage areas, uses index positions to dynamically apply for space according to the actual required size, releases it after use, and can dynamically adjust the size if it is found that the space is insufficient after dynamic application, thereby improving the flexibility and efficiency of shared memory.

[0326] In this embodiment, FIG7 is a schematic diagram of a business data interaction process according to an embodiment of the present application. As shown in FIG7 , during operation, the first operating system generates business data and determines whether the business data is required by the second operating system or needs to be sent to the second operating system. At this time, the first operating system stores the business data in the storage space and sends an eighth interrupt request to the second operating system. The second operating system responds to the eighth interrupt request, reads the business data from the storage space, and performs subsequent processing.

[0327] The first operating system may, but is not limited to, have different operating mechanisms, such as: controlling the first operating system to run periodically based on the processor; or, in response to a received wake-up request, controlling the first operating system to run based on the processor; or, controlling the first operating system to run based on the processor based on the degree of match between the operating services generated on the processor and the first operating system.

[0328] Optionally, in this embodiment, the operating mechanism of the first operating system may include, but is not limited to, periodic operation and triggered operation. Periodic operation can also be referred to as polling mode, and triggered operation can also be referred to as trigger mode. It can include, but is not limited to, two modes: one can be request triggering, where a wake-up request triggers the first operating system to wake up. The other can be conditional triggering, where the first operating system wakes up based on the matching degree between the operating service and the first operating system.

[0329] Optionally, in this embodiment, when the first operating system is running periodically, the duration of a single operating cycle and the interval between two operating cycles may be the same or different. During the interval between two operating cycles, the first operating system may be, but is not limited to, in a dormant state, and the second operating system uses the processor core allocated to the first operating system. If the duration of a single operating cycle is the same as the interval between two operating cycles, the first operating system and the second operating system alternately occupy the processor core allocated to the first operating system for the same duration. If the duration of a single operating cycle is different from the interval between two operating cycles, the first operating system and the second operating system alternately occupy the processor core allocated to the first operating system for different durations. The duration occupied by the first operating system may be greater than the duration occupied by the second operating system, or the duration occupied by the second operating system may be greater than the duration occupied by the first operating system.

[0330] Depending on different operating scenarios, different system functions can, but are not limited to, use different operating mechanisms to run the first operating system, thereby more flexibly finding an operating mechanism that better matches the current operating scenario and system function to run the first operating system and improve the processing efficiency of operating business.

[0331] In an optional embodiment, a wake-up strategy for a first operating system (such as an RTOS) in a polling mode is provided. FIG8 is a schematic diagram of the operation process of a first operating system according to an embodiment of the present application. As shown in FIG8 , the round-robin mode can be a polling scheduling mode based on a time slice, and the RTOS can be woken up periodically according to the set time. In this mode, during the operation of multiple systems (taking Linux and RTOS dual systems as an example), (T0, T1) = (Tn, T(n+1)), where n is a non-zero positive integer, that is, the dual systems alternately occupy the same time of CPU core 0. In the (T0, T1) time slice, the RTOS schedules CPU core 0 to run its process, and in the (T1, T2) time slice, Linux schedules CPU core 0 to run its process. In this time slice, the RTOS is in a dormant state, and the subsequent time slices are divided according to the cycle in this way.

[0332] For the request triggering manner in the trigger mode, the wake-up request may be, but is not limited to, initiated by a device connected to the first operating system, or may be, but is not limited to, initiated by the second operating system.

[0333] In an optional embodiment, taking the device triggering the first operating system to wake up and run as an example, a wake-up strategy for the first operating system (such as RTOS) in a trigger mode is provided. Figure 9 is a second schematic diagram of the operation process of a first operating system according to an embodiment of the present application. As shown in Figure 9, the trigger mode can be started by an interrupt initiated by a device in the RTOS bus domain. The RTOS bus domain connects device 0 to device N. When the RTOS is in a dormant state, assuming that device 0 triggers an interrupt to the RTOS at a certain moment, the RTOS is immediately awakened. After awakening, the RTOS first triggers the interrupt of CPU core 0 to Linux. After receiving the interrupt, Linux first releases CPU core 0 and saves the scene (pushes the running data into the stack). Then the RTOS system schedules CPU core 0 to process the operation business indicated by the interrupt triggered by device 0. If it is currently in polling mode, the subsequent processing process is the same as the above polling mode, and will not be repeated here.

[0334] If the first operating system is triggered to wake up and run by the second operating system, if the second operating system is currently occupying the processor core allocated to the first operating system, the processor core can be directly released, and the first operating system can use the processor core to process the operating business allocated by the second operating system after waking up.

[0335] In an optional embodiment, the service running on the first operating system may include, but is not limited to, a service for generating a hardware interface signal. In this embodiment, a process for generating a hardware interface signal is provided, which includes the following steps:

[0336] Step 11: Obtain a request command through the first operating system.

[0337] In step 11, the request command may be a command for generating a hardware interface signal. For example, the hardware interface signal may be a PECI signal, and the request command is a PECI request command based on the PECI protocol.

[0338] Optionally, the hardware interface signal can also be a hardware interface signal of other protocol types, such as HDMI (high definition multimedia interface) signal, RGMII (reduced gigabit media independent interface, parallel bus) signal, SGMII (serial gigabit media independent interface, single-channel serial bus) signal, GPIO (general-purpose input / output, general-purpose input and output port) signal, SPI (serial peripheral interface, serial peripheral interface) signal, etc. On this basis, the request command can also be a request command of other protocol types. For example, when the hardware interface signal is a GPIO signal, the request command is a GPIO request command. This application does not specifically limit the optional types of request commands and hardware interface signals.

[0339] Step 12: Determine multiple logical bit information corresponding to the request command.

[0340] In step 12, after receiving the request command, the first operating system can analyze and obtain multiple logical bit information corresponding to the request command, wherein there is a sequence between the multiple logical bit information. The first operating system can generate a waveform signal (i.e., a hardware interface signal) corresponding to the request command through the multiple logical bit information corresponding to the request command, thereby transmitting the information contained in the request command to other devices through the hardware interface signal.

[0341] Optionally, the request command includes at least one field, each of which can be represented by a logical bit 0 or 1. On this basis, the corresponding conversion relationship between each field and the logical bit 1 or 0 is the logical bit information corresponding to the field. In the case where the request command corresponds to multiple fields, the request command corresponds to multiple logical bit information. In addition, each logical bit can be represented by a combination of a high-level signal and a low-level signal. For example, for a logical bit 0, a high-level signal of a first preset duration and a low-level signal of a second preset duration can be used to represent it. For a logical bit 1, a high-level signal of a second preset duration and a low-level signal of a first preset duration can be used to represent it, wherein the first preset duration and the second preset duration are different. On this basis, since each logical bit contains both a high-level signal and a low-level signal, each logical bit is actually represented by a waveform signal (the conversion between the high and low level signals is presented as a waveform). Since the request command corresponds to multiple logical bit information, that is, it corresponds to multiple logical bits, the hardware interface signal corresponding to the request command is a waveform signal obtained by combining the waveform signals corresponding to each logical bit information.

[0342] Step 13: Generate a hardware interface signal corresponding to the request command according to the plurality of logic bit information and the timer.

[0343] Optionally, the timer in step 13 may be a timing program in the first operating system, or a register on the chip where the first operating system resides, wherein the timer may at least provide a timing function and a counting function. This application utilizes the timing and counting functions of the timer, combined with multiple logic bit information, to generate a hardware interface signal corresponding to the request command.

[0344] It should be noted that, taking the BMC chip as an example and the PECI signal as the hardware interface signal, in the related art, in order to realize PECI communication between the BMC chip and components such as the CPU, the related art requires the BMC chip itself to have the hardware logic design of the PECI controller, which leads to the problem of high design cost of the BMC chip. In other words, in the related art, in order to generate a PECI signal on the BMC chip, the hardware logic design of the PECI controller must be implemented on the BMC chip in advance. In this application, only the first operating system is required to generate a PECI signal on the BMC chip, and there is no need to implement the hardware logic design of the PECI controller on the BMC chip, thereby reducing the design difficulty and design cost of the BMC chip.

[0345] Based on the contents of steps 11 to 13, it can be seen that in this embodiment, the first operating system is used to generate a hardware interface signal corresponding to the request command. First, the request command is obtained through the first operating system, and then the multiple logical bit information corresponding to the request command is determined. Finally, the hardware interface signal corresponding to the request command is generated based on the multiple logical bit information and the timer.

[0346] From the above content, it can be seen that in this embodiment, the hardware interface signal corresponding to the request command is generated by the first operating system, thereby realizing the technical effect of simulating the generation of hardware interface signals using software, and thus achieving the purpose of hardware logic design without the chip itself having relevant hardware interface signals, which not only reduces the design difficulty of the chip, but also reduces the design cost of the chip.

[0347] It can be seen that this embodiment achieves the purpose of using a software system to generate hardware interface signals without the need for hardware logic design of the chip, thereby reducing the design difficulty of the chip, and further solving the technical problem in related technologies that the chip itself needs to have a hardware logic design of the controller, resulting in high chip design costs.

[0348] Optionally, when a first request triggered by a second operating system is detected by the first operating system, request data is obtained, wherein the first operating system and the second operating system run on the same processor, the request data is generated by the second operating system, and the service response speed of the second operating system is slower than that of the first operating system. Finally, the first operating system parses the request data to obtain a request command.

[0349] Optionally, before obtaining the requested data, the requested data can be stored in the target memory (i.e., the storage space on the processor) through the second operating system, and after the requested data is stored, the first request is triggered through the second operating system, wherein the first request is used to notify the first operating system to read the requested data from the target memory, and the target memory is a memory that can be accessed by both the first operating system and the second operating system.

[0350] In an optional embodiment, the first operating system may further receive response data corresponding to the hardware interface signal, wherein the transmission format of the response data is the same as the transmission format of the hardware interface signal. The first operating system may further adjust the data structure of the response data to a second data structure.

[0351] In addition, after the data structure of the response data is adjusted to the second data structure, a second request is triggered through the first operating system, wherein the second request is used to notify the second operating system to read the response data.

[0352] For example, the first operating system is an RTOS system, the second operating system is a Linux system, and the hardware interface signal is a PECI signal. Regarding the command request process, the upper-layer application in the Linux system involved in PECI services (such as fault diagnosis and CPU temperature acquisition) first actively initiates PECI request commands as needed. These request commands include but are not limited to basic Ping() commands, commands to obtain CPU temperature, and commands to read MSR register (Machine Specific Register) information. The code implementation of different PECI request commands is completed by the corresponding interface function.

[0353] Optionally, the Linux system writes the target address, read / write length, command code, and para parameter of each request command into the target memory according to the PECI protocol specification. After all the request data has been written into the target memory, the Linux system generates a first request to notify the RTOS system. The first request may be an SGI interrupt request (a software generated interrupt request, a communication interrupt request between processor cores).

[0354] It should be noted that, in the process of storing the requested data in the target memory through the second operating system, the second operating system stores the requested data in the target memory in the form of a first data structure, wherein the first data structure includes at least a device address, a write length, a read length, a command code, and a request parameter. The device address is used to represent the address of the target device. The target device is a device that generates response data based on a hardware interface signal. The command code is used to distinguish different request commands. The write length is used to represent the number of bytes from the command code to the end of the request data. The read length is used to represent the number of bytes in the request data including the completion code and the read data. The request parameters are used to represent the parameters of the request command.

[0355] For the command response process, the RTOS system receives the response data from the PECI bus, and then completes the data parsing to convert the signal form of the response data from the form of the hardware interface signal to the form of the software signal. For example, the waveform changes between the high-level signal and the low-level signal in the hardware interface signal are identified to obtain the corresponding logical bit information, and the software signal data is obtained based on the logic information. The parsed response data is adjusted by the command parameter structuring module and written into the target memory. After all the parsed response data is written, the RTOS system triggers a second request to notify the Linux system. The Linux system detects the second request, actively reads the parsed response data stored in the target memory, and returns the data to the upper-level application after processing. Among them, the second request can be an SGI interrupt request.

[0356] In addition to shared memory, the target memory may also be other memories, such as random access memory (RAM), flash memory, and the like.

[0357] In an optional embodiment, after generating a hardware interface signal corresponding to the request command according to the logic bit information and the timer, the first operating system may convert the voltage of the hardware interface signal to obtain a target hardware interface signal.

[0358] Optionally, the first operating system may input the hardware interface signal into the voltage conversion device to obtain a target hardware interface signal output by the voltage conversion device.

[0359] Optionally, the voltage conversion device may be a CPLD, and the CPLD may be connected to a target device, wherein the target device may be a CPU in a server.

[0360] It should be noted that, in addition to being applicable to replacing the PECI interface to generate PECI signals, the above-mentioned service can also be applied to other hardware interfaces.

[0361] As can be seen from the above, the first operating system and the second operating system of the combined embedded system realize data interaction in the embedded system through inter-core interrupts and shared memory. A waveform generation function module for request commands is constructed in the RTOS system, and hardware interface signal communication between the embedded system and external devices is realized through software simulation. In addition, the high real-time characteristics of the RTOS system are fully utilized to ensure the accuracy of the timing when simulating the request command waveform, which is flexible and efficient. It can significantly reduce the difficulty of chip design. Since the hardware interface signals are generated by software simulation, more possibilities are provided for the optimized design between the communication function and other business functions in the embedded system. At the same time, since the controller specially configured to realize hardware interface signal communication is omitted in the chip, the design cost and manufacturing cost of the chip can be reduced.

[0362] In an optional embodiment, the service running on the first operating system may include, but is not limited to, a serial port switching service. In this embodiment, a serial port switching process is provided, which includes the following steps:

[0363] Step 21 : When it is detected that the second operating system receives the serial port switching instruction, the second operating system sends the serial port switching instruction to the first operating system.

[0364] Optionally, when the user initiates serial port switching, the second operating system can detect whether the serial port switching instruction initiated by the user is received. It should be noted that the serial port switching instruction needs to include information about the target serial port to be switched to, for example, the serial port switching instruction includes the serial port number of the target serial port to be switched to.

[0365] In an optional embodiment, the format of the serial port switching instruction can be<switch_command_app-n number-t sleep_time> , switch_command_app represents the switching command program, -n represents the target serial port number for switching, the value of number can be 1, 2, or 3, -t represents the time after which the switching action is performed after the command is initiated, and sleep_time is in seconds.

[0366] It should be noted that, when implementing serial port switching, the currently available serial ports can be numbered so that when performing serial port switching later, the target serial port can be switched by the serial port number.

[0367] In an optional embodiment, the serial ports that can currently be switched include: BMC Linux system serial port, server BIOS (Basic Input Output System) serial port and SMART NIC (network interface controller) serial port, and correspondingly, 1 can represent the BMC Linux system serial port, 2 represents the server BIOS serial port, and 3 represents the SMART NIC serial port.

[0368] Step 22: Execute serial port switching according to the serial port switching instruction through the first operating system.

[0369] Optionally, upon detecting that the second operating system has received a serial port switching instruction, the second operating system will immediately send the serial port switching instruction to the first operating system. It should be noted that the first operating system and the second operating system can be run on two separate processor cores, and inter-core communication can be used between the first and second operating systems to help improve the reliability of signal transmission.

[0370] It should be noted that the first operating system responds to instructions much faster than the second operating system, so the first operating system can quickly respond to the serial port switching instruction and complete the switching work in a very short time.

[0371] In summary, the serial port switching software function is implemented by replacing the CPLD or FPGA with the first operating system and the second operating system running on the same processor. When the second operating system receives a serial port switching instruction, the second operating system forwards the serial port switching instruction to the first operating system, and the first operating system implements serial port switching according to the serial port switching instruction, avoiding the need in the related art to connect each serial port through the CPLD or FPGA, and then use the switch structure in the CPLD or FPGA to implement serial port switching, reducing hardware costs, and after the first operating system receives the serial port switching instruction, the serial port switching can be completed quickly in a very short time. Therefore, the technical method proposed in this solution can not only effectively reduce the serial port switching cost, but also effectively improve the efficiency of serial port switching.

[0372] In order to enable the second operating system to implement serial port switching, in the serial port switching process provided in this embodiment, the serial port switching instruction includes at least: the serial port number of the target serial port. Before the serial port switching is executed by the first operating system according to the serial port switching instruction, the following steps are included: obtaining the parsing rules of the serial port switching instruction from the target memory through the first operating system; parsing the serial port number of the target serial port in the serial port switching instruction according to the parsing rules, and determining the device corresponding to the serial port number, wherein the target serial port is the serial port of the device, and the target serial port is connected to the chip.

[0373] Executing serial port switching according to the serial port switching instruction through the first operating system includes: determining the serial port address of the device through the first operating system; and mapping the target serial port to the target output interface of the chip according to the serial port address.

[0374] In order to enable the first operating system to implement serial port switching, the first operating system may parse the serial port switching instruction, and then obtain the device corresponding to the target serial port.

[0375] In an optional embodiment, the parsing rules for serial port switching instructions can be customized according to the chip or server motherboard, and the parsing rules can be stored in a target memory, which can be a storage medium such as an electrically erasable programmable read-only memory (EEPROM) or non-volatile memory (Flash). It should be noted that the target memory can be deployed in the chip or not. Storing the parsing rules in the target memory improves data security, and the parsing rules can be customized according to the chip or server motherboard, which improves programmability and scalability.

[0376] After receiving the serial port switching instruction, the first operating system reads the parsing rule of the serial port switching instruction from the target memory, and then uses the parsing rule to parse the serial port number of the target serial port in the serial port switching instruction to obtain the device corresponding to the serial port number.

[0377] After obtaining the device corresponding to the serial port number, the first operating system can map the target serial port to the target output interface of the chip through the serial port address of the device. After mapping the serial port address of the device to the target output interface, the device can be accessed through the target output interface.

[0378] It should be noted that the serial port switching instruction and parsing rules can be set according to the model of the chip used and the types of the first operating system and the second operating system.

[0379] In the serial port switching method provided in the first embodiment of the present application, the chip includes: a serial data bus. Before determining the serial port address of the device through the first operating system, the method also includes: determining multiple devices connected to the serial port of the serial data bus; mapping the serial port of each device to the memory of the chip through the serial data bus to obtain the serial port address of each device.

[0380] Optionally, the aforementioned chip also includes a serial data bus, and the TX and RX of the serial ports of multiple devices are currently connected to the serial data bus. For example, the current serial ports include the BMC Linux system serial port (UART1), the server BIOS serial port (UART2), and the SMART NIC serial port (UART3). UART, Universal Asynchronous Receiver / Transmitter. The serial port data bus maps the TX and RX data of the different serial ports UART1, UART2, and UART3 to different address spaces in the BMC memory. This is the aforementioned mapping of the serial port of each device to the chip's memory via the serial data bus. For example, the UART1 TX and RX buffers are the serial port address of serial port UART1, the UART2 TX and RX buffers are the serial port address of serial port UART2, and the UART3 TX and RX buffers are the serial port address of serial port UART3.

[0381] When the user issues a serial port switching instruction, the first operating system (RTOS) selects three different memory segments mapped by the UART (one out of three) and exchanges the data of one of the memory segments to the customer, thereby achieving the purpose of simulating the CPLD hardware serial port switching circuit.

[0382] It should be noted that if the serial ports of different devices cannot be distinguished, developers will not be able to accurately locate which device's serial port has a problem during maintenance. Therefore, it is necessary to locate the abnormal problem by switching the serial ports.

[0383] In this embodiment, after the target serial port is mapped to the target output interface of the chip according to the serial port address, if the target output interface is connected to the target smart network card, it includes: detecting through the smart network card whether an access request to the target serial port is received; if an access request to the target serial port is received, forwarding the access request to the target serial port through the smart network card.

[0384] Optionally, the target output interface of the chip can also be connected to a target smart network card. The smart network card then detects whether a user has received a request to access the target serial port. If so, the device's serial port can be directly accessed through the target smart network card, implementing SOL (Serial over LAN, a specification of data packet formats and protocols). These steps improve the efficiency of serial port access to the device.

[0385] In an optional embodiment, after mapping the target serial port to the target output interface of the chip according to the serial port address, the following steps are also included: obtaining the execution result of the serial port switching instruction through the first operating system, wherein the execution result is one of the following: switching success and switching failure; sending the execution result to the second operating system through the first operating system.

[0386] The execution result of the serial port switching instruction is received through the second operating system, wherein the execution result is sent from the first operating system to the second operating system, and the execution result is one of the following: serial port switching success and serial port switching failure.

[0387] After the first operating system switches the serial port, it will obtain the execution result of the serial port switching instruction, and then feed back the execution result of the serial port switching instruction to the second operating system to inform the second operating system of the success or failure of the serial port.

[0388] To improve the success rate of serial port switching, in this embodiment, after receiving the execution result of the serial port switching instruction via the second operating system, the method further includes: if the execution result is failure, repeatedly executing the step of sending the serial port switching instruction to the first operating system via the second operating system until the execution result is successful or the number of serial port switching executions exceeds a preset number. If the number of serial port switching executions exceeds the preset number, a prompt signal is triggered via the second operating system, wherein the prompt signal is used to indicate that the serial port switching has failed.

[0389] If the serial port switching instruction fails, the second operating system must repeat the step of sending the serial port switching instruction to the first operating system until the execution result is successful, or the number of serial port switching attempts exceeds a preset number, which can be set to three. If the number of serial port switching attempts exceeds the preset number, the corresponding second operating system triggers a prompt signal to indicate that the serial port switching failed, so that this situation can be handled promptly.

[0390] Before detecting that the first operating system has received a serial port switching instruction, the method also includes: after the second operating system is started, the second processor core triggers a first interrupt and sends a first signal to the first operating system; the first operating system detects the operating status of multiple serial ports in the chip based on the first signal to obtain a detection result; the first processor core triggers a second interrupt and sends the detection result to the second operating system through a second signal; and the second operating system receives the detection result to determine the number of serial ports in the chip that are operating normally.

[0391] After the second processor core triggers the first interrupt and sends the first signal to the first operating system, it detects whether the first operating system receives the first signal; if the first operating system receives the first signal, the first operating system detects the operating status of multiple serial ports in the chip to obtain a detection result.

[0392] After the second operating system is started, the second processor core triggers the first interrupt (IPI interrupt, IPI, inter-processor interrupts) to send the first signal to the first operating system. The first operating system can know from the first signal that the second operating system has started normally and can interact normally with the second operating system. The first operating system will detect the operating status of multiple serial ports in the chip based on the first signal to determine whether all serial ports are operating normally.

[0393] After the first operating system detects and obtains the detection result, the first processor core triggers a second interrupt to send the detection result to the second operating system via a second signal. The second operating system uses the detection result to determine the number of switchable serial ports (i.e., the number of serial ports that are operating normally) so that it can subsequently perform serial port switching on these serial ports. At the same time, in order to enable the first operating system to perform serial port switching more quickly, after the first operating system completes the detection, the first operating system begins to block and wait for the serial port switching instruction issued by the second operating system.

[0394] In an optional embodiment, the first operating system is RTOS, and when the second operating system is Linux, the first operating system runs on CPU0 and the second operating system runs on CPU1. The preparation steps before serial port switching include: when the Linux system on CPU1 starts to a specific stage, CPU1 will trigger an IPI interrupt to notify the RTOS system on CPU0 that Linux has started normally and can interact normally with the Linux on CPU1. After the RTOS system receives the IPI interrupt from CPU1, it will start the serial port switching controller program to check whether UART1, UART2, and UART3 are normal. Then CPU0 triggers another IPI interrupt to notify the Linux operating system on CPU1 that the RTOS system has been started. At the same time, the reported information includes the number of switchable serial ports owned by the RTOS operating system on CPU0. Then the RTOS operating system on CPU0 starts to block and wait for the switching instruction issued by the operating system on CPU1.

[0395] When an abnormality occurs in the operation of the second operating system, a serial port switching instruction is sent to the first operating system through the service terminal; and the first operating system executes the serial port switching according to the serial port switching instruction.

[0396] Because the second operating system runs many functions and handles a large amount of business, it may experience operational anomalies or require a restart. When the second operating system experiences an anomaly, a serial port switching instruction can be directly sent to the first operating system through the service terminal to ensure that the first operating system executes the serial port switching normally. It should be noted that the service terminal can be a terminal on the server where the chip is located.

[0397] Through the above steps, it is ensured that the first operating system does not rely on the second operating system to implement serial port switching, thereby improving the independence of the first operating system in executing serial port switching.

[0398] In summary, in the serial port switching process provided by this embodiment, the first operating system and the second operating system running in the same processor are used to replace the CPLD or FPGA to implement the serial port switching software function. When the second operating system receives a serial port switching instruction, the second operating system forwards the serial port switching instruction to the first operating system. The first operating system implements serial port switching according to the serial port switching instruction, avoiding the use of hardware to implement serial port switching and reducing hardware costs. After the first operating system receives the serial port switching instruction, it can quickly complete the serial port switching in a very short time. Therefore, the above process can not only effectively reduce the serial port switching cost, but also effectively improve the efficiency of serial port switching.

[0399] For the conditional triggering method in the trigger mode, the matching degree between the current operating business and the first operating system can be, but is not limited to, indicating whether the operating business generated on the processor is suitable for processing by the first operating system, and the suitable operating business is allocated to the first operating system for processing, thereby achieving a reasonable allocation of the operating business and improving the processing efficiency of the operating business.

[0400] In this embodiment, the first operating system can be controlled to run based on the processor in the following manner, but is not limited to: detecting business information of the current operating business generated on the processor; and controlling the first operating system to run the current operating business based on the processor when it is detected that the matching degree between the business information and the first operating system is higher than the matching degree threshold.

[0401] Optionally, in this embodiment, the matching degree between the operating business and the first operating system can be represented by, but not limited to, the matching degree between the business information of the operating business and the first operating system. The business information can be, but not limited to, any dimension with processing requirements, such as: business response speed, business resource occupancy rate, business coupling degree, business importance, etc.

[0402] Optionally, in this embodiment, if the degree of match between the service information and the first operating system is greater than a matching threshold, it can indicate that the service is suitable for running on the first operating system. The matching threshold can be, but is not limited to, dynamically adjusted based on the current resource usage or operating requirements of the first operating system. This increases the adaptability and flexibility of the first operating system.

[0403] In this embodiment, the business information of the current operating business generated on the processor can be detected in the following manner, but is not limited to: detecting the target response speed of the current operating business, and / or the target resource occupancy, wherein the business information includes: target response speed, and / or resource occupancy, the target response speed is the response speed that the current operating business requires the processor to achieve, and the target resource occupancy is the amount of resources that the current operating business requires the processor to provide; when the target response speed is less than or equal to the speed threshold, and / or the target resource occupancy is less than or equal to the occupancy threshold, it is determined that the matching degree between the business information and the first operating system is higher than the matching degree threshold.

[0404] Optionally, in this embodiment, the service information may include, but is not limited to, target response speed and / or resource usage. The target response speed is the response speed required by the processor for the current service operation, and the target resource usage is the amount of resources required by the processor for the current service operation. The current service operation's requirement for processor response speed may be considered separately, or the current service operation's requirement for available processor resources may be considered separately. Alternatively, both requirements may be considered together to allocate the current service operation.

[0405] In an optional implementation, the following methods may be used to allocate operating services and processing resources to each operating system, but are not limited to:

[0406] Allocating a group of to-be-allocated services to corresponding operating systems in the embedded system according to a dynamic resource allocation rule, wherein the dynamic resource allocation rule includes dynamically allocating resources based on at least one of the following: service response speed, service resource occupancy rate, service coupling degree, and service importance; the embedded system includes a first operating system and a second operating system, the first operating system and the second operating system running on a processor, and the response speed of the first operating system is higher than that of the second operating system;

[0407] Determining a resource allocation result corresponding to the set of to-be-allocated services, wherein the resource allocation result is used to indicate a processing resource corresponding to each to-be-allocated service in the set of to-be-allocated services among processing resources of a processor, the processing resources of the processor including a processor core;

[0408] The processing resources of the processor are allocated to the first operating system and the second operating system according to the operating system corresponding to each to-be-allocated service and the resource allocation result.

[0409] During the operation of the processor, a set of services to be allocated can be obtained, that is, services to be allocated to the first operating system and the second operating system. Since different services to be allocated may differ in terms of response speed, service resource occupancy rate, service coupling with other services, service importance, etc., resource dynamic allocation rules can be pre-configured. The resource dynamic allocation rules may include rules for performing service allocation, allocating services to corresponding operating systems so that the processing resources of the corresponding operating systems can execute the services allocated to themselves. Optionally, the resource dynamic allocation rules may include dynamically allocating resources based on at least one of the following: service response speed, service resource occupancy rate, service coupling degree, service importance. Different allocation rules may have corresponding priorities. For example, the priorities are in the following order from high to low: service importance, service coupling degree, service response speed, service resource occupancy rate. According to the source dynamic allocation rules, a set of services to be allocated (or tasks to be allocated, different services to be allocated may correspond to different processes) can be allocated to the corresponding operating systems in the embedded system to obtain service allocation results.

[0410] Optionally, based on the response time constraint, the first operating system can be an operating system with clear and fixed time constraints. All processing processes (task scheduling) need to be completed within the fixed time constraints, otherwise the system will fail. It can be a real-time operating system (RTOS), such as FreeRTOS, RTLinux, etc., or a real-time operating system in other embedded systems. The second operating system does not have this feature. The second operating system generally adopts a fair task scheduling algorithm. When the number of threads / processes increases, the CPU time needs to be shared. Task debugging is uncertain. It can be called a non-real-time operating system, such as contiki, HeliOS, Linux (full name GNU / Linux, a freely distributable Unix-like operating system), etc. It can also be a non-real-time operating system in other embedded systems. Among them, the Linux system is a multi-user, multi-tasking operating system based on POSIX (Portable Operating System Interface) that supports multi-threading and multi-CPU.

[0411] Correspondingly, the business assigned to the first operating system is usually a real-time business. A real-time business refers to a business that needs to be scheduled within a specified time. The business requires the processor to process it at a fast enough speed, and the processing results can control the production process or respond quickly to the processing system within the specified time. As a typical scenario, the control of a robot arm in industrial control is a real-time business. The system needs to take timely measures before detecting an erroneous operation of the robot arm, otherwise serious consequences may result. The business assigned to the second operating system is usually a non-real-time business. A non-real-time business refers to a business that is not sensitive to scheduling time and has a certain tolerance for scheduling delays, for example, reading sensor data from a temperature sensor in a server.

[0412] It should be noted that a real-time operating system is an operating system that can accept and process external events or data at a fast enough speed when they occur, and the processing results can control the production process or respond quickly to the processing system within the specified time, dispatch all available resources to complete real-time business, and control the coordinated operation of all real-time businesses. It has the characteristics of timely response and high reliability.

[0413] After each to-be-allocated service is assigned to a corresponding operating system, corresponding processing resources can be allocated to each to-be-allocated service based on the service allocation results, resulting in a resource allocation result corresponding to a group of to-be-allocated services. When allocating processing resources to the to-be-allocated services, services assigned to a first operating system can be allocated the processing resources of the first operating system, while services assigned to a second operating system can be allocated the processing resources of the second operating system. Furthermore, considering load balancing, if unallocated processing resources exist, some services can be allocated the unallocated processing resources.

[0414] The processing resources of the processor can be dynamically allocated in units of time slices. Taking into account the frequent switching of the operating systems to which the processing resources belong and the fact that the business processing time is not necessarily an integer multiple of the time slice, which leads to the extension of the response time of some businesses, the processing resources can be allocated to the first operating system and the second operating system in units of processor cores. That is, the processor cores of the processor are allocated to the corresponding operating systems in units of the entire processor core. The number of processor cores allocated to each operating system is an integer, and the processor cores allocated to different operating systems are different.

[0415] Based on the operating system corresponding to each to-be-allocated service and the resource allocation result, the processing resources of the processor can be allocated to the first operating system and the second operating system. Optionally, the unallocated processing resources of the processor can be allocated to the corresponding operating system. The unallocated processing resources can be determined based on the correspondence between the unallocated processing resources and the to-be-allocated services, and the correspondence between the to-be-allocated services and the operating systems.

[0416] Optionally, allocating the processor's processing resources to the first operating system and the second operating system can be performed by a resource adaptive scheduling module (e.g., a core adaptive scheduling module). The resource adaptive scheduling module can be a software module running on the first operating system or the second operating system. Taking running on the second operating system as an example, the resource adaptive scheduling module can be implemented by software in the Linux system. It can complete the actual scheduling of the processor's processing resources (e.g., processor hard core resources) based on the output of the business management module and the output of the resource dynamic allocation module. For example, after resource scheduling by the core resource adaptive module, M cores out of (M+N) cores are scheduled to the real-time operating system, and N cores are scheduled to the non-real-time operating system.

[0417] For example, heterogeneous operating systems (heterogeneous operating systems) can be run on different cores of the same processor, enabling the entire processor system to process both real-time and non-real-time services in parallel. Furthermore, by adaptively adjusting the processor core resources (e.g., processor cores) occupied by different operating systems, processor resource utilization can be significantly improved. Here, heterogeneity refers to the different types of operating systems running on the same multi-core processor in an embedded system, and multi-system refers to the number of operating systems running on the same multi-core processor in an embedded system, and these operating systems run simultaneously in the time dimension.

[0418] Optionally, the above process further includes: generating a rule structure by reading a rule configuration file, wherein the rule structure is used to record the resource dynamic allocation rule.

[0419] Dynamic resource allocation rules can be configured based on a rule configuration file. By reading the rule configuration file, a rule structure for recording dynamic resource allocation rules can be generated. Here, the rule configuration file can be a load balancing policy file (payload_balance.config). The load balancing policy file can be used to configure the classification method of various running services (or processes), the evaluation principle of the real-time level, etc. The dynamic resource allocation rules can be configured with different parameters in the load balancing policy file. An example of a load balancing policy configuration file is as follows:

[0420] classificationkinds=2 / / A value of 1 means that processes are classified according to attributes such as important and non-important. Otherwise, processes are classified according to the preset classification method (such as real-time and non-real-time);

[0421] real-time grade evaluation = 2 / / A value of 1 indicates that the average CPU usage in the past statistical minutes is used as the process real-time grade evaluation principle; otherwise, the preset priority is used as the process real-time grade evaluation principle;

[0422] statistic minutes = 5 / / represents the statistical time (in minutes) for the average occupancy of each process. This value is valid when real-time grade evaluation is 1.

[0423] Optionally, the dynamic resource allocation rules can be stored in a load balancing policy module. Here, the load balancing policy module can be a software module running under the first operating system or the second operating system (for example, a software module running under the Linux system), which can provide policy guidance for the service management module, including classification methods for various services (or processes) running in the system, evaluation principles for real-time levels, etc. The service management module can divide and manage the services in the system according to the real-time level, and optionally guide the resource adaptive scheduling module to reallocate processor resources. Exemplarily, it can perform actual classification of services based on the output of the load balancing policy module and generate a list containing real-time services and non-real-time services.

[0424] It should be noted that the above classification methods and real-time performance evaluation principles are open-ended. Users can define their own methods or principles. The rules underlying service management in the service management module can be dynamically configured, allowing for optional rules to be set based on existing rules. The service management module can configure multiple rules with the same functionality without conflicts between them. Specifically, rule selection criteria, such as the time of configuration and priority, can be used to determine which rule is currently in use among rules with the same function, thus avoiding conflicts between rules. The load_balance.config configuration file described above illustrates one possible scenario. In the configuration file, the classification_kinds variable indicates the optional classification criteria (e.g., by service importance or real-time performance) and classification categories (e.g., critical services vs. general services, real-time services vs. non-real-time services), while the real-time_grade_evaluation variable indicates the real-time performance evaluation criteria (e.g., average CPU utilization over the past statistic_minutes or a preset service priority). The real-time performance grade type is user-defined and can be defined as high, normal, or low, or further subdivided.

[0425] The output of the load balancing strategy module is the configured classification method, real-time level evaluation principle, etc. When implemented in software, it can be an optional configuration file (such as the load_balance.config file) or a structure variable. These files or structure variables can ultimately be accessed by the business management module to obtain the optional load balancing strategy.

[0426] Through this embodiment, by reading the rule configuration file, a rule structure is generated to record the resource dynamic allocation rule, which can improve the convenience of information configuration.

[0427] Optionally, the above process also includes: obtaining a rule update configuration file through the external interface of the second operating system, wherein the rule update configuration file is used to update the configured resource dynamic allocation rules; using the rule update configuration file to update the rule structure to update the resource dynamic allocation rules recorded in the rule structure.

[0428] The rule structure can be in a fixed format, meaning it cannot be modified while the embedded system is running, or it can be in a flexibly configurable format, meaning it can be modified via a configuration file in a specific format. In this embodiment, a rule update configuration file can be obtained, which is used to update the configured dynamic resource allocation rules. Using the rule update configuration file, the rule structure can be updated, thereby updating the dynamic resource allocation rules recorded in the rule structure.

[0429] When using a rule update configuration file to update a rule structure, you can directly generate a new rule structure based on the rule update configuration file and use the newly generated rule structure to replace the existing rule structure, or you can use the parameter values ​​of the rule parameters indicated by the rule update configuration file to update the parameter values ​​of the corresponding rule parameters in the rule structure.

[0430] Optionally, the configuration file in a specific format can be read through the external interface of the first operating system or the second operating system. Considering the volume of services to be processed, dynamic resource scheduling of the embedded system can be primarily handled by the second operating system. When obtaining the rule update configuration file, the rule update configuration file can be obtained through the external interface of the second operating system.

[0431] For example, the load balancing policy module may be in a fixed format or may be configured through an external interface of the Linux system. For example, a configuration file (load_balance.config) in a specific format as described above may be defined, and configuration changes may be made through file reading and writing.

[0432] It should be noted that the external interface refers to the multi-core processor's external interface and can be a network interface, an SPI (Serial Peripheral Interface) controller interface, a UART (Universal Asynchronous Receiver / Transmitter) serial port, or any other means of accessing data from the outside world. The hardware used to read files and the file location vary depending on the implementation. For example, a network interface can be used to load configuration files from the World Wide Web (WWW) interface; an SPI controller can be used to read configuration files from the board's SPI Flash; and a UART serial port can be used to retrieve configuration files from a serial data transmission and reception software tool on another PC (Personal Computer).

[0433] Through this embodiment, by obtaining a rule update configuration file and using the obtained rule update configuration file to update the rule structure, the flexibility of resource dynamic allocation rule configuration can be improved.

[0434] Optionally, a group of to-be-allocated services can be allocated to corresponding operating systems in an embedded system according to dynamic resource allocation rules in the following manner, but is not limited to: a group of to-be-allocated services whose service response speed requirements are greater than or equal to a set response speed threshold are allocated to a first operating system, and a group of to-be-allocated services whose service response speed requirements are less than a set response speed threshold are allocated to a second operating system.

[0435] When allocating pending services, the services can be assigned to corresponding operating systems based on their response speed requirements. Service response speed can be used to assess the real-time performance of a service. The higher the service response speed requirement, the more sensitive it is to the operating system's scheduling time and response speed. Services with high response speed requirements require the operating system to process them quickly enough, and their processing results must be sufficient to control the production process or respond quickly to the processing system within the specified timeframe. Services with lower response speed requirements, on the other hand, have a certain tolerance for scheduling delays.

[0436] For the services to be allocated whose service response speed requirement is greater than or equal to the set response speed threshold, they are sensitive to the scheduling time and response speed of the operating system, and such services to be allocated can be allocated to the first operating system (for example, real-time services are allocated to the real-time operating system). For the services to be allocated whose service response speed requirement is less than the set response speed threshold, they are not sensitive to the response speed and scheduling time, and therefore, such services to be allocated can be allocated to the second operating system (for example, non-real-time services are allocated to the non-real-time operating system). Here, the service response speed requirement can be indicated by an indication parameter of the service response speed, and the set response speed threshold can be a millisecond-level response speed threshold or a second-level response speed threshold, for example, 100ms, 200ms, 1s, etc. There is no limitation on the set response speed threshold in this embodiment.

[0437] Optionally, when a group of to-be-allocated services are allocated to corresponding operating systems in an embedded system, a first service list corresponding to the first operating system and a second service list corresponding to the second operating system can be output. The first service list is used to record the services allocated to the first operating system, and the second service list is used to record the services allocated to the second operating system. That is, the service allocation result includes the first service list and the second service list. The output first service list and the second service list can be used to perform a dynamic scheduling process of the processor's processing resources.

[0438] For example, the real-time level of system services is classified to obtain a list of real-time services and non-real-time services. Assume that there are 20 services in total, of which real-time services are services 1 and 2, and non-real-time services are services 3 to 20.

[0439] Here, the business management module can classify the currently pending businesses. When the BMC system first runs, since all the businesses currently to be run are known to the system, the business management module classifies these businesses based on the output of the load balancing module. After classification, different businesses will be assigned to different operating systems (RTOS system and Linux system) for execution. During subsequent operations, if the number of business processes changes (for example, some processes hang or new processes are started), the business management module will continue to divide the businesses, dividing and managing existing businesses in real time according to the load balancing strategy. The business management module can be a resident process in the Linux system. It is always running and manages and divides the currently running processes.

[0440] Through this embodiment, by allocating the services to be allocated to the corresponding operating systems according to the service response speed requirements, the timeliness of the service response for the services that are sensitive to the scheduling time can be guaranteed.

[0441] Optionally, a group of to-be-allocated services can be allocated to corresponding operating systems in an embedded system according to dynamic resource allocation rules in the following manner, but is not limited to: allocating to-be-allocated services whose service resource occupancy rate in a group of to-be-allocated services is less than a first occupancy rate threshold to a first operating system, and allocating to-be-allocated services whose service resource occupancy rate in a group of to-be-allocated services is greater than or equal to the first occupancy rate threshold to a second operating system.

[0442] When allocating pending services, the pending services can be allocated to the corresponding operating system based on the service resource occupancy rate of the pending services. The service resource occupancy rate can be the average proportion of the service to the processing resources per unit time (for example, the CPU occupancy rate per minute). The level of the service resource occupancy rate affects the response speed of the service and the response speed of subsequent services. Therefore, the real-time level of the service can be evaluated based on the service resource occupancy rate. The higher the service resource occupancy rate, the greater the impact on the scheduling time and response speed of the operating system, and the lower the real-time level. For services with low service resource occupancy rates, the impact on the scheduling time and response speed of the operating system is not significant, and the real-time level is higher.

[0443] For services to be allocated whose service resource occupancy rate is less than the first occupancy rate threshold, their impact on the scheduling time and response speed of the operating system is not significant, and such services to be allocated can be allocated to the first operating system. For services to be allocated whose service resource occupancy rate is greater than or equal to the first occupancy rate threshold, their impact on the scheduling time and response speed of the operating system is greater, and therefore such services to be allocated can be allocated to the second operating system. Here, the first occupancy rate threshold can be configured as needed, and can be 10%, 15%, 20% or other thresholds. At the same time, the first occupancy rate threshold can be dynamically adjusted.

[0444] Through this embodiment, by allocating the services to be allocated to the corresponding operating systems according to the service resource occupancy rates, it is possible to ensure timeliness of response to services with low service resource occupancy rates.

[0445] Optionally, a group of services to be allocated may be allocated to corresponding operating systems in the embedded system according to a dynamic resource allocation rule in at least one of the following ways, but not limited to:

[0446] Allocating to-be-allocated services, among a group of to-be-allocated services, whose service coupling degree with services already allocated to the first operating system is greater than or equal to a first coupling degree threshold, to the first operating system;

[0447] To-be-allocated services whose service coupling degree with services already allocated to the second operating system is greater than or equal to a second coupling degree threshold in a group of to-be-allocated services are allocated to the second operating system.

[0448] When allocating pending services, the services can be assigned to corresponding operating systems based on their business coupling. Business coupling indicates the degree of correlation between the pending services and the already allocated services in each operating system. If a pending service has a high business coupling with an already allocated service in one operating system, it is not appropriate to allocate it to another operating system. Therefore, the pending services can be allocated to corresponding operating systems based on their business coupling with the already allocated services in each operating system.

[0449] Optionally, the business coupling degree can be evaluated by the association between the input and output of the business. The business coupling degree can be represented by different coupling degree levels. If there is no relationship between the input and output of the business, the coupling degree level is low (or other coupling degree levels indicating that there is no association between the businesses). If the execution of a business depends on the output of another application (the business cannot start without the output as input), the coupling degree level between the businesses is high. If the execution of a business uses the output of another application, but the output does not hinder the normal execution of the business (the output can be obtained when the business executes the corresponding operation, and the corresponding operation is not a core operation), the coupling degree level between the businesses is medium. In addition, the business coupling degree can also be represented by a numerical value. The business coupling degree can be evaluated by one or more coupling degree conditions (for example, the association relationship between input and output), and the numerical value corresponding to the satisfied coupling degree condition is determined as the numerical value of the business coupling degree.

[0450] If there is a business to be allocated in a group of businesses to be allocated whose business coupling degree with the allocated business of the first operating system is greater than or equal to the first coupling degree threshold, then such business to be allocated can be allocated to the first operating system. If there is a business to be allocated in a group of businesses to be allocated whose business coupling degree with the allocated business of the second operating system is greater than or equal to the first coupling degree threshold, then such business to be allocated can be allocated to the second operating system.

[0451] For example, in addition to generating a list of real-time services and a list of non-real-time services, the service management module is also responsible for service decoupling evaluation and management, that is, finding out from all real-time services which can be independently handed over to the real-time operating system for running, so that the hardware resource dynamic allocation module can reallocate processor resources. For services that cannot be independently handed over to the real-time operating system for running, if they have a high degree of service coupling with non-real-time services, they can be allocated to the non-real-time operating system.

[0452] Here, some services, while requiring real-time performance, frequently interact with other non-real-time services in the system (i.e., they are highly coupled). To improve overall data interaction efficiency, these services are assigned to the non-real-time operating system. However, some real-time services are relatively independent and can simply be assigned to the real-time operating system. This process is known as "decoupling." There are various criteria for determining service decoupling; they can be based on the closeness of the relationships between the aforementioned services or other user-related metrics.

[0453] The reallocation strategy is open. One possible strategy is: when the system runs for the first time, processor cores are allocated according to the ratio of the number of services allocated to the real-time operating system and the non-real-time operating system by the service management module. During subsequent operation, resource allocation is adjusted according to the core resource occupancy rate of each system in the dual system. From this perspective, the reallocation process and the core preemption and release process are mutually coordinated processes.

[0454] Through this embodiment, by allocating the services to be allocated to the corresponding operating systems according to the service coupling degrees, the accuracy of service processing for multiple services with high service coupling degrees can be guaranteed.

[0455] Optionally, a group of services to be allocated may be allocated to corresponding operating systems in the embedded system according to a dynamic resource allocation rule in the following manner, but is not limited to:

[0456] Allocating a group of to-be-allocated services containing sensitive information to a target operating system, wherein the target operating system is an operating system of the first operating system and the second operating system that interacts less frequently with a user object.

[0457] In this embodiment, for the to-be-assigned business containing sensitive data (for example, sensitive information such as passwords) (which may be an important sensitive business, such as a business that is not desired to be exposed to users), it can be assigned to the target operating system, and the to-be-assigned business containing sensitive information is isolated by the target operating system at a hard-core level of security protection. Here, the target operating system is the operating system with a low frequency of interaction with the user object between the first operating system and the second operating system, or the operating system with a fast response speed, for example, the first operating system.

[0458] For example, the business processing module is responsible for the optional hard-core level security isolation of system services, that is, dividing important sensitive services (which do not want to be exposed to users) into real-time services, and ultimately achieving the unloading of these services from non-real-time operating systems to real-time operating systems, thereby achieving the effect of security protection. Here, the different services divided by the business processing module can be organized in the form of structures during software implementation. By designing the security space between heterogeneous operating systems, sensitive services are unloaded from non-real-time operating systems to real-time operating systems, achieving the purpose of hard-core level security protection. Here, sensitive services refer to: security-related services, such as user passwords, identity information, and other services involving user personal privacy.

[0459] Here, the hard-core level refers to the isolation of services at the processor core level. Specifically, sensitive services are assigned to the real-time operating system (RTOSs occupy different cores than non-RTOSs, so this is considered core-level isolation). Compared to non-RTOSs, RTOSs interact with users less frequently and to a lesser degree, making it difficult for users to "detect" sensitive data generated by services running on them. For upper-layer applications, services such as user identity authentication management and secure encryption are considered these critical sensitive services. These services are forcibly classified as real-time services through the service management module. Subsequent dynamic allocation of hardware resources allows these services to run on the RTOS, achieving a secure isolation effect.

[0460] Through this embodiment, by allocating the to-be-assigned business containing sensitive information to an operating system with a low frequency of user interaction, the system business can be isolated for hard-core security protection, thereby improving the security of business execution.

[0461] Optionally, the resource allocation result corresponding to a group of services to be allocated may be determined in the following manner, but is not limited to:

[0462] A mapping table between a group of services to be allocated and the processing resources of the processor is generated according to the allocation results of the group of services to be allocated and combined with the resource utilization of the processing resources of the first operating system and the resource utilization of the processing resources of the second operating system.

[0463] In this embodiment, the allocation results for a set of pending services are used to indicate the correspondence between the pending services and operating systems. A pending service assigned to an operating system is typically executed using the processing resources of that operating system. However, if the volume of services assigned to a particular operating system is excessive and there are currently unallocated processing resources, the unallocated processing resources may be allocated to the pending services assigned to that operating system. Therefore, based on the allocation results for a set of pending services, combined with the resource utilization of the processing resources of the first operating system and the resource utilization of the processing resources of the second operating system, a mapping table of a set of pending services and processor processing resources can be generated to indicate the processing resources allocated to each pending service.

[0464] Here, each service to be assigned is mapped to only one processor core, while the same processor core can be mapped to multiple services. Different services can be mapped to the same processor core by occupying different time slices of the same processor core. At any given time, the same processor core is occupied by only one service, meaning it is used to execute only one service. Different services assigned to an operating system can determine the time slices they occupy on the same processor resource based on the allocation time, service response speed requirements, or other methods.

[0465] For example, the dynamic resource allocation module dynamically adjusts processor resources based on the output of the service management module, creating a mapping table between different services and actual hardware resources. This optimizes the deployment structure of different hardware resources under heterogeneous operating systems to improve overall system hardware resource utilization. This dynamic resource allocation process is managed and configured by software in the second operating system.

[0466] Taking an eight-core processor (core 1 to core 8) as an example, the processor cores scheduled to the first operating system include: core 1, and the processor cores scheduled to the second operating system include: core 2, core 3 and core 4. There are 6 services to be allocated, real-time services are services 1 and 2, and non-real-time services are services 3 to 6. Corresponding processor cores are allocated to the 6 services, core 1 is allocated to service 1, core 5 is allocated to service 2, core 2 is allocated to service 3, core 3 is allocated to service 4, core 4 is allocated to service 5, and core 6 is allocated to service 6.

[0467] Through this embodiment, based on the correspondence between services and operating systems, and in combination with the usage of processing resources of different operating systems, dynamic allocation of processing resources is performed, thereby ensuring the rationality of processing resource allocation.

[0468] Optionally, the processing resources of the processor can be allocated to the first operating system and the second operating system according to the operating system corresponding to each to-be-allocated business and the resource allocation result in the following manner, but not limited to: when it is determined according to the resource allocation result that there is a corresponding to-be-allocated business among the unallocated processing resources of the processor, the unallocated processing resources are allocated to the operating system to which the to-be-allocated business corresponding to the unallocated processing resources is allocated.

[0469] When allocating processing resources, if there is a corresponding to-be-allocated business for the unallocated processing resources in the processor's processing resources, that is, the unallocated processing resources are allocated to the to-be-allocated business, the unallocated processing resources can be allocated to the operating system to which the to-be-allocated business corresponding to the unallocated processing resources is allocated.

[0470] Optionally, the resource adaptive scheduling module can perform actual scheduling of the processor's processing resources based on the results of the dynamic allocation of hardware resources. The resource adaptive scheduling module schedules a portion of the processor cores, such as the M cores in core group 1, to execute services assigned to the first operating system, and schedules the remaining processor cores, such as the N cores in core group 2, to execute services assigned to the second operating system.

[0471] Taking the aforementioned eight-core processor as an example, based on the service allocation and resource allocation results, unassigned core 4 can be assigned to the first operating system, and unassigned cores 5 and 6 can be assigned to the Linux system. The entire scheduling process can be led by the second operating system.

[0472] Through this embodiment, unallocated processor resources are scheduled to the corresponding operating system based on the resource allocation result, which can improve the utilization rate of the processor resources.

[0473] After the first operating system finishes running, it can be controlled to enter a dormant state. For example, the first operating system can be controlled to enter a dormant state after the first operating system finishes running.

[0474] The end of the operation of the first operating system may be the end of an operation cycle, the completion of a wake-up request process, or the completion of a current operation service process.

[0475] After the first operating system goes into hibernation, the second operating system can occupy the processor core allocated to the first operating system, thereby improving resource utilization. For example, after controlling the first operating system to go into hibernation after completion of operation, the second operating system is notified to allow the second operating system to occupy the processor core used by the first operating system. The second operating system is configured to add the target processor core used by the first operating system to the scheduling resource pool of the second operating system during the hibernation period of the first operating system. The scheduling resource pool includes all processors in the processor pool except the target processor core.

[0476] Optionally, in this embodiment, the method of notifying the second operating system of its permission to occupy the processor core used by the first operating system may include, but is not limited to, sending an interrupt request to the second operating system. After the first operating system goes into hibernation, it sends an interrupt request to the second operating system to notify it of its permission to occupy the processor core used by the first operating system. The second operating system responds to the interrupt request by adding the target processor core used by the first operating system to the scheduling resource pool for scheduling and use.

[0477] In one exemplary embodiment, the operating services executed on the second operating system may be monitored, but is not limited to monitoring. If an abnormal operating service is detected, the first operating system may take over the operation of the abnormal operating service, thereby preventing the abnormal operating service from affecting the entire processing process and improving the success rate and efficiency of the service operation. For example, the operating services executed on the second operating system may be monitored; if an abnormal operating service is detected in the operating services executed on the second operating system, the abnormal operating service may be taken over by the first operating system.

[0478] Optionally, in this embodiment, the processor or the first operating system can monitor the second operating system, but is not limited to the first operating system. The monitored abnormal operation business (such as the operation business where the business thread is hung) is taken over by the first operating system. Alternatively, the monitored abnormal operation business can be assigned to the operating system with a higher degree of matching with the abnormal operation business among the multiple operating systems to take over.

[0479] Optionally, in this embodiment, the manner of monitoring the operating service executed on the second operating system may include, but is not limited to, monitoring of heartbeat signals, monitoring of service logs, etc. For example, if monitoring detects that an abnormality log is generated, it is determined that the operating service is abnormal.

[0480] In an exemplary embodiment, the operating business executed on the second operating system can be monitored in the following manner, but is not limited to: receiving a heartbeat signal of each operating business executed on the second operating system; and determining an operating business whose frequency of the heartbeat signal does not meet the corresponding target frequency as an abnormal operating business.

[0481] Optionally, in this embodiment, each operating service executed on the second operating system will generate a heartbeat signal, and the heartbeat signals of different operating services have different frequencies. The heartbeat signal of each operating service executed on the second operating system is connected to the monitoring party of the operating service, such as the processor or the first operating system, and the frequency of the connected heartbeat signal is compared with the target frequency corresponding to the operating service. The operating service whose heartbeat signal frequency does not meet the corresponding target frequency is taken over as an abnormal operating service.

[0482] Optionally, in this embodiment, whether the frequency of the heartbeat signal and the corresponding target frequency are consistent can be determined by, but is not limited to, comparing whether the two are completely consistent. If they are completely consistent, it is determined to be consistent; otherwise, it is determined to be inconsistent. Alternatively, it is also possible, but is not limited to, to provide a certain error range and determine whether the frequency of the heartbeat signal is consistent by comparing whether it falls within the error range of the target frequency. If it falls within the error range, it is determined to be consistent; otherwise, it is determined to be inconsistent.

[0483] In an exemplary embodiment, after the abnormal operation service is taken over by the first operating system, the abnormal operation service on the second operating system may be restarted in the following manner, but is not limited to: sending a restart instruction to the second operating system, wherein the restart instruction is used to instruct to restart the abnormal operation service.

[0484] Optionally, in this embodiment, the restart instruction is used to instruct to restart the abnormal operation service. After receiving the restart instruction, the second operating system may initialize the abnormal operation service until it is restarted.

[0485] Optionally, in this embodiment, after the abnormal operation business on the second operating system is resumed, the first operating system can return the taken-over abnormal operation business to the second operating system. The first operating system can save the current running scene of the abnormal operation business to the shared memory and send an interrupt request to the second operating system. The second operating system reads the current running scene of the abnormal operation business from the shared memory and loads it into the abnormal operation business it is running, so that the abnormal operation business can continue to run, thereby improving the business operation efficiency.

[0486] FIG10 is a schematic diagram of a system abnormality monitoring process according to an embodiment of the present application. As shown in FIG10 , a first operating system receives a heartbeat signal from an operating service executed on a second operating system. If an abnormal operating service is detected whose heartbeat signal frequency does not meet a target frequency, the first operating system will take over the abnormal operating service on the second operating system and continue to execute it. The first operating system then sends a restart instruction to the second operating system, enabling the second operating system to restart the abnormal operating service.

[0487] In an exemplary embodiment, the dual system may be started in the following manner, but is not limited to: booting the first operating system; booting the second operating system.

[0488] Optionally, in this embodiment, the first operating system is booted first, and then the second operating system is booted. The first operating system can be, but is not limited to, an operating system with a faster and simpler startup process. During the startup of the second operating system, the first operating system can execute some urgent or operating services that help the second operating system to start, thereby improving the startup efficiency of the operating system or improving the processing efficiency of the operating services.

[0489] Optionally, in this embodiment, the first operating system and the second operating system may be, but are not limited to, started successively, the first operating system may be, but are not limited to, started faster than the second operating system, the first operating system may also be, but are not limited to, having simpler conditions required for starting than the second operating system, and after the first operating system is started, services that can meet the conditions required for starting the second operating system or can speed up the startup of the second operating system can be run, thereby enabling multiple systems to start and run services more efficiently and quickly.

[0490] For example: after booting the first operating system, the first operating system can run services that can control the chip environment parameters to meet the startup requirements of the second operating system (such as fan operation, parameter control, etc.), so that the chip environment parameters can quickly reach the environment for the startup and operation of the second operating system, thereby improving the startup efficiency and operation efficiency of the operating system.

[0491] Optionally, in this embodiment, the first operating system may be, but is not limited to, booted by the boot program of the first operating system, and the second operating system may be, but is not limited to, booted by the boot program of the second operating system. Alternatively, both operating systems may be booted and started sequentially by the same boot program.

[0492] In an exemplary embodiment, the first operating system can be booted in the following manner but is not limited to: the chip is powered on, and the first processor core allocated to the first operating system in the processor is awakened by the processor; and the boot program of the first operating system is executed by the first processor core to boot the first operating system.

[0493] Optionally, in this embodiment, the first processor core of the first operating system can be determined based on, but not limited to, the processor core of the processor where the first operating system is located. For example, the processor where the first operating system is located can include, but is not limited to, multiple processor cores (processor core 0 to processor core N), and one or more processor cores (such as processor core 0) among the multiple processor cores can be allocated to the first operating system as the first processor core of the first operating system.

[0494] Optionally, in this embodiment, the boot program of the first operating system may be, but is not limited to, stored in a specific storage space on the chip specifically for starting the first operating system.

[0495] Optionally, in this embodiment, the first processor core of the first operating system may be, but is not limited to, configured to execute a boot program of the first operating system, and may be, but is not limited to, starting the first operating system by executing the boot program of the first operating system.

[0496] In an exemplary embodiment, the first operating system can be booted by executing the boot program of the first operating system through the first processor core in the following manner, but is not limited to: executing a secondary program loader through the first processor core, wherein the boot program of the first operating system includes a secondary program loader; and loading the first operating system through the secondary program loader.

[0497] Optionally, in this embodiment, the boot program of the first operating system may include, but is not limited to, a secondary program loader, and the first processor core may load the first operating system by, but is not limited to, executing the secondary program loader (SPL).

[0498] In an exemplary embodiment, the second operating system can be booted in the following manner but is not limited to: waking up the second processor core allocated to the second operating system through the secondary program loader; and booting the second operating system by executing the boot program of the second operating system through the second processor core.

[0499] Optionally, in this embodiment, the second processor core of the second operating system can be determined based on, but not limited to, the processor core of the processor where the second operating system is located. For example, the processor where the second operating system is located can include, but is not limited to, multiple processor cores (processor core 0 to processor core N), and one or more processor cores (processor core 1 to processor core N) among the multiple processor cores can be allocated to the second operating system as the second processor core of the second operating system.

[0500] Optionally, in this embodiment, the second processor core of the second operating system may be awakened using, but not limited to, the secondary program loader. For example, after the first operating system is loaded using the secondary program loader, the second processor core of the second operating system may be awakened using, but not limited to, the secondary program loader. Alternatively, while the first operating system is being loaded using the secondary program loader, the second processor core of the second operating system may be awakened using, but not limited to, the secondary program loader.

[0501] Optionally, in this embodiment, the second processor core may be used, but is not limited to, to execute a boot program of the second operating system to boot the second operating system.

[0502] In an exemplary embodiment, the second operating system can be booted by executing the boot program of the second operating system through the second processor core in the following manner, but is not limited to: executing a universal boot loader through the second processor core, wherein the boot program of the second operating system includes a universal boot loader; and loading the second operating system through the universal boot loader.

[0503] Optionally, in this embodiment, the second processor core may load the second operating system by, but is not limited to, executing a universal boot loader. The universal boot loader may include, but is not limited to, U-Boot (Universal Boot Loader).

[0504] In an exemplary embodiment, the secondary program loader can be executed through the first processor core in the following manner, but is not limited to: a security boot check is performed on the code of the secondary program loader through the boot memory on the chip; if the check result is normal, the secondary program loader is executed through the first processor core.

[0505] Optionally, in this embodiment, the boot program of the operating system may include but is not limited to a secondary program loader, and may use the boot program of the operating system as the above-mentioned boot memory, and verify the code of the secondary program loader included in the boot program of the operating system through the boot memory. For example: the secondary program loader of the first operating system (the secondary program loader may be but is not limited to SPL) can be obtained according to the boot program of the first operating system (the boot program may be but is not limited to BootROM), and the code of the secondary program loader may be verified according to the boot memory of the first operating system (the boot memory may be but is not limited to BootROM).

[0506] Optionally, in this embodiment, the process of the boot memory performing a security startup check on the code of the secondary program loader may be, but is not limited to: the boot memory reads the code and verification code of the secondary program loader, operates on the code of the secondary program loader through an agreed operation method (such as a hash operation) to obtain an operation value, and then compares the operation value with the read verification code. If the two are consistent, the inspection result is normal; if the two are inconsistent, the inspection result is abnormal.

[0507] Optionally, in this embodiment, the secondary program loader can also perform a secure boot check on the code of the universal boot loader. The secondary program loader reads the code and verification code of the universal boot loader, and operates on the code of the universal boot loader through an agreed operation method (such as a hash operation, which can be the same or different from the operation method of the boot memory check of the secondary program loader) to obtain an operation value, and then compares the operation value with the read verification code. If the two are consistent, the inspection result is normal; if the two are inconsistent, the inspection result is abnormal. If the inspection result is normal, the second operating system is loaded through the universal boot loader.

[0508] In an exemplary embodiment, an example of starting a first operating system and a second operating system is provided. Taking the first processor core as CPU-0 and the second processor cores as CPU-1 to CPU-N as an example, the first operating system and the second operating system can be started in the following manner, but not limited to: powering on the chip; waking up the first processor core CPU-0 of the first operating system in the processor; using the first processor core CPU-0 to execute the boot program of the first operating system, which can be, but not limited to, a secondary program loader; performing a security boot check on the code of the secondary program loader through the boot memory on the chip (which can be, but not limited to, BootROM); if the check result is normal, executing the secondary program loader (which can be, but not limited to, SPL) through the first processor core to load the first operating system; waking up the second processor cores CPU-1 to CPU-N of the second operating system through the secondary program loader; and executing the universal boot loader (which can be, but not limited to, U-Boot) through the second processor core to load the second operating system.

[0509] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.

[0510] In this embodiment, an embedded system is also provided that is configured to implement the operation control method of the above-mentioned operating system. Figure 11 is a schematic diagram of an embedded system according to an embodiment of the present application. As shown in Figure 11, the embedded system may include: a chip and at least two operating systems, wherein the chip includes a processor 1102, a hardware controller 1104, a first bus 1106 and a second bus 1108, wherein the bandwidth of the first bus 1106 is higher than the bandwidth of the second bus 1108, and the first bus 1106 is configured in a multi-master and multi-slave mode, and the second bus 1108 is configured in a one-master and multi-slave mode; at least two operating systems run based on the processor 1102; at least two operating systems communicate through the first bus 1106; and at least two operating systems control the hardware controller through the second bus 1108.

[0511] Among them, the above-mentioned chip can be a BMC chip; the above-mentioned processor can be a multi-core processor, and the above-mentioned hardware controller can be configured to control external devices connected to corresponding external interfaces; the above-mentioned first bus is configured in a multi-master-multi-slave mode, which can be a bus used for communication between multiple processor cores of the processor, for example, AHB (Advanced High Performance Bus), and the above-mentioned second bus is configured in a one-master-multi-slave mode, which can be a bus used by the processor to control the hardware controllers, for example, APB (Advanced Peripheral Bus), and the bandwidth of the first bus is higher than the bandwidth of the second bus.

[0512] The embedded system may include at least two operating systems, which run based on a processor, and the processing resources of the processor are dynamically allocated to the at least two operating systems. The processing resources of the processor include a processor core. The at least two operating systems communicate through a first bus, and the at least two operating systems control a hardware controller through a second bus.

[0513] Optionally, the hardware controller may include one or more controllers corresponding to chip peripherals, including but not limited to at least one of the following: I2C, USB (Universal Serial Bus), UART, ADC (Analog to Digital Converter), JTAG (Joint Test Action Group), RTC (Real-Time Clock), GPIO (General Purpose Input / Output), WDT (Watch Dog Timer), Virtual UART, Super I / O, SGPIO (Serial General Purpose Input / Output), PWM (Pulse Width Modulation), FanTach (fan speed control), Timer, PECI (Platform Environment Control Interface), Mailbox, and may also include other types of controllers. The external interface may include one or more, including but not limited to the external interface corresponding to any of the above controllers.

[0514] For example, an example of a BMC chip can be shown in Figure 12. The hardware of the BMC chip can include, but is not limited to, a SOC sub-module and a BMC out-of-band sub-module, wherein the SOC sub-module mainly includes an ARM core (ARM Core 1, ARM Core 2, ..., ARM Core X), which can also include, but is not limited to, a DDR (Double Data Rate) 4 controller (memory controller), a MAC (Media Access Control Address) controller (network controller), an SD (Secure Digital) Card / eMMC (Embedded Multi Media Card) controller (storage controller), a PCIe RC (Root Complex) controller, an SRAM (Static Random-Access Memory) and an SPI controller.

[0515] The cores and controllers are interconnected via a second bus, enabling interaction between the cores and the controllers. Simultaneously, the ARM cores are connected to the first bus (e.g., via an AXI (Advanced eXtensible Interface) bridge), and inter-core communication is achieved via the first bus. Furthermore, the SOC submodules also implement interconnection between the first and second buses (e.g., via a bridge), providing a physical path for the SOC submodules to access peripherals on the second bus.

[0516] The DDR4 controller can be connected to other components or devices through the DDR4PHY (Physical Layer) interface, the MAC controller is connected to other components or devices through the RGMII (Reduced Gigabit Media Independent Interface), the SD card / eMMC controller is connected to other components or devices through the SD interface, and the PCIe RC controller is connected to other components or devices through the PCIe PHY interface.

[0517] The BMC out-of-band submodule primarily includes controllers for chip peripherals such as PWM, GPIO, FanTech (fan speed control), and mailbox. These controllers enable out-of-band management functions such as PECI communication with the BMC (for example, using GPIO to simulate PECI) and fan control. As shown in Figure 12, the BMC out-of-band submodule can, but is not limited to, interact with the SOC submodule via the second bus.

[0518] The BMC chip interconnects the on-chip ARM cores, storage units, and controller hardware resources via the first and second buses. Dynamic, balanced scheduling of processor resources primarily involves the BMC chip's ARM core resource scheduling, and inter-core communication refers to communication between ARM cores. Taking the Linux system preempting an RTOS system core as an example, the Linux system first sends an inter-core interrupt (interrupt number 9) to core 1 via the on-chip first bus from one of cores 2 to N. If the RTOS system is idle and preemption is allowed, core 1 responds to the inter-core interrupt (interrupt number 10) via the first bus and releases the peripheral controller resources currently mapped to core 1 (e.g., PWM / PECI). Upon receiving inter-core interrupt 10, the Linux system initiates a preemption process, adding core 1 to the Linux SMP scheduler and simultaneously gaining control of the PWM / PECI peripherals, allowing it to be controlled via the second bus.

[0519] On the one hand, at least two operating systems include a first operating system and a second operating system, wherein the chip loads a communication value to a first bus, and the first bus sends a communication signal carrying the communication value to a communication register corresponding to the second operating system to realize communication between the first operating system and the second operating system, wherein the communication value is used to indicate the communication content between the first operating system and the second operating system.

[0520] On the other hand, the chip loads the control value to the second bus, and the second bus sends the control signal carrying the control value to the register corresponding to the hardware controller to realize the operating system's control over the hardware controller, wherein the control value is used to indicate the operating system's control content over the hardware controller.

[0521] The operating system controls the hardware controller by accessing (such as performing read and write operations) the registers of each hardware controller. The operating system accesses the registers of the hardware controller by, but is not limited to, reading or writing the register addresses of each hardware controller, and the addresses of these registers can be, but are not limited to, unique and determined when the chip is designed. For example, the operating system can implement a specific function (such as the communication function between the above-mentioned operating systems or the control function of the operating system on the hardware controller) by writing a specific value (i.e., the above-mentioned communication register or the register corresponding to the hardware controller) to a specific address (i.e., the above-mentioned communication register or the register corresponding to the hardware controller). In other words, different functions correspond to different control values, and the chip maintains the correspondence between the function of the hardware controller and the control value, for example: a control value of 00 means that the air conditioner accelerates by one gear, a control value of 01 means that the air conditioner decelerates by one gear, and so on.

[0522] Communication, control, and other interactions between operating systems and between operating systems and hardware controllers can be, but are not limited to, conducted via buses. The operating system's read and write operations on the registers of each hardware controller are ultimately converted into control signals for the hardware controller via the first bus (or second bus). This conversion and the control of the hardware controller by the first bus (or second bus) can be, but are not limited to, automatically implemented by the chip's internal hardware. This implementation complies with the bus specification. During operation, the first bus (or second bus) can transmit physical signals related to control and bus protocols, and can also transmit valid data to the hardware controllers via its physical data channels.

[0523] The first bus system may include, but is not limited to, a master module, slave modules, and an infrastructure. Transmissions on the entire first bus are initiated by the master module, and responses are provided by the slave modules. The infrastructure may include, but is not limited to, an arbiter, a multiplexer from the master module to the slave module, a multiplexer from the slave module to the master module, a decoder, a dummy slave module, and a dummy master module. In the multi-master, multi-slave mode of the first bus, the master first sends a request to the arbiter. The arbiter decides when to grant the master bus access. After obtaining access, the master sends data and control signals to the arbiter. The arbiter determines the corresponding slave path through address resolution and then sends the request to the corresponding destination. Similarly, the response data is parsed by the decoder and returned to the corresponding master. This multiplexing mechanism enables many-to-many access.

[0524] In the one-master-multiple-slave mode of the secondary bus, the secondary bus can be attached to the primary bus system, with transactions transferred between the bus systems via a bridge. In this case, the bridge is the master of the secondary bus, and all other peripheral devices (i.e., hardware controllers) are slaves. Data requests can only be sent from the master to the slaves. After receiving the request, the slave returns the corresponding response data to the master. This process enables one-to-many access without involving arbitration and decoder parsing operations in the primary bus.

[0525] In the above-mentioned embedded system, the first bus is configured in a multi-master and multi-slave mode, and the second bus is configured in a single-master and multi-slave mode. The first bus in the multi-master and multi-slave mode can utilize relatively more complex logic circuits and bus protocols to more efficiently complete communication between systems. The second bus in the single-master and multi-slave mode can utilize relatively simple logic circuits and bus protocols to reduce the complexity of the structure while completing the system's control over the hardware controller, thereby reducing the power consumption of the entire embedded system. The configuration and coordination of multiple modes on the bus can further improve the operating performance of the embedded system.

[0526] In this embedded system, the first and second operating systems run on processors, and communication between the operating systems and control of the hardware controller are achieved via buses with different functions. Because both the first and second operating systems run on the same processor, the addition and deployment of hardware components is avoided, reducing system costs. Furthermore, processor resources are effectively utilized to support operation between the systems. This solves the technical problem of low operating system efficiency and achieves the technical effect of improving operating system efficiency.

[0527] In an exemplary embodiment, at least two operating systems include a first operating system and a second operating system, wherein the first operating system controls the target hardware controller to run the target operation business based on the processor; the first operating system releases the target hardware controller through the second bus when the target operation business runs to the target business state; and the second operating system controls the target hardware controller to run the target operation business through the second bus.

[0528] Optionally, in this embodiment, the target operating service is run by the target hardware controller, the first operating system controls the target hardware controller based on the processor, and the second operating system can take over the target operating service by taking over the target hardware controller.

[0529] Optionally, in this embodiment, the process of taking over the target operation service is similar to that in the above-mentioned embodiment and will not be described in detail here.

[0530] When the target operating service reaches the target service state, the first operating system writes a specific value (i.e., the control value) corresponding to disabling the target hardware controller to a register of the target hardware controller to disable the target hardware controller. The specific value to be written is automatically loaded into the data channel of the second bus by the chip hardware, ultimately achieving hardware control of the hardware controller (i.e., implementing the release operation).

[0531] The second operating system writes a specific value corresponding to the target operation service (i.e., the control value) to the register of the target hardware controller to control the target hardware controller to execute the target operation service. The chip hardware automatically loads the specific value to the data channel of the second bus, ultimately achieving hardware control of the hardware controller (i.e., executing the target operation service).

[0532] In an exemplary embodiment, the second operating system sends a first interrupt request to the first operating system via the first bus, wherein the first interrupt request is used to request to take over the target hardware controller; the first operating system releases the target hardware controller via the second bus in response to the first interrupt request; or, the first operating system releases the target hardware controller via the second bus when the business attributes of the target operating business reach the target business attributes.

[0533] Optionally, in this embodiment, the second operating system may actively request to take over the target hardware controller and thus take over the target operation service, and the first operating system may also actively release the target hardware controller and thus release the target operation service.

[0534] Optionally, in this embodiment, the process of releasing and taking over the target hardware controller is similar to that in the above embodiment and will not be described in detail here.

[0535] The second operating system writes a specific value corresponding to the first interrupt request (i.e., the aforementioned communication value) into the interrupt register to transmit the first interrupt request to the first operating system. The specific value to be written is automatically loaded into the data channel of the first bus by the chip hardware, ultimately implementing the interrupt request function in hardware.

[0536] In an exemplary embodiment, the first operating system determines whether the second operating system takes over the target hardware controller in response to the first interrupt request; if the second operating system takes over the target hardware controller, the first operating system releases the target hardware controller through the second bus.

[0537] Optionally, in this embodiment, the first operating system may determine whether the second operating system takes over the target hardware controller. The determination process is similar to that in the above embodiment and is not described in detail here.

[0538] In an exemplary embodiment, the first operating system sends a second interrupt request to the second operating system through the first bus when the second operating system does not take over the target hardware controller, wherein the second interrupt request is used to indicate that the second operating system is denied from taking over the target hardware controller.

[0539] Optionally, in this embodiment, the process of the first operating system refusing the second operating system to take over the target hardware controller is similar to that in the above embodiment and is not described in detail here.

[0540] In an exemplary embodiment, the first operating system sends a third interrupt request to the second operating system, wherein the third interrupt request is used to indicate that the first operating system has released the target hardware controller; the second operating system responds to the third interrupt request and controls the target hardware controller to run the target operation service through the second bus.

[0541] Optionally, in this embodiment, the process of the first operating system notifying the second operating system that the target hardware controller has been released is similar to that in the above embodiment and is not described in detail here.

[0542] The second operating system writes a specific value corresponding to the target operation service (i.e., the control value) to the register of the target hardware controller to control the target hardware controller to execute the target operation service. The specific value to be written is automatically loaded into the data channel of the second bus by the chip hardware, ultimately achieving hardware control of the hardware controller.

[0543] In an exemplary embodiment, at least two operating systems include a first operating system and a second operating system, wherein the first operating system runs based on a target processor core in a processor; the first operating system releases the target processor core when running to a target system state; and the second operating system adds the target processor core to a scheduling resource pool of the second operating system, wherein the scheduling resource pool includes the processor core in the processor allocated to the second operating system.

[0544] Optionally, in this embodiment, the process of at least two operating systems occupying the target processor core is similar to that in the above embodiment, and is not described in detail here.

[0545] In an exemplary embodiment, the second operating system sends a fourth interrupt request to the first operating system via the first bus, wherein the fourth interrupt request is used to request occupation of a target processor core; the first operating system releases the target processor core in response to the fourth interrupt request; or, the first operating system releases the target processor core when the system properties reach the target system properties.

[0546] Optionally, in this embodiment, the second operating system may proactively seize the target processor core, and the first operating system may proactively release the target processor core.

[0547] Optionally, in this embodiment, the process of preempting and releasing the target processor core is similar to that in the above embodiment and will not be described in detail here.

[0548] In an exemplary embodiment, the first operating system determines whether the target processor core is occupied by the second operating system in response to the fourth interrupt request; the first operating system releases the target processor core if the target processor core is occupied by the second operating system.

[0549] Optionally, in this embodiment, the first operating system may determine whether the target processor core is occupied by the second operating system. This process is similar to that in the aforementioned embodiment and will not be described in detail here.

[0550] In an exemplary embodiment, the first operating system sends a fifth interrupt request to the second operating system through the first bus when the second operating system does not occupy the target processor core, wherein the fifth interrupt request is used to indicate that the second operating system is denied from occupying the target processor core.

[0551] Optionally, in this embodiment, the process of the first operating system rejecting the second operating system from occupying the target processor core is similar to that in the above embodiment and is not described in detail here.

[0552] In an exemplary embodiment, the first operating system sends a sixth interrupt request to the second operating system, wherein the sixth interrupt request is used to indicate that the first operating system has released the target processor core; the second operating system adds the target processor core to the scheduling resource pool in response to the sixth interrupt request.

[0553] Optionally, in this embodiment, the process of the first operating system notifying the second operating system that the target processor core has been released is similar to that in the above embodiment and will not be described in detail here.

[0554] In an exemplary embodiment, at least two operating systems include a first operating system and a second operating system, wherein a target processor core in a processor has been added to a scheduling resource pool of the second operating system, wherein the scheduling resource pool includes processor cores in the processor allocated to the second operating system; the second operating system releases the target processor core when the first operating system is awakened; and the first operating system runs based on the target processor core.

[0555] Optionally, in this embodiment, the process of the first operating system waking up and using the target processor core is similar to that in the above embodiment and will not be described in detail here.

[0556] In an exemplary embodiment, the second operating system releases the target processor core when detecting that the first operating system is awakened; or, the first operating system sends a seventh interrupt request to the second operating system when awakened, wherein the seventh interrupt request is used to request the second operating system to release the target processor core; the second operating system releases the target processor core in response to the seventh interrupt request.

[0557] Optionally, in this embodiment, the second operating system actively releases the target processor core when the first operating system wakes up, or the first operating system actively requests it to release the target processor core. This process is similar to that in the above embodiment and will not be described in detail here.

[0558] In an exemplary embodiment, at least two operating systems include a first operating system and a second operating system, and the chip also includes a storage space. The at least two operating systems control the storage space through a first bus, wherein the first operating system generates business data based on the operation of the processor; the first operating system stores the business data in the storage space through the first bus, and sends an eighth interrupt request to the second operating system through the first bus, wherein the eighth interrupt request is used to request the second operating system to read the business data from the storage space; the second operating system responds to the eighth interrupt request and reads the business data from the storage space.

[0559] Optionally, in this embodiment, the first operating system and the second operating system can, but are not limited to, realize the interaction of business data between systems through the transmission of storage space and interrupt requests. The interaction process of business data between systems is similar to that in the aforementioned embodiment and will not be repeated here.

[0560] The first operating system writes a specific value to a specific address in the storage controller to store the service data in the storage space. The chip hardware automatically loads the specific value into the data channel of the first bus, ultimately achieving hardware control of the storage controller and storage of service data (i.e., transmitting valid data through its physical data channel).

[0561] In an exemplary embodiment, the first operating system runs periodically based on the processor; or, the first operating system runs based on the processor in response to a received wake-up request; or, the first operating system runs based on the processor based on the matching degree between the current operating business generated on the processor and the first operating system.

[0562] Optionally, in this embodiment, the operating mechanism of the first operating system is similar to that in the aforementioned embodiment and will not be described in detail here.

[0563] In an exemplary embodiment, the first operating system goes into hibernation after the operation ends; the second operating system adds the target processor core used by the first operating system to the scheduling resource pool of the second operating system during the hibernation period of the first operating system, wherein the scheduling resource pool includes other processors in the processor except the target processor core.

[0564] Optionally, in this embodiment, the process of the second operating system occupying the target processor core during the hibernation of the first operating system is similar to that in the above embodiment and will not be described in detail here.

[0565] In an exemplary embodiment, at least two operating systems communicate via a communication protocol implemented by the first bus; or, at least two operating systems communicate via the first bus, the second bus, and a communication hardware controller in the hardware controller.

[0566] Optionally, in this embodiment, at least two operating systems may communicate via, but are not limited to, a communication protocol deployed by the first bus, that is, inter-core communication may be implemented via, but is not limited to, software.

[0567] Optionally, in this embodiment, at least two operating systems may also communicate through, but not limited to, the first bus, the second bus, and a communication hardware controller in the hardware controller, that is, inter-core communication may be implemented through, but not limited to, hardware.

[0568] In an exemplary embodiment, at least two operating systems communicate by sending an inter-processor interrupt request via a first bus; alternatively, one of the at least two operating systems sends a system interrupt request to the first bus; the first bus forwards the system interrupt request to a second bus; the second bus sends the system interrupt request to a mailbox hardware module controlled by a communication hardware controller; and the mailbox hardware module sends the system interrupt request to another of the at least two operating systems via the second bus and the first bus.

[0569] Optionally, in this embodiment, the preemption and release of processor resources and the interaction of business data between different operating systems can be completed, but not limited to, through inter-core interrupts, for example, SGI (Software Generated Interrupt, software-triggered interrupt, inter-core interrupt in Linux system). One operating system can send a resource preemption request (for example, core preemption request) or a resource release request (for example, core release request) to another operating system through IPI (Inter-Processor Interrupt) to request the preemption or release of processing resources.

[0570] Optionally, in this embodiment, inter-core communication can also be achieved through, but not limited to, a mailbox channel mailbox connected to a mailbox controller in an out-of-band submodule.

[0571] In an exemplary embodiment, at least two operating systems include a first operating system and a second operating system, wherein the first operating system monitors the operating services executed on the second operating system through a first bus; when there are abnormal operating services in the operating services executed by the first operating system on the second operating system, the first operating system takes over the abnormal operating services through the first bus.

[0572] Optionally, in this embodiment, the process of the first operating system monitoring abnormal operation services on the second operating system is similar to that in the above embodiment and will not be described in detail here.

[0573] Each operating service of the second operating system writes a value to a specific address of the storage controller at a certain frequency. The first operating system reads the specific address of the storage controller to monitor the operating services executed by the second operating system. The chip hardware automatically loads the specific address of the storage controller to the address channel of the first bus. The reading of the specific address of the storage controller is implemented in hardware. The read value is returned to the first operating system in hardware via the data channel of the first bus, ultimately enabling monitoring of the operating services executed by the second operating system.

[0574] The first operating system may take over control of the hardware controller corresponding to the abnormal operation service. The first operating system writes a specific value to a register of the hardware controller for the abnormal operation service to control the hardware controller. The chip hardware automatically loads the specific value into the data channel of the first bus, ultimately achieving hardware-based control of the hardware controller and takeover of the abnormal operation service.

[0575] In an exemplary embodiment, the first operating system receives a heartbeat signal of an operating service executed on the second operating system via the first bus; the first operating system takes over an operating service whose frequency of the heartbeat signal does not conform to the corresponding target frequency as an abnormal operating service via the first bus.

[0576] Optionally, in this embodiment, the process in which the first operating system monitors abnormal operation services on the second operating system by monitoring the frequency of the heartbeat signal is similar to that in the above-mentioned embodiment and is not described in detail here.

[0577] The first operating system reads the value of a specific address of the storage controller to receive a heartbeat signal for an operating service executed on the second operating system. The specific address of the storage controller to be read is automatically loaded into the address channel of the first bus by chip hardware, enabling hardware-based reading of the specific address of the storage controller. The read value is then returned to the first operating system via the data channel of the first bus in hardware, ultimately enabling the reception of a heartbeat signal for the operating service executed on the second operating system.

[0578] In an exemplary embodiment, after taking over the abnormal operation service, the first operating system sends a restart instruction to the second operating system through the first bus, wherein the restart instruction is used to instruct to restart the abnormal operation service.

[0579] Optionally, in this embodiment, the process of restarting the abnormal operation service of the second operating system after the first operating system takes over the abnormal operation service is similar to that in the above embodiment and is not described in detail here.

[0580] After taking over the abnormal operation service, the first operating system writes a specific value to a specific address in the storage controller to restart the abnormal operation service of the second operating system. The chip hardware automatically loads this specific value into the data channel of the first bus, updating the value at the specific address in the storage controller in hardware. The second operating system reads and interprets this specific value, then restarts the corresponding abnormal operation service.

[0581] In an exemplary embodiment, the chip further includes: a memory storing a boot module, which runs the boot module after the chip is powered on to boot one of at least two operating systems, and the boot module boots the other operating systems of the at least two operating systems.

[0582] Optionally, in this embodiment, the booting process of multiple operating systems is similar to that in the aforementioned embodiment and will not be described in detail here.

[0583] In an exemplary embodiment, at least two operating systems include a first operating system and a second operating system, wherein the first operating system controls a target hardware controller based on a processor to run a target operation business; the first operating system releases the target hardware controller through a second bus when the target operation business runs to a target business state; the second operating system controls the target hardware controller through the second bus to run the target operation business; the first operating system runs based on a target processor core in a processor; the first operating system releases the target processor core when running to a target system state; the second operating system adds the target processor core to a scheduling resource pool of the second operating system, wherein the scheduling resource pool includes the processor core in the processor allocated to the second operating system; the chip also includes a storage space, and at least two operating systems control the storage space through the first bus, wherein the first operating system generates business data based on the process of running the processor; the first operating system stores the business data in the storage space through the first bus, and sends an eighth interrupt request to the second operating system through the first bus, wherein the eighth interrupt request is used to request the second operating system to read business data from the storage space; the second operating system reads business data from the storage space in response to the eighth interrupt request.

[0584] Optionally, in this embodiment, the operating system can take over the hardware controller and preempt the processor core. This process is similar to that in the above embodiment and will not be described in detail here.

[0585] In this embodiment, another embedded system configured to implement the above-mentioned operating system operation control method is also provided. The above-mentioned embedded system can run on the above-mentioned BMC chip. The embedded system includes: a first operating system, a second operating system, a controller and a processor, wherein the first operating system and the second operating system are run based on the processor, and the controller is configured to detect the running status of the first operating system during operation and control the processor resources used by the first operating system according to the running status.

[0586] In the above-described embedded system, the first and second operating systems run on a processor, and the controller detects the operating status of the first operating system during operation and controls the processor resources used by the first operating system based on this operating status. Because both the first and second operating systems run on the same processor, the addition and deployment of hardware components is avoided, reducing system costs. Furthermore, the processor resources used by the operating systems can be controlled during their operation, thereby rationally utilizing processor resources to support operations between systems. This resolves the technical issue of low operating efficiency of the operating systems and achieves the technical effect of improving their operating efficiency.

[0587] In this embodiment, the first operating system and the second operating system may be similar to those in the aforementioned embodiment. The first operating system and the second operating system are run based on a processor, and the controller may be a software module running under the first operating system or the second operating system.

[0588] Optionally, in this embodiment, the processing logic of the controller can be deployed on the processor, but is not limited to being deployed on the first operating system, or can be divided into a first control unit and a second control unit according to functions and deployed on the first operating system and the second operating system respectively, thereby realizing processor resource control, operation business management, business interaction and other functions between systems.

[0589] In an exemplary embodiment, the controller is configured to at least one of: detect a business state of a first operating system based on a target operating business run by a processor, wherein the running state includes a business state; detect a system state of the first operating system, wherein the running state includes a system state, and the first operating system runs based on a target processor core in the processor.

[0590] Optionally, in this embodiment, the detection of the service status and the system status by the controller is similar to that in the above-mentioned embodiment, and will not be described in detail here.

[0591] In an exemplary embodiment, the controller is configured to release the target operating business when it detects that the business state is a target business state, wherein the processor resources include the target operating business; the second operating system is used to run the target operating business; and / or the controller is configured to release the target processor core when it detects that the system state is a target system state, wherein the processor resources include the target processor core; the second operating system is used to add the target processor core to the scheduling resource pool of the second operating system, and the scheduling resource pool includes the processor core allocated to the second operating system in the processor.

[0592] Optionally, in this embodiment, the process of the controller controlling the target operation service and releasing the target processor core is similar to that in the above embodiment, and will not be described in detail here.

[0593] In an exemplary embodiment, the embedded system also includes: a first business interaction thread running on a first operating system, and a second business interaction thread running on a second operating system, wherein the controller is configured to determine that the business state is detected to be a target business state when a first interrupt request sent by the second business interaction thread to the first business interaction thread is obtained, wherein the first interrupt request is used to request to take over the target operation business; or, the controller is configured to determine that the business state is detected to be a target business state when the business attributes of the target operation business reach the target business attributes.

[0594] Optionally, in this embodiment, the interaction process between operating systems may be controlled, but is not limited to, by service interaction threads deployed on each operating system.

[0595] Optionally, in this embodiment, the process of detecting the service status is similar to that in the above-mentioned embodiment and will not be described in detail here.

[0596] In an exemplary embodiment, the controller is configured to: respond to the first interrupt request, determine whether the second operating system takes over the target operation service; and release the target operation service if the second operating system takes over the target operation service.

[0597] Optionally, in this embodiment, the controller's determination process of whether the second operating system takes over the target operating service is similar to that in the aforementioned embodiment, and is not described in detail here.

[0598] In an exemplary embodiment, the embedded system also includes: a first business interaction thread running on a first operating system, and a second business interaction thread running on a second operating system, wherein the first business interaction thread is used to send a second interrupt request to the second business interaction thread without the second operating system taking over the target operation business, wherein the second interrupt request is used to indicate a refusal for the second operating system to take over the target operation business.

[0599] Optionally, in this embodiment, the process of rejecting the second operating system from taking over the target operating service is similar to that in the above embodiment and is not described in detail here.

[0600] In an exemplary embodiment, the embedded system also includes: a first business interaction thread running on a first operating system, and a second business interaction thread running on a second operating system, wherein the first business interaction thread is used to send a third interrupt request to the second business interaction thread, wherein the third interrupt request is used to indicate that the target hardware controller has been released; and the second operating system is used to control the target hardware controller to run the target operation business in response to the third interrupt request.

[0601] Optionally, in this embodiment, the notification process of the released target hardware controller is similar to that in the above embodiment and is not described in detail here.

[0602] In an exemplary embodiment, the embedded system also includes: a first business interaction thread running on a first operating system, and a second business interaction thread running on a second operating system, wherein the controller is configured to determine that the system state is detected to be the target system state when a fourth interrupt request sent by the second business interaction thread to the first business interaction thread is obtained, wherein the fourth interrupt request is used to request occupation of the target processor core; or, the controller is configured to determine that the system state is detected to be the target system state when the system properties of the first operating system reach the target system properties.

[0603] Optionally, in this embodiment, the process of detecting the system status is similar to that in the above-mentioned embodiment and will not be described in detail here.

[0604] In an exemplary embodiment, the controller is configured to: in response to the fourth interrupt request, determine whether the target processor core is occupied by the second operating system; and release the target processor core if the target processor core is occupied by the second operating system.

[0605] Optionally, in this embodiment, the controller's determination process of whether the target processor core is occupied by the second operating system is similar to that in the aforementioned embodiment and is not described in detail here.

[0606] In an exemplary embodiment, the embedded system also includes: a first business interaction thread running on a first operating system, and a second business interaction thread running on a second operating system, wherein the first business interaction thread is used to send a fifth interrupt request to the second business interaction thread when the target processor core is not occupied by the second operating system, wherein the fifth interrupt request is used to indicate that the second operating system is denied occupation of the target processor core.

[0607] Optionally, in this embodiment, the process of denying the second operating system from occupying the target processor core is similar to that in the above embodiment and is not described in detail here.

[0608] In an exemplary embodiment, the embedded system also includes: a first business interaction thread running on a first operating system, and a second business interaction thread running on a second operating system, wherein the first business interaction thread is used to send a sixth interrupt request to the second business interaction thread, wherein the sixth interrupt request is used to indicate that the first operating system has released the target processor core; and the second operating system is used to respond to the eighth interrupt request to add the target processor core to the scheduling resource pool.

[0609] Optionally, in this embodiment, the notification process of the released target processor core is similar to that in the above embodiment and will not be described in detail here.

[0610] In an exemplary embodiment, the controller is further configured to: when a target processor core in the processor has been added to a scheduling resource pool of a second operating system and the first operating system is awakened and running, detect whether the target processor core is released, wherein the scheduling resource pool includes the processor core in the processor allocated to the second operating system; and when it is detected that the second operating system has released the target processor core when the first operating system is awakened, run the first operating system based on the target processor core.

[0611] Optionally, in this embodiment, the operation process when the first operating system wakes up is similar to that in the above embodiment and will not be described in detail here.

[0612] In an exemplary embodiment, the embedded system also includes: a first business interaction thread running on a first operating system, and a second business interaction thread running on a second operating system, wherein the first business interaction thread is used to send a seventh interrupt request to the second business interaction thread when it detects that the target processor core has not been released, wherein the seventh interrupt request is used to request the second operating system to release the target processor core; and the second operating system is used to release the target processor core in response to the seventh interrupt request.

[0613] Optionally, in this embodiment, the negotiation process of the second operating system releasing the target processor core is similar to that in the above embodiment and is not described in detail here.

[0614] In an exemplary embodiment, the embedded system also includes: a first business interaction thread running on a first operating system, and a second business interaction thread running on a second operating system, wherein the first business interaction thread is used to obtain business data generated by the first operating system during its operation based on the processor; store the business data in a storage space on the processor; send an eighth interrupt request to the second business interaction thread, wherein the eighth interrupt request is used to request the second operating s...

Claims

1. An embedded system, characterized in that: include: chip and at least two operating systems, wherein: The chip includes a processor, a hardware controller, a first bus and a second bus, wherein the bandwidth of the first bus is higher than the bandwidth of the second bus, and the first bus is configured in a multi-master and multi-slave mode, and the second bus is configured in a one-master and multi-slave mode; The at least two operating systems are run based on the processor; The at least two operating systems communicate via the first bus; The at least two operating systems control the hardware controller through the second bus.

2. The embedded system according to claim 1, characterized in that: The at least two operating systems include a first operating system and a second operating system, wherein: The first operating system controls the target hardware controller to run a target operation service based on the processor; The first operating system releases the target hardware controller through the second bus when the target operation service runs to a target service state; The second operating system controls the target hardware controller to run the target operating service through the second bus.

3. The embedded system according to claim 2, characterized in that: The second operating system sends a first interrupt request to the first operating system through the first bus, wherein the first interrupt request is used to request to take over the target hardware controller; the first operating system releases the target hardware controller through the second bus in response to the first interrupt request; or The first operating system releases the target hardware controller through the second bus when the service attribute of the target operation service reaches the target service attribute.

4. The embedded system according to claim 3, characterized in that: The first operating system determines, in response to the first interrupt request, whether the second operating system takes over the target hardware controller; The first operating system releases the target hardware controller through the second bus when the target hardware controller is taken over by the second operating system.

5. The embedded system according to claim 4, characterized in that: The first operating system sends a second interrupt request to the second operating system through the first bus when the second operating system does not take over the target hardware controller, wherein the second interrupt request is used to indicate that the second operating system is refused to take over the target hardware controller.

6. The embedded system according to claim 2, characterized in that: The first operating system sends a third interrupt request to the second operating system, wherein the third interrupt request is used to indicate that the first operating system has released the target hardware controller; The second operating system controls the target hardware controller to execute the target operation service through the second bus in response to the third interrupt request.

7. The embedded system according to any one of claims 1 to 6, characterized in that: The at least two operating systems include a first operating system and a second operating system, wherein: The first operating system runs based on a target processor core in the processor; The first operating system releases the target processor core when running into the target system state; The second operating system adds the target processor core to a scheduling resource pool of the second operating system, wherein the scheduling resource pool includes processor cores in the processor allocated to the second operating system.

8. The embedded system according to claim 7, characterized in that: The second operating system sends a fourth interrupt request to the first operating system through the first bus, wherein the fourth interrupt request is used to request to occupy the target processor core; the first operating system releases the target processor core in response to the fourth interrupt request; or The first operating system releases the target processor core when the system attribute reaches the target system attribute.

9. The embedded system according to claim 8, characterized in that: The first operating system determines, in response to the fourth interrupt request, whether the target processor core is occupied by the second operating system; The first operating system releases the target processor core if the target processor core is occupied by the second operating system.

10. The embedded system according to claim 9, characterized in that: The first operating system sends a fifth interrupt request to the second operating system through the first bus when the target processor core is not occupied by the second operating system, wherein the fifth interrupt request is used to indicate that the second operating system is denied from occupying the target processor core.

11. The embedded system according to claim 7, characterized in that: The first operating system sends a sixth interrupt request to the second operating system, wherein the sixth interrupt request is used to indicate that the first operating system has released the target processor core; The second operating system adds the target processor core to the scheduling resource pool in response to the sixth interrupt request.

12. The embedded system according to claim 1, characterized in that: The at least two operating systems include a first operating system and a second operating system, wherein: The target processor core in the processor has been added to the scheduling resource pool of the second operating system, wherein the scheduling resource pool includes the processor core in the processor allocated to the second operating system; The second operating system releases the target processor core when the first operating system is awakened; The first operating system runs based on the target processor core.

13. The embedded system according to claim 12, characterized in that: The second operating system releases the target processor core when detecting that the first operating system is awakened; or, When the first operating system is awakened, it sends a seventh interrupt request to the second operating system, wherein the seventh interrupt request is used to request the second operating system to release the target processor core; the second operating system releases the target processor core in response to the seventh interrupt request.

14. The embedded system according to claim 1, characterized in that: The at least two operating systems include a first operating system and a second operating system, the chip further includes a storage space, and the at least two operating systems control the storage space through the first bus, wherein: The first operating system generates business data during the operation of the processor; The first operating system stores the service data in the storage space through the first bus, and sends an eighth interrupt request to the second operating system through the first bus, wherein the eighth interrupt request is used to request the second operating system to read the service data from the storage space; The second operating system reads the service data from the storage space in response to the eighth interrupt request.

15. The embedded system according to claim 1, characterized in that: The first operating system runs periodically based on the processor; or, The first operating system runs based on the processor in response to the received wake-up request; or, The first operating system runs on the processor according to a matching degree between a current operating service generated on the processor and the first operating system.

16. The embedded system according to claim 15, characterized in that: The first operating system goes into hibernation after the operation is completed; The second operating system adds the target processor core used by the first operating system to a scheduling resource pool of the second operating system during hibernation of the first operating system, wherein the scheduling resource pool includes other processors among the processors except the target processor core.

17. The embedded system according to claim 1, characterized in that: The at least two operating systems communicate via a communication protocol deployed by the first bus; or, The at least two operating systems communicate via the first bus, the second bus and a communication hardware controller in the hardware controller.

18. The embedded system according to claim 17, characterized in that: The at least two operating systems communicate by sending an inter-processor interrupt request via the first bus; or One of the at least two operating systems sends a system interrupt request to the first bus; the first bus forwards the system interrupt request to the second bus; the second bus sends the system interrupt request to the mailbox hardware module controlled by the communication hardware controller; The mailbox hardware module sends the system interrupt request to another operating system of the at least two operating systems through the second bus and the first bus.

19. The embedded system according to claim 1, characterized in that: The at least two operating systems include a first operating system and a second operating system, wherein: The first operating system monitors the operation business executed on the second operating system through the first bus; When there is an abnormal operation service among the operation services executed by the first operating system on the second operating system, the abnormal operation service is taken over through the first bus.

20. The embedded system according to claim 19, characterized in that: The first operating system receives a heartbeat signal of an operating service executed on the second operating system through the first bus; The first operating system takes over, via the first bus, an operation service in which the frequency of the heartbeat signal does not conform to the corresponding target frequency as the abnormal operation service.

21. The embedded system according to claim 19, characterized in that: After taking over the abnormal operation service, the first operating system sends a restart instruction to the second operating system through the first bus, wherein the restart instruction is used to instruct to restart the abnormal operation service.

22. The embedded system according to claim 1, characterized in that: The chip further comprises: a memory, wherein the memory stores a boot module, After the chip is powered on, the boot module is run to boot one of the at least two operating systems, and the boot module boots the other operating systems of the at least two operating systems.

23. The embedded system according to claim 1, characterized in that: The at least two operating systems include a first operating system and a second operating system, wherein: The first operating system controls the target hardware controller to run the target operation service based on the processor; the first operating system releases the target hardware controller through the second bus when the target operation service runs to the target service state; the second operating system controls the target hardware controller to run the target operation service through the second bus; The first operating system runs based on the target processor core in the processor; the first operating system releases the target processor core when running to the target system state; the second operating system adds the target processor core to the scheduling resource pool of the second operating system, wherein the scheduling resource pool includes the processor core in the processor allocated to the second operating system; The chip also includes a storage space, and the at least two operating systems control the storage space through the first bus, wherein the first operating system generates business data based on the operation of the processor; the first operating system stores the business data in the storage space through the first bus, and sends an eighth interrupt request to the second operating system through the first bus, wherein the eighth interrupt request is used to request the second operating system to read the business data from the storage space; the second operating system reads the business data from the storage space in response to the eighth interrupt request.

24. The embedded system according to claim 1, characterized in that: The at least two operating systems include a first operating system and a second operating system, wherein: The chip loads the communication value to the first bus, and the first bus sends the communication signal carrying the communication value to the first bus. The communication registers corresponding to the two operating systems are used to implement communication between the first operating system and the second operating system, wherein the communication value is used to indicate the communication content between the first operating system and the second operating system.

25. The embedded system according to claim 1, characterized in that: The chip loads the control value to the second bus, and the second bus sends a control signal carrying the control value to the register corresponding to the hardware controller to implement the operating system's control over the hardware controller, wherein the control value is used to indicate the operating system's control content over the hardware controller.

26. An embedded system, characterized in that: include: A first operating system, a second operating system, a controller and a processor, wherein the first operating system and the second operating system are run based on the processor, The controller is used to detect the running state of the first operating system during operation, and control the processor resources used by the first operating system according to the running state.

27. The embedded system according to claim 26, characterized in that: The controller is used for at least one of the following: detecting a service state of the first operating system based on a target operating service run by the processor, wherein the operating state includes the service state; A system state of the first operating system is detected, wherein the running state includes the system state, and the first operating system runs based on a target processor core in the processor.

28. The embedded system according to claim 27, characterized in that: The controller is used to release the target operation service when detecting that the service state is a target service state, wherein the processor resources include the target operation service; the second operating system is used to run the target operation service; and / or, The controller is used to release the target processor core when it is detected that the system state is the target system state, wherein the processor resources include the target processor core; the second operating system is used to add the target processor core to the scheduling resource pool of the second operating system, wherein the scheduling resource pool includes the processor core allocated to the second operating system in the processor.

29. The embedded system according to claim 28, characterized in that: The embedded system further includes: a first service interaction thread running on the first operating system, and a second service interaction thread running on the second operating system, wherein: The controller is used to determine that the service state is detected as the target service state when a first interrupt request sent by the second service interaction thread to the first service interaction thread is obtained, wherein the first interrupt request is used to request to take over the target operation service; or The controller is configured to determine that the service state is detected to be the target service state when the service attribute of the target operation service reaches the target service attribute.

30. The embedded system according to claim 29, characterized in that: The controller is used to: In response to the first interrupt request, determining whether the second operating system should take over the target operation service; When the target operation service is taken over by the second operating system, the target operation service is released.

31. The embedded system according to claim 30, characterized in that: The embedded system further includes: a first service interaction thread running on the first operating system, and a second service interaction thread running on the second operating system, wherein: The first service interaction thread is used to send a second interrupt request to the second service interaction thread without the second operating system taking over the target operation service, wherein the second interrupt request is used to indicate a rejection of the second operating system taking over the target operation service.

32. The embedded system according to claim 28, characterized in that: The embedded system further includes: a first service interaction thread running on the first operating system, and a second service interaction thread running on the second operating system, wherein: The first service interaction thread is used to send a third interrupt request to the second service interaction thread, wherein the third interrupt request is used to indicate that the target hardware controller has been released; The second operating system is used to control the target hardware controller to run the target operation service in response to the third interrupt request.

33. The embedded system according to claim 28, characterized in that: The embedded system further includes: a first service interaction thread running on the first operating system, and a second service interaction thread running on the second operating system, wherein: The controller is used to determine that the system state is detected as the target system state when a fourth interrupt request sent by the second service interaction thread to the first service interaction thread is obtained, wherein the fourth interrupt request is used to request to occupy the target processor core; or The controller is configured to determine that the system state is detected to be the target system state when the system property of the first operating system reaches the target system property.

34. The embedded system according to claim 33, characterized in that: The controller is used to: In response to the fourth interrupt request, determining whether the target processor core is occupied by the second operating system; In a case where the target processor core is occupied by the second operating system, the target processor core is released.

35. The embedded system according to claim 34, characterized in that: The embedded system further includes: a first service interaction thread running on the first operating system, and a second service interaction thread running on the second operating system, wherein: The first service interaction thread is used to send a fifth interrupt request to the second service interaction thread when the target processor core is not occupied by the second operating system, wherein the fifth interrupt request is used to indicate that the second operating system is denied from occupying the target processor core.

36. The embedded system according to claim 28, characterized in that: The embedded system further includes: a first service interaction thread running on the first operating system, and a second service interaction thread running on the second operating system, wherein: The first service interaction thread is used to send a sixth interrupt request to the second service interaction thread, wherein the sixth interrupt request is used to indicate that the first operating system has released the target processor core; The second operating system is used to add the target processor core to the scheduling resource pool in response to the eighth interrupt request.

37. The embedded system according to claim 26, characterized in that: The controller is further used for: When the target processor core in the processor has been added to the scheduling resource pool of the second operating system and the first operating system is awakened and running, detecting whether the target processor core is released, wherein the scheduling resource pool includes the processor core in the processor allocated to the second operating system; In a case where it is detected that the second operating system has released the target processor core when the first operating system is awakened, the first operating system is run based on the target processor core.

38. The embedded system according to claim 37, characterized in that: The embedded system further includes: a first service interaction thread running on the first operating system, and a second service interaction thread running on the second operating system, wherein: The first service interaction thread is used to send a seventh interrupt request to the second service interaction thread when detecting that the target processor core is not released, wherein the seventh interrupt request is used to request the second operating system to release the target processor core; The second operating system is used to release the target processor core in response to the seventh interrupt request.

39. The embedded system according to any one of claims 26 to 38, characterized in that: The embedded system further includes: a first service interaction thread running on the first operating system, and a second service interaction thread running on the second operating system, wherein: The first business interaction thread is used to obtain business data generated by the first operating system during operation based on the processor; store the business data in a storage space on the processor; and send an eighth interrupt request to the second business interaction thread, wherein the eighth interrupt request is used to request the second operating system to read the business data from the storage space; The second operating system is used to read the business data from the storage space in response to the eighth interrupt request.

40. The embedded system according to claim 26, characterized in that: The controller is also used for: controlling the first operating system to run periodically based on the processor; or, In response to the received wake-up request, controlling the first operating system to run based on the processor; or, According to the matching degree between the operation business generated on the processor and the first operating system, the first operating system is controlled to run based on the processor.

41. The embedded system according to claim 40, characterized in that: The controller is used to: Detecting business information of a current operation business generated on the processor; In a case where it is detected that the matching degree between the service information and the first operating system is higher than a matching degree threshold, the first operating system is controlled to run the current operating service based on the processor.

42. The embedded system according to claim 41, characterized in that: The controller is used to: Detecting a target response speed and / or a target resource occupancy of the current operating service, wherein the service information includes: a target response speed and / or a resource occupancy, wherein the target response speed is a response speed that the current operating service requires the processor to achieve, and the target resource occupancy is an amount of resources that the current operating service requires the processor to provide; When the target response speed is less than or equal to a speed threshold, and / or the target resource occupancy is less than or equal to an occupancy threshold, it is determined that the matching degree between the business information and the first operating system is higher than the matching degree threshold.

43. The embedded system according to claim 40, characterized in that: The controller is further used for: Control the first operating system to hibernate after the operation is completed.

44. The embedded system according to claim 43, characterized in that: The embedded system further includes: a first service interaction thread running on the first operating system, and a second service interaction thread running on the second operating system, wherein: The first service interaction thread is used to notify the second service interaction thread that it is allowed to occupy the processor core used by the first operating system; The second operating system is used to add the target processor core used by the first operating system to the scheduling resource pool of the second operating system during the hibernation of the first operating system, and the scheduling resource pool includes other processors among the processors except the target processor core.

45. The embedded system according to claim 26, characterized in that: The embedded system further includes: a service takeover thread running on the first operating system, wherein: The service takeover thread is used to monitor the operating services executed on the second operating system; when abnormal operating services are detected in the operating services executed on the second operating system, the service takeover thread takes over the abnormal operating services.

46. ​​The embedded system according to claim 45, characterized in that: The service takeover thread is used to: Receiving a heartbeat signal of each operation service executed on the second operating system; An operation service whose frequency of the heartbeat signal does not conform to the corresponding target frequency is determined as the abnormal operation service.

47. The embedded system according to claim 45, characterized in that: The business takeover thread is also used to: After the abnormal operation service is taken over by the first operating system, a restart instruction is sent to the second operating system, wherein the restart instruction is used to instruct to restart the abnormal operation service.

48. The embedded system according to claim 26, characterized in that: The embedded system further comprises: a boot module, The boot module is used to boot the first operating system and boot the second operating system.

49. A method for controlling the operation of an operating system, characterized in that: include: Detecting an operating state of a first operating system during operation, wherein the first operating system and the second operating system are operated based on a processor; Processor resources used by the first operating system are controlled according to the operating state.

50. The method according to claim 49, characterized in that The detecting the running state of the first operating system during running includes at least one of the following: detecting a service state of the first operating system based on a target operating service run by the processor, wherein the operating state includes the service state; A system state of the first operating system is detected, wherein the running state includes the system state, and the first operating system runs based on a target processor core in the processor.

51. The method according to claim 50, characterized in that The controlling the processor resources used by the first operating system according to the running state includes at least one of the following: In the case where it is detected that the service state is a target service state, releasing the target operation service, wherein the processor resources include the target operation service, and the second operating system is used to run the target operation service; When it is detected that the system state is the target system state, the target processor core is released, wherein the processor resources include the target processor core, and the second operating system is used to add the target processor core to the scheduling resource pool of the second operating system, and the scheduling resource pool includes the processor core allocated to the second operating system in the processor.

52. The method according to claim 51, characterized in that The method further comprises: In the case of acquiring a first interrupt request sent by the second operating system to the first operating system, determining that the service state is detected to be the target service state, wherein the first interrupt request is used to request to take over the target operating service; or In a case where the service attribute of the target operation service reaches the target service attribute, it is determined that the service state is detected to be the target service state.

53. The method according to claim 52, characterized in that When detecting that the service state is a target service state, releasing the target operation service includes: In response to the first interrupt request, determining whether the second operating system should take over the target operation service; When the target hardware controller is taken over by the second operating system, the target operation service is released.

54. The method according to claim 51, characterized in that The method further comprises: In the case of acquiring a fourth interrupt request sent by the second operating system to the first operating system, determining that the system state is detected to be the target system state, wherein the fourth interrupt request is used to request to occupy the target processor core; or When the system properties of the first operating system reach the target system properties, it is determined that the system state is detected to be the target system state.

55. The method according to claim 54, characterized in that When detecting that the system state is the target system state, releasing the target processor core includes: In response to the fourth interrupt request, determining whether the target processor core is occupied by the second operating system; In a case where the target processor core is occupied by the second operating system, the target processor core is released.

56. The method according to any one of claims 49 to 55, characterized in that The method further comprises: Acquire business data generated during the operation of the first operating system based on the processor; storing the business data in a storage space on the processor; An eighth interrupt request is sent to the second operating system, wherein the eighth interrupt request is used to request the second operating system to read the business data from the storage space, and the second operating system is used to read the business data from the storage space in response to the eighth interrupt request.

57. The method according to claim 49, characterized in that The method further comprises: controlling the first operating system to run periodically based on the processor; or, In response to the received wake-up request, controlling the first operating system to run based on the processor; or, According to the matching degree between the operation business generated on the processor and the first operating system, the first operating system is controlled to run based on the processor.

58. The method according to claim 57, characterized in that The controlling the first operating system to run based on the processor according to the matching degree between the current operating service generated on the processor and the first operating system includes: Detecting business information of a current operation business generated on the processor; In a case where it is detected that the matching degree between the service information and the first operating system is higher than a matching degree threshold, the first operating system is controlled to run the current operating service based on the processor.

59. The method according to claim 49, characterized in that The method further comprises: Monitoring the operation business executed on the second operating system; When it is monitored that there are abnormal operations in the operations executed on the second operating system, the abnormal operations are taken over by the first operating system.

60. An operation control device for an operating system, characterized in that: include: A first detection module is configured to detect an operating state of a first operating system during operation, wherein the first operating system and the second operating system are operated based on a processor; The control module is configured to control the processor resources used by the first operating system according to the running state.

61. A chip, characterized in that: The chip includes at least one of a programmable logic circuit and an executable instruction, and the chip runs in an electronic device to implement the method described in any one of claims 49 to 59.

62. A BMC chip, characterized in that: include: A storage unit and a processing unit connected to the storage unit, wherein the storage unit is configured to store a program, and the processing unit is configured to run the program to execute the method according to any one of claims 49 to 59.

63. A motherboard, characterized in that: include: at least one processor; at least one memory configured to store at least one program; When the at least one program is executed by the at least one processor, the at least one processor implements the method according to any one of claims 49 to 59.

64. A server, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; a memory arranged to store a computer program; A processor, when configured to execute a program stored in a memory, implements the method described in any one of claims 49 to 59.

65. A non-volatile readable storage medium, characterized in that: The non-volatile readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 49 to 59 when executed by a processor.

66. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method described in any one of claims 49 to 59 are implemented.

Citation Information

Patent Citations

  • Starting method and device of embedded equipment, embedded equipment and storage medium

    CN115237480A

  • Bandwidth adjustment method and device, electronic equipment and computer readable storage medium

    CN115379512A

  • Method and device for dynamically allocating hardware resources of system and computing equipment

    CN115421871A

  • Operating systems

    CN1791862A

  • Method and apparatus for uniformly integrating operating system resources

    US20070050770A1

Cited By

  • Linux system abnormal equipment troubleshooting method and device and storage medium

    CN119311463A