CN117421141A - Inter-process data parameter sharing method, device, equipment and medium - Google Patents

Inter-process data parameter sharing method, device, equipment and medium Download PDF

Info

Publication number
CN117421141A
CN117421141A CN202311479912.7A CN202311479912A CN117421141A CN 117421141 A CN117421141 A CN 117421141A CN 202311479912 A CN202311479912 A CN 202311479912A CN 117421141 A CN117421141 A CN 117421141A
Authority
CN
China
Prior art keywords
data
parameter
storage
sharing
shared
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
CN202311479912.7A
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.)
XIAMEN FOUR-FAITH COMMUNICATION TECHNOLOGY CO LTD
Original Assignee
XIAMEN FOUR-FAITH COMMUNICATION TECHNOLOGY CO LTD
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by XIAMEN FOUR-FAITH COMMUNICATION TECHNOLOGY CO LTD filed Critical XIAMEN FOUR-FAITH COMMUNICATION TECHNOLOGY CO LTD
Priority to CN202311479912.7A priority Critical patent/CN117421141A/en
Publication of CN117421141A publication Critical patent/CN117421141A/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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, a device, equipment and a medium for sharing data parameters among processes, which comprise the steps of loading a parameter sharing kernel module when judging that the equipment starts a system kernel; starting a shared cache export library to initialize parameter data through an init program, judging whether equipment runs for the first time, generating a judging result, and initializing shared parameter memory cache data according to the judging result; calling the creation, reading, writing, deleting and submitting storage interfaces of the export library to access the shared parameter data and the storage files; and calling the export library to execute the commit memory operation and configuring a timer to trigger the memory backup. The method aims to solve the problems that the stability or performance requirement on each functional module program of the system is very high, secondary packaging or development is needed, and direct expansion and use cannot be realized in the existing inter-process data sharing method.

Description

