Common resource access system, common resource control method, and electronic device
By centrally deploying the operation interface of public resources in a multi-core-multi-operating system environment in a single operating system and using inter-core communication, the problem of disordered access timing of multiple operating systems is solved, and the stability and performance improvement of the system is achieved.
Patent Information
- Application Number
- CN202411707667.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2024-12-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the multi-core-multi-operating system-multi-service module software architecture, when multiple operating systems access the same module or the same peripheral from time to time, timing disorders may result in task execution errors.
By deploying the operation interface of public resources in one operating system and using inter-core communication, other operating systems operate based on the operating system, thereby avoiding direct operation of the same public resource by different operating systems and achieving unified operation control.
It effectively reduces timing errors caused by different operating systems operating on the same public resource, improves system stability and processor performance, and reduces code redundancy.
Smart Images

Figure CN119201500A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a public resource access system, a public resource control method and an electronic device. Background Art
[0002] As the requirements for computing speed and computing scale in various fields continue to increase, traditional single-core processors have become difficult to adapt to large-scale parallel computing. In order to expand processor performance, multi-core processors have come into being. Multi-core processors use their superior processor architecture to distribute tasks to multiple computer cores, and by making full use of processor resources, they have greatly improved processor performance.
[0003] In scenarios with complex business logic, the software architecture of multiple operating systems is combined to achieve logical segmentation of business modules. Based on the characteristics of the business itself and the capabilities of the computer core, business modules with similar functions are deployed on one operating system, thus realizing the software architecture of multi-core-multi-operating system-multi-business module. The software modules deployed on multiple operating systems work together and interact according to the timing of the overall software design to achieve the final business level requirements.
[0004] In the related art, during the use of products based on a multi-core, multi-operating system, and multi-business module software architecture, there are situations where multiple operating systems access the same module or the same peripheral device at irregular intervals. At this time, the access timing of different operating systems to the same module or the same peripheral device may be disrupted, causing errors in the execution of the entire task. Summary of the invention
[0005] The embodiments of the present application provide a public resource access system, a public resource control method and an electronic device, which can effectively reduce the timing errors when different operating systems access the same public resource.
[0006] In a first aspect, an embodiment of the present application provides a public resource access system, including a first operating system, a second operating system, and public resources; wherein: An operation interface of the public resource is deployed on the first operating system; The second operating system implements the operation on the public resource based on the communication with the first operating system.
[0007] In a second aspect, an embodiment of the present application further provides a public resource control method, which is applied to the public resource access system as described in the first aspect, and the method includes: The second operating system is controlled to implement operations on the public resources based on the communication with the first operating system, wherein an operation interface of the public resources is deployed on the first operating system.
[0008] In a third aspect, an embodiment of the present application further provides an electronic device, which includes the public resource access system as shown in the first aspect.
[0009] In a fourth aspect, an embodiment of the present application further provides an electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps in the public resource control method described in the second aspect are implemented.
[0010] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the public resource control method described in the second aspect are implemented.
[0011] In a sixth aspect, an embodiment of the present application further provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps in the public resource control method as described in the second aspect.
[0012] In an embodiment of the present application, in a multi-operating system scenario, there are multiple operating systems that require operations on the same public resource, for example: deploying a multi-core-multi-operating system-multi-business module software architecture on an electronic device. In terms of hardware, by deploying multiple operating systems on multiple computer cores, the processor performance of the electronic device can be improved. In terms of software, the software modules deployed on multiple operating systems work together and interact according to the timing of the overall software design to achieve the final business level requirements. In this process, different operating systems have operational requirements for the same public resource. Based on an embodiment of the present application, the operation interface of the same public resource is deployed in one operating system. When other operating systems need to operate the public resource, they can implement the corresponding operation of the public resource by the operating system with the operation interface of the public resource deployed based on inter-core communication. In this way, the public resource is always operated by one operating system, which can effectively reduce the timing errors caused by different operating systems operating the same public resource. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0014] Figure 1 It is one of the software architecture diagrams of multi-core-multi-operating system-multi-business modules in the related art; Figure 2 This is the second schematic diagram of the software architecture of multi-core-multi-operating system-multi-business module in the related art; Figure 3 This is the third software architecture diagram of multi-core-multi-operating system-multi-business module in the related art; Figure 4 It is one of the schematic diagrams of the public resource access system provided in the embodiment of the present application; Figure 5 This is the second schematic diagram of the public resource access system provided in the embodiment of the present application; Figure 6 This is the third schematic diagram of the public resource access system provided in the embodiment of the present application; Figure 7 This is the fourth schematic diagram of the public resource access system provided in the embodiment of the present application; Figure 8 is a flow chart of a public resource control method provided in an embodiment of the present application; Fig. 9 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application; Figure numerals: first operating system 60; second operating system 70; first hardware resource 11; second hardware resource 21; multi-core processor 40; first computer kernel 41; second computer kernel 42; common resource 51; first common resource 53; second common resource 52; shared memory 90; first shared memory 91; second shared memory 92; third shared memory 93; processor 900; memory 920. DETAILED DESCRIPTION
[0015] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0016] In order to make the embodiments of the present application clearer, the relevant technical knowledge involved in the embodiments of the present application is first introduced as follows: In the related art, for products with multi-core-multi-operating system-multi-business module software architecture, during use, due to the fact that multiple operating systems irregularly access the same module or the same peripheral, when different operating systems operate the same module or the same peripheral, timing disorder may occur, thereby causing errors in the execution of the entire task. The following three solutions are proposed: 1) Through hardware expansion, a hardware resource is allocated to each operating system to avoid timing disorder caused by simultaneous access of the same hardware resource by different operating systems. Figure 1 As shown, assuming that a first operating system 60 is deployed on the first computer core 41, and a second operating system 70 is deployed on the second computer core 42, at this time, independent first hardware resources 11 and second hardware resources 21 are deployed for the first operating system 60 and the second operating system 70, respectively. In this way, the first operating system 60 can only operate the first hardware resource 11, but not the second hardware resource 21, and the second operating system 70 can only operate the second hardware resource 21, but not the first hardware resource 11, thereby avoiding the situation where different operating systems operate the same module or the same peripheral device; 2) Add some resource locks to the hardware to prevent multiple cores from accessing the same public resource at the same time, and limit software access through hardware timing. For example: Figure 2 As shown, for common resources that can be operated by the first operating system 60 and the second operating system 70, a resource lock can be added to the hardware to implement hardware timing management of the common resources using the resource lock.
[0017] 3) When designing software, set the timing in advance to avoid the scenario where different operating systems access the same hardware resources at the same time. This method requires setting timing constraints in advance when designing the software system. For example: Figure 3 As shown, for hardware resources that can be operated by the first operating system 60 and the second operating system 70, the timing for the first operating system 60 and the second operating system 70 to respectively operate the common hardware resources can be set in advance when the software system is designed.
[0018] However, although the above methods 1) and 2) can effectively handle resource allocation and the timing error problems that may be caused by multiple operating systems accessing the same public resource at the same time through the expansion of hardware resources, they require additional hardware resources and increase the cost of electronic equipment. The above method 3) uses timing restrictions in software design to make multiple operating systems access the same public resource at staggered times as much as possible, which can solve the timing problem to a certain extent, but from the perspective of software design, the flexibility and scalability are poor, and there is still a risk of timing disorder.
[0019] In the embodiment of the present application, based on real-time communication between multi-core cores, a unified operation interface is provided for multiple operating systems to simultaneously access the same public resource, thereby realizing decoupled control in which operations on the same public resource are deployed only on one operating system. This can effectively overcome the problem of task bus timing confusion caused by multiple operating systems simultaneously accessing the same public resource, and compared with the method of deploying operation interfaces for the same public resource in each operating system in the related art, it can reduce code redundancy of multiple operating systems.
[0020] It should be noted that the public resources in the embodiments of the present application can be software modules or hardware resources, which are not specifically limited here. For the sake of convenience of explanation, in the embodiments of the present application, the public resources are usually taken as software modules for example, which is not specifically limited here.
[0021] In addition, in addition to the application scenarios of the above-mentioned multi-core-multi-operating system-multi-business module software architecture, the public resource access system of the embodiment of the present application can be applied to any other deployment with at least two operating systems, and there are at least two operating systems that have access requirements to the same public resource. For example: public resources can be hardware resources such as cameras, and at least two operating systems have the need to call the camera for image acquisition. For ease of explanation, in the embodiments of the present application, the application scenarios of the multi-core-multi-operating system-multi-business module software architecture are generally used as examples for illustration, and it is not limited here that the public resource access system of the embodiment of the present application can only be applied to the multi-core-multi-operating system-multi-business module software architecture.
[0022] The public resource access system, public resource control method and electronic device provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0023] See also Figure 4 The public resource access system provided in the embodiment of the present application includes: a first operating system 60, a second operating system 70 and public resources 51.
[0024] The first operating system 60 is provided with an operation interface of the public resource 51; The second operating system 70 implements operations on the common resources 51 based on communication with the first operating system 60 .
[0025] In some embodiments, the second operating system 70 implements operations on the common resources 51 based on communication with the first operating system 60. The second operating system 70 may send operation information or control instructions on the common resources 51 to the first operating system 60, so that the first operating system 60 calls the operation interface of the common resources 51 according to the received operation information or control instructions, so as to operate the common resources 51 according to the instructions of the operation information or the control instructions.
[0026] It is worth mentioning that the operations on the public resources 51 in the embodiments of the present application may include data access and control operations on the public resources 51, which are not specifically limited here.
[0027] In some embodiments, the second operating system 70 implements operations on the common resources 51 based on communication with the first operating system 60. The second operating system 70 may store operation information on the common resources 51 in a memory shared with the first operating system 60, and control the first operating system 60 to read the operation information from the memory shared with the second operating system 70 in a timely manner, and call the operation interface of the common resources 51 according to the instructions of the operation information to implement operations on the common resources 51.
[0028] In some implementations, the operation interface of the public resource 51 may also be referred to as an operation function interface.
[0029] In an embodiment of the present application, the operation interface of the same public resource is deployed in one operating system. When other operating systems need to operate the public resource, the operating system on which the operation interface of the public resource is deployed can perform corresponding operations on the public resource based on inter-core communication. In this way, the public resource is always operated by one operating system, which can effectively reduce the timing errors caused by different operating systems operating the same public resource.
[0030] As an optional implementation manner, the second operating system is specifically used to output second operation information, where the second operation information is used to indicate operation information of the second operating system on the public resource; The first operating system is specifically used to perform a target operation on the public resource according to the second operation information to obtain an operation result and feedback information.
[0031] In some implementations, the second operating system outputs the second operation information by transmitting the second operation information to the first operating system, or writing the second operation information into a memory shared with the first operating system, so that the first operating system can obtain the second operation information.
[0032] In some embodiments, the first operating system performs the target operation on the public resource according to the second operation information. The first operating system may call the corresponding operation interface of the public resource according to the second operation information, perform the target operation on the public resource through the operation interface, and obtain the operation result and feedback information of the target operation.
[0033] In this embodiment, when the second operating system needs to operate a public resource whose operation interface is deployed on the first operating system, it cannot directly operate the public resource because the operation interface of the public resource is not deployed on the second operating system, and thus generates second operation information for the public resource, so that the first operating system can obtain the second operation information and perform the target operation on the public resource accordingly, and obtain the operation result and feedback information of the target operation.
[0034] As an optional implementation, the public resource access system further includes a shared memory; wherein: The second operating system is specifically used to write the second operation information into the shared memory and trigger an interrupt to the first operating system; The first operating system is specifically used to obtain the second operation information according to the interrupt, and perform a target operation on the common resource according to the second operation information, obtain the operation result and feedback information, and write them into the shared memory; and / or, The first operating system is specifically used to perform a target operation on the public resource according to the operation information in the message queue in a priority order, wherein the message queue includes the first operation information and / or the third operation information in addition to the second operation information; The first operation information is used to indicate operation information of the first operating system on the public resource; The third operation information is used to indicate operation information of a third operating system on the public resource, and the public resource access system further includes the third operating system, and the third operating system implements the operation on the public resource based on communication with the first operating system; and / or, The second operating system is specifically further used to obtain the operation result and the feedback information.
[0035] In some implementations, if only one operating system operates on the common resources at the same time, the first operating system can directly perform the target operation on the common resources according to the second operation information that triggers the interrupt, obtain the operation result and feedback information, and write them into the shared memory.
[0036] In other implementations, if at least two operating systems operate on a common resource at the same time, the first operating system may place the operation information for operating the common resource in a message queue, and prioritize the operation information in the message queue, such as by time sequence, or by the priority of the operating system that generates the operation information, etc. Finally, the target operation is performed on the common resource according to each piece of operation information in descending order of priority in the message queue.
[0037] Among them, at least two operating systems operating the same public resource at the same time may include a first operating system deployed with an operation function interface of the public resource and at least one other operating system, or may include at least two other operating systems in addition to the first operating system deployed with the operation function interface of the public resource.
[0038] In some embodiments, after the first operating system performs a target operation on a public resource and obtains an operation result and feedback information, the operation result and feedback information can be written into a memory shared with the second operating system, so that the second operating system obtains the operation result and feedback information of the second operation information generated by it based on the shared content.
[0039] In this implementation, when there is a shared memory between the first operating system and the second operating system, the shared memory can be used to implement interaction between the first operating system and the second operating system regarding at least one of the operation information, operation result, and feedback information; in addition, when one operating system writes at least one of the operation information, operation result, and feedback information to the shared memory, an interruption of the opposite operating system, such as an inter-process communication (IPC) interruption, can be triggered, so that the opposite operating system reads at least one of the operation information, operation result, and feedback information from the shared memory in a timely manner based on the detection of the interruption, and performs corresponding subsequent processing on the information.
[0040] For ease of explanation, the working principle of the public resource access system provided in the embodiment of the present application is explained by taking the application scenario of a multi-core-multi-operating system-multi-business module software architecture as an example.
[0041] For example: Figure 5 As shown, the public resource access system includes a multi-core processor 40 and a multi-service module; The multi-core processor 40 includes N computer cores, where N is an integer greater than 1; A first operating system 60 is deployed on a first computer core 41 of the N computer cores, and a second operating system 70 is deployed on a second computer core 42 of the N computer cores, wherein the first computer core 41 includes at least one computer core of the N computer cores, and the second computer core 42 includes at least one computer core of the N computer cores that is different from the first computer core 41; The multi-service module includes a second public resource 52, wherein the operation interface of the first public resource 53 is deployed in the first operating system 60, and the operation interface of the second public resource 52 is deployed in the second operating system 70; The first target operating system is used to send first target information to the second target operating system, and the second target operating system is used to call the operation interface of the target public resource according to the first target information to perform corresponding operations on the target public resource; The first target information is used to indicate operation information or access information on the target public resource; the first target operating system is one of the first operating system 60 and the second operating system 70, and the second target operating system is the other of the first operating system 60 and the second operating system 70; the target public resource is one of the first public resource 53 and the second public resource 52, and the operation interface of the target public resource is deployed in the second target operating system.
[0042] In some embodiments, N may be equal to 2, or N may be any integer greater than 2, for example, N is equal to any integer of 3, 4, 5, etc., which are not exhaustive. For ease of explanation, the present application embodiment takes N equal to 2 as an example for illustration, which does not constitute a specific limitation.
[0043] Among them, Figure 5 As shown, when N is equal to 2, the first computer core 41 and the second computer core 42 each include one computer core.
[0044] Of course, when N is greater than 2, at least one of the first computer core 41 and the second computer core 42 may include at least two computer cores.
[0045] In some implementations, the multi-service module may include the first public resource 53 but not the second public resource 52 . In this case, it is only necessary to deploy the operation interface of the first public resource 53 on the first operating system 60 .
[0046] In other embodiments, Figure 5As shown, the multi-service module includes the second public resource 52 but does not include the first public resource 53 . In this case, it is only necessary to deploy the operation interface of the second public resource 52 on the second operating system 70 .
[0047] In some other implementations, such as Figure 6 As shown, the multi-service module includes a first public resource 53 and a second public resource 52. At this time, the operation interface of the first public resource 53 needs to be deployed on the first operating system 60, and the operation interface of the second public resource 52 also needs to be deployed on the second operating system 70.
[0048] It should be noted that the multi-service module may also include non-public resources that can only be operated by one operating system, for example: a first service module deployed in the first operating system 60 , which is a service module that can only be operated by the first operating system 60 .
[0049] In some embodiments, the first operating system 60 and the second operating system 70 may be different types of operating systems. For example, the first operating system 60 is a Linux operating system, and the second operating system 70 is a bare metal operating system. In addition, when the public resource access system further includes a third operating system, the third operating system may be another type of operating system different from the first operating system 60 and the second operating system 70, such as a real-time operating system (RTOS).
[0050] It should be noted that the number of the first public resources 53 may be one or more. For the sake of convenience, in the embodiments of the present application, the number of the first public resources 53 is usually one, which is not a specific limitation.
[0051] Similarly, the number of the second public resources 52 may be one or more. For the sake of convenience, in the embodiments of the present application, the number of the second public resources 52 is usually one, which is not a specific limitation.
[0052] It is worth mentioning that in the embodiments of the present application, a public resource access system including two operating systems is used as an example for illustration. In other implementations, the public resource access system may include three or even four or more operating systems, and each operating system is deployed on non-overlapping computer cores.
[0053] For example: Figure 7As shown, the public resource access system may include three operating systems, namely: operating system (OS) 1, OS 2, and OS 3. At this time, the value of N is an integer greater than or equal to 3, so that OS 1, OS 2, and OS 3 are respectively deployed on non-overlapping computer cores.
[0054] For the sake of convenience of explanation, in the embodiments of the present application, a public resource access system including two operating systems is generally used as an example for illustration, which does not constitute a specific limitation herein.
[0055] In some embodiments, assuming that the first target operating system is the first operating system 60 and the second target operating system is the second operating system 70, the target common resource is the second common resource 52. At this time, when the first operating system 60 needs to operate the second common resource 52, the first operating system 60 sends the first target information to the second operating system 70, and the second operating system 70 calls the operation interface of the second common resource 52 according to the first target information to perform corresponding operations on the second common resource 52.
[0056] In some embodiments, assuming that the first target operating system is the second operating system 70, and the second target operating system is the first operating system 60, the target common resource is the first common resource 53. At this time, when the second operating system 70 needs to operate the first common resource 53, it sends the first target information to the first operating system 60, and the first operating system 60 calls the operation interface of the first common resource 53 according to the first target information to perform corresponding operations on the first common resource 53.
[0057] In an embodiment of the present application, a software architecture of multi-core, multi-operating system and multi-business module is deployed on an electronic device. In terms of hardware, the processor performance of the electronic device can be improved by deploying multiple operating systems on multiple computer cores. In terms of software, the software modules deployed on multiple operating systems work together and interact according to the timing of the overall software design to achieve the final business level requirements. In this process, multiple operating systems have operation requirements for the same public resource. Based on the embodiment of the present application, the operation interface of the same public resource is deployed in one operating system. When other operating systems need to operate the public resource, they can implement the corresponding operation of the public resource by the second target operating system deployed with the operation interface of the public resource based on inter-core communication. In this way, the same public resource is always operated by one operating system, which can effectively reduce the timing errors caused by different operating systems accessing the same public resource.
[0058] It should be noted that in the embodiment of the present application, the first operating system 60 and the second operating system 70 need to interact with each other. Based on the fact that the first operating system 60 and the second operating system 70 are deployed on different computer cores, the information interaction between the first operating system 60 and the second operating system 70 is implemented based on the communication between the computer cores.
[0059] As an optional implementation, Figure 6 As shown, the public resource access system provided by the embodiment of the present application further includes: a shared memory 90; The shared memory 90 is connected between the first computer core 41 and the second computer core 42; The first target operating system is used to send the first target information to the second target operating system through the shared memory 90, and the second target operating system is used to call the operation interface of the target public resource according to the first target information to perform corresponding operations on the target public resource.
[0060] For example: Figure 6 As shown, the shared memory 90 can be shared and accessed by the first operating system 60 and the second operating system 70. In this way, when the first operating system 60 needs to send information to the second operating system 70, it can store the information in the shared memory 90 shared with the second operating system 70, so that the second operating system 70 can read the information written by the first operating system 60 from the shared memory 90, thereby realizing the first operating system 60 to send information to the second operating system 70; correspondingly, when the second operating system 70 needs to send information to the first operating system 60, it can store the information in the shared memory 90 shared with the first operating system 60, so that the first operating system 60 can read the information written by the second operating system 70 from the shared memory 90, thereby realizing the second operating system 70 to send information to the first operating system 60.
[0061] In some embodiments, Figure 7 As shown, when the public resource access system also includes OS 1, OS 2 and OS 3, a first shared memory 91 that can be shared and accessed by OS 1 and OS 2, a second shared memory 92 that can be shared and accessed by OS 3 and OS 1, and a third shared memory 93 that can be shared and accessed by OS 3 and OS 2 can be set.
[0062] In some embodiments, when the first target operating system is used to send the first target information to the second target operating system through the shared memory 90, the first target operating system can write the resources and operations that need to be accessed into the shared memory 90 according to a specified protocol, and trigger an inter-process communication (IPC) interrupt to wait for the second target operating system to read the above information from the shared memory 90. When the second target operating system receives the IPC interrupt, it parses the information in the shared memory 90 to obtain the resources and operations that the first target operating system needs to access.
[0063] It should be noted that, in some other implementations, information interaction between the first target operating system and the second target operating system can also be achieved through other methods, for example: setting up an additional communication interface or communication peripheral to achieve information interaction between the first target operating system and the second target operating system through the communication interface or communication peripheral. The information interaction method between the first target operating system and the second target operating system is not specifically limited herein.
[0064] As an optional implementation, the second target operating system is also used to send second target information to the first target operating system through the shared memory 90 after performing corresponding operations on the target public resources, and the second target information includes feedback information of the operation interface of the target public resources and the operation results of the target public resources.
[0065] In some implementations, the second target information may be response information to the first target information.
[0066] For example: For Figure 6 In the public resource access system shown, when the first operating system 60 needs to operate the second public resource 52, the first operating system 60 writes the resources to be accessed and the operation information into the shared memory 90 according to the prescribed protocol, and triggers an IPC interrupt, waiting for the second operating system 70 to receive it; the second operating system 70 receives the IPC interrupt, parses the shared memory 90, and performs corresponding operations on the second public resource 52 according to the parsed first target information, and writes the operation result and the return information of the operation function into the shared memory 90. At this time, if the first operating system 60 needs to read the operation result, it can copy the corresponding result of the shared memory 90 to the local memory after the operation function returns.
[0067] In this embodiment, the interaction of the response information to the first target information can be implemented through the shared memory 90 in a similar manner to the first target information, so that the first target operating system can obtain the response information to the first target information.
[0068] See also Figure 8 , a public resource control method provided in an embodiment of the present application, the execution subject of which can be any public resource access system provided in the aforementioned embodiments of the present application. Figure 8 As shown, the public resource control method includes the following steps: Step 801: Control a second operating system to implement operations on public resources based on communication with a first operating system, wherein an operation interface of the public resources is deployed on the first operating system.
[0069] It should be noted that the first operating system, the second operating system, the public resources, etc. in the embodiment of the present application have the same meanings as the first operating system, the second operating system, and the public resources in the aforementioned public resource access system embodiment of the present application. To avoid repetition, they will not be repeated here.
[0070] The public resource control method provided in the embodiments of the present application can implement any of the public resource access systems provided in the aforementioned embodiments of the present application, in which the first operating system with an operation interface of the public resource deployed performs various processes on the public resource according to corresponding operations based on communication between operating systems, and can achieve the same beneficial effects as the aforementioned public resource access system embodiments of the present application. To avoid repetition, they will not be described here.
[0071] As an optional implementation manner, controlling the second operating system to implement operation on the public resource based on communication with the first operating system includes: Controlling the second operating system to output second operation information, wherein the second operation information is used to indicate operation information of the second operating system on the public resource; The first operating system is controlled to perform a target operation on the public resource according to the second operation information, and obtain an operation result and feedback information.
[0072] As an optional implementation, the public resource access system further includes a shared memory, and the controlling the second operating system to output second operation information, and controlling the first operating system to perform a target operation on the public resource according to the second operation information, to obtain an operation result and feedback information, includes: Controlling the second operating system to write the second operation information into the shared memory, and triggering an interrupt to the first operating system; Controlling the first operating system to obtain the second operation information according to the interrupt, and performing a target operation on the common resource according to the second operation information, obtaining an operation result and feedback information, and writing the operation result and feedback information into the shared memory; and / or, The controlling the first operating system to perform a target operation on the public resource according to the second operation information includes: Controlling the first operating system to perform a target operation on the public resource according to the operation information in the message queue in a priority order, wherein the message queue includes, in addition to the second operation information, first operation information and / or third operation information; the first operation information is used to indicate the operation information of the first operating system on the public resource; the third operation information is used to indicate the operation information of the third operating system on the public resource, and the public resource access system also includes the third operating system, and the third operating system implements the operation on the public resource based on the communication with the first operating system; and / or, After obtaining the operation result and the feedback information, the method further includes: Control the second operating system to obtain the operation result and the feedback information.
[0073] In the embodiment of the present application, the manner in which the second operating system transmits the second operation information to the first operating system through shared memory is implemented, which is the same as the manner in which the second operating system transmits the second operation information to the first operating system through shared memory in the aforementioned public resource access system embodiment of the present application, and can achieve the same beneficial effects. For details, please refer to the description in the aforementioned public resource access system embodiment of the present application, which will not be repeated here.
[0074] In some embodiments, the first operation information is used to indicate the operation information or access information of the first operating system on the public resource, the second operation information is used to indicate the operation information or access information of the second operating system on the public resource, and the third operation information is used to indicate the operation information or access information of the third operating system on the public resource. For example, the first operation information, the second operation information, and the third operation information can respectively indicate the party that needs to operate the public resource. For example, assuming that OS 1 and OS 2 need to operate the public resource respectively, and the operation interface of the public resource is only deployed on OS 3, then when both OS 1 and OS 2 need to operate the public resource, OS 1 will generate an operation information to indicate that OS 1 needs to operate the public resource and what operation OS 1 needs to perform on the public resource; OS 2 will generate another operation information to indicate that OS 2 needs to operate the public resource and what operation OS 2 needs to perform on the public resource.
[0075] In some implementations, the first operating system may store the received operation information and the first operation information generated by itself in a message queue, and call one operation information in the message queue each time in order of priority, and operate on the public resources according to the called operation information.
[0076] For example: in a scenario where the first operating system generates first operation information based on the need to operate the public resource, and the second operating system generates second operation information based on the need to operate the public resource, and sends the second operation information to the first operating system, if the priority of the first operation information generated by the first operating system is higher than the priority of the second operation information generated by the second operating system, the first operating system may operate the public resource according to the second operation information first, and then operate the public resource according to the first operation information.
[0077] In some embodiments, when the total number of operation information in the message queue is greater than 1, the first operating system can arbitrate the operation information in the message queue according to preset priority information to determine the execution order of each operation information or whether to execute specified operation information therein.
[0078] The preset priority information may be pre-configured by the first operating system, and the preset priority information may include priority information of each operating system that may operate the public resources deployed on the first operating system. At this time, the priority of the operation information from the operating system may be determined according to the priority of each operating system.
[0079] For example: if OS 1, OS 2 and OS 3 may all access the public resources deployed on OS 3, OS 3 may set the priorities of OS 1, OS 2 and OS 3 in advance. Assuming that the priority of OS 3 is higher than that of OS 1, and the priority of OS 1 is higher than that of OS 2, when the message queue of OS 3 contains operation information from OS 1 and OS 2, as well as operation information generated by OS 3 itself, OS 3 will first call the operation function interface of the public resources to operate on the public resources according to the operation information generated by OS 3 itself; then, OS 3 will call the operation function interface of the public resources to operate on the public resources according to the operation information from OS 1; finally, OS 3 will call the operation function interface of the public resources to operate on the public resources according to the operation information from OS 2.
[0080] In some implementations, the preset priority information may indicate that the operation information is executed in the order of their generation time. In this case, the priority of the operation information generated first is higher than the priority of the operation information generated later.
[0081] In this embodiment, the operating system configured with the operation interface of the public resource can set the priority of other operating systems. At this time, the priority of the operation information generated by the operating system with a high priority is higher than the operation information generated by the operating system with a low priority.
[0082] In other implementations, the operation information may carry dynamic priority information. In this case, the first operating system determines the priority order of each operation information in the message queue based on the priority information carried in the operation information.
[0083] In some other implementations, for operation information in a message queue that does not carry priority information, the priority information of the operation information can be determined by default according to preset priority information pre-configured by the first operating system. For operation information in a message queue that carries priority information, the priority information of the operation information can be determined based on the priority information carried in the operation information.
[0084] For example: for public resources that deploy operation interfaces on OS 3, OS3 defaults to the priority order of OS 1, OS 2 and OS 3 as OS 1>OS 2>OS 3. Assume that at the same time, the message queue corresponding to the public resource contains operation information from OS 1, operation information from OS 2 and operation information generated by OS 3 itself, and the operation information generated by OS 3 itself carries first priority information, which indicates that the operation information generated by OS 3 itself has the highest priority. Then OS 3 will operate on the public resources in the order of the operation information generated by OS 3 itself, the operation information from OS 1 and the operation information from OS 2.
[0085] In this way, the priority information of the operation information can be dynamically adjusted by carrying the priority information in the operation information.
[0086] In this embodiment, the operation information for operating the same public resource is intercepted in a message queue, and the priority order of each operation information in the message queue is determined by the first operating system deployed with the public resource. In this way, the operation instructions of the public resource are sorted and screened according to the priority order of each operation information, which can overcome the timing problem caused by multiple operating systems operating a certain public resource at the same time.
[0087] For ease of understanding, we apply Figure 6 Taking the public resource access system shown as an example, various resource control methods provided in the embodiments of the present application are illustrated.
[0088] In this embodiment, the operation interface of the second public resource 52 is deployed on the second operating system 70, and the operation interface of the first public resource 53 is deployed on the first operating system 60. At this time, in order to realize the operation of the first operating system 60 on the second public resource 52 and the operation of the second operating system 70 on the first public resource 53, the following steps need to be included: Step 1: When designing the software, from a functional perspective, the operation interface of the second public resource 52 that may be accessed by each system is deployed only on the second operating system 70 .
[0089] Step 2: When the first operating system 60 needs to operate the resources of the second public resources 52 , the operation on the second public resources 52 can be finally completed on the second operating system 70 through inter-core communication.
[0090] Wherein, step 2 specifically includes the following sub-steps: Sub-step 2.1: The first operating system 60 writes the resources and operations to be accessed into the shared memory 90 according to the prescribed protocol, triggers an IPC interrupt, and waits for the second operating system 70 to receive it.
[0091] Sub-step 2.2: The second operating system 70 receives the IPC interrupt, parses the shared memory 90 , and performs corresponding operations on the second public resource 52 according to the parsed accessed resources and operation information, and writes the operation result and return information into the shared memory 90 .
[0092] Sub-step 2.3: If the first operating system 60 needs to read the operation result, after the function returns, the corresponding result of the shared memory 90 is copied to the local memory.
[0093] Step 3: When designing the software, from a functional perspective, the operation interface of the first public resource 53 that may be accessed by each system is deployed only on the first operating system 60 .
[0094] Step 4: When the second operating system 70 needs to operate the resources of the first public resources 53 , the operation on the first public resources 53 can be finally completed on the first operating system 60 through inter-core communication.
[0095] Wherein, step 4 specifically includes the following sub-steps: Sub-step 4.1: The second operating system 70 writes the resources and operations to be accessed into the shared memory 90 according to the prescribed protocol, triggers an IPC interrupt, and waits for the first operating system 60 to receive it.
[0096] Sub-step 4.2: The first operating system 60 receives the interrupt, parses the shared memory 90 , and performs corresponding operations on the first public resource 53 , and writes the operation result and the return information into the shared memory 90 .
[0097] Sub-step 4.3: If the second operating system 70 needs to read the operation result, after the function returns, the corresponding result of the shared memory 90 is copied to the local memory.
[0098] The above process is only used as an example. When the public resource access system includes multiple operating systems and multiple public resources, the operation interface of a certain public resource can be deployed on an operating system according to the logic of the above steps. When other operating systems need to operate the public resource, they can send information to the operating system where the operation interface of the public resource is deployed through inter-core communication, and finally control of the public resource is achieved through one operating system.
[0099] The embodiment of the present application further provides an electronic device, which may include any public resource access system in the aforementioned public resource access system embodiment of the present application.
[0100] See also Fig. 9 , Fig. 9 is a structural diagram of an electronic device provided in an embodiment of the present application. Since the principle of solving the problem by the electronic device is similar to that of the aforementioned public resource control method embodiment of the present application, the implementation of the electronic device can refer to the implementation of the method, and the repeated parts will not be repeated. Fig. 9 As shown, the electronic device includes: a processor 900 and a memory 920, the processor 900 is a multi-core processor, the structure of the multi-core processor, and the deployment of the operating system and business modules on the multi-core processor are the same as the structure of the multi-core processor in the aforementioned public resource access system embodiment of the present application, and the deployment of the operating system and business modules on the multi-core processor, and will not be repeated here.
[0101] In the embodiment of the present application, the processor 900 is used to read the program in the memory 920 and execute the following process: The second operating system is controlled to implement operations on the public resources based on the communication with the first operating system, wherein an operation interface of the public resources is deployed on the first operating system.
[0102] Among them, Fig. 9 In the embodiment, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits of one or more processors represented by processor 900 and memory represented by memory 920. The bus architecture may also link various other circuits such as peripheral devices (such as cameras), voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface provides an interface. The processor 900 is responsible for managing the bus architecture and general processing, and the memory 920 may store data used by the processor 900 when performing operations.
[0103] Optionally, the processor 900 is further configured to read a program in the memory 920 and execute the following process: Controlling the second operating system to output second operation information, wherein the second operation information is used to indicate operation information of the second operating system on the public resource; The first operating system is controlled to perform a target operation on the public resource according to the second operation information, and obtain an operation result and feedback information.
[0104] Optionally, the public resource access system further includes a shared memory, and the processor 900 is further configured to read a program in the memory 920 and execute the following process: After the second target operating system performs a corresponding operation on the target common resource, the second target operating system controls the second operating system to write the second operation information into a shared memory and triggers an interrupt to the first operating system; Controlling the first operating system to obtain the second operation information according to the interrupt, and performing a target operation on the common resource according to the second operation information, obtaining an operation result and feedback information, and writing the operation result and feedback information into the shared memory; and / or, Controlling the first operating system to perform a target operation on the public resource according to the operation information in the message queue in a priority order, wherein the message queue includes, in addition to the second operation information, first operation information and / or third operation information; the first operation information is used to indicate the operation information of the first operating system on the public resource; the third operation information is used to indicate the operation information of the third operating system on the public resource, and the public resource access system also includes the third operating system, and the third operating system implements the operation on the public resource based on the communication with the first operating system; and / or, Control the second operating system to obtain the operation result and the feedback information.
[0105] The electronic device provided in the embodiment of the present application can execute each process of the aforementioned public resource control method embodiment, and its implementation principle and technical effect are similar, which will not be repeated in this embodiment.
[0106] The embodiment of the present application also provides a computer-readable storage medium for storing a computer program. The computer program can be executed by a processor, can implement the various steps of the aforementioned public resource control method embodiment, and can achieve the same beneficial effects as the aforementioned public resource control method embodiment. To avoid repetition, it will not be repeated here.
[0107] The embodiment of the present application also provides a computer program product, which is stored in a non-volatile storage medium. The computer program product is executed by at least one processor to implement the various steps of the aforementioned public resource control method embodiment, and can achieve the same beneficial effects as the aforementioned public resource control method embodiment. To avoid repetition, it will not be repeated here.
[0108] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0109] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may be physically included separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0110] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform some steps of the sending and receiving method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0111] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A public resource access system, characterized in that: It includes a first operating system, a second operating system and public resources; wherein: An operation interface of the public resource is deployed on the first operating system; The second operating system implements the operation on the public resource based on the communication with the first operating system.
2. The public resource access system according to claim 1, characterized in that: The second operating system is specifically used to output second operation information, where the second operation information is used to indicate operation information of the second operating system on the public resource; The first operating system is specifically used to perform a target operation on the public resource according to the second operation information to obtain an operation result and feedback information.
3. The public resource access system according to claim 2, characterized in that: The public resource access system also includes a shared memory; wherein: The second operating system is specifically used to write the second operation information into the shared memory and trigger an interrupt to the first operating system; The first operating system is specifically used to obtain the second operation information according to the interrupt, and perform a target operation on the common resource according to the second operation information, obtain the operation result and feedback information, and write them into the shared memory; and / or, The first operating system is specifically used to perform a target operation on the public resource according to the operation information in the message queue in a priority order, wherein the message queue includes the first operation information and / or the third operation information in addition to the second operation information; The first operation information is used to indicate operation information of the first operating system on the public resource; The third operation information is used to indicate operation information of a third operating system on the public resource, and the public resource access system further includes the third operating system, and the third operating system implements the operation on the public resource based on communication with the first operating system; and / or, The second operating system is specifically further used to obtain the operation result and the feedback information.
4. The public resource access system according to claim 1, characterized in that: The first operating system and the second operating system are both multi-core operating systems, and the second operating system implements operations on the common resources based on inter-core communication with the first operating system.
5. A method for controlling public resources, characterized in that: Applied to the public resource access system according to any one of claims 1 to 4, the method comprises: The second operating system is controlled to implement operations on the public resources based on the communication with the first operating system, wherein an operation interface of the public resources is deployed on the first operating system.
6. The method according to claim 5, characterized in that The controlling the second operating system to implement the operation on the public resources based on the communication with the first operating system includes: Controlling the second operating system to output second operation information, wherein the second operation information is used to indicate operation information of the second operating system on the public resource; The first operating system is controlled to perform a target operation on the public resource according to the second operation information, and obtain an operation result and feedback information.
7. The method according to claim 6, characterized in that The public resource access system further includes a shared memory, and the controlling the second operating system to output second operation information and controlling the first operating system to perform a target operation on the public resource according to the second operation information to obtain an operation result and feedback information includes: Controlling the second operating system to write the second operation information into the shared memory, and triggering an interrupt to the first operating system; Controlling the first operating system to obtain the second operation information according to the interrupt, and performing a target operation on the common resource according to the second operation information, obtaining an operation result and feedback information, and writing the operation result and feedback information into the shared memory; and / or, The controlling the first operating system to perform a target operation on the public resource according to the second operation information includes: Controlling the first operating system to perform a target operation on the public resource according to the operation information in the message queue in a priority order, wherein the message queue includes, in addition to the second operation information, first operation information and / or third operation information; the first operation information is used to indicate the operation information of the first operating system on the public resource; the third operation information is used to indicate the operation information of the third operating system on the public resource, and the public resource access system also includes the third operating system, and the third operating system implements the operation on the public resource based on the communication with the first operating system; and / or, After obtaining the operation result and the feedback information, the method further includes: Control the second operating system to obtain the operation result and the feedback information.
8. An electronic device, characterized in that: The electronic device comprises the public resource access system according to any one of claims 1 to 4.
9. A computer-readable storage medium for storing a computer program, characterized in that: When the computer program is executed by a processor, the steps in the common resource control method according to any one of claims 5 to 7 are implemented.
10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps in the public resource control method according to any one of claims 5 to 7.
Citation Information
Patent Citations
Method and apparatus for sharing memory medium between multiple operating systems
CN101477511A
Method, device and equipment for sharing audio equipment
CN116560614A
Multi-core operating system architecture applied to acquisition terminal
CN118796285A
Shared resource access control method and device, storage medium and electronic equipment
CN118885307A
