CN112181504B - Operating system calling method and device - Google Patents

Operating system calling method and device Download PDF

Info

Publication number
CN112181504B
CN112181504B CN202011012177.5A CN202011012177A CN112181504B CN 112181504 B CN112181504 B CN 112181504B CN 202011012177 A CN202011012177 A CN 202011012177A CN 112181504 B CN112181504 B CN 112181504B
Authority
CN
China
Prior art keywords
operating system
code
execution
function
execution code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011012177.5A
Other languages
Chinese (zh)
Other versions
CN112181504A (en
Inventor
焦保存
谭艳勇
孙振
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Fenda Intelligent Technology Co ltd
Original Assignee
Shenzhen Fenda Intelligent Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Fenda Intelligent Technology Co ltd filed Critical Shenzhen Fenda Intelligent Technology Co ltd
Priority to CN202011012177.5A priority Critical patent/CN112181504B/en
Publication of CN112181504A publication Critical patent/CN112181504A/en
Application granted granted Critical
Publication of CN112181504B publication Critical patent/CN112181504B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application provides a method and a device for calling an operating system, wherein the method comprises the following steps: receiving a first execution code for calling a first operating system, wherein the first operating system is operated in a first execution environment of the electronic equipment, and the first execution code is a code for executing a first function by an application program in the electronic equipment; converting the first execution code into a second execution code according to a first interface specification, wherein the second execution code meets the interface specification of the first operating system; and calling the first operating system to execute the first function based on the second execution code. The application can solve the compatibility problem of the application program between different operating systems by converting the execution code of the calling operating system in the application program into the code meeting the interface specification of the operating system, provides the utilization rate of the application program code and improves the development efficiency.

Description

Operating system calling method and device
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for calling an operating system.
Background
The mobile terminal such as mobile phones and wearable devices has relatively complex functions and more interaction logic, and usually needs to select an embedded operating system as a basis, and after the operating system is selected, the mobile terminal is designed and developed on the basis of the operating system. For the provider of the application program, corresponding products need to be developed on different operating systems facing different mobile terminals, and the iteration of the products needs to reconstruct product software in different operating systems, so that development time of part of products is occupied, and repeated utilization of codes is not facilitated.
Disclosure of Invention
In order to solve the problems, the application discloses a method and a device for calling an operating system, which can solve the problem of compatibility of application programs among different operating systems.
In a first aspect, an embodiment of the present application provides a method for calling an operating system, which is applied to an electronic device, where the method includes:
Receiving a first execution code for calling a first operating system, wherein the first operating system is operated in a first execution environment of the electronic equipment, and the first execution code is a code for executing a first function by an application program in the electronic equipment;
Converting the first execution code into a second execution code according to a first interface specification, wherein the second execution code meets the interface specification of the first operating system;
and calling the first operating system to execute the first function based on the second execution code.
In a second aspect, an embodiment of the present application provides an operating system calling device, which is applied to an electronic device, where the device includes:
The electronic equipment comprises a receiving unit, a first operating system and a second operating system, wherein the receiving unit is used for receiving a first execution code for calling the first operating system, the first operating system is operated in a first execution environment of the electronic equipment, and the first execution code is a code for executing a first function by an application program in the electronic equipment;
The conversion unit is used for converting the first execution code into a second execution code according to a first interface specification, and the second execution code meets the interface specification of the first operating system;
and the calling unit is used for calling the first operating system to execute the first function based on the second execution code.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for performing steps in any of the methods of the first aspect of the embodiments of the present application.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method described in the first aspect of the embodiments of the present application.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps described in the method of the first aspect of the embodiments of the present application. The computer program product may be a software installation package.
In the embodiment of the application, a first execution code for calling a first operating system is received, the first operating system is operated in a first execution environment of the electronic equipment, and the first execution code is a code for executing a first function by an application program in the electronic equipment; converting the first execution code into a second execution code according to a first interface specification, wherein the second execution code meets the interface specification of the first operating system; and calling the first operating system to execute the first function based on the second execution code. The application can solve the compatibility problem of the application program between different operating systems by converting the execution code of the calling operating system in the application program into the code meeting the interface specification of the operating system, provides the utilization rate of the application program code and improves the development efficiency.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a model of an operating system according to an embodiment of the present application;
FIG. 2 is a block diagram of an operating system according to an embodiment of the present application;
FIG. 3 is a flowchart illustrating a method for calling an operating system according to an embodiment of the present application;
FIG. 4 is a block diagram of a virtual operating system according to an embodiment of the present application;
FIG. 5a is a functional block diagram of a calling device of an operating system according to an embodiment of the present application;
FIG. 5b is a block diagram illustrating functional units of a calling device of another operating system according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "comprising" and "having" and any variations thereof in the description and claims of the invention and in the foregoing drawings are intended to cover non-exclusive inclusions. For example, a process, system, article, or apparatus that comprises a list of steps or elements is not limited to only those listed but may optionally include additional steps or elements not listed or inherent to such process, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the invention. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
For a better understanding of aspects of embodiments of the present application, related terms and concepts that may be related to embodiments of the present application are described below.
An Operating System (OS) refers to System software that is used to manage all resources (including hardware, software, and data resources) of a computer System, control program operations, improve human-machine interfaces, provide support for other application software, and the like.
As shown in fig. 1, fig. 1 is an operating system model provided in an embodiment of the present application, which includes a software body below an application layer above a hardware platform and a system application embedded in an operating system. As shown, the operating system is above the receiving terminal hardware layer and below the application layer, so that the difference of the hardware layers is shielded, a unified environment is provided for the running of the application, and a complete and unified application programming interface (Application Programming Interface, API) is provided for the development of the application.
As shown, the operating system has three types of interfaces with the periphery: an application programming interface, i.e., an interface that the operating system provides to the application developer; a system transplanting interface, namely an interface of an operating system for transplanting aiming at a specific hardware platform; application signaling, i.e. the interface where the operating system interacts with the operating front-end.
Among them, by application development technology types may include Java applications and Web applications: java applications refer to a generic term for applications developed using the Java programming language; the Web application is a generic term for applications developed using Web technologies such as HTML, javaScript, CSS.
As shown in fig. 2, fig. 2 is a block diagram of an operating system according to an embodiment of the present application, which includes an application layer, an application framework layer, a system library, and a kernel layer.
The application layer is used for realizing various applications including Java applications and Web applications. Wherein the application is in the form of software or files, and implements all or part of the functions of a service. The applications can be classified into system applications, operator custom applications and user self-selection applications according to different sources. Specifically, the application layer may include applications such as cameras, gallery, calendar, phone calls, maps, navigation, WLAN, bluetooth, music, video, short messages, etc.
The application framework layer is used for combining and repackaging all component interfaces and logic of the component layer so as to simplify the reuse mechanism of the application on the component layer components. In some examples, the application framework layer includes a Java application framework including a Java application programming interface and a Web application framework; the Web application framework comprises a Web application programming interface including an HTML5 extended JS port. The Java application framework invokes components in the component layer through Java Native Interfaces (JNIs), and the Web application framework invokes components in the component layer through JavaScript native interfaces (JSNI).
Optionally, the application framework layer further includes a multi-application intelligent adaptation mechanism for compatibility and adaptation of applications developed for other operating systems. The multi-application intelligent adapting mechanism keeps the component layer of the operating system unchanged, and different combinations and packages are carried out on the components at the application framework layer according to the application programming interface requirements of the target operating system so as to realize the application programming interfaces required by the target operating system and realize the application compatibility of the target operating system. The application framework layer invokes the exposed canonical generic component interface of the component through JNI or JSNI.
In some possible examples, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like. The window manager is used for managing window programs. The window manager can acquire the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like. The content provider is used to store and retrieve data and make such data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phonebooks, etc. The view system includes visual controls, such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a text message notification icon may include a view displaying text and a view displaying a picture. The telephony manager is for providing communication functions of the electronic device. Such as the management of call status (including on, hung-up, etc.). The resource manager provides various resources for the application program, such as localization strings, icons, pictures, layout files, video files, and the like. The notification manager allows the application to display notification information in a status bar, can be used to communicate notification type messages, can automatically disappear after a short dwell, and does not require user interaction. Such as notification manager is used to inform that the download is complete, message alerts, etc. The notification manager may also be a notification in the form of a chart or scroll bar text that appears on the system top status bar, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in a status bar, a prompt tone is emitted, the electronic device vibrates, and an indicator light blinks, etc.
Wherein the system library may comprise a plurality of functional modules. For example: surface manager (surface manager), media library (media library), three-dimensional graphics processing library (e.g., openGL ES), 2D graphics engine (e.g., SGL), etc.; the surface manager is used for managing the display subsystem and providing fusion of 2D and 3D layers for a plurality of application programs; media libraries support a variety of commonly used audio, video format playback and recording, still image files, and the like. The media library may support a variety of audio video encoding formats, such as: MPEG4, h.264, MP3, AAC, AMR, JPG, PNG, etc.; the three-dimensional graphic processing library is used for realizing three-dimensional graphic drawing, image rendering, synthesis, layer processing and the like; the 2D graphics engine is a drawing engine for 2D drawing.
The kernel layer is a layer between hardware and software and is used for performing process management, memory management, realizing network protocol and providing a driver for a hardware platform. The inner core layer at least comprises a display driver, a camera driver, an audio driver and a sensor driver.
Optionally, the operating system may further include an application execution environment layer, which is an execution interpretation environment for providing application code. The application execution environment layer comprises a Java application execution environment and a Web application execution environment, wherein the Java application execution environment comprises a Java virtual machine and a Java core class library; the Web application execution environment adopts a Web engine based on WebKit; the Java application execution environment and the Web application execution environment run independently. In this embodiment, the Java application execution environment and the Web application execution environment each independently run, each independently exist, the Java application execution environment does not depend on the capability of the Web application execution environment, the Web application execution environment does not depend on the capability of the Java application execution environment, the lifecycle of any one application execution environment begins to depend on whether other application execution environments run or not, and the end of the lifecycle of any one application execution environment does not cause the end of the lifecycle of other applications.
Optionally, the operating system may further include a component layer including electronic device related components for supporting electronic device applications, each component providing a canonical generic component interface to the application framework layer so that the interfaces exposed to the application framework layer remain unchanged when the component is replaced. For example, the operating system may include a set of components of all or part of the following types: a network communication related component, a device management related component, a man-machine interaction related component, a media processing related component, a window management related component, an application management related component, a graphic display related component, a system management related component and a browser related component.
At present, the functions which can be realized by electronic equipment such as a mobile phone, a wearable device, a computer and the like are relatively complex, the interaction logic is more, an embedded operating system is usually required to be selected as a basis, and after the operating system is selected, the mobile terminal is designed and developed on the basis of the operating system. For the provider of the application program, corresponding products need to be developed on different operating systems in the face of different mobile terminals, and the iteration of the products needs to reconstruct product software in different operating systems, so that development time of part of products is occupied, and repeated utilization of codes is not facilitated.
In view of the above problems, embodiments of the present application provide a method for calling an operating system, which can solve the problem of compatibility of an application program between different operating systems by converting an execution code of calling the operating system in the application program into a code meeting the operating system interface specification, thereby providing a utilization rate of the application program code and improving development efficiency.
The electronic device according to the embodiments of the present application may be implemented in various forms. For example, the electronic device described in the embodiments of the present application may be a mobile terminal, which may include a mobile terminal such as a mobile phone, a smart phone, a notebook computer, a digital broadcast receiver, a Personal digital assistant (Personal DIGITAL ASSISTANT, PDA), a tablet (PAD), a Portable multimedia player (Portable MEDIA PLAYER, PMP), a navigation device, and the like, and a fixed terminal such as a digital TV, a desktop computer, and the like. In the following, it is assumed that the electronic device is a mobile terminal. However, it will be understood by those skilled in the art that the configuration according to the embodiment of the present application can be applied to a fixed type terminal in addition to elements particularly used for a moving purpose.
The following describes in detail the implementation of the embodiment of the present application with reference to the drawings.
Referring to fig. 3, fig. 3 is a flowchart of a method for calling an operating system, which is applied to an electronic device. As shown in fig. 3, the method includes the following steps.
S310, receiving a first execution code which calls a first operating system, wherein the first operating system is operated in a first execution environment of the electronic equipment, and the first execution code is a code for executing a first function by an application program in the electronic equipment.
When an application program is executed in an execution environment of an electronic device, a memory space is allocated for the application program according to an instruction message for executing the application program, and an execution code of the application program is loaded into the allocated memory space. Specifically, after receiving an operation command for executing an application program in the first execution environment, a memory space may be allocated for the application program, for storing execution code for executing the application program, where the allocated memory space is exclusive to the application program. After the memory space is divided, the execution code for executing the application program, i.e. the execution program, is loaded into the memory space, and further, the execution code of the application program involves an operating system that needs to be called in the execution process.
The operating system running on the electronic device includes Linux, ubuntu, android, windows, RT _ Thread, freeRTOS, liteOS, in which one or more system containers may be installed, each for providing an operating system or virtual operating system, and any two systems provided by the system containers may be the same or different.
When the electronic device is a mobile device or a PC, the system container (equivalent to a virtual operating system) is provided in the mobile device or the PC, so that a user can conveniently use the mobile device or the PC in a safe mode, namely, each user can only enter the virtual operating system provided by the corresponding system container, the system containers used by a plurality of users are independent and physically isolated from each other, the mutual influence is avoided, and the safety of information in the mobile device or the PC can be improved.
When the target equipment is a server, the server can provide a plurality of system containers in a cloud service mode, and each user can use the own system container through the Internet, so that on one hand, the cost of a local terminal of the user can be reduced (only one networking equipment is needed to enter the own virtual system) without frequently upgrading the equipment; on the other hand, the security of the information can be improved (because the used system containers are independent and physically isolated).
It should be noted that, the method for calling the operating system provided by the present application may be applied to a virtual operating system in an electronic device, where the virtual operating system is similar to a virtual file system, and multiple operating systems may be mounted at will under the virtual operating system, as shown in fig. 4. The virtual operating system can receive the execution code of the application program, call the operating system of the application program according to the requirement, and the virtual operating system is between the application program and the operating system.
S320, converting the first execution code into a second execution code according to a first interface specification, wherein the second execution code meets the interface specification of the first operating system.
In practical applications, the operating systems provided by suppliers generally have the following functions: task creation, message streaming, soft timers, interrupt mechanisms, events, mutex locks, semaphores, event management, memory management, doubly linked lists, etc. The principle of implementing the functions is consistent between the operating systems, except for the external interfaces, but finally the functions of the interfaces are consistent. Therefore, in the embodiment of the application, the functional interfaces of the operating systems can be packaged uniformly. When the software is developed, a unified interface is used for developing the system. After unified standards are provided, the product is not dependent on a single operating system, but has unified specifications, and is favorable for iterative development and repeated utilization of product software.
Specifically, after receiving the first execution code for calling the first operating system, the execution code of the application program can be converted into the execution code meeting the interface specification of the first operating system according to the packaged first interface specification, so that the application program can run on different operating systems.
In one possible embodiment, the method further comprises: the first interface specification is predefined, the first interface specification including a first code template, the first code template being a code template of an interface specification of the first operating system implementing the first function.
When the code of the first function executed by the application program is received, the code is converted into the code template of the first function, so that the corresponding operating system is called.
In the embodiment of the application, the interface functions of different operating systems are packaged, the code templates of the interface functions are provided, unified task creation, queue message creation and using mechanisms and the like are provided for an application side of the operating system, so that unified interface templates are provided for development of product equipment, rapid development and realization of products are provided, and the problem of changing product design due to change of the operating system is solved.
Optionally, the step 320 of converting the first execution code into the second execution code according to the first interface specification may include the following steps:
21. traversing each line of code in the first execution code;
22. selecting the first code template from the first interface specification based on the first operating system and a mapping relationship between the first function and the code template;
23. The first execution code is converted to the second execution code based on the first code template.
When a first execution code calling the first operating system is received, a code template corresponding to a first function in the first operating system can be searched from the first standard interface, each row of codes in the first execution code is compared with the first code template, and if the codes in the first execution code do not meet the function requirements, writing standards and/or parameter requirements of the first code template, the codes are converted into second execution codes according to the first code template.
S330, calling the first operating system to execute the first function based on the second execution code.
When a second execution code meeting the interface specification of the first operating system is obtained, the system resource in the first operating system can be called to execute the first function directly according to the second execution code.
In one possible embodiment, a second operating system is run in a second execution environment of the electronic device; the method further comprises the steps of:
when the first execution code is further used for calling the second operating system, the first execution code is converted into a third execution code according to the first interface specification, and the third execution code meets the interface specification of the second operating system; and calling the second operating system to execute the first function based on the third execution code.
The electronic device simultaneously runs a first operating system and a second operating system, the first operating system runs in a first execution environment, and the second operating system runs in a second execution environment. Further, physical resources such as a CPU and a memory used by the first operating system and the second operating system may be shared; the physical resources such as the CPU and the memory used for distributing and running or carrying the first operating system and the second operating system may be different, that is, the physical resources are isolated independently, which is not limited in the embodiment of the present application.
Specifically, when the first execution code of the application program needs to call the first operating system and the second operating system, when the first execution code is executed, a first code template corresponding to a first function in the first operating system and a second code template corresponding to the first function in the second operating system can be searched from the first interface specification, and according to the first code template and the second code template, the first execution code is converted into a second execution code and a third execution code, and the first operating system and the second operating system are respectively called to execute the first function.
In one possible embodiment, the method further comprises: receiving a fourth execution code which calls the first operating system, wherein the fourth execution code is a code for executing a second function in the electronic equipment, and the fourth execution code and the first execution code are received simultaneously; invoking the first operating system to execute the first function or the second function based on the priority levels of the first function and the second function.
Optionally, when the priority level of the first function is greater than the priority level of the second function, calling the first operating system to execute the first function;
and when the priority level of the first function is smaller than that of the second function, calling the first operating system to execute the second function.
Specifically, when a first execution code for executing a first function and a second execution code for executing a second function of an application program are received at the same time, the first execution code and the second execution code may be sequentially converted to call the first operating system according to a predefined priority order of the first function and the second function. For example, the first function is task creation, and the second function is interrupt, and the priority of the interrupt is higher than that of task creation, so when the execution code of task creation and the execution code of interrupt are received simultaneously, the interrupt is executed preferentially, and then the task creation is executed, that is, the first operating system is called preferentially to execute the interrupt operation, and then the first operating system is called to execute the task creation.
In one possible embodiment, the method further comprises:
Receiving a first operation result of the first operating system; and according to a second interface specification, converting the first operation result into a second operation result, wherein the data format of the second operation result meets the data format of the application program interface.
Specifically, after the first operating system is called to execute the first function to obtain the first operation result, the data format of the first operation result may not meet the data format of the application program interface, so after the first operation result of the first function is received, the data format of the first operation result may be converted into the data format of the application program interface according to the second interface specification defined in advance.
It can be seen that the present application proposes a method for calling an operating system, which receives a first execution code for calling a first operating system, where the first operating system is run in a first execution environment of an electronic device, and the first execution code is a code for executing a first function by an application program in the electronic device; converting the first execution code into a second execution code according to a first interface specification, wherein the second execution code meets the interface specification of the first operating system; and calling the first operating system to execute the first function based on the second execution code. The application can solve the compatibility problem of the application program between different operating systems by converting the execution code of the calling operating system in the application program into the code meeting the interface specification of the operating system, provides the utilization rate of the application program code and improves the development efficiency.
The foregoing description of the embodiments of the present application has been presented primarily in terms of a method-side implementation. It will be appreciated that the electronic device, in order to achieve the above-described functions, includes corresponding hardware structures and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application can divide the functional units of the electronic device according to the method example, for example, each functional unit can be divided corresponding to each function, and two or more functions can be integrated in one processing unit. The integrated units may be implemented in hardware or in software functional units. It should be noted that, in the embodiment of the present application, the division of the units is schematic, which is merely a logic function division, and other division manners may be implemented in actual practice.
Referring to fig. 5a, fig. 5a is a functional unit block diagram of an operating system call device 500 according to an embodiment of the present application, where the operating system call device 500 includes: a receiving unit 510, a converting unit 520, and a calling unit 530, wherein,
A receiving unit 510, configured to receive a first execution code that invokes a first operating system, where the first operating system is running in a first execution environment of the electronic device, and the first execution code is a code that an application program in the electronic device executes a first function;
a conversion unit 520, configured to convert the first execution code into a second execution code according to a first interface specification, where the second execution code meets the first operating system interface specification;
And a calling unit 530, configured to call the first operating system to execute the first function based on the second execution code.
Optionally, as shown in fig. 5b, the calling device 500 of the operating system further includes a defining unit 540, where the defining unit 540 is configured to define the first interface specification in advance, and the first interface specification includes a first code template, where the first code template is a code template of an interface specification of the first operating system implementing the first function.
Optionally, the converting unit 520 is specifically configured to: traversing each line of code in the first execution code; selecting the first code template from the first interface specification based on the first operating system and a mapping relationship between the first function and the code template; the first execution code is converted to the second execution code based on the first code template.
Optionally, a second operating system is run in a second execution environment of the electronic device; the conversion unit 520 is further configured to:
when the first execution code is further used for calling the second operating system, the first execution code is converted into a third execution code according to the first interface specification, and the third execution code meets the interface specification of the second operating system; and calling the second operating system to execute the first function based on the third execution code.
Optionally, the receiving unit 510 is further configured to: receiving a fourth execution code which calls the first operating system, wherein the fourth execution code is a code for executing a second function in the electronic equipment, and the fourth execution code and the first execution code are received simultaneously;
the calling unit 530 is further configured to: invoking the first operating system to execute the first function or the second function based on the priority levels of the first function and the second function.
Optionally, when the priority level of the first function is greater than the priority level of the second function, calling the first operating system to execute the first function; and when the priority level of the first function is smaller than that of the second function, calling the first operating system to execute the second function.
Optionally, the receiving unit 510 is further configured to: receiving a first operation result of the first operating system;
the conversion unit 520 is further configured to: and according to a second interface specification, converting the first operation result into a second operation result, wherein the data format of the second operation result meets the data format of the application program interface.
It may be understood that the functions of each program module of the calling device of the operating system according to the embodiment of the present application may be specifically implemented according to the method in the embodiment of the method, and the specific implementation process may refer to the related description of the embodiment of the method, which is not repeated herein.
Referring to fig. 6, fig. 6 is an electronic device according to an embodiment of the present application, including: one or more processors, one or more memories, one or more communication interfaces, and one or more programs;
The one or more programs are stored in the memory and configured to be executed by the one or more processors;
the program includes instructions for performing the steps of:
Receiving a first execution code for calling a first operating system, wherein the first operating system is operated in a first execution environment of the electronic equipment, and the first execution code is a code for executing a first function by an application program in the electronic equipment;
Converting the first execution code into a second execution code according to a first interface specification, wherein the second execution code meets the interface specification of the first operating system;
and calling the first operating system to execute the first function based on the second execution code.
The processor is a control center of a calling device of an operating system, and may be one processor or a collective name of a plurality of processing elements. For example, the processor is a central processing unit (central processing unit, CPU), may be an Application SPECIFIC INTEGRATED Circuit (ASIC), or may be one or more integrated circuits configured to implement embodiments of the present application, such as: one or more microprocessors (DIGITAL SIGNAL processors, DSPs), or one or more field programmable gate arrays (field programmable GATE ARRAY, FPGAs).
Further, the processor may perform various functions of the server by running or executing software programs stored in the memory, and invoking data stored in the memory.
The memory may be, but is not limited to, read-only memory (ROM) or other type of static storage device that can store static information and instructions, random access memory (random access memory, RAM) or other type of dynamic storage device that can store information and instructions, but may also be electrically erasable programmable read-only memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-only memory, EEPROM), compact disc read-only memory (compact disc read only memory, CD-ROM) or other optical disk storage, optical disk storage (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The memory may be stand alone and be coupled to the processor via a communication bus. The memory may also be integrated with the processor.
A communication interface, using any transceiver-like means for communicating with other devices or communication networks, such as auxiliary devices, radio access networks (radio access network, RAN), wireless local area networks (wireless local area networks, WLAN), etc. The communication interface may include a receiving unit implementing a receiving function and a transmitting unit implementing a transmitting function.
Alternatively, the operating system call device may also include a communication bus, which may be an industry standard architecture (industry standard architecture, ISA) bus, an external device interconnect (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus, or an extended industry standard architecture (extended industry standard architecture, EISA) bus, among others. The bus may be classified as an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in fig. 6, but not only one bus or one type of bus.
It should be noted that, the specific implementation process of the embodiment of the present application may refer to the specific implementation process described in the foregoing method embodiment, and will not be described herein.
The embodiment of the application also provides a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program makes a computer execute part or all of the steps of any one of the methods described in the above method embodiments.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform part or all of the steps of any one of the methods described in the method embodiments above. The computer program product may be a software installation package.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and the division of elements, such as those described above, is merely a logical function division, and may be implemented in other manners, such as multiple elements or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, or may be in electrical or other forms.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present application.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units described above, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable memory. Based on such understanding, the technical solution of the present application may be embodied essentially or partly in the form of a software product or all or part of the technical solution, which is stored in a memory, and includes several instructions for causing a computer device (which may be a personal computer, a server, or TRP, etc.) to perform all or part of the steps of the method of the embodiments of the present application. And the aforementioned memory includes: a usb disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Those of ordinary skill in the art will appreciate that all or a portion of the steps in the various methods of the above embodiments may be implemented by a program that instructs associated hardware, and the program may be stored in a computer readable memory, which may include: flash disk, ROM, RAM, magnetic or optical disk, etc.
The foregoing has outlined rather broadly the more detailed description of embodiments of the application, wherein the principles and embodiments of the application are explained in detail using specific examples, the above examples being provided solely to facilitate the understanding of the method and core concepts of the application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.

Claims (9)

1. A method for invoking an operating system, the method being applied to an electronic device, the electronic device having a virtual operating system, the virtual operating system configured to receive a first execution code and invoke a first operating system, the first operating system being an operating system running on the electronic device, the method comprising:
Receiving the first execution code which calls the first operating system, and running the first operating system in a first execution environment of the electronic equipment, wherein the first execution code is the code for executing a first function by an application program in the electronic equipment;
Traversing each row of codes in the first execution codes, selecting a first code template from a first interface specification based on the first operating system and the mapping relation between the first function and the code template, and converting the first execution codes which do not meet the requirements of the first code template into second execution codes according to the first code template in the first interface specification, wherein the second execution codes meet the interface specification of the first operating system, the first interface specification is a unified specification of the functional interfaces of the first operating system, and the first code template requirements comprise function requirements, writing specifications and/or parameter requirements;
and calling the first operating system to execute the first function based on the second execution code.
2. The method according to claim 1, wherein the method further comprises: the first interface specification is predefined, the first interface specification including a first code template, the first code template being a code template of an interface specification of the first operating system implementing the first function.
3. The method of any of claims 1-2, wherein a second operating system is run in a second execution environment of the electronic device;
the method further comprises the steps of:
When the first execution code is further used for calling the second operating system, the first execution code is converted into a third execution code according to the first interface specification, and the third execution code meets the interface specification of the second operating system;
And calling the second operating system to execute the first function based on the third execution code.
4. The method according to any one of claims 1-2, wherein the method further comprises:
Receiving a fourth execution code which calls the first operating system, wherein the fourth execution code is a code for executing a second function in the electronic equipment, and the fourth execution code and the first execution code are received simultaneously;
invoking the first operating system to execute the first function or the second function based on the priority levels of the first function and the second function.
5. The method of claim 4, wherein invoking the first operating system to execute the first function when the priority of the first function is greater than the priority of the second function;
and when the priority level of the first function is smaller than that of the second function, calling the first operating system to execute the second function.
6. The method of claim 5, wherein the method further comprises:
receiving a first operation result of the first operating system;
and according to a second interface specification, converting the first operation result into a second operation result, wherein the data format of the second operation result meets the data format of the application program interface.
7. An operating system calling device, applied to an electronic device, wherein the electronic device has a virtual operating system, and the virtual operating system is used for receiving a first execution code and calling a first operating system, and the first operating system is an operating system running on the electronic device, and the device comprises:
the receiving unit is used for receiving the first execution code which calls the first operating system, the first operating system is operated in a first execution environment of the electronic equipment, and the first execution code is a code for executing a first function by an application program in the electronic equipment;
The traversing unit is used for traversing each line of codes in the first execution codes, selecting a first code template from first interface specifications based on the first operating system and the mapping relation between the first function and the code template, and converting the first execution codes which do not meet the requirements of the first code template into second execution codes according to the first code template in the first interface specifications, wherein the second execution codes meet the interface specifications of the first operating system, the first interface specifications are unified specifications of functional interfaces of the first operating system, and the first code template requirements comprise function requirements, writing specifications and/or parameter requirements;
The conversion unit is used for converting the first execution code into a second execution code according to a first interface specification, and the second execution code meets the interface specification of the first operating system;
and the calling unit is used for calling the first operating system to execute the first function based on the second execution code.
8. An electronic device comprising a processor, a memory, a communication interface, and one or more programs stored in the memory and configured to be executed by the processor, the programs comprising instructions for performing the steps in the method of any of claims 1-6.
9. A computer readable storage medium, characterized in that the computer storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any of claims 1-6.
CN202011012177.5A 2020-09-23 2020-09-23 Operating system calling method and device Active CN112181504B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011012177.5A CN112181504B (en) 2020-09-23 2020-09-23 Operating system calling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011012177.5A CN112181504B (en) 2020-09-23 2020-09-23 Operating system calling method and device

Publications (2)

Publication Number Publication Date
CN112181504A CN112181504A (en) 2021-01-05
CN112181504B true CN112181504B (en) 2024-06-07

Family

ID=73956028

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011012177.5A Active CN112181504B (en) 2020-09-23 2020-09-23 Operating system calling method and device

Country Status (1)

Country Link
CN (1) CN112181504B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5794049A (en) * 1996-06-05 1998-08-11 Sun Microsystems, Inc. Computer system and method for executing architecture specific code with reduced run-time memory space requirements
US6247067B1 (en) * 1996-03-29 2001-06-12 Sun Microsystems, Inc. Transparently converting program calls between interfaces
CN1609791A (en) * 2003-10-24 2005-04-27 惠普开发有限公司 Interface module
CN103377079A (en) * 2012-04-16 2013-10-30 展讯通信(上海)有限公司 Terminal, device and method for terminal application running and application program running method
CN109491755A (en) * 2018-09-27 2019-03-19 深圳壹账通智能科技有限公司 The guard method of application program and device in operating system
CN110704137A (en) * 2019-09-30 2020-01-17 郑州信大捷安信息技术股份有限公司 Security chip calling system and method based on dual systems
CN111045840A (en) * 2019-12-06 2020-04-21 北京和利时智能技术有限公司 PLC firmware system, packaging interface method, device, storage medium and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9495183B2 (en) * 2011-05-16 2016-11-15 Microsoft Technology Licensing, Llc Instruction set emulation for guest operating systems

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6247067B1 (en) * 1996-03-29 2001-06-12 Sun Microsystems, Inc. Transparently converting program calls between interfaces
US5794049A (en) * 1996-06-05 1998-08-11 Sun Microsystems, Inc. Computer system and method for executing architecture specific code with reduced run-time memory space requirements
CN1609791A (en) * 2003-10-24 2005-04-27 惠普开发有限公司 Interface module
CN103377079A (en) * 2012-04-16 2013-10-30 展讯通信(上海)有限公司 Terminal, device and method for terminal application running and application program running method
CN109491755A (en) * 2018-09-27 2019-03-19 深圳壹账通智能科技有限公司 The guard method of application program and device in operating system
CN110704137A (en) * 2019-09-30 2020-01-17 郑州信大捷安信息技术股份有限公司 Security chip calling system and method based on dual systems
CN111045840A (en) * 2019-12-06 2020-04-21 北京和利时智能技术有限公司 PLC firmware system, packaging interface method, device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN112181504A (en) 2021-01-05

Similar Documents

Publication Publication Date Title
KR102431773B1 (en) Managing delivery of code and dependent data using application containers
US11853820B2 (en) Cross-process communication method, apparatus, and device
US11706331B2 (en) Information processing method and apparatus, storage medium, and electronic device
CN104951326B (en) Webpage access method and device
WO2022199111A1 (en) Method and apparatus for implementing functions in application program, electronic device and storage medium
CN107656759B (en) Rendering method and device for user interface
EP3971818A1 (en) Picture processing method and apparatus
US20190080017A1 (en) Method, system, and device that invokes a web engine
EP4095723B1 (en) Permission reuse method, permission reuse-based resource access method, and related device
CN115309511B (en) Xen-based data interaction method and device, storage medium and electronic equipment
CN113835571A (en) Terminal device, information display method and storage medium
CN114625439A (en) Sub-application operation method based on micro front-end architecture, electronic device and storage medium
CN112235132B (en) Method, device, medium and server for dynamically configuring service
US20230139886A1 (en) Device control method and device
CN112181504B (en) Operating system calling method and device
CN111324347A (en) Component construction method, device and system, page generation method, equipment and medium
WO2022227997A1 (en) Memory request method and related device
CN110134463B (en) Data processing method, device, equipment and machine readable medium
CN113608610B (en) Interaction control method, electronic equipment and system
CN114675786A (en) Large-capacity storage mounting method, device, terminal and medium
US11893199B2 (en) Systems and methods for viewing incompatible web pages via remote browser instances
CN117992189A (en) Window realization method under multiple systems and electronic equipment
CN114444003A (en) Webpage content processing method, electronic equipment and storage medium
CN115175002A (en) Video playing method and device
CN117851215A (en) Coverage rate aggregation analysis method and related products

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant