CN117608675A - System initialization method for low coupling in network equipment application software - Google Patents

System initialization method for low coupling in network equipment application software Download PDF

Info

Publication number
CN117608675A
CN117608675A CN202311612653.0A CN202311612653A CN117608675A CN 117608675 A CN117608675 A CN 117608675A CN 202311612653 A CN202311612653 A CN 202311612653A CN 117608675 A CN117608675 A CN 117608675A
Authority
CN
China
Prior art keywords
initialization
module
sub
task
application software
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
CN202311612653.0A
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.)
Sichuan Netop Telecom Co ltd
Original Assignee
Sichuan Netop Telecom 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 Sichuan Netop Telecom Co ltd filed Critical Sichuan Netop Telecom Co ltd
Priority to CN202311612653.0A priority Critical patent/CN117608675A/en
Publication of CN117608675A publication Critical patent/CN117608675A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4403Processor initialisation

Landscapes

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

Abstract

The invention discloses a system initialization method for low coupling in network equipment application software, which comprises the following steps: in the application software of the network equipment, the segmentation technology is compiled based on the software, and an initialization middle layer module is added in the application software, so that unified initialization of the sub-modules is completed through the call of the middle layer module in the initialization stage, and the software is coupled with low level. The invention discloses a system initialization method for low coupling in network equipment application software, which is an initialization method for unified management of software system initialization, can effectively reduce the coupling of software system initialization, enhance the software running stability and facilitate the calling of sub-module developers.

Description

System initialization method for low coupling in network equipment application software
Technical Field
The invention relates to the field of application software operation. More particularly, the present invention relates to a system initialization method for low coupling in network device applications.
Background
To accommodate more flexible and versatile application scenarios, large application software such as network devices may require the development of more and more sub-module functionality to support product requirements. Most of the sub-modules can require initializing tasks of functions in an initializing stage of an application software system, so that the initializing part of the application software can be a software part with high coupling, and different collaboration developers can increase the functions of the initializing tasks of the sub-modules according to the needs and adjust the sequence of the initializing tasks according to the design needs.
The conventional system initialization software is realized by calling each sub-module initialization function one by one at the entrance of the application software according to the initialization flow. When the application software needs to add sub-modules, the application software needs to modify the initialization code and add the header files referencing the corresponding sub-modules. The implementation is very unfavorable for system layering of application software in large-scale software, the submodule functions called in the initialization codes often contain software content of each level, the existing software level design can be destroyed, and too many private data structures and function declarations can be exposed for irrelevant modules by adding the cited header files, so that the design risk of the software is increased. The primary submodule developer lacks enough knowledge on the whole initialization flow, can randomly adjust the initialization flow, and can also cause abnormal exit and unexpected submodule operation and other results to reduce the software debugging efficiency when the software is debugged.
The initialization of the application software almost relates to all sub-modules, and the sub-module initialization needs to be arranged according to a certain sequence according to the importance and the universality of the sub-module tasks, so that an initialization method for uniformly managing the software system initialization needs to be designed, the method is used for reducing the coupling of the software system initialization, enhancing the software running stability and facilitating the calling of sub-module developers.
Disclosure of Invention
It is an object of the present invention to address at least the above problems and/or disadvantages and to provide at least the advantages described below.
To achieve these objects and other advantages and in accordance with the purpose of the invention, a system initialization method for low coupling in application software of a network device is provided, comprising: in the application software of the network equipment, the segmentation technology is compiled based on the software, and an initialization middle layer module is added in the application software, so that unified initialization of the sub-modules is completed through the call of the middle layer module in the initialization stage, and the software is coupled with low level.
Preferably, initializing the middle tier file of the middle tier module includes: registration of the submodule initialization task, prioritization and calling of the submodule initialization function and state query of the declared submodule initialization function.
Preferably, the registration flow of the sub-module initialization task is configured to include:
s10, defining a global initialization management data structure;
s11, allocating different task IDs to the initialization tasks defined by using NETOP_ENTRY_DEF macros according to the registered sequence, and calculating the total priority according to the sub-module initialization task priority and the task IDs;
s12, registering an initialization task defined by using the NETOP_ENTRY_DEF macro into a global initialization management data structure.
Preferably, the sub-module initializing function has the following steps of prioritizing and calling:
s20, traversing the global initialization management data structure, judging whether the priority of the sub-module initialization task is out of range, if so, retrieving the next sub-module initialization task again, otherwise, executing the next step;
s21, sequencing the priority of the sub-module initialization task;
s22, sequentially calling the sequenced modules according to the priority, and outputting corresponding calling information;
s23, judging whether the traversal is finished, if not, starting to execute again from S20, otherwise, ending the program operation, and returning the function.
Preferably, the comprehensive priority of the sub-module initialization task is: sub-module basic priority + sub-module task initialization priority + sub-module ID number;
the sub-module initialization task is comprised of the following five classes:
a system initialization task related to configuration file reading and device type configuration;
a hardware driver initialization task associated with hardware driver initialization;
a platform related to task management and thread management initializes tasks;
initializing tasks by application programs related to network protocols;
command line interface initialization tasks associated with interactive command lines
The five types of initialization tasks are from a system initialization task to a command line interface initialization task, the priority levels are sequentially reduced, the basic priority of each priority interval is 0, 10000, 20000, 30000 and 40000, and the interval length is 10000.
Preferably, a sub-module initialization dedicated macro definition is defined in the middle layer file, and input parameters of the macro definition include task names, task priorities, task realization callback functions and transfer parameters of the callback functions, wherein the macro definition mode is as follows:
NETOP_ENTRY_DEF(NAME,PRI_BASE+PRI_OFFSET,xxx_init_callback,argc,argv);
wherein NAME represents the sub-module task NAME, PRI_BASE represents the task class basic priority to which the sub-module belongs, PRI_OFFSET represents the self-priority of the sub-module, xxx_init_callback represents the sub-module initialization function, and argc and argv represent the input parameters of the sub-module initialization function.
Preferably, the initialization function after the nettop_entry_def statement is used, and the corresponding initialization function is set into the private code segment netop_mod_entry of the executable program file by the compilation technology in the compilation stage of the submodule source program.
Preferably, the loading mode of the application software is as follows: and starting the operation of the initialization middle layer module, and calling the sub-module initialization task functions defined by the special macros one by the initialization middle layer module based on the priority order until the execution of the sub-module initialization tasks is completed, and turning to a subsequent operation stage.
Preferably, the application software loading operation steps are as follows:
s30, calling a registration function of the initialization middle layer module, and registering the initialization functions of all the sub-modules into a global initialization management data structure;
s31, sorting the priorities of the initialization functions registered in the global initialization management data structure;
s32, sequentially calling according to the comprehensive priority of the sub-module initialization task to finish the initialization function of the application software, initializing related work according to the priority by adopting a method of classifying partitions when the sub-module initialization task is called, and designing private codes among all the classifying partitions to meet the overall design requirement of the system;
s33, the initialization of the application software is completed, and the subsequent operation stage of the application software is transferred.
The invention at least comprises the following beneficial effects: the invention provides a system initialization method for low coupling of application software, which is an initialization method for unified management of software system initialization, can effectively reduce the coupling of software system initialization, enhance the software running stability and facilitate the calling of sub-module developers.
Specifically, the invention is an effective solution to the problems, and mainly uses the software compiling segmentation technology of the computer system and adds an initialization management middle layer file in the application software to realize low coupling of function call of each sub-module of the application software in the initialization stage. The sub-module function separates the module function to be initialized from the general code segment when executing sub-module compiling by calling the public middle layer header file in the file, and compiles into the private code segment of the sub-module static library. Before the final target file of the application software is linked, the function information is extracted from the private code segments of the static library by using compiling tool software, a source file of a new middle layer is generated, and the link is compiled into the final target file. Therefore, when the sub-module is added, the application software can achieve the purpose of adding the initialization task into the whole initialization task of the application software only by calling the initialization management header file of the middle layer.
Additional advantages, objects, and features of the invention will be set forth in part in the description which follows and in part will become apparent to those having ordinary skill in the art upon examination of the following or may be learned from practice of the invention.
Drawings
FIG. 1 is a schematic diagram comparing the present invention with the prior art application software at system initialization;
FIG. 2 is a schematic diagram of private code compilation of an executable program file according to the present invention.
Detailed Description
The present invention is described in further detail below with reference to the drawings to enable those skilled in the art to practice the invention by referring to the description.
Aiming at the problem of high application software initialization coupling program, the patent provides a system initialization method for low application software coupling. As shown in fig. 1, conventional system initialization software is implemented by calling each sub-module initialization function one by one at the entry of application software according to an initialization flow. When the application software needs to add sub-modules, the application software needs to modify the initialization code and add the header files referencing the corresponding sub-modules. The implementation is very unfavorable for system layering of application software in large-scale software, the submodule functions called in the initialization codes often contain software content of each level, the existing software level design can be destroyed, and too many private data structures and function declarations can be exposed for irrelevant modules by adding the cited header files, so that the design risk of the software is increased. The primary submodule developer lacks enough knowledge on the whole initialization flow, can randomly adjust the initialization flow, and can also cause abnormal exit and unexpected submodule operation and other results to reduce the software debugging efficiency when the software is debugged.
The invention utilizes the software compiling and segmenting technology of the computer system and adds an initialization management middle layer file in the application software to realize the low coupling of the function call of each sub-module of the application software in the initialization stage (namely, the mode of realizing the unified initialization of the sub-modules by the call of the middle layer module in the initialization stage so as to further realize the aim of low coupling of the software). The sub-module function separates the module function to be initialized from the general code segment when executing sub-module compiling by calling the public middle layer header file in the file, and compiles into the private code segment of the sub-module static library. Before the final target file of the application software is linked, the function information is extracted from the private code segments of the static library by using compiling tool software, a source file of a new middle layer is generated, and the link is compiled into the final target file. Therefore, when the sub-module is added, the application software can achieve the purpose of adding the initialization task into the whole initialization task of the application software only by calling the initialization management header file of the middle layer.
Specifically, the design method of the invention has the following processing flow:
1. sub-module initialization task priority classification
According to the application requirements of the network equipment, the initialization tasks are divided into the following five types:
1. system initialization tasks: the method mainly relates to task types such as configuration file reading, device type configuration and the like.
2. Hardware driver initialization task: mainly relates to task types such as hardware drive initialization and the like.
3. Platform initialization tasks: the method mainly relates to task types such as task management, thread management and the like.
4. Application initialization tasks: mainly the application program initialization task type such as network protocol.
5. Command line interface initialization tasks: the method mainly comprises the steps of interaction command line and other task initialization types.
The five initialization tasks have different priority intervals, the priority levels are sequentially reduced from the system initialization task to the command line interface initialization task, the basic priority of each priority interval is 0, 10000, 20000, 30000 and 40000, and the interval length is 10000. The sub-module initialization tasks registered in the interval are set to be basic priority, sub-module task initialization priority and sub-module ID number, so that each sub-module initialization task is guaranteed to have unique determined priority, and the set total priority does not enter the adjacent priority interval beyond the boundary. The initialization task with high total priority is preferentially called when the application program runs the initialization stage, so that the aim of orderly calling the initialization function according to the total priority order is fulfilled.
2. Initialization management layer declares macro definition
The initialization middle layer defines a sub-module initialization special macro definition, and input parameters of the macro definition comprise task names, task priorities, task realization callback functions and transfer parameters of the callback functions. The macro definition is as follows:
NETOP_ENTRY_DEF(NAME,PRI_BASE+PRI_OFFSET,xxx_init_callback,argc,argv);
wherein NAME represents the sub-module task NAME, PRI_BASE represents the task class BASE priority to which the sub-module belongs, PRI_OFFSET represents the sub-module own priority, xxx_init_callback represents the sub-module initialization function, argc and argv represent the input parameters of the sub-module initialization function.
When the submodule needs to create an initialization task, only the initialization intermediate layer header file needs to be referenced and macro declaration of NETOP_ENTRY_DEF is carried out on the corresponding initialization function. The initialization function after the nettop_entry_def statement is used to set the corresponding initialization function into the private code segment netop_mod_entry of the executable program file using the compilation technology of the computer at the compilation stage of the sub-module source program, as shown in the block of fig. 2.
3. Initializing middle tier module designs
The initialization middle layer file realizes a unified management method for the sub-module initialization task, and comprises the registration of the sub-module initialization task, the priority ordering and calling of the sub-module initialization function, the state inquiry of the declared sub-module initialization function and the like.
The sub-module initialization task registration steps are as follows:
1. defining a global initialization management data structure, wherein the data structure comprises an initialization task name, an initialization task priority, an initialization task running function, the number of input parameters of the running function and the numerical value of the input parameters.
2. And assigning different task IDs to the initialization tasks defined by using the NETOP_ENTRY_DEF macros according to the registered sequences, and calculating the total priority according to the priority of the initialization tasks and the task IDs.
3. An initialization task defined using a nettop_entry_def macro is registered into a global initialization management data structure.
The sub-module initialises the prioritization and calling steps of the function as follows:
(1) Traversing the global initialization management data structure, judging whether the priority of the sub-module initialization task is out of range, if so, retrieving the next sub-module initialization task again, otherwise, executing the next step.
(2) The sub-module initialization task priorities are ordered.
(3) And sequentially calling the sequenced modules according to the priority, and outputting corresponding calling information.
(4) Judging whether the traversal is finished, if not, starting to execute again from the step (1), otherwise, ending the program operation, and returning the function.
4. Application software overall program compilation
The application software of the invention is composed of a plurality of sub-modules, when the application software is compiled, each sub-module is compiled firstly to form a static library file, then the initialization middle layer module is compiled, and finally the static library files of all modules are linked to form a final application software target file. The compiling steps of the whole program of the application software are as follows:
1. compiling all sub-module source files except the initialized middle layer module and generating a sub-module static library file.
2. And acquiring information of a special code segment (namely a netop_mod_entry segment in the description) defined by the middle layer from the completed compiling sub-module static library file by using a compiling system tool, generating a new source code file, adding the new source code file into an initializing middle layer module to form a complete initializing middle layer source file, and compiling the complete initializing middle layer source file into the initializing middle layer module static library file.
3. And finally, the application software links all the module static library files to form a final target file of the application software.
4. If the sub-module functions of some functions need to be removed in the application software, the corresponding library files are canceled when the final program is linked, and no operation is required to be independently performed on the initialization task.
5. Application software loading operation
When the application software is loaded and run, the initialization middle layer module is started to run first, the sub-module initialization task functions defined by the special macros are called one by one through the middle layer module according to the priority order until the sub-module initialization tasks are executed, and the subsequent operation stage is shifted. The application software loading operation steps are as follows:
1. and calling a registration function of the initialization middle layer module, and registering the initialization functions of all the sub-modules into a global initialization management data structure.
2. The initialization functions registered in the global initialization management data structure are prioritized. When the sub-module registers and manages, different ids are allocated to each initialization function, so that the initialization functions can be sequentially called according to the different ids under the condition that the priorities of the functions are the same.
3. And sequentially calling according to the total priority of the sub-module initialization tasks to finish the initialization function of the application software. When the sub-module initiates task call, the method of classifying partitions is adopted to initialize related work according to the priority, and private codes can be designed among the classifying partitions to meet the overall design requirement of the system.
4. The initialization of the application software is completed and the application software is transferred to the subsequent operation stage.
The above is merely illustrative of a preferred embodiment, but is not limited thereto. In practicing the present invention, appropriate substitutions and/or modifications may be made according to the needs of the user.
The number of equipment and the scale of processing described herein are intended to simplify the description of the present invention. Applications, modifications and variations of the present invention will be readily apparent to those skilled in the art.
Although embodiments of the invention have been disclosed above, they are not limited to the use listed in the specification and embodiments. It can be applied to various fields suitable for the present invention. Additional modifications will readily occur to those skilled in the art. Therefore, the invention is not to be limited to the specific details and illustrations shown and described herein, without departing from the general concepts defined in the claims and their equivalents.

