CN112181504A - Calling method and device of operating system - Google Patents

Calling method and device of operating system Download PDF

Info

Publication number
CN112181504A
CN112181504A CN202011012177.5A CN202011012177A CN112181504A CN 112181504 A CN112181504 A CN 112181504A CN 202011012177 A CN202011012177 A CN 202011012177A CN 112181504 A CN112181504 A CN 112181504A
Authority
CN
China
Prior art keywords
operating system
code
execution code
function
execution
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.)
Pending
Application number
CN202011012177.5A
Other languages
Chinese (zh)
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/CN112181504A/en
Publication of CN112181504A publication Critical patent/CN112181504A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/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

Abstract

The application provides a calling method and a calling device of 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; based on the second execution code, calling the first operating system to execute the first function. According to the application program interface code conversion method and device, the execution code for calling the operating system in the application program is converted into the code meeting the operating system interface specification, the compatibility problem of the application program among different operating systems can be solved, the utilization rate of the application program code is increased, and the development efficiency is improved.

Description

Calling method and device of operating system
Technical Field
The present application relates to the field of computers, and in particular, to a method and an apparatus for invoking an operating system.
Background
The functions of mobile terminals such as mobile phones and wearable devices are relatively complex, and many interaction logics are available, and usually an embedded operating system is 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 providers of application programs, corresponding products need to be developed on different operating systems for different mobile terminals, and product software needs to be reconstructed in different operating systems for product iteration, so that development time of part of products is occupied, and code recycling is not facilitated.
Disclosure of Invention
In order to solve the above problem, the present application discloses a method and an apparatus for calling an operating system, which can solve the problem of compatibility of an application program between different operating systems.
In a first aspect, an embodiment of the present application provides an operating system calling method, which is applied to an electronic device, and 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;
based on the second execution code, calling the first operating system to execute the first function.
In a second aspect, an embodiment of the present application provides an apparatus for invoking an operating system, which is applied to an electronic device, and the apparatus includes:
a receiving unit, configured to receive a first execution code for calling a first operating system, where the first operating system is run in a first execution environment of the electronic device, and the first execution code is a code for executing a first function by an application program in the electronic device;
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, which includes 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 program includes instructions for executing the steps in any of the methods in the first aspect of the embodiment of the present application.
In a fourth aspect, embodiments of the present application provide a computer-readable storage medium, in which a computer program is stored, the computer program comprising program instructions, which, when executed by a processor, cause the processor to perform the method described in the first aspect of 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 of a method as described in the first aspect of 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 run in a first execution environment of the 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; based on the second execution code, calling the first operating system to execute the first function. According to the application program interface code conversion method and device, the execution code for calling the operating system in the application program is converted into the code meeting the operating system interface specification, the compatibility problem of the application program among different operating systems can be solved, the utilization rate of the application program code is increased, and the development efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is an operating system model provided by an embodiment of the present application;
fig. 2 is a block diagram of an operating system according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of 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 block diagram illustrating functional units of a calling device of an operating system according to an embodiment of the present disclosure;
FIG. 5b is a block diagram illustrating functional units of a calling device of another operating system according to an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "including" and "having," and any variations thereof, in the description and claims of this invention and the above-described 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 steps or elements but may alternatively include other steps or elements not expressly listed or inherent to such process, system, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase 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. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to better understand the scheme of the embodiments of the present application, the following first introduces the related terms and concepts that may be involved in the embodiments of the present application.
The Operating System (OS) is System software for managing all resources (including hardware, software, and data resources) of a computer System, controlling program operation, improving a human-machine interface, and providing support for other application software.
As shown in fig. 1, fig. 1 is an operating system model provided in an embodiment of the present application, and includes a software body below an application layer above a hardware platform and a system application embedded in an operating system. As shown in the figure, the operating system is located above a hardware layer and below an Application layer of the receiving terminal, so that differences of the hardware layer are shielded, a uniform environment is provided for running of applications, and a complete and uniform Application Programming Interface (API) is provided for development of the applications.
As shown, the operating system has three types of interfaces with the periphery: an application programming interface, i.e., an interface provided by an operating system to an application developer; a system migration interface, which is an interface for an operating system to migrate to a specific hardware platform; and (3) application signaling, namely an interface for interaction between the operating system and the operation front end.
The method comprises the following steps of according to the application development technology types, Java application and Web application: java applications refer to the collective name of applications developed using the Java programming language; the Web application is a generic term of an application developed by using Web technologies such as HTML, JavaScript, CSS, and the like.
As shown in fig. 2, fig. 2 is a block diagram of an operating system provided in this embodiment of the present application, which includes an application layer, an application framework layer, a system library, and a kernel layer.
Wherein the application layer is used for implementing various applications including Java applications and Web applications. Wherein the application is in the form of software or files, implementing all or part of the functions of a service. The applications can be classified into system applications, operator customized applications and user-selected applications according to different sources. Specifically, the application layer may include applications such as a camera, a gallery, a calendar, a call, a map, a navigation, a WLAN, a bluetooth, music, a video, and a short message.
The application framework layer is used for combining and repackaging each component interface and logic of the component layer so as to simplify the reuse mechanism of the components of the component layer by the application. 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 calls components in the component layer through a Java Native Interface (JNI), and the Web application framework calls components in the component layer through a JavaScript Native Interface (JNI).
Optionally, the application framework layer further includes a multi-application intelligent adaptation mechanism, which is used for compatible and adaptive application developed for other operating systems. The multi-application intelligent adaptation mechanism keeps the operating system component layer unchanged, and different combinations and encapsulation are carried out on the components in the application framework layer according to the application programming interface requirements of the target operating system, so that the application programming interface required by the target operating system is realized, and the application compatibility of the target operating system is realized. And the application framework layer calls a standard universal component interface exposed by the component through JNI or JNI.
In some possible examples, the application framework layer may include a window manager, a content provider, a view system, a phone manager, an explorer, a notification manager, and the like. The window manager is used for managing window programs. The window manager can obtain 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 it accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, 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, the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures. The phone manager is used to provide communication functions of the electronic device. Such as management of call status (including on, off, etc.). The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like. The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short dwell, and does not require user interaction. Such as a notification manager used to inform download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, 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, prompting text information in the status bar, sounding a prompt tone, vibrating the electronic device, flashing an indicator light, etc.
Wherein the system library may comprise a plurality of functional modules. For example: surface managers (surface managers), media libraries (media libraries), three-dimensional graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (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; the media library supports a variety of commonly used audio, video format playback and recording, and still image files, among others. 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, implementing a 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, and the application execution environment layer is an execution interpretation environment for providing the application code. The application execution environment layer comprises a Java application execution environment and a Web application execution environment, and 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 operate independently. In this embodiment, the Java application execution environment and the Web application execution environment run independently and exist independently, 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 life cycle of any application execution environment starts without depending on whether other application execution environments run, and the end of the life cycle of any application execution environment does not cause the end of the life cycles of other applications.
Optionally, the operating system may further include a component layer, where the component layer includes electronic device related components for supporting electronic device applications, and each component provides a canonical common component interface to the application framework layer, so that when a component is replaced, the interface exposed to the application framework layer is kept unchanged. For example, the operating system may include the following set of components, all or in part: network communication related components, device management related components, human-computer interaction related components, media processing related components, window management related components, application management related components, graphic display related components, system management related components, and browser related components.
At present, electronic devices such as mobile phones, wearable devices, computers and the like have relatively complex functions and more interactive logics, an embedded operating system is generally 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 providers of application programs, different mobile terminals are faced with, corresponding products need to be developed on different operating systems, and product software needs to be reconstructed in different operating systems for product iteration, so that development time of partial products is occupied, and code recycling is not facilitated.
In view of the above problems, embodiments of the present application provide a method for calling an operating system, where an execution code for calling the operating system in an application program is converted into a code that meets interface specifications of the operating system, so that the problem of compatibility of the application program between different operating systems can be solved, the utilization rate of the application program code is provided, and development efficiency is improved.
The electronic device related 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 (PDA), a tablet computer (PAD), a Portable Multimedia 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 invention can be applied to a fixed type terminal in addition to elements particularly used for moving purposes.
Embodiments of the present application will be described in detail below with reference to the drawings.
Referring to fig. 3, fig. 3 is a flowchart illustrating a method for invoking an operating system according to an embodiment of the present application, and the method is applied to an electronic device. As shown in fig. 3, the method includes the following steps.
S310, 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.
When an application program is executed in an execution environment of an electronic device, a memory space may be allocated for the application program according to an instruction message for executing the application program, and an execution code of the application program may be 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 an execution code for executing the application program, where the allocated memory space is exclusive to the application program. After the memory space is divided, an execution code, i.e., an execution program, used for executing the application program is loaded into the memory space, and further, the execution code of the application program relates to an operating system which needs to be called in the execution process.
The operating system running on the electronic device comprises Linux, Ubuntu, Android, Windows, RT _ Thread, FreeRTOS and LiteOS, one or more system containers can be installed in the electronic device, each system container is used for providing an operating system or a virtual operating system, and the systems provided by any two system containers can 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 secure mode, that is, each user can only enter the virtual operating system provided by the corresponding system container, and the system containers used by a plurality of users are independent and physically isolated from each other without mutual influence, thereby improving the security of information in the mobile device or the PC.
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 the cost of the local terminal of the user can be reduced (only one networking equipment is needed to enter the own virtual system) on one hand, and the equipment does not need to be frequently upgraded; on the other hand, the information security can be improved (because the used system containers are mutually 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 a plurality of operating systems may be arbitrarily mounted under the virtual operating system, as shown in fig. 4. The virtual operating system can receive the execution code of the application program and call the operating system of the application program according to the requirement, wherein the virtual operating system is arranged 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 the suppliers have roughly the following functions: task creation, message convection, soft timers, interrupt mechanisms, events, mutexes, semaphores, event management, memory management, doubly linked lists, and the like. The principle of realizing each function is consistent among operating systems, and only external interfaces are different, but finally, the functions of the interfaces are also consistent. Therefore, in the embodiment of the present application, the functional interfaces of the operating systems can be uniformly packaged. When software is developed, a system is developed using a uniform interface. After the unified standard exists, the product does not depend on a single operating system, but has the unified standard, and the iterative development and the repeated utilization of product software are facilitated.
Specifically, after receiving a first execution code for calling a first operating system, the execution code of the application program may be converted into an execution code meeting an interface specification of the first operating system according to the packaged first interface specification, so that the application program may run on a different operating system.
In a possible embodiment, the method further comprises: predefining the first interface specification, wherein the first interface specification comprises a first code template, and the first code template is a code template of an interface specification of the first operating system for realizing the first function.
When the functional interfaces of different operating systems are uniformly packaged, a code template of the functional interface specification of each operating system can be predefined, and when a code of a first function executed by an 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, interface functions of different operating systems are packaged, a code template of the interface function is provided, and a unified task creation mechanism, a queue message use mechanism and the like are provided for an application side of the operating system, so that a unified interface template is provided for development of product equipment, rapid development and realization of products are provided, and the problem of product design change caused by operating system change is solved.
Optionally, in step 320, converting the first execution code into a second execution code according to the first interface specification may include the following steps:
21. traversing each line of code in the first executing code;
22. selecting the first code template from the first interface specification based on the first operating system and the mapping relation between the first function and the code template;
23. converting the first execution code into the second execution code based on the first code template.
When a first execution code for 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 specification interface, each line 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 requirement, the writing specification and/or the parameter requirement of the first code template, the codes are converted into a second execution code according to the first code template.
S330, based on the second execution code, calling the first operating system to execute the first function.
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 running in a second execution environment of the electronic device; the method further comprises the following steps:
when the first execution code is also used for calling the second operating system, converting the first execution code into a third execution code according to the first interface specification, wherein the third execution code meets the interface specification of the second operating system; based on the third execution code, calling the second operating system to execute the first function.
The electronic equipment 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. Furthermore, physical resources such as a CPU (central processing unit), a memory and the like used by the first operating system and the second operating system can be shared; physical resources such as a CPU and a memory used for allocating, running, or carrying the first operating system and the second operating system may be different, that is, the physical resources are mutually independent and isolated, which is not limited in this embodiment of the present application.
Specifically, when a first execution code of the application program needs to call a first operating system and a second operating system, and 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 may be searched from the first interface specification, the first execution code is converted into a second execution code and a third execution code according to the first code template and the second code template, and the first operating system and the second operating system are respectively called to execute the first function.
In a possible embodiment, the method further comprises: receiving a fourth execution code for calling 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, the first operating system is called to execute the first function;
and when the priority level of the first function is less than that of the second function, calling the first operating system to execute the second function.
Specifically, when a first execution code for an application program to execute a first function and a second execution code for an application program to execute a second function 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, the second function is interrupt, the priority of the interrupt is higher than the priority of the task creation, therefore, when the execution code of the task creation and the execution code of the interrupt are received simultaneously, the interrupt is executed preferentially, and the task creation is executed again, namely, 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 a possible embodiment, the method further comprises:
receiving a first operation result of the first operating system; and converting the first operation result into a second operation result according to a second interface specification, 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, and therefore, 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 predefined second interface specification.
The application provides a method for calling an operating system, which receives a first execution code for calling a first operating system, wherein 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; based on the second execution code, calling the first operating system to execute the first function. According to the application program interface code conversion method and device, the execution code for calling the operating system in the application program is converted into the code meeting the operating system interface specification, the compatibility problem of the application program among different operating systems can be solved, the utilization rate of the application program code is increased, and the development efficiency is improved.
The above description has introduced the solution of the embodiment of the present application mainly from the perspective of the method-side implementation process. It is understood that the electronic device comprises corresponding hardware structures and/or software modules for performing the respective functions in order to realize the above-mentioned functions. Those of skill in the art will readily appreciate that the present application is capable of hardware or a combination of hardware and computer software implementing the various illustrative elements and algorithm steps described in connection with the embodiments provided herein. Whether a function is performed as hardware or computer software drives 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.
In the embodiment of the present application, the electronic device may be divided into the functional units according to the method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
Referring to fig. 5a, fig. 5a is a block diagram illustrating functional units of a calling device 500 of an operating system according to an embodiment of the present application, where the calling device 500 of the operating system 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 for calling a first operating system, where the first operating system is run in a first execution environment of the electronic device, and the first execution code is a code for executing a first function by an application program in the electronic device;
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 an interface specification of the first operating system;
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 apparatus 500 of the operating system further includes a defining unit 540, where the defining unit 540 is configured to predefine the first interface specification, and the first interface specification includes a first code template, and the first code template is a code template of an interface specification of the first operating system that implements the first function.
Optionally, the conversion unit 520 is specifically configured to: traversing each line of code in the first executing code; selecting the first code template from the first interface specification based on the first operating system and the mapping relation between the first function and the code template; converting the first execution code into 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 also used for calling the second operating system, converting the first execution code into a third execution code according to the first interface specification, wherein the third execution code meets the interface specification of the second operating system; based on the third execution code, calling the second operating system to execute the first function.
Optionally, the receiving unit 510 is further configured to: receiving a fourth execution code for calling 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 invoking 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, the first operating system is called to execute the first function; and when the priority level of the first function is less 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 converting the first operation result into a second operation result according to a second interface specification, wherein the data format of the second operation result meets the data format of the application program interface.
It can be understood that the functions of each program module of the calling device of the operating system in the embodiment of the present application can be specifically implemented according to the method in the foregoing method embodiment, and the specific implementation process of the method can refer to the relevant description of the foregoing method embodiment, which is not described herein again.
Referring to fig. 6, fig. 6 is an electronic device according to an embodiment of the present disclosure, where the electronic device includes: 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;
based on the second execution code, calling the first operating system to execute the first function.
The processor is a control center of a calling device of the operating system, and may be a single processor or a collective term for a plurality of processing elements. For example, the processor is a Central Processing Unit (CPU), and may be an Application Specific Integrated Circuit (ASIC), or 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 (FPGAs).
Further, the processor may perform various functions of the server by running or executing software programs stored in the memory, as well as invoking data stored in the memory.
The memory may be, but is not limited to, a read-only memory (ROM) or other type of static storage device that may store static information and instructions, a Random Access Memory (RAM) or other type of dynamic storage device that may store information and instructions, an electrically erasable programmable read-only memory (EEPROM), a compact disk read-only memory (CD-ROM) or other optical disk storage, optical disk storage (including compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, 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 self-contained and coupled to the processor via a communication bus. The memory may also be integral to the processor.
A communication interface, using any transceiver or other device, is used to communicate with other devices or communication networks, such as auxiliary devices, Radio Access Networks (RAN), Wireless Local Area Networks (WLAN), and so on. The communication interface may include a receiving unit implementing a receiving function and a transmitting unit implementing a transmitting function.
Optionally, the invoking device of the operating system may further include a communication bus, where the communication bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an extended ISA (extended industry standard architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 6, but this is not intended to represent only one bus or type of bus.
It should be noted that, for a specific implementation process in the embodiment of the present application, reference may be made to the specific implementation process described in the foregoing method embodiment, and details are not described herein again.
Embodiments of the present application also provide a computer storage medium, wherein the computer storage medium stores a computer program for electronic data exchange, and the computer program enables a computer to execute part or all of the steps of any one of the methods as 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 some or all of the steps of any of the methods as described in the above method embodiments. The computer program product may be a software installation package.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the above-described division of the units is only one type of division of logical functions, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present application.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit may be stored in a computer readable memory if it is implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be substantially or partially contributed by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a memory and includes several instructions for causing a computer device (which may be a personal computer, a server, or a TRP, etc.) to execute all or part of the steps of the method of the embodiments of the present application. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable memory, which may include: flash disk, ROM, RAM, magnetic or optical disk, and the like.
The foregoing detailed description of the embodiments of the present application has been presented to illustrate the principles and implementations of the present application, and the above description of the embodiments is only provided to help understand the method and the core concept of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A calling method of an operating system is applied to an electronic device, and 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;
based on the second execution code, calling the first operating system to execute the first function.
2. The method of claim 1, further comprising: predefining the first interface specification, wherein the first interface specification comprises a first code template, and the first code template is a code template of an interface specification of the first operating system for realizing the first function.
3. The method of claim 2, wherein converting the first execution code into a second execution code according to a first interface specification comprises:
traversing each line of code in the first executing code;
selecting the first code template from the first interface specification based on the first operating system and the mapping relation between the first function and the code template;
converting the first execution code into the second execution code based on the first code template.
4. The method of any of claims 1-3, wherein a second operating system is running in a second execution environment of the electronic device;
the method further comprises the following steps:
when the first execution code is also used for calling the second operating system, converting the first execution code into a third execution code according to the first interface specification, wherein the third execution code meets the interface specification of the second operating system;
based on the third execution code, calling the second operating system to execute the first function.
5. The method according to any one of claims 1-3, further comprising:
receiving a fourth execution code for calling 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.
6. The method of claim 5, wherein the first operating system is invoked to perform the first function when the priority level of the first function is greater than the priority level of the second function;
and when the priority level of the first function is less than that of the second function, calling the first operating system to execute the second function.
7. The method according to any one of claims 4-6, further comprising:
receiving a first operation result of the first operating system;
and converting the first operation result into a second operation result according to a second interface specification, wherein the data format of the second operation result meets the data format of the application program interface.
8. An apparatus for invoking an operating system, applied to an electronic device, the apparatus comprising:
a receiving unit, configured to receive a first execution code for calling a first operating system, where the first operating system is run in a first execution environment of the electronic device, and the first execution code is a code for executing a first function by an application program in the electronic device;
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.
9. An electronic device, comprising a processor, 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-7.
10. A computer-readable storage medium, characterized in that the computer storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method according to any of claims 1-7.
CN202011012177.5A 2020-09-23 2020-09-23 Calling method and device of operating system Pending CN112181504A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011012177.5A CN112181504A (en) 2020-09-23 2020-09-23 Calling method and device of operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011012177.5A CN112181504A (en) 2020-09-23 2020-09-23 Calling method and device of operating system

Publications (1)

Publication Number Publication Date
CN112181504A true CN112181504A (en) 2021-01-05

Family

ID=73956028

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011012177.5A Pending CN112181504A (en) 2020-09-23 2020-09-23 Calling method and device of operating system

Country Status (1)

Country Link
CN (1) CN112181504A (en)

Citations (8)

* 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
US20120296626A1 (en) * 2011-05-16 2012-11-22 Microsoft Corporation Instruction set emulation for guest operating systems
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

Patent Citations (8)

* 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
US20120296626A1 (en) * 2011-05-16 2012-11-22 Microsoft Corporation Instruction set emulation for guest operating systems
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

Similar Documents

Publication Publication Date Title
US20210191996A1 (en) Method for displaying application page, non-transitory storage medium and electronic device
CN104951326B (en) Webpage access method and device
US11853820B2 (en) Cross-process communication method, apparatus, and device
US11706331B2 (en) Information processing method and apparatus, storage medium, and electronic device
EP3971818A1 (en) Picture processing method and apparatus
CN106533926B (en) Webpage information spreading method and device
CN108647032B (en) Application loading method and device, computer device and computer readable storage medium
CN110990075A (en) Starting method, device and equipment of fast application and storage medium
CN115309511B (en) Xen-based data interaction method and device, storage medium and electronic equipment
CN110795649A (en) Target page display method, device and system 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
CN109491687B (en) Hot updating method and device of application software, terminal and readable medium
CN110618811B (en) Information presentation method and device
CN111177634A (en) Multi-language supporting file content loading method, device, equipment and medium
WO2022227997A1 (en) Memory request method and related device
CN115878115A (en) Page rendering method, device, medium and electronic equipment
CN112181504A (en) Calling method and device of operating system
CN114675786A (en) Large-capacity storage mounting method, device, terminal and medium
CN111324347B (en) Component construction method, device and system, page generation method, device and medium
CN113900740A (en) Method and device for loading multiple list data
CN113934340A (en) Terminal device and progress bar display method
CN112612633A (en) Inter-process communication method, device, storage medium and terminal

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