Layering method of operating system, computing equipment and storage medium
By drawing a directed graph in the operating system and generating a topological sequence, the complexity problem in the hierarchical division of the operating system is solved, the clear layering of the operating system and the orderly representation of dependencies are achieved, and the ease of use and ease of use of the system are improved. Administrative.
Patent Information
- Application Number
- CN202410606117.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-02
- Publication Date
- 2024-08-20
AI Technical Summary
The complexity of modern operating systems makes their hierarchies complex and difficult to clearly divide and expand, affecting the ease of use and portability of the system.
By drawing a directed graph between applications in the operating system, a topological sequence is generated, multiple levels of the operating system are determined, and the division of levels and the orderly representation of dependencies are achieved.
It effectively solves the circular dependency problem in the hierarchical division of operating systems, realizes clear layering of operating systems, simplifies the expansion and transplantation process, and improves the ease of use and management of the system.
Smart Images

Figure CN118519675A_ABST
Abstract
Description
[0001] This application is a divisional application of the invention patent application filed on August 2, 2022. The application number of the original application is: 202210922130.5, and the name of the invention is: A layered method, computing device and storage medium for an operating system. Technical Field
[0002] The present invention relates to the field of operating systems, and in particular to a layering method, computing equipment and storage medium for an operating system. Background Art
[0003] With the increasing development of computer technology and its applications, operating systems have gradually become larger and more complex. Due to the complexity of modern operating systems, the number and complexity of applications involved from the bottom layer to the upper layer have increased exponentially, and the dependencies and hierarchical structures have become more intricate. In order to make the structure of the operating system clearer and easier to expand and transplant, it is necessary to divide the operating system into hierarchical structures.
[0004] To do this, a layered approach to operating systems is needed. Summary of the invention
[0005] To this end, the present invention provides a layering method for an operating system, in an effort to solve or at least alleviate the above problems.
[0006] According to one aspect of the present invention, there is provided a method for layering an operating system, which is suitable for execution in a computing device, and the method comprises: drawing a directed graph based on the dependency relationship between multiple applications included in the operating system, the directed graph being used to characterize the dependency relationship between the applications; generating a topological sequence about the applications based on the directed graph, the topological sequence being used to characterize the applications on which the corresponding nodes of the multiple applications depend; and determining multiple levels of the operating system based on the topological sequence.
[0007] Optionally, in the method according to the present invention, a directed graph is drawn based on the dependency relationships between multiple applications included in the operating system, including: determining one or more dependency relationships between multiple applications; taking each dependency relationship as a directed edge in the directed graph, to obtain a directed graph including multiple directed edges.
[0008] Optionally, in the method according to the present invention, a topological sequence about an application is generated based on a directed graph, including: determining the type of the directed graph, which includes a directed acyclic graph and a directed cyclic graph; if the type of the directed graph is a directed acyclic graph, generating a topological sequence based on the directed acyclic graph; if the type of the directed graph is a directed cyclic graph, generating a directed acyclic graph based on the directed cyclic graph, and then generating a topological sequence based on the directed acyclic graph.
[0009] Optionally, generating a directed acyclic graph based on a directed cyclic graph includes: traversing directed edges in the directed cyclic graph to determine one or more cycles included in the directed cyclic graph; and taking the one or more cycles as a cycle set to generate a directed acyclic graph including the cycle set.
[0010] Optionally, in the method according to the present invention, a topological sequence is generated according to a directed acyclic graph, including: based on the dependency relationship between the nodes included in the directed acyclic graph, all nodes are sorted to obtain a topological sequence, wherein the dependent nodes in the directed acyclic graph serve as upstream nodes of their dependent nodes, and the dependent nodes serve as downstream nodes of their dependent nodes.
[0011] Optionally, in the method according to the present invention, determining multiple levels of the operating system according to the topological sequence includes: determining a key point set in the topological sequence according to the topological sequence; and determining multiple levels of the operating system according to the key point set.
[0012] Optionally, in the method according to the present invention, the key point set in the topological sequence is determined according to the topological sequence, including: for each node in the topological sequence, determining whether its preceding nodes have no dependency on the succeeding nodes; if so, taking the node as the key node in the key point set.
[0013] Optionally, in the method according to the present invention, multiple levels of the operating system are determined based on a key point set, including: dividing the topological sequence into multiple sequence segments based on the position of each key node in the key point set in the topological sequence; determining each sequence segment in the multiple sequence segments as a level, thereby obtaining multiple levels of the operating system.
[0014] According to another aspect of the present invention, a computing device is provided, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs include instructions for executing the layering method of the operating system according to the present invention.
[0015] According to another aspect of the present invention, a computer-readable storage medium storing one or more programs is provided. The one or more programs include instructions that, when executed by a computing device, cause the computing device to perform the operating system layering method according to the present invention.
[0016] The present invention discloses a layering method of an operating system, which is suitable for execution in a computing device, and the method comprises: drawing a directed graph between multiple applications included in the operating system, the directed graph is used to characterize the dependency relationship between the applications; generating a topological sequence about the applications according to the directed graph, the topological sequence is used to characterize the applications on which the corresponding nodes of the multiple applications depend; and determining multiple levels of the operating system according to the topological sequence. The present invention can divide the levels of the operating system according to the dependency relationship of the dependent packages in the operating system, and realize the determination of the levels of the operating system. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. By reading the following detailed description in conjunction with the accompanying drawings, the above and other purposes, features and advantages disclosed by the present invention will become more apparent. Throughout the present disclosure, the same reference numerals generally refer to the same parts or elements.
[0018] Figure 1 A schematic flow chart of a method 100 for layering an operating system according to an exemplary embodiment of the present invention is shown;
[0019] Figure 2 shows a block diagram of a computing device 200 according to an exemplary embodiment of the present invention;
[0020] Figure 3 A schematic diagram of a directed cyclic graph according to an exemplary embodiment of the present invention is shown;
[0021] Figure 4 A schematic diagram of a directed acyclic graph according to an exemplary embodiment of the present invention is shown;
[0022] Figure 5 A schematic diagram showing a topological sequence according to an exemplary embodiment of the present invention is shown;
[0023] Figure 6 A schematic diagram showing a layering according to an exemplary embodiment of the present invention is shown;
[0024] Figure 7 A schematic diagram of a directed acyclic graph according to an exemplary embodiment of the present invention is shown;
[0025] Figure 8 A schematic diagram of a layered architecture diagram according to an exemplary embodiment of the present invention is shown;
[0026] Fig. 9 A schematic diagram showing an application function classification decision according to an exemplary embodiment of the present invention is shown;
[0027] Fig.10 A schematic diagram showing application function determination according to an exemplary embodiment of the present invention is shown. DETAILED DESCRIPTION
[0028] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to enable the scope of the present disclosure to be fully conveyed to those skilled in the art. The same reference numerals generally refer to the same components or elements.
[0029] Figure 1 A schematic flow chart of a method 100 for layering an operating system according to an exemplary embodiment of the present invention is shown. The method for layering an operating system of the present invention is suitable for running in a computing device. An operating system runs in the computing device. The present invention does not limit the type of operating system running in the computing device. The computing device is introduced below.
[0030] Figure 2 A structural block diagram of a computing device according to an exemplary embodiment of the present invention is shown.
[0031] In a basic configuration, computing device 200 includes at least one processing unit 220 and system memory 210. According to one aspect, system memory 210 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories, depending on the configuration and type of computing device. According to one aspect, system memory 210 includes operating system 211.
[0032] According to one aspect, the operating system 211 is important software running on the computing device 200, suitable for managing the memory and processes of the computing device 200, as well as all software and hardware. For example, the operating instructions input by the user can achieve the effect of controlling the hardware to meet the needs of the user. In addition, the example is practiced in conjunction with a graphics library, other operating systems, or any other application, and is not limited to any specific application or system. Figure 2 This basic configuration is illustrated in FIG by those components within dashed line 215. According to one aspect, computing device 200 has additional features or functionality. For example, according to one aspect, computing device 200 includes additional data storage devices (removable and / or non-removable), such as magnetic disks, optical disks, or tapes.
[0033] As stated above, according to one aspect, the program module 212 is stored in the system memory 210. According to one aspect, the program module 212 may include one or more application programs, and the present invention does not limit the type of application program, for example, the application program also includes: email and contact application programs, word processing application programs, spreadsheet application programs, database application programs, slide show application programs, drawing or computer-aided application programs, web browser application programs, etc.
[0034] According to one aspect, the examples may be practiced on a circuit comprising discrete electronic components, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or a single chip containing electronic components or a microprocessor. Figure 2 Each or many components shown in can be integrated into a system on a chip (SOC) on a single integrated circuit to practice examples. According to one aspect, such a SOC device may include one or more processing units, a graphics unit, a communication unit, a system virtualization unit, and various application functions, all of which are integrated (or "burned") into a chip substrate as a single integrated circuit. When operated via SOC, the functions described in this article can be operated via a dedicated logic integrated with other components of the computing device 200 on a single integrated circuit (chip). Other technologies that can perform logical operations (such as AND, OR, and NOT) can also be used to practice embodiments of the present invention, including but not limited to mechanical, optical, fluid, and quantum technologies. In addition, embodiments of the present invention can be practiced in a general-purpose computer or in any other circuit or system.
[0035] According to one aspect, the computing device 200 may also have one or more input devices 231, such as a keyboard, a mouse, a pen, a voice input device, a touch input device, etc. Output devices 232 may also be included, such as a display, a speaker, a printer, etc. The aforementioned devices are examples and other devices may also be used. The computing device 200 may include one or more communication connections 233 that allow communication with other computing devices 240. Examples of suitable communication connections 233 include, but are not limited to: RF transmitters, receivers and / or transceiver circuits; Universal Serial Bus (USB), parallel and / or serial ports. The computing device 200 can be communicatively connected to other computing devices 240 via the communication connection 233.
[0036] The embodiment of the present invention also provides a non-transitory readable storage medium, which stores instructions, and the instructions are used to make the computing device perform a method according to an embodiment of the present invention. The readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information can be a computer-readable instruction, a data structure, a module of a program, or other data. Examples of readable storage media include, but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, tape disk storage or other magnetic storage device or any other non-transitory readable storage medium.
[0037] According to one aspect, communication media is implemented by computer readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., a carrier wave or other transport mechanism), and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more characteristics set or changed in a manner that encodes information in the signal. By way of example and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.
[0038] It should be noted that, although the computing device shown above only includes the processing unit 220, the system memory 210, the input device 231, the output device 232, and the communication connection 233, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the device may only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0039] Please see Figure 1 .like Figure 1 As shown, first, step 110 is performed to draw a directed graph according to multiple applications included in the operating system. The directed graph is used to represent the dependency relationship between the applications.
[0040] According to an embodiment of the present invention, the operating system may include one or more applications. The present invention does not limit the number and type of applications included in the operating system. The applications included in the operating system may also be implemented as software packages, that is, the operating system includes one or more software packages, and the present invention does not limit the types of applications included in the operating system.
[0041] According to one embodiment of the present invention, when drawing a directed graph based on the dependency relationships between multiple applications included in an operating system, one or more dependency relationships between the multiple applications are first determined; then each dependency relationship is used as a directed edge in the directed graph, thereby obtaining a directed graph including multiple directed edges.
[0042] According to an embodiment of the present invention, there is a reference or call dependency relationship between applications. The application includes application information, which records various descriptions and data of the application, including version (Version), architecture (Architecture), summary (Summary), description (Description) and dependency (Depends) relationship, etc. The present invention can determine the dependency relationship of the application by parsing the application information, and the present invention does not limit the specific method of determining the dependency of the application.
[0043] A directed graph D is an ordered triple (V(D), A(D), ψD), where ψD) is an association function that makes each element in A(D) (called a directed edge or arc) correspond to a pair of ordered elements (called vertices, points or nodes) in V(D).
[0044] According to an embodiment of the present invention, each pair of dependency relationships is used as a dependency relationship in a directed graph, and the applications included in the dependency relationships are used as nodes in the directed graph to obtain a directed graph.
[0045] Then, step 120 is executed to generate a topological sequence of applications according to the directed graph, and the topological sequence is used to characterize the applications on which the corresponding nodes of multiple applications depend; specifically, the type of the directed graph is first determined. According to an embodiment of the present invention, the directed graph can be divided into a directed acyclic graph and a directed cyclic graph according to whether the graph has a cycle or not.
[0046] If the directed graph is a directed acyclic graph, a topological sequence is generated according to the directed acyclic graph;
[0047] If the directed graph is a directed cyclic graph, a directed acyclic graph is generated based on the directed cyclic graph, and then a topological sequence is generated based on the directed acyclic graph.
[0048] A directed acyclic graph is a directed graph without loops (or cycles). A loop or cycle is when a node can return to itself through a directed edge.
[0049] According to an embodiment of the present invention, the dependency relationship of the application for the entire operating system is output through the dependency relationship recorded by the application itself, or through the dependency relationship between application files, to form a directed graph, which can be expressed as:
[0050] G=(V,E)
[0051] Since the hierarchical structure of the operating system needs to follow the unidirectional dependency principle, it is necessary to judge whether G is a directed acyclic graph. If G is a directed acyclic graph (DAG), a topological sequence is generated based on the directed acyclic graph; if G is a directed cyclic graph (DCG), the directed cyclic graph needs to be converted into a directed acyclic graph based on the loop processing algorithm.
[0052] When generating a directed acyclic graph according to a directed cyclic graph, directed edges in the directed cyclic graph are traversed to determine one or more cycles included in the directed cyclic graph; then the one or more cycles are taken as cycle sets to generate a directed acyclic graph including the cycle sets.
[0053] Figure 3 FIG. 1 shows a schematic diagram of a directed cyclic graph according to an exemplary embodiment of the present invention. Figure 3 As shown in Figure 2, the directed cyclic graph represents the dependency relationship between applications, namely Figure 3 This is the dependency graph for the operating system. Figure 3 The network includes multiple nodes, each of which represents an application. The directed edges between nodes represent the dependency relationship between applications. Figure 3 There are multiple loops in it. Traverse the dependency relationship and use CircleN to represent the loop set:
[0054] Circle 0 : [glibc, libselinux]
[0055] Circle 1 :[glibc, libselinux, libsepol]
[0056] Circle 2 :[glibc, libselinux, pcre2]
[0057] Circle 3 :[gbibc,bash]
[0058] Circle 4 :[glibc, bash, filesystem]
[0059] Circle 5 : [glibc, bash, ncurses]
[0060] Circle 6 :[glibc,basesystem,filesystem,bash]
[0061] Circle 7:[glibc, basesystem, filesystem, bash, ncurses]
[0062] Among them, self-dependency is not treated as a loop.
[0063] Then, substitute it into the directed cyclic graph, the ring relationship in the operating system dependency graph can be eliminated, and the operating system dependency graph will be transformed into a DAG, which is denoted as G i .
[0064] Figure 4 FIG. 1 shows a schematic diagram of a directed acyclic graph according to an exemplary embodiment of the present invention. Figure 4 As shown, the directed acyclic path no longer includes a cycle.
[0065] According to one embodiment of the present invention, when generating a topological sequence based on a directed acyclic graph, the nodes in the directed acyclic graph are taken as the front nodes and the dependent nodes as the back nodes, and the nodes included in the directed acyclic graph are sorted to obtain a topological sequence. In the topological sequence, the more dependent nodes are located at the back, and the nodes that depend on other nodes less are located at the front.
[0066] According to one embodiment of the present invention, Figure 4 As shown, the node readline depends on the node texinfo. The node readline is the dependent node, and the node texinfo is the dependent node. Therefore, in the topological sequence, the node readline is the previous node, and the node texinfo is the next node.
[0067] Figure 5 FIG. 4 shows a schematic diagram of a topological sequence according to an exemplary embodiment of the present invention. Figure 5 As shown, Figure 5 for Figure 4 An example of a topological sequence for the directed acyclic graph shown.
[0068] According to an embodiment of the present invention, when determining the topological sequence of a directed acyclic graph, since each directed graph may have multiple ways of forming a topological sequence, it is necessary to determine a topological sequence from them. In the process of generating a topological sequence, when there are multiple nodes to choose from, the nodes are sorted according to the number of times they are dependent, and the nodes with higher number of dependent data are placed later in the topological sorting.
[0069] Finally, step 130 is executed to determine multiple levels of the operating system according to the topological sequence; specifically: determine a key point set in the topological sequence according to the topological sequence; determine multiple levels of the operating system according to the key point set.
[0070] According to one embodiment of the present invention, when determining the key point set in the topological sequence based on the topological sequence, for each node in the topological sequence, it is determined whether its preceding nodes have no dependency on the succeeding nodes; if so, the node is used as the key node in the key point set.
[0071] If a node is a key node, then the node can be used as the boundary node of each layer in the topological sorting of the DAG, so that there will be no cross-layer dependency between the layers, and it is the boundary of the layer. i In the topological sequence of , there exists a node set V = {v 1 ,v 2 …,v n}, exists in any node v in the node set x All nodes before the position of v are not correct. x The nodes after the node are dependent on each other, and this node set is called the critical node set.
[0072] According to one embodiment of the present invention, when determining multiple levels of an operating system based on a key node set, the topological sequence is divided into multiple sequence segments based on the position of each key node in the key point set in the topological sequence; each sequence segment in the multiple sequence segments is determined as a level, thereby obtaining multiple levels of the operating system.
[0073] When dividing a topological sequence into multiple sequences, the key nodes and other nodes that depend on the key nodes are divided into one level.
[0074] According to one embodiment of the present invention, Figure 6 FIG. 4 shows a schematic diagram of a layer according to an exemplary embodiment of the present invention. Figure 6 As shown: the topological sequence of the directed acyclic graph of readline is used to divide the levels. According to the definition of key nodes, there will be a key node set, namely V = {Circle0~7}. There is a key node in this key node set, which divides the dependency relationship of readline into two layers.
[0075] According to one embodiment of the present invention, when dividing the topological sequence, the node readline with an in-degree of 0 is listed as a separate level. In the topological sequence of the DAG, after the key nodes are extracted, the remaining topological sequence will appear in 2 levels, forming a total order structure, realizing the division of the operating system level. The hierarchical structure is divided into a total order and a partial order. If there is a one-way dependency between the layers and the modules between each layer remain independent, this hierarchical structure is called a total order. If there is a one-way dependency between the layers, but some layers are allowed to have mutual calling relationships, then this hierarchical structure becomes a partial order.
[0076] According to one embodiment of the present invention, podman's application dependency relationship can draw a dependency graph. Figure 7 FIG. 1 shows a schematic diagram of a directed acyclic graph according to an exemplary embodiment of the present invention. Figure 7 As shown, Figure 7 The dependency graph of podman is shown as a directed acyclic graph.
[0077] Then according to Figure 7 Generating a topological sequence. According to an embodiment of the present invention, when generating a plurality of simultaneously dependent applications in a topological sequence or the order of dependent applications in a topological sequence, the applications may be sorted by weight.
[0078] Get the topological sequence:
[0079] ['podman','skopeo','conmon','fuse-overlayfs','containernetworking-plugins','libvarlink','slirp4netns','runc','criu','container-selinux','protobuf-c','libnet']
[0080] The key node set can be determined based on the topological sequence and the directed acyclic graph:
[0081] {criu,container-selinux}
[0082] The stratification results are obtained by stratifying according to the key node set:
[0083] Starting package or application: ['podman']
[0084] The third layer (Level3): ['skopeo','conmon','fuse-overlayfs','containernetworking-plugins','libvarlink','slirp4netns','runc']
[0085] Level 2: ['criu', 'container-selinux']
[0086] Level 1: ['protobuf-c', 'libnet']
[0087] According to the layering results, the layered architecture diagram of Podman can be obtained. Figure 8 FIG. 1 is a schematic diagram of a layered architecture diagram according to an exemplary embodiment of the present invention. Figure 8 As shown, Figure 8 The diagram shows Podman as a cloud native subsystem, which includes multiple layers, each layer including multiple applications.
[0088] The present invention discloses a layering method of an operating system, which is suitable for execution in a computing device, and the method comprises: drawing a directed graph according to the dependency relationship between multiple applications included in the operating system; generating a topological sequence about the application according to the directed graph; and determining multiple levels of the operating system according to the topological sequence. The present invention can divide the levels of the operating system according to the dependency relationship of dependent packages in the operating system, thereby determining the levels of the operating system.
[0089] The present invention can solve the problem that circular dependencies cannot be processed during the hierarchical grading of the operating system by shrinking the directed cyclic graph into a directed acyclic graph, so that the dependencies of the operating system can form an ordered relationship. In the present invention, the number of software packages that are dependent can be used as a judgment weight to solve the problem that the order cannot be determined during the generation of the topological sequence. By increasing the definition of key nodes, the problem of being unable to split the topological sequence into levels is solved. After obtaining the hierarchical data, the hierarchical feature keywords are extracted through algorithms such as TextRank, kNN, and Naive Bayes, solving the definition problem of each level.
[0090] Through the description of the present invention, a complete set of tools can be designed and implemented, and developers can use the tools to obtain hierarchical data of any complete dependency relationship in the operating system and obtain the characteristic keywords defined at each level.
[0091] According to an embodiment of the present invention, after the level of the operating system is determined, the characteristics of each level may also be determined. The specific steps are as follows:
[0092] First, application information of each of one or more applications is obtained, and characteristic data of the application is determined according to the application information of the application. According to one embodiment of the present invention, each layer may include one or more applications. The present invention does not limit the number and type of applications included in the layer. The applications included in the operating system can also be implemented as software packages, that is, the layer of the operating system includes one or more software packages, and the present invention does not limit the specific types of programs included in the operating system.
[0093] When determining the characteristic data of an application according to the application information of the application, data cleaning is performed on the application information of the application to obtain one or more characteristic keywords of the application, and the one or more characteristic keywords are determined as the characteristic data of the application.
[0094] According to an embodiment of the present invention, an application includes application information, which records various descriptions and data of the application, including version, architecture, summary, description, and dependencies, etc. The present invention can determine the characteristic data of the application by parsing the application information, and the present invention does not limit the specific method of determining the characteristic data of the application.
[0095] According to an embodiment of the present invention, the characteristic data of an application is recorded in its corresponding application information. The application information can be specifically implemented as an English description in a natural language. The present invention does not limit the specific presentation method of the application information. In order to facilitate determining the characteristics of the application based on the application information, it is first necessary to extract the metadata of the application information of the application, and then standardize and clean the metadata to obtain the characteristic data.
[0096] When performing data cleaning, the application information is screened by a binning method to obtain screened data, wherein the screened data includes information that can determine the characteristics of the application.
[0097] Subsequently, the filtered data is cleaned to obtain one or more characteristic keywords.
[0098] According to an embodiment of the present invention, the metadata of the application can be roughly screened and cleaned by the binning method, and the application name, summary, and description are defined as the screening data for determining the application characteristics. However, these screening data cannot be used directly, as they contain a large amount of natural language, and pre-operation is required to convert the screening data into data that can be analyzed for characteristics.
[0099] According to one embodiment of the present invention, the screening data of the software package can be cleaned by using the Natural Language Processing Toolkit (NLTK). First, the screening data is segmented by NLTK, and the segmented sentences are segmented and marked with parts of speech, and stop words and punctuation marks are removed. Nouns, verbs, adjectives, and adverbs are obtained according to the parts of speech of the words after segmentation, and then word frequency statistics are performed to finally obtain feature data including one or more feature keywords.
[0100] Subsequently, the characteristics of the application are determined according to the characteristic data of the application. According to one embodiment of the present invention, the characteristics of the application include type characteristics and functional characteristics. When determining the type characteristics, the application type to which the characteristic keyword belongs is determined according to the pre-built characteristic key dictionary; and the type characteristics of the application are determined according to the application type to which the characteristic keyword in the characteristic data belongs.
[0101] According to an embodiment of the present invention, the application information of an application includes: "zlib is a decompression / compression library". The type feature of the application is "library"; and the function feature is "decompression / compression".
[0102] According to an embodiment of the present invention, the feature key dictionary includes one or more application types, each application type includes one or more feature keywords, and each feature keyword has a weight.
[0103] The process of constructing a feature keyword dictionary includes: obtaining application information of multiple applications, performing data cleaning based on the application information of the applications to obtain a feature keyword set; determining the weight and application type corresponding to each feature keyword in the feature keyword set; and constructing a feature keyword dictionary based on the feature keywords and the corresponding weights and application types.
[0104] According to an embodiment of the present invention, the application types in the feature key dictionary include library, service, and application / tool. The present invention does not limit the specific number and form of the application types included in the feature key dictionary.
[0105] According to an embodiment of the present invention, the weight of each feature keyword in the feature key dictionary can be determined by marking, or determined according to the frequency of occurrence of the feature keyword.
[0106] When determining the type characteristics of an application based on the application type to which the characteristic keywords in the characteristic data belong, the weight of each application type to which the application belongs is determined separately based on the weight of the characteristic keywords and the application type to which they belong; the application type corresponding to the maximum value of the weight of each application type to which the application belongs is determined as the type characteristics of the application.
[0107] According to an embodiment of the present invention, if the characteristic keywords of an application include library files and software services, the library files are characteristic keywords in the "library" application type, with a weight of 10, and the software services are characteristic keywords in the "service" application type, with a weight of 80. Then, the application type "service" corresponding to the weight of 80 is used as the application type of the application.
[0108] According to an embodiment of the present invention, the characteristics of the application also include functional characteristics, and determining the characteristics of the application based on the characteristic data of the application further includes: determining the functional characteristics of the application based on a preset function classification list.
[0109] According to an embodiment of the present invention, the preset function classification list may include multiple functions and corresponding application types or application names. According to the application type or application name, the function classification corresponding to the application can be found from the preset function list to determine the functional characteristics.
[0110] According to an embodiment of the present invention, the functional classification may include: network, I / O, storage, security, compression / decompression, database, middleware, virtualization, etc. The present invention does not limit the specific types and numbers included in the functional classification.
[0111] According to one embodiment of the present invention, if the preset functional classification does not record the functional features of the application, one or more dependent packages of the application are determined; one or more dependent packages of the same level of dependency are selected from the one or more dependent packages of the application as sibling dependent packages to obtain a sibling dependent package set including one or more sibling dependent packages; the probability that the application has each functional feature is determined based on the functional features of each sibling dependent package in the sibling dependent packages to obtain multiple probability values; the functional features of the application are determined based on the multiple probability values obtained for the sibling dependent packages at each level.
[0112] According to an embodiment of the present invention, the software design and development process follows the principle of "high cohesion and low coupling", and the operating system is no exception. Modules with similar functions are highly cohesive, so the functional feature analysis of the software package will be carried out around this principle. In a general operating system, the operation of a single software cannot provide services to users, so the function of a software package should be analyzed based on its own aggregation and its coupling. The aggregation is for itself, and the coupling is for dependency.
[0113] Therefore, according to an embodiment of the present invention, the present invention can use the KNN algorithm model to determine the functional classification of the application. Specifically: according to the classification decision principle, it is necessary to circle a range of a point with the highest similarity to one of the software packages, so as to finally determine the functional category of the software package by the majority voting principle.
[0114] Fig. 9 FIG. 4 is a schematic diagram showing an application function classification decision according to an exemplary embodiment of the present invention. Fig. 9 As shown in the figure: the application A to be classified directly depends on packages B, C, and D; package C depends on packages E and F, which are indirect dependencies of application A. Both direct and indirect dependencies of application A are within the scope of the circle. Then the functional classification probability of package A is P(A) = (P(B) + P(C) + P(D)) / 3, where the functional probability of package D is known, P(B) = 1, and the functional probability of package C is P(C) = (P(E) + P(F)) / 2, where package D does not have a dependency relationship with package E. The functional probabilities of packages D and E can only be inferred from the information of packages D and E. The functional description of the package will be in the summary and description. The classification probabilities P(D) and P(E) of packages D and E can be derived using the naive Bayes classification method.
[0115] According to one embodiment of the present invention, if an application has k layers of dependencies, the dependency range is used as the value range of K according to the hierarchical dependency data structure, the similarity of the functions of each layer of dependency is used as the distance metric, and the probability of the characteristic functions represented by all software packages in each layer of dependency is used as the rule for classification decision, that is, within the K-layer dependency range, the greater the average probability of a function in a layer, the higher the probability that the application belongs to that function.
[0116] According to the operating system dependency hierarchy diagram, assuming that the probability of all functions represented by a certain layer is 1, and there are n software packages in this dependency layer, then the average probability of each software package included is 1 / n, of which k software packages have known functions, and x software packages have unknown probabilities, so the function probability of all software packages in this layer is: (1*k+x*p(x)) / n, and the average probability of the entire application function is:
[0117]
[0118] The average probability is the probability that this application belongs to each functional category. The larger the probability, the more votes there are, and the more similar the function of this software package is to this function.
[0119] According to one embodiment of the present invention, after determining which function has the highest probability in each level of dependency, the function probabilities of each level can be counted, and the probabilities of each level belonging to each function category can be weighted to ultimately determine the function category of the application.
[0120] According to one embodiment of the present invention, according to the first level dependency of the application, the probability of belonging to functional category 1 in this level is 50%. The probability of belonging to functional category 2 is 50%. According to the second level dependency of the application, the probability of belonging to functional category 1 in this level is 20%, and the probability of belonging to functional category 2 is 80%. Then, the weight of the application belonging to functional category 1 is 0.7, and the weight of the application belonging to functional category 2 is 1.3, and the functional feature of the application is determined to be functional category 2.
[0121] Fig.10 FIG. 2 shows a schematic diagram of determining an application function according to an exemplary embodiment of the present invention. Fig.10 As shown in the figure, taking the application to be classified as the origin, the direct dependencies of the application to be classified are dependent packages s1, s2, s3, s4, s5, s6, and s7, which are respectively in Fig.10In the figure, it is shown in the form of points. It can be seen that points s1, s2, and s3 belong to the fun1 functional class, and points s4 and s5 belong to the fun2 functional class. Assuming that the weight of the functional class is uniform and the range is within the direct dependency range, according to the principle of the KNN algorithm, as long as the category of most of the seven points of direct dependency is calculated, the category of the software package to be classified can be determined. However, the functional categories of two points s6 and s7 are uncertain, and the categories of these two points also determine the category of the software package to be classified. Therefore, the functional classification p(x) of the two points s6 and s7 (unknown software packages) must be determined first to finally determine the functional classification of the software package to be classified. The functional classification of the unknown dependent package can be determined based on the information of the dependent package.
[0122] According to one embodiment of the present invention, when determining the functional characteristics of an application, one or more functional keywords of the application may also be determined based on the characteristic data of the application; then, the one or more functional keywords of the application are input into a classification model to obtain a classification result, and the functional characteristics of the application are determined based on the classification result.
[0123] According to an embodiment of the present invention, when the functional features of the application cannot be determined according to the dependent package, or when the application has no dependent package, the functional classification can be determined according to the functional keywords. The present invention does not limit the specific application scenario when determining the functional classification of the application.
[0124] According to one embodiment of the present invention, a method for constructing a classification model includes: obtaining application information of multiple applications, determining a functional keyword set including each application based on the application information, the functional keyword set including one or more functional keywords; taking each application as a training sample to obtain a training sample set including multiple training samples, each training sample including functional features and a functional keyword set of the application; and training the classification model based on the training sample set.
[0125] According to one embodiment of the present invention, the trained classification model may specifically be a naive Bayes classification model, and the present invention does not limit the specific implementation method of the classification model.
[0126] According to an embodiment of the present invention, when constructing a training sample set, multiple functional categories can be divided. Then, multiple applications are labeled with functional categories. When labeling, the entire ISO / warehouse software package can be functionally classified, and the corresponding applications can be selected as basic data for classification, and then the feature information of each type of application can be extracted. The input of this stage is the classification and data of ISO / warehouse, and the output is the feature category and training samples.
[0127] Subsequently, the frequency of occurrence of each category in the training sample and the conditional probability estimation of each functional classification division for each category are calculated, and the results are recorded. In this stage, the nouns, verbs, adjectives, and adverbs that may represent the functional category that can be extracted from the available application information (such as: abstract and description) are used as its keywords, and the word frequency of these words in the abstract and description is extracted, and the keywords plus the word frequency are used as the functional features for training, and finally the functional features of multiple software packages of a certain functional class are used as its training samples. According to one embodiment of the present invention, the Bayesian classifier provided by NLTK can be used to complete the input and training.
[0128] According to an embodiment of the present invention, when determining the functional features of an application based on a trained classification model, the functional keyword set of the application is input to the classifier, and the output is the probability of the application being in each functional category. In this stage, the summary and description information of the application to be classified can be extracted, and the functional keyword set that can represent its function can be extracted from it as the input of the classifier, and the output is the similarity probability between the software package to be classified and each category.
[0129] According to one embodiment of the present invention, the above classification model can also be used to determine the functional category of the dependency package of the location functional type, and the functional keywords of the dependency package are input for determination. The dependency package of the unknown functional category is determined as the dependency package of the known functional category, and then the functional classification of the application is determined according to the KNN algorithm model.
[0130] Finally, the characteristics of the layer of the operating system are determined according to the characteristics of the applications included in the layer.
[0131] According to one embodiment of the present invention, when determining the characteristics of the operating system hierarchy, the feature set of the characteristics included in the operating system hierarchy can be determined based on the characteristics of the applications included in the hierarchy; the characteristics of the operating system hierarchy can be determined based on the most common features in the feature set.
[0132] After determining the feature set, you can sort the features by the number of occurrences. The feature with the most occurrences is the feature of the level.
[0133] According to an embodiment of the present invention, the characteristics of the operating system level include type characteristics and function characteristics.
[0134] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0135] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof.
[0136] Those skilled in the art will appreciate that the modules or units or groups of the devices in the examples disclosed herein may be arranged in the device as described in the embodiment, or alternatively may be located in one or more devices different from the devices in the example. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.
[0137] Those skilled in the art will appreciate that the modules in the devices in the embodiments can be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or groups in the embodiments can be combined into one module or unit or group, and in addition they can be divided into multiple submodules or subunits or subgroups. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification and all processes or units of any method or device disclosed in this manner can be combined in any combination. Unless otherwise explicitly stated, each feature disclosed in this specification can be replaced by an alternative feature that provides the same, equivalent or similar purpose.
[0138] Furthermore, those skilled in the art will appreciate that although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features from different embodiments is meant to be within the scope of the present invention and to form different embodiments.
[0139] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.
[0140] The various techniques described herein may be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or portions of the method and apparatus of the present invention may be in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a floppy disk, a CD-ROM, a hard disk drive, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.
[0141] In the case where the program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the layered method of the operating system of the present invention according to the instructions in the program code stored in the memory.
[0142] By way of example and not limitation, computer readable media include computer storage media and communication media. Computer readable media include computer storage media and communication media. Computer storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and includes any information delivery medium. Any combination of the above is also included within the scope of computer readable media.
[0143] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.
[0144] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and instructional purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art. The disclosure of the present invention is illustrative, rather than restrictive, with respect to the scope of the present invention.
Claims
1. A method for layering an operating system, suitable for execution in a computing device, the method comprising: Drawing a directed graph according to a plurality of applications included in the operating system, wherein the directed graph is used to represent dependency relationships between the applications; generating a topological sequence according to the directed graph, wherein the topological sequence is used to characterize the applications on which the nodes corresponding to the multiple applications depend; A plurality of levels of the operating system are determined according to the topological sequence.
2. The method of claim 1, wherein: The drawing of a directed graph according to a plurality of applications included in the operating system comprises: determining one or more dependencies between the plurality of applications; Each dependency relationship is taken as a directed edge in the directed graph, so as to obtain a directed graph including a plurality of directed edges.
3. The method of claim 1, wherein: The directed graph topology sequence includes: Determine the type of the directed graph, the type including directed acyclic graph and directed cyclic graph; If the type of the directed graph is a directed acyclic graph, generating a topological sequence according to the directed acyclic graph; If the type of the directed graph is a directed cyclic graph, a directed acyclic graph is generated according to the directed cyclic graph, and then the topological sequence is generated according to the directed acyclic graph.
4. The method of claim 3, wherein: Generating a directed acyclic graph according to the directed cyclic graph includes: Traversing the directed edges in the directed cyclic graph to determine one or more cycles included in the directed cyclic graph; The one or more cycles are taken as a cycle set, and a directed acyclic graph including the cycle set is generated.
5. The method according to claim 3 or 4, wherein: Generating the topological sequence according to the directed acyclic graph includes: Based on the dependency relationship between the nodes included in the directed acyclic graph, all nodes are sorted to obtain a topological sequence, wherein the dependent nodes in the directed acyclic graph serve as upstream nodes of their dependent nodes, and the dependent nodes serve as downstream nodes of their dependent nodes.
6. The method of claim 1, wherein: The determining the multiple levels of the operating system according to the topological sequence includes: Determine a key point set in the topological sequence according to the topological sequence; A plurality of levels of the operating system are determined according to the key point set.
7. The method of claim 6, wherein: Determining a key point set in the topological sequence according to the topological sequence includes: For each node in the topological sequence, determining whether the preceding nodes have no dependency on the succeeding nodes; If so, the node is used as a key node in the key node set.
8. The method of claim 7, wherein: Determining the multiple levels of the operating system according to the key point set includes: Based on the position of each key node in the key point set in the topological sequence, the topological sequence is divided into multiple sequences; Each sequence in the multiple sequences is determined as a level, so as to obtain multiple levels of the operating system.
9. A computing device comprising: one or more processors; Memory; as well as One or more programs, wherein the one or more programs are stored in a memory and configured to be executed by one or more processors, and the one or more programs include instructions for executing the method according to any one of claims 1-8.
10. A computer-readable storage medium storing one or more programs, the one or more programs comprising instructions which, when executed by a computing device, cause the computing device to perform the method according to any one of claims 1-8.