Claims (9)

1. A method for initializing a system with low coupling in application software of a network device, comprising: in the application software of the network equipment, the segmentation technology is compiled based on the software, and an initialization middle layer module is added in the application software, so that unified initialization of the sub-modules is completed through the call of the middle layer module in the initialization stage, and the software is coupled with low level.
2. The method for initializing a system for low coupling in network device application software of claim 1, wherein initializing a middle tier file of the middle tier module comprises: registration of the submodule initialization task, prioritization and calling of the submodule initialization function and state query of the declared submodule initialization function.
3. The system initialization method of low coupling in network device application software of claim 2, wherein the registration procedure of the sub-module initialization task is configured to include:
s10, defining a global initialization management data structure;
s11, allocating different task IDs to the initialization tasks defined by using NETOP_ENTRY_DEF macros according to the registered sequence, and calculating the total priority according to the sub-module initialization task priority and the task IDs;
s12, registering an initialization task defined by using the NETOP_ENTRY_DEF macro into a global initialization management data structure.
4. A method of system initialization for low coupling in network device application software as claimed in claim 3, wherein the sub-module initialization function prioritizing and invoking steps are as follows:
s20, traversing the global initialization management data structure, judging whether the priority of the sub-module initialization task is out of range, if so, retrieving the next sub-module initialization task again, otherwise, executing the next step;
s21, sequencing the priority of the sub-module initialization task;
s22, sequentially calling the sequenced modules according to the priority, and outputting corresponding calling information;
s23, judging whether the traversal is finished, if not, starting to execute again from S20, otherwise, ending the program operation, and returning the function.
5. The system initialization method of low coupling in network device application software according to claim 1, wherein the comprehensive priority of the sub-module initialization task is: sub-module basic priority + sub-module task initialization priority + sub-module ID number;
the sub-module initialization task is comprised of the following five classes:
a system initialization task related to configuration file reading and device type configuration;
a hardware driver initialization task associated with hardware driver initialization;
a platform related to task management and thread management initializes tasks;
initializing tasks by application programs related to network protocols;
command line interface initialization tasks associated with interactive command lines
The five types of initialization tasks are from a system initialization task to a command line interface initialization task, the priority levels are sequentially reduced, the basic priority of each priority interval is 0, 10000, 20000, 30000 and 40000, and the interval length is 10000.
6. The system initialization method for low coupling in network device application software according to claim 2, wherein a sub-module initialization dedicated macro definition is defined in the middle layer file, and input parameters of the macro definition include task names, task priorities, task implementation callback functions and transfer parameters of the callback functions, and a macro definition manner is as follows:
NETOP_ENTRY_DEF(NAME,PRI_BASE+PRI_OFFSET,xxx_init_callback,argc,argv);
wherein NAME represents the sub-module task NAME, PRI_BASE represents the task class basic priority to which the sub-module belongs, PRI_OFFSET represents the self-priority of the sub-module, xxx_init_callback represents the sub-module initialization function, and argc and argv represent the input parameters of the sub-module initialization function.
7. The system initialization method of claim 6, wherein the initialization function after using nettop_entry_def declaration, sets the corresponding initialization function into a private code segment netop_mod_entry of the executable program file by a compilation technique at a compilation stage of the sub-module source program.
8. The method for initializing a system with low coupling in application software of a network device according to claim 1, wherein the application software is loaded in the following manner: and starting the operation of the initialization middle layer module, and calling the sub-module initialization task functions defined by the special macros one by the initialization middle layer module based on the priority order until the execution of the sub-module initialization tasks is completed, and turning to a subsequent operation stage.
9. The method for initializing a system for low coupling in application software of a network device according to claim 8, wherein the application software loading operation steps are as follows:
s30, calling a registration function of the initialization middle layer module, and registering the initialization functions of all the sub-modules into a global initialization management data structure;
s31, sorting the priorities of the initialization functions registered in the global initialization management data structure;
s32, sequentially calling according to the comprehensive priority of the sub-module initialization task to finish the initialization function of the application software, initializing related work according to the priority by adopting a method of classifying partitions when the sub-module initialization task is called, and designing private codes among all the classifying partitions to meet the overall design requirement of the system;
s33, the initialization of the application software is completed, and the subsequent operation stage of the application software is transferred.
CN202311612653.0A 2023-11-27 2023-11-27 System initialization method for low coupling in network equipment application software Pending CN117608675A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311612653.0A CN117608675A (en) 2023-11-27 2023-11-27 System initialization method for low coupling in network equipment application software

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311612653.0A CN117608675A (en) 2023-11-27 2023-11-27 System initialization method for low coupling in network equipment application software