Inter-process data parameter sharing method, device, equipment and medium
Technical Field
The present invention relates to the field of embedded applications, and in particular, to a method, an apparatus, a device, and a medium for sharing data parameters between processes.
Background
Currently, commonly used inter-process data sharing has methods of sharing memory, pipeline, message, database and the like, and the common characteristics of the methods are that the methods are operated at an application layer, and the operation needs creator management of shared parameter data. In an embedded device system, memory resources are limited, and when the device runs for a long time, application memory is insufficient or a system application program is abnormal, a shared memory creator is possibly abnormal, so that shared data is abnormal, and therefore, the stability or performance requirement of the use of the embedded device system on each functional module program of the system is high.
Meanwhile, the coupling degree and independence among the processes of all the functional modules of the system are also problems to be solved; if the database is used, more memory is occupied in the embedded environment, the data sharing access is a problem that the data needs to be read and written in a special access process, and the existing shared memory, pipelines and messages do not have a scheme for directly storing data, so that secondary packaging or development is needed. And the methods such as shared memory, pipelines, messages, databases and the like commonly used in the market at present cannot be directly compatible with the script language and cannot be directly expanded for use.
In short, the methods of commonly used shared memory, pipelines, messages, databases and the like in the market at present are unfriendly in support of the low memory state of the embedded system, and the resources are limited or are difficult to ensure stability during long-time running; the functions and the memory are all operated on an application layer, and the stability or performance requirements on the programs of all the functional modules of the system are very high; the coupling degree among the processes of each functional module of the system is high, and decoupling is required to be independently designed; there is no ready-made data storage interface, and development and implementation are needed; the time consumption memory is stored in a database mode, the parameter sharing among lightweight database processes on the embedded system is inconvenient, and concurrent access support is not friendly; the database file or the random storage file is easy to damage due to abnormal power failure; and the problem of not supporting scripting language programs.
In view of this, the present application is presented.
Disclosure of Invention
Accordingly, the present invention aims to provide a method, apparatus, device and medium for sharing inter-process data parameters, which can effectively solve the problems of the prior art that the inter-process data sharing method has high stability or performance requirements for each functional module program of the system, needs to be packaged or developed for a second time, and cannot be directly expanded for use.
The invention discloses a method for sharing data parameters among processes, which comprises the following steps:
when judging that the equipment starts the system kernel, loading the parameter sharing kernel module;
starting a shared cache export library to initialize parameter data through an init program, judging whether equipment runs for the first time, generating a judging result, and initializing shared parameter memory cache data according to the judging result;
calling the creation, reading, writing, deleting and submitting storage interfaces of the export library to access the shared parameter data and the storage files;
and calling the export library to execute the commit memory operation and configuring a timer to trigger the memory backup.
Preferably, when judging that the device starts the system kernel, loading the parameter sharing kernel module, specifically:
when judging that the equipment starts a system kernel, loading a parameter sharing kernel module, and setting a hash algorithm key, a field maximum byte number and a data maximum byte number;
applying for a shared parameter list cache, a hash table cache and a defragmentation cache;
and setting a defragmentation threshold and a defragmentation timer, and finishing loading of the parameter sharing kernel module.
Preferably, the init program starts the shared cache export library to initialize parameter data, specifically:
starting an init process, initializing a shared parameter library, exporting a creation, reading and writing, deleting and submitting a storage access interface;
mapping kernel storage to an application space, and detecting whether a file system has a shared parameter storage file;
if yes, loading the parameter file into the mapped memory space;
if not, establishing a shared parameter storage file and a backup file.
Preferably, whether the device is operated for the first time is judged, a judging result is generated, and the shared parameter memory cache data is initialized according to the judging result, specifically:
judging whether the equipment operates for the first time;
if yes, the library is initialized, cache information is obtained from the kernel module, and data files and backup files are pre-allocated and stored in flash storage;
if not, checking the integrity of the data storage file, and generating a checking result;
when the verification result is that the storage file is complete and the data version is newer, initializing shared parameter cache data by using the storage file data;
and when the verification result is that the storage file is abnormal or the data version is lower than the backup file, recovering the data from the backup file to the storage file, and then using the storage file data to initially share the parameter memory to cache the data.
Preferably, the creation, reading, writing, deleting and submitting storage interfaces of the export library are called to access the shared parameter data and the storage files, specifically:
calling a writing interface of the export library, and writing data into the parameter field;
acquiring a data address corresponding to a field through a hash table, and judging whether a maximum writing field of the current address crosses a boundary;
if so, clearing the current address data, finding out new address writing, marking fragments and number;
if not, locking the read function, and finishing unlocking the data;
when judging that the defragmentation timer is triggered, defragmentation is carried out;
calling a creation interface of the export library, creating a field, and configuring a field attribute;
the interface library invokes the driver module interface to initialize the field attributes.
Preferably, the creating, reading, writing, deleting and submitting the storage interface of the export library is called to access the shared parameter data and the storage file, and the method further specifically comprises the following steps:
calling a reading interface of the export library, and transmitting parameter fields to read field data;
acquiring field attributes through a hash table, and judging whether locking is performed or not;
if yes, locking, acquiring a data address corresponding to the field through a hash table, and reading;
if not, acquiring a data address corresponding to the field through the hash table, and reading;
when the unlocking is judged to be needed, unlocking is carried out;
calling a deletion interface of the export library, deleting fields, and clearing the node data of the hash chain table, the mark fragment address and the format;
judging whether the fragments exceed a threshold value or not;
if yes, when judging that the defragmentation timer is triggered, defragmentation is carried out.
Preferably, the exporting library is called to execute a commit store operation, and a timer is configured to trigger a store backup, specifically:
calling a storage interface of the export library, submitting storage, and storing the cache data into a file;
the configuration timer triggers a file backup.
The invention also discloses a device for sharing the data parameters among the processes, which comprises the following steps:
the module loading unit is used for loading the parameter sharing kernel module when judging that the equipment starts the system kernel;
the system initialization unit is used for starting the shared cache export library to initialize parameter data through an init program, judging whether the equipment operates for the first time, generating a judging result, and initializing the shared parameter memory cache data according to the judging result;
the access unit is used for calling the creation, reading, writing, deleting and submitting storage interfaces of the export library to access the shared parameter data and the storage files;
and the parameter storage unit is used for calling the export library to execute the submitting storage operation and configuring a timer to trigger the storage backup.
The invention also discloses an inter-process data parameter sharing device, which comprises a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, wherein the processor realizes the inter-process data parameter sharing method according to any one of the above when executing the computer program.
The invention also discloses a readable storage medium storing a computer program executable by a processor of a device in which the storage medium is located to implement an inter-process data parameter sharing method as described in any one of the above.
In summary, the method, the device, the equipment and the medium for sharing data parameters between processes provided in this embodiment load a shared parameter driving module when the equipment starts a system kernel: the module registers equipment nodes to the system, pre-configures memory caches of shared parameter data to be used, memory defragmentation caches, hash chain table node caches, memory caches of the formatted shared parameter data, hash table key values, defragmentation thresholds and application layer cache mapping address derivation; secondly, the system starts a shared cache export library to initialize parameter data through an init program; thirdly, the application program calls the creation, reading, writing, deleting and submitting storage interfaces of the export library to access the shared parameter data and the storage files; finally, the application program calls the export library to execute the submitting storage operation, and configures a timer to trigger the storage backup; the script program uses the command line program of creating, reading, writing, deleting and submitting the storage interface to access the shared parameter data, and expands the use of the shared parameter data function. Therefore, the problems that the support of the inter-process data sharing method in the prior art is not friendly in the low memory state of the embedded system, and the stability is difficult to ensure when the resources are limited or the inter-process data sharing method runs for a long time are solved; the functions and the memory are all operated on an application layer, and the stability or performance requirements on the programs of all the functional modules of the system are very high; the coupling degree among the processes of each functional module of the system is high, and decoupling is required to be independently designed; there is no ready-made data storage interface, and development and implementation are needed; the time consumption memory is stored in a database mode, the parameter sharing among lightweight database processes on the embedded system is inconvenient, and concurrent access support is not friendly; the database file or the random storage file is easy to damage due to abnormal power failure; and the problem of not supporting scripting language programs.
Drawings
Fig. 1 is a flow chart of a method for sharing data parameters between processes according to an embodiment of the present invention.
Fig. 2 is a schematic diagram of a data storage structure of a method for sharing data parameters between processes according to an embodiment of the present invention.
Fig. 3 is a schematic block loading flow diagram of a method for sharing data parameters between processes according to an embodiment of the present invention.
Fig. 4 is a schematic diagram of a system initialization flow of a method for sharing data parameters between processes according to an embodiment of the present invention.
Fig. 5 is a schematic diagram of a parameter writing flow of an inter-process data parameter sharing method according to an embodiment of the present invention.
Fig. 6 is a schematic diagram of a parameter creation flow of an inter-process data parameter sharing method according to an embodiment of the present invention.
Fig. 7 is a schematic diagram of a parameter reading flow of an inter-process data parameter sharing method according to an embodiment of the present invention.
Fig. 8 is a schematic diagram of a parameter deletion flow of an inter-process data parameter sharing method according to an embodiment of the present invention.
Fig. 9 is a schematic diagram of a parameter storage flow of an inter-process data parameter sharing method according to an embodiment of the present invention.
Fig. 10 is a schematic block diagram of an inter-process data parameter sharing apparatus according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, based on the embodiments of the invention, which are apparent to those of ordinary skill in the art without inventive faculty, are intended to be within the scope of the invention. Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, based on the embodiments of the invention, which are apparent to those of ordinary skill in the art without inventive faculty, are intended to be within the scope of the invention.
Specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
Referring to fig. 1 to 2, a first embodiment of the present invention provides an inter-process data parameter sharing method, which may be executed by an inter-process data parameter sharing device (hereinafter, sharing device), and in particular, by one or more processors in the sharing device, to implement the following steps:
in this embodiment, the sharing device may be a user terminal device (such as a smart phone, an intelligent computer or other intelligent devices), and the user terminal device may establish a communication connection with a cloud server to implement data interaction.
Referring to fig. 3, S101, when it is determined that the device starts the system kernel, loading the parameter sharing kernel module;
specifically, step S101 includes: when judging that the equipment starts a system kernel, loading a parameter sharing kernel module, and setting a hash algorithm key, a field maximum byte number and a data maximum byte number;
applying for a shared parameter list cache, a hash table cache and a defragmentation cache;
and setting a defragmentation threshold and a defragmentation timer, and finishing loading of the parameter sharing kernel module.
Specifically, in this embodiment, the shared parameter driving module is loaded when the device starts the system kernel: the module registers equipment nodes to the system, pre-configures memory caches of shared parameter data to be used, memory defragmentation caches, hash chain table node caches, memory caches of formatted shared parameter data, hash table key values, defragmentation thresholds and application layer cache mapping address derivation. The memory cache of the shared parameter data and other memory caches possibly used by the shared parameter data and other related memory caches are pre-allocated when the system starts the loading module, and one memory cache is used in a high-order memory area of the kernel and is independent of the application memory, so that the memory overflow, abnormal access and other damages or modifications of the application program are prevented; secondly, the application memory is not required to be dynamically allocated in the access operation of the shared parameters, so that the device system is ensured not to cause abnormal functions because the application memory cannot be applied to the device system when the device system is in low memory.
In this embodiment, the memory cache may be mapped to the process space address through the export library, so that the copy access of the high-order kernel and the application memory is not required to be performed by using the driving interface, and the access efficiency is improved. The driving module can use a hash algorithm to calculate the hash algorithm through the field of the shared parameter, and maintain the hash index table, so that the access efficiency of the shared parameter is further improved. The memory defragmentation refers to the defragmentation of the shared parameter cache when the shared parameter cache region generates memory defragmentation after long-term application and release, and when the defragmentation ratio is higher than a threshold value or the available region is lower than the threshold value, the defragmentation of the shared parameter cache is triggered, and the utilization rate of the cache is improved.
Referring to fig. 4, S102, by an init program, starting a shared cache export library to initialize parameter data, judging whether the device is operated for the first time, generating a judging result, and initializing shared parameter memory cache data according to the judging result;
specifically, step S102 includes: starting an init process, initializing a shared parameter library, exporting a creation, reading and writing, deleting and submitting a storage access interface;
mapping kernel storage to an application space, and detecting whether a file system has a shared parameter storage file;
if yes, loading the parameter file into the mapped memory space;
if not, establishing a shared parameter storage file and a backup file.
Judging whether the equipment operates for the first time;
if yes, the library is initialized, cache information is obtained from the kernel module, and data files and backup files are pre-allocated and stored in flash storage;
if not, checking the integrity of the data storage file, and generating a checking result;
when the verification result is that the storage file is complete and the data version is newer, initializing shared parameter cache data by using the storage file data;
and when the verification result is that the storage file is abnormal or the data version is lower than the backup file, recovering the data from the backup file to the storage file, and then using the storage file data to initially share the parameter memory to cache the data.
Specifically, in this embodiment, the system starts the shared cache export library through the init program to initialize parameter data, when the device runs for the first time, the library initialization finishes obtaining cache information from the kernel module, and pre-allocates and stores data files and backup files in flash storage; when the equipment is not operated for the first time, the integrity of the data storage file is checked, if the storage file is complete and the data version is newer, the data of the storage file is used for initializing the shared parameter cache data, if the storage file is abnormal or the data version is lower than the backup file, the data is restored from the backup file to the storage file, and then the data of the storage file is used for initializing the shared parameter memory cache data.
Referring to fig. 5 to 8, S103, call the creation, reading, writing, deleting and submitting storage interface of the export library to access the shared parameter data and the storage file;
specifically, step S103 includes: calling a writing interface of the export library, and writing data into the parameter field;
acquiring a data address corresponding to a field through a hash table, and judging whether a maximum writing field of the current address crosses a boundary;
if so, clearing the current address data, finding out new address writing, marking fragments and number;
if not, locking the read function, and finishing unlocking the data;
when judging that the defragmentation timer is triggered, defragmentation is carried out;
calling a creation interface of the export library, creating a field, and configuring a field attribute;
the interface library invokes the driver module interface to initialize the field attributes.
Calling a reading interface of the export library, and transmitting parameter fields to read field data;
acquiring field attributes through a hash table, and judging whether locking is performed or not;
if yes, locking, acquiring a data address corresponding to the field through a hash table, and reading;
if not, acquiring a data address corresponding to the field through the hash table, and reading;
when the unlocking is judged to be needed, unlocking is carried out;
calling a deletion interface of the export library, deleting fields, and clearing the node data of the hash chain table, the mark fragment address and the format;
judging whether the fragments exceed a threshold value or not;
if yes, when judging that the defragmentation timer is triggered, defragmentation is carried out.
Specifically, in this embodiment, the application program calls the creation, reading, writing, deleting, and submitting the storage interface of the export library to perform access operation on the shared parameter data and the storage file. The application program calls a loading export library, and the export library automatically maps the shared parameter cache and the hash table cache to a process address space of the application program. When the shared data field is created, the field can be configured as required to be a write lock or a read-write lock attribute, the field name and the field attribute are written into a hash table buffer area, and a hash algorithm is operated to generate a hash access index adjustment hash dynamic chain table pointer; and writing the shared parameter data into the shared parameter buffer area, and updating the data address in the field attribute data. When shared parameter data is less in writing update and more in concurrent reading operation, the attribute can be configured to be only writing lock, whether writing lock exists or not is judged in reading, when writing lock exists, writing, unlocking and reading are waited to prevent dirty data from being read, and the read data is not locked, so that locking is not needed to synchronously access the data when multiple processes access the shared parameter data in high concurrency, and the running efficiency of the system can be greatly improved. And deleting the field only needs to clear the attribute content of the field corresponding to the hash table cache region, updating the fragment value of the data cache, and starting a timer to trigger the fragment finishing when the fragment value exceeds a preset fragment finishing threshold. The export library interface is used for accessing operation sharing parameter data, an application program only needs to be concerned about the use requirement of field data, and does not need to be concerned about the access operation of other module processes, so that the high internal set low coupling target designed among program modules is achieved, and the development efficiency and the stability of a system are improved.
Referring to fig. 9, S104, the export library is called to perform a commit store operation, and a timer is configured to trigger a store backup.
Specifically, step S104 includes: calling a storage interface of the export library, submitting storage, and storing the cache data into a file;
the configuration timer triggers a file backup.
Specifically, in this embodiment, the application invokes the export library to perform a commit store operation and configures a timer to trigger a store backup. When the application program submits the storage operation, a timer is used for triggering the purpose of storage backup: 1. the method can prevent the stored data from being restored from the backup file when the stored file is damaged due to abnormal power failure, flash bad blocks, program abnormality and the like. 2. And a timer is used for triggering timing backup, so that backup is prevented from being carried out every time of submitting storage, flash write operation is reduced, and the service life of the flash and the CPU utilization rate are improved.
In this embodiment, the script program uses the command program for creating, reading, writing, deleting, submitting the storage interface to perform access operation on the shared parameter data, and expands the use of the shared parameter data function.
In summary, the inter-process data parameter sharing method has the following advantages that 1. In the kernel integrated parameter sharing function module driver of the system, the driver pre-distributes the parameter memory buffer to be shared and the memory buffer needing defragmentation, so that the function stability of the module is ensured when the embedded system is used with low memory. 2. And (3) carrying out field formatting on the cache, and carrying out field corresponding data storage address positioning on the field by using a hash algorithm, so that dirty data reading is prevented, and meanwhile, the access rate of multi-process concurrent access to shared parameter data is ensured to be improved. 3. The shared parameter data is in the high-order memory address space of the system kernel, is not easily influenced by the use of the system application memory, and ensures the stability of functions and the data security. 4. The field data can be selectively written and locked without being read and locked, dirty data is prevented from being read, and meanwhile the efficiency of multiple processes for concurrently accessing shared parameter data is guaranteed to be improved. 5. The application layer uses the library to export the shared parameters to access the operation interface and the command interface, is compatible with script language programs and high-level language programs, reduces the coupling degree between processes, improves the independence of the program functions, and improves the efficiency and the stability of system integration. 6. Only the creation, reading, writing, deleting and submitting storage interfaces are exported, and the interfaces are operated simply and conveniently by taking the parameter fields as keywords. 7. The shared cache supports defragmentation, and the cache utilization rate is improved. 8. The shared data parameters can be synchronously stored on the fixed storage device of the flash. 9. The stored file and the backup file are pre-distributed on the flash, so that the files are not easy to damage when power is lost. 10. And (3) checking the integrity of the stored file and recovering the backup file, thereby ensuring recovery when the parameter file is abnormal.
Referring to fig. 10, a second embodiment of the present invention provides an inter-process data parameter sharing apparatus, including:
a module loading unit 201, configured to load a parameter sharing kernel module when it is determined that the device starts a system kernel;
the system initialization unit 202 is configured to start the shared cache export library to initialize parameter data through an init program, determine whether the device is running for the first time, generate a determination result, and initialize the shared parameter memory cache data according to the determination result;
the access unit 203 is configured to invoke creation, reading, writing, deleting, and submitting a storage interface of the export library to perform access operation on the shared parameter data and the storage file;
and the parameter storage unit 204 is used for calling the export library to execute the submitting storage operation and configuring a timer to trigger the storage backup.
A third embodiment of the present invention provides an inter-process data parameter sharing apparatus, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing an inter-process data parameter sharing method as described in any one of the above when executing the computer program.
A fourth embodiment of the present invention provides a readable storage medium storing a computer program executable by a processor of a device in which the storage medium is located to implement an inter-process data parameter sharing method as described in any one of the above.
Illustratively, the computer programs described in the third and fourth embodiments of the present invention may be divided into one or more modules, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing particular functions for describing the execution of the computer program in the one inter-process data parameter sharing device. For example, the device described in the second embodiment of the present invention.
The processor may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, which is a control center of the one inter-process data parameter sharing method, and which connects the various parts of the entire one inter-process data parameter sharing method using various interfaces and lines.
The memory may be used to store the computer program and/or the module, and the processor may implement various functions of an inter-process data parameter sharing method by running or executing the computer program and/or the module stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, a text conversion function, etc.) required for at least one function, and the like; the storage data area may store data (such as audio data, text message data, etc.) created according to the use of the cellular phone, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash Card (Flash Card), at least one disk storage device, flash memory device, or other volatile solid-state storage device.
Wherein the modules may be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as a stand alone product. Based on this understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and the computer program may implement the steps of each method embodiment described above when executed by a processor. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
It should be noted that the above-described apparatus embodiments are merely illustrative, and the units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the embodiment of the device provided by the invention, the connection relation between the modules represents that the modules have communication connection, and can be specifically implemented as one or more communication buses or signal lines. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above examples, and all technical solutions belonging to the concept of the present invention belong to the protection scope of the present invention.