Publications (1)

Publication Number Publication Date
CN117608675A true CN117608675A (en) 2024-02-27

Family

ID=89951120

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311612653.0A Pending CN117608675A (en) 2023-11-27 2023-11-27 System initialization method for low coupling in network equipment application software

Country Status (1)

Country Link
CN (1) CN117608675A (en)

Similar Documents

Publication Publication Date Title
US8434054B2 (en) System and method for managing cross project dependencies at development time
US8813048B2 (en) Single code set applications executing in a multiple platform system
US8473935B2 (en) Just-ahead-of-time compilation
CN111796831B (en) Compiling method and device for multi-chip compatibility
Philippsen A survey of concurrent object‐oriented languages
EP1645959A2 (en) Grouping of run-time components in entity domains
US11093241B2 (en) Outlier software component remediation
JP2004220583A (en) Method and system for executing global processor resource assignment in assembler
US7509633B2 (en) System and method for grid-based distribution of Java project compilation
US7757224B2 (en) Software support for dynamically extensible processors
US20050262471A1 (en) System and method for managing cross project dependencies at development time
EP3032413B1 (en) Code generation method, compiler, scheduling method, apparatus and scheduling system
US20180203676A1 (en) Removing library objects from a static library
US20060130011A1 (en) Extending existing model-to-model transformations
CN117608675A (en) System initialization method for low coupling in network equipment application software
CN114911586A (en) Task scheduling method, device and system
CN112306539A (en) Method, system, terminal and medium for developing application layer of single chip microcomputer
US11435989B2 (en) Thread-local return structure for asynchronous state machine
Cox et al. Adding parallelism to visual data flow programs
Tauber et al. Compiling IOA without global synchronization
US7765530B2 (en) Fixed point dependency determination
CN110737429A (en) modular compiling method and device utilizing Makefile self-dependent relationship
JP5845788B2 (en) Execution control program, execution control apparatus, and execution control method
CN113778452A (en) Routing method, device, computer system and computer readable storage medium
CN114218024A (en) Method and system for implementing CPU verification simulation management

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