Claims (10)

1. An inter-process data parameter sharing method, comprising:
when judging that the equipment starts the system kernel, loading the parameter sharing kernel module;
starting a shared cache export library to initialize parameter data through an init program, judging whether equipment runs for the first time, generating a judging result, and initializing shared parameter memory cache data according to the judging result;
calling the creation, reading, writing, deleting and submitting storage interfaces of the export library to access the shared parameter data and the storage files;
and calling the export library to execute the commit memory operation and configuring a timer to trigger the memory backup.
2. The method for sharing data parameters between processes according to claim 1, wherein when it is determined that the device starts a system kernel, loading the parameter sharing kernel module is specifically:
when judging that the equipment starts a system kernel, loading a parameter sharing kernel module, and setting a hash algorithm key, a field maximum byte number and a data maximum byte number;
applying for a shared parameter list cache, a hash table cache and a defragmentation cache;
and setting a defragmentation threshold and a defragmentation timer, and finishing loading of the parameter sharing kernel module.
3. The method for sharing data parameters between processes according to claim 1, wherein the initialization of the parameter data is performed by starting a shared cache export library by an init program, specifically:
starting an init process, initializing a shared parameter library, exporting a creation, reading and writing, deleting and submitting a storage access interface;
mapping kernel storage to an application space, and detecting whether a file system has a shared parameter storage file;
if yes, loading the parameter file into the mapped memory space;
if not, establishing a shared parameter storage file and a backup file.
4. The method for sharing data parameters between processes according to claim 3, wherein determining whether the device is running for the first time, generating a determination result, and initializing the shared parameter memory cache data according to the determination result, specifically:
judging whether the equipment operates for the first time;
if yes, the library is initialized, cache information is obtained from the kernel module, and data files and backup files are pre-allocated and stored in flash storage;
if not, checking the integrity of the data storage file, and generating a checking result;
when the verification result is that the storage file is complete and the data version is newer, initializing shared parameter cache data by using the storage file data;
and when the verification result is that the storage file is abnormal or the data version is lower than the backup file, recovering the data from the backup file to the storage file, and then using the storage file data to initially share the parameter memory to cache the data.
5. The method for sharing data parameters between processes according to claim 4, wherein the steps of calling the creation, reading, writing, deleting and submitting the storage interface of the export library to access the shared parameter data and the storage file are as follows:
calling a writing interface of the export library, and writing data into the parameter field;
acquiring a data address corresponding to a field through a hash table, and judging whether a maximum writing field of the current address crosses a boundary;
if so, clearing the current address data, finding out new address writing, marking fragments and number;
if not, locking the read function, and finishing unlocking the data;
when judging that the defragmentation timer is triggered, defragmentation is carried out;
calling a creation interface of the export library, creating a field, and configuring a field attribute;
the interface library invokes the driver module interface to initialize the field attributes.
6. The method for sharing data parameters between processes according to claim 5, wherein the steps of calling the creation, reading, writing, deleting and submitting the storage interface of the export library to access the shared parameter data and the storage file are as follows:
calling a reading interface of the export library, and transmitting parameter fields to read field data;
acquiring field attributes through a hash table, and judging whether locking is performed or not;
if yes, locking, acquiring a data address corresponding to the field through a hash table, and reading;
if not, acquiring a data address corresponding to the field through the hash table, and reading;
when the unlocking is judged to be needed, unlocking is carried out;
calling a deletion interface of the export library, deleting fields, and clearing the node data of the hash chain table, the mark fragment address and the format;
judging whether the fragments exceed a threshold value or not;
if yes, when judging that the defragmentation timer is triggered, defragmentation is carried out.
7. The method for sharing data parameters between processes according to claim 6, wherein the step of calling the export library to perform a commit store operation and configuring a timer to trigger a store backup is performed by:
calling a storage interface of the export library, submitting storage, and storing the cache data into a file;
the configuration timer triggers a file backup.
8. An inter-process data parameter sharing apparatus, comprising:
the module loading unit is used for loading the parameter sharing kernel module when judging that the equipment starts the system kernel;
the system initialization unit is used for starting the shared cache export library to initialize parameter data through an init program, judging whether the equipment operates for the first time, generating a judging result, and initializing the shared parameter memory cache data according to the judging result;
the access unit is used for calling the creation, reading, writing, deleting and submitting storage interfaces of the export library to access the shared parameter data and the storage files;
and the parameter storage unit is used for calling the export library to execute the submitting storage operation and configuring a timer to trigger the storage backup.
9. An inter-process data parameter sharing device comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, the processor implementing an inter-process data parameter sharing method as claimed in any one of claims 1 to 7 when executing the computer program.
10. A readable storage medium storing a computer program executable by a processor of a device in which the storage medium is located to implement an inter-process data parameter sharing method as claimed in any one of claims 1 to 7.
CN202311479912.7A 2023-11-08 2023-11-08 Inter-process data parameter sharing method, device, equipment and medium Pending CN117421141A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311479912.7A CN117421141A (en) 2023-11-08 2023-11-08 Inter-process data parameter sharing method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311479912.7A CN117421141A (en) 2023-11-08 2023-11-08 Inter-process data parameter sharing method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN117421141A true CN117421141A (en) 2024-01-19

Family

ID=89522754

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311479912.7A Pending CN117421141A (en) 2023-11-08 2023-11-08 Inter-process data parameter sharing method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN117421141A (en)

Similar Documents

Publication Publication Date Title
CN108763099B (en) System starting method and device, electronic equipment and storage medium
CN112328435B (en) Method, device, equipment and storage medium for backing up and recovering target data
CN108121813B (en) Data management method, device, system, storage medium and electronic equipment
US11030092B2 (en) Access request processing method and apparatus, and computer system
CN113220669B (en) Service data processing method and device and electronic equipment
CN108846129B (en) Storage data access method, device and storage medium
CN110716845A (en) Method for reading log information of Android system
US20030037323A1 (en) Method for upgrading data
CN111309799A (en) Method, device and system for realizing data merging and storage medium
CN114936010B (en) Data processing method, device, equipment and medium
CN117421141A (en) Inter-process data parameter sharing method, device, equipment and medium
CN112115521A (en) Data access method and device
CN115794819A (en) Data writing method and electronic equipment
JP2022184735A (en) Program starting method and device, and storage medium
CN111399753B (en) Method and device for writing pictures
CN110515751B (en) Method and system for loading and running VxWorks real-time protection process
CN111858487A (en) Data updating method and device
CN114443598A (en) Data writing method and device, computer equipment and storage medium
CN114675995A (en) Data backup method and device and electronic equipment
CN112783866A (en) Data reading method and device, computer equipment and storage medium
US20230045119A1 (en) Data access method and apparatus
CN113760195B (en) FATFS file system based on embedded type
CN112434001B (en) Multi-data source configurable MongoDB data synchronization system supporting data preprocessing, electronic equipment and medium
CN113986126B (en) TCG data deleting method and device based on solid state disk and computer equipment
CN116303245A (en) File system snapshot creation method, device, equipment and medium

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