[go: up one dir, main page]

CN118689659B - Method, system and device for accessing form data of shared memory - Google Patents

Method, system and device for accessing form data of shared memory Download PDF

Info

Publication number
CN118689659B
CN118689659B CN202411176553.2A CN202411176553A CN118689659B CN 118689659 B CN118689659 B CN 118689659B CN 202411176553 A CN202411176553 A CN 202411176553A CN 118689659 B CN118689659 B CN 118689659B
Authority
CN
China
Prior art keywords
data
shared memory
record
background monitoring
subunit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202411176553.2A
Other languages
Chinese (zh)
Other versions
CN118689659A (en
Inventor
李磊
鹿璇
周严
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Zhuomu Technology Co ltd
Original Assignee
Wuhan Zhuomu 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 Wuhan Zhuomu Technology Co ltd filed Critical Wuhan Zhuomu Technology Co ltd
Priority to CN202411176553.2A priority Critical patent/CN118689659B/en
Publication of CN118689659A publication Critical patent/CN118689659A/en
Application granted granted Critical
Publication of CN118689659B publication Critical patent/CN118689659B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/3287Power saving characterised by the action undertaken by switching off individual functional units in the computer system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5017Task decomposition
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Human Computer Interaction (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method for accessing form data of a shared memory, which comprises the steps that a main process initializes and distributes a shared memory space and empties all data of the shared memory space, a fork is called to split the main process into a sub-process as a foreground task process, the main process of the split sub-process is a father process, the father process is used as a background monitoring process and split into the sub-process as the foreground task process, each thread data is written into a data.unit subunit, the background monitoring process is called waitpid to sleep and wait for the end of the foreground task process, the background monitoring process is switched to the base address of a base_address after the background monitoring process wakes up to latch all recorded data, all the data latched in the shared memory space are analyzed and packed and stored in a designated position, the foreground task process and the background monitoring process are all finished executing, the two processes access the data in the form of the shared memory, the background monitoring process has no loss of kernel mode switching, and the data analysis of the background monitoring process does not influence the data writing and task executing of the foreground task process, and time sequence disturbance is not caused.

Description

Method, system and device for accessing form data of shared memory
Technical Field
The present invention relates to the field of data access technologies, and in particular, to a method, a system, and an apparatus for accessing morphological data of a shared memory.
Background
The LINUX operating system is widely applied to various embedded devices and servers, and a large amount of complex high-performance software is also emerging in various industries. These high performance software has severe time requirements on data processing, and is assisted by real-time observers such as logic analyzers and oscilloscopes in terms of hardware signals, but is not a sufficiently effective real-time observation method in terms of software execution.
The development period of the application program of the LINUX operating system generally adopts a DEBUG mode, and a large number of printouts are contained for observing the dynamic execution flow, and the printouts are processed by adopting a character string function, belong to byte-by-byte information processing, and have low calculation speed and low efficiency.
The fish and the bear's feet can not be combined, and the prior art can not meet the two requirements of high-performance running and observable conditions of the program. On the other hand, even though the fastest memory device is adopted to output character string information in the RELEASE mode, the delay of the memory device is microsecond level and the clock speed of the actual running of the processor still has a thousand times difference to describe microscopic running conditions, time sequence disturbance is generated for the program which is executed in full real time, and the real execution flow during multi-thread scheduling is possibly influenced.
In view of the foregoing, it is desirable to provide a novel method, system and apparatus for accessing morphological data of a shared memory with low power consumption to overcome the above-mentioned drawbacks.
Disclosure of Invention
The invention aims to provide a method, a system and a device for accessing form data of a shared memory, which are used for analyzing data into two independent processes of real-time binary tracking and non-real text translation on demand, so that the data analysis can be triggered on demand, the indiscriminate waste of processor computing power due to useless information is avoided, a main process is split into a foreground task process, the split process is used as a background monitoring process, the two processes access the data in the form of the shared memory, the loss of kernel mode switching is avoided, the data analysis of the background monitoring process does not influence the data writing and task execution of the foreground task process, and the time sequence disturbance is avoided.
In order to achieve the above purpose, the technical scheme provided by the invention is realized by a method for accessing morphological data of a shared memory, which comprises the following steps:
Initializing and distributing shared memory space and clearing all data in the shared memory space by a main process, calling a fork to split the main process into sub-processes as foreground task processes, using the main process of the split sub-processes as a parent process, using the parent process as a background monitoring process, writing thread data into a data.unit sub-unit,
Calling waitpid to enable the background monitoring process to sleep and wait for the foreground task process to finish, switching the pointer base address of the base address to latch all recorded data after the background monitoring process wakes up, analyzing all data latched in the shared memory space, compressing and packaging the data and storing the data in a designated position,
And the foreground task process and the background monitoring process are all finished executing.
The process of writing the data of each thread by adopting the foreground task process comprises the following steps:
Performing an atomic addition operation on the data of the alloc-serial-parallel unit in the control and status module, performing a logical AND operation on the calculated result after the operation and N-1 as a sequence code to obtain a write offset, and combining the write offset with the data in the base-address-atomic to obtain an actually written record address;
Obtaining the exclusive write right of the record group module, writing the calculated sequence code into a serial subunit of the fixed-length record unit, writing the ID of each thread into belongs subunits, and keeping the time stamp as 0 or registering the current nanosecond time stamp;
And writing the data to be recorded into a data.unit subunit, and registering the enumeration type of the data record in the type.enum subunit.
Judging the awakening reason of the background monitoring process, if the external signal triggers the awakening of the background monitoring process, returning to the call waitpid to enable the background monitoring process to sleep and wait for the end of the foreground task process;
Otherwise, checking the state code of the foreground task process in the control and state module, if no state code information indicates abnormal crash, the background monitoring process is ready to split again in the recovery priority, if the state code information indicates normal exit, the shared memory space is released, and the foreground task process and the background monitoring process are all finished to execute.
The data analysis process adopting the background monitoring process is as follows:
The base-address of the base-address unit in the control and status module is switched, and the other record group module is converted into a writing area, so that all data of the current record group module are locked;
The data is completely synchronized, the scanning and locking record group module marks the starting point and the end point of the continuous interval containing the maximum serial number, the time stamp is added from the starting point to the end point, the data is recorded time by time according to the type requirement of the type.enum subunit to be analyzed into normalized text character strings,
The text string information is written into the memory disk file one by one, compressed and packed, and named and stored according to the triggering reason and time.
On the other hand, the invention also provides a system for accessing the morphological data of the shared memory, which comprises a control and status module and two record group modules;
The control and status module comprises a base_address, an alloc_serial, an auto and an exit_status, the record group module comprises a plurality of offset units, each offset unit comprises a fixed length record unit,
The base_address in the control and status module is the base address of the data record, the alloc_serial_atomic in the control and status module is the total sequence number of the data record, and the exit_status in the control and status module is the status code of the process exit, and the reason of the parent-child process exit execution is inferred through the status code.
The serial subunit in the fixed-length recording unit is used for recording the serial number, the belongs subunit in the fixed-length recording unit is used for recording the ID of the affiliated thread, the type. Enum subunit in the fixed-length recording unit is used for recording the enumeration serial number of the type, the timestamp subunit in the fixed-length recording unit is used for recording the timestamp, and the data. Unit subunit in the fixed-length recording unit is used for recording the binary data.
An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method for accessing morphological data of a shared memory when executing the program.
A non-transitory computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method for accessing morphological data of a shared memory.
A computer program product comprising a computer program which when executed by a processor performs the steps of the method for accessing morphological data of a shared memory.
Compared with the prior art, the method has the advantages that the data is analyzed into two independent processes of real-time binary tracking and non-real-time text translation on demand, the data analysis can be triggered on demand, the useless information is prevented from wasting the computing power of a processor indiscriminately, the main process is split into a foreground task process and a split background monitoring process, the two processes access the data in a shared memory mode, the loss of kernel mode switching is avoided, nanosecond data tracking capability can be obtained, the data analysis of the background monitoring process does not influence the data writing and task execution of the foreground task process, automatic recording is realized when abnormal crashes occur, and the system has soft watchdog capability.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The features and advantages of the invention may be realized and obtained by means of the elements and combinations particularly pointed out in the appended claims. These and other features of the present invention will become more fully apparent from the following description and appended claims, or may be learned by the practice of the embodiments of the invention as set forth hereinafter.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a shared memory access data system according to the present invention.
Fig. 2 is a flowchart of a method for accessing a shared memory according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantageous technical effects of the present invention more apparent, the present invention will be further described in detail with reference to the accompanying drawings and detailed description. It should be understood that the detailed description is intended to illustrate the invention, and not to limit the invention.
It should be appreciated that the terms "first," "second," "third," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first", "a second", or a third "may explicitly or implicitly include one or more such feature. Furthermore, the meaning of "a plurality of", "a number" means two or more, unless specifically defined otherwise.
Referring to fig. 1 to fig. 2, the present invention provides a method for accessing morphological data of a shared memory, which includes that a main process splits out a sub-process as a foreground task process, the main process splitting out the sub-process is a parent process, the parent process is a background monitoring process, and the foreground task process operates and processes and writes data of each thread;
The writing of the data of each thread of the foreground task process, namely the writing of the record, can occur at any running time, and the specific process is as follows:
a1, performing an atomic addition operation on data of an alloc_serial.atomic unit in a control and status module, performing logical AND operation on a calculated result after the operation and N-1 as a sequence code to obtain a write offset, and then combining the write offset with the data in a base_address.atomic unit to obtain an actually written record address;
a2, obtaining the exclusive write right of a corresponding record group module, writing the calculated sequence code into a serial subunit of the fixed-length recording unit for recording numbers, writing the ID of the thread into a belongs subunit of the fixed-length recording unit, and keeping the timestamp (used for recording the timestamp) as 0 or registering the current nanosecond timestamp (needing to consume the delay of additional access equipment);
and a3, writing the data of each thread into a data.unit subunit of the fixed-length recording unit, and registering the enumeration type of the data record in the type.enum subunit.
The specific processing process of the main process is as follows:
b1, initializing and distributing a shared memory space by a main process;
b2, emptying all data in the shared memory space;
b3, calling a fork to split the main process into sub-processes as foreground task processes, wherein the main process of the split sub-processes is a parent process, and the parent process is used as a background monitoring process;
b4, the background monitoring process reduces the priority, and avoids influencing the foreground task process in the data analysis process;
b5, calling waitpid to enable the background monitoring process to sleep and wait for the foreground task process to finish, wherein the sleep can be interrupted by an external signal;
b6, immediately switching the pointer base address of the base_address to latch all recorded data after the background monitoring process wakes up, analyzing all the data latched in the shared memory space, compressing and packing the data and storing the data in a designated position;
b7, judging the awakening reason of the background monitoring process, returning to b5 if the background monitoring process is triggered by an external signal, otherwise checking a foreground task process exit state code in the control and state module, continuing b8 if no state code information indicates abnormal breakdown, and continuing b9 if the state code information indicates normal exit;
b8, the monitoring process resumes the priority and prepares to split again, returns to b2, and has the function of a watchdog;
And b9, releasing the shared memory, and ending execution of the foreground task process and the background monitoring process.
If the external signal triggers or the foreground task process exits (that is, only occurs when the external signal triggers or the foreground task process exits), the background monitoring process performs data analysis and record reading, and the specific processing procedure is as follows:
c1, switching the base address of the pointer of the base_address in the control and status module, and converting the other record group module into a writing area, thereby locking all data of the current record group module;
c2, waiting for a plurality of milliseconds to completely synchronize the data;
c3, scanning the locked record group module, and marking the starting point and the end point of the continuous interval containing the maximum serial number;
c4, supplementing a time stamp from the starting point to the ending point, namely taking the time stamp of one record if the record time stamp is 0, wherein the time stamp is also 0, and the time stamp is just for the purpose of preserving the sequence in various analysis and comparison operations of the data record;
c5, when the time stamping is completed, recording data according to the type requirement of the type. Enum subunit every time to obtain normalized text character strings, wherein the text character strings comprise but are not limited to entry information such as recording serial numbers, time stamps, thread IDs and the like which can be sequenced, searched or arranged;
and c6, accessing the memory disk file of the data system by writing the text character string information one by one, compressing and packaging, and then naming and storing according to the triggering reason and time.
In the method, the external signal which can be received by the background monitoring process refers to an inter-process signal delivery mechanism in the linux system, and an operator can normally send a designated signal through a kill command. The background monitoring process can immediately start the analysis of the current data record under the triggering of an external signal by capturing a specific signal. If the foreground task process is unexpected crashed, the background monitoring process also automatically analyzes the last execution status data and restarts the foreground task process.
The invention also provides a form access data system of the shared memory, which comprises a control and status module and two record group modules (a record group module 0 and a record group module 1 respectively);
The control and status modules include base_address, alloc_serial, atomic, and exit_status, the record group module includes a plurality of offset units (offset 0 units, offset 1 units, respectively.) each of the offset units includes a fixed length record unit,
The base_address in the control and status module is the base address of the data record, the switching refers to one record group module or one of the other record group modules as the position where the actual data is written, and the other units in the rest record group modules are in a locking state which cannot be written;
The alloc_serial.atomic in the control and status module is the total sequence number of the data record, the exit_status unit in the control and status module is the status code of the process exit, and the reason why the sub-process exits execution can be deduced by the control and status module, if the sub-process exits actively, the sub-process exits from the status code information, otherwise, the sub-process exits from the passive result caused by the process exception.
The service subunit in the fixed-length recording unit is used for recording numbers, the belongs subunit in the fixed-length recording unit is used for recording the ID of the thread to which the service belongs, the type. Enum subunit in the fixed-length recording unit is used for recording the enumeration numbers of the types, the timestamp subunit in the fixed-length recording unit is a timestamp, and the data. Unit subunit in the fixed-length recording unit is used for recording binary data.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the processor realizes the steps of the method for accessing the morphological data of the shared memory when executing the program.
The invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method for accessing morphological data of a shared memory.
The invention also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method for accessing morphological data of a shared memory.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
In particular, according to some embodiments of the present disclosure, the processes described above may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In some such embodiments, the computer program may be downloaded and installed from a network via a communications device, or installed from a memory device, or installed from a ROM. The above-described functions defined in the methods of some embodiments of the present disclosure are performed when the computer program is executed by a processing device.
It should be noted that, the computer readable medium described in some embodiments of the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, the computer-readable signal medium may comprise a task data signal that propagates in baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to electrical wiring, fiber optic cable, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText TransferProtocol ), and may be interconnected with any form or medium of digital task data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be included in the electronic device or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to determine a network connection state of a production collaboration document in a production line management application of the switch in response to detecting a query operation of the production collaboration document in the production line management application, to download, from a production line server, web page resource information corresponding to the production collaboration document in response to determining that the network connection state of the production line management application characterizes an offline state, and to load target web page resource information to display, in the production line management application, a web page of the production collaboration document offline, wherein the target web page resource information is file information of an entry file of a web page corresponding to the production collaboration document downloaded in advance, the target web page resource information is locally stored in response to determining that the network connection state of the production line management application characterizes an online state, and to locally not store web page resource information corresponding to the production collaboration document, wherein the web page resource information includes web page resource information of the web page, the web page resource information of the production collaboration document is stored in a database, and the web page resource information of the production collaboration document is stored in the production line management application.
Computer program code for carrying out operations for some embodiments of the present disclosure may be written in one or more programming languages, including a product oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The present invention is not limited to the details and embodiments described herein, and thus additional advantages and modifications may readily be made by those skilled in the art, without departing from the spirit and scope of the general concepts defined in the claims and the equivalents thereof, and the invention is not limited to the specific details, representative apparatus and illustrative examples shown and described herein.

Claims (9)

1.一种共享内存的形态数据访问方法,其特征在于,包括以下步骤:1. A shared memory morphological data access method, characterized in that it comprises the following steps: 主进程初始化并分配共享内存空间和清空共享内存空间所有数据,共享内存空间包括控制与状态模块和两个记录组团模块,调用fork将主进程分裂出子进程作为前台任务进程,分裂出子进程的主进程为父进程,父进程作为后台监控进程,前台任务进程将各线程数据写入两个记录组团模块中的一个记录组团模块的data.union子单元中,The main process initializes and allocates shared memory space and clears all data in the shared memory space. The shared memory space includes a control and status module and two record grouping modules. Fork is called to split the main process into a child process as the foreground task process. The main process that splits the child process is the parent process, and the parent process is used as the background monitoring process. The foreground task process writes each thread data into the data.union subunit of one of the two record grouping modules. 后台监控进程降低优先级后,调用waitpid使后台监控进程睡眠等待前台任务进程结束,后台监控进程苏醒来后切换控制与状态模块中的base_address.atomic的指针基地址,将另一个记录组团模块转变为写入区从而锁定了当前记录组团模块的全部数据,解析共享内存空间中锁存的全部数据并压缩打包存储到指定位置,After the background monitoring process lowers its priority, it calls waitpid to put the background monitoring process to sleep and wait for the foreground task process to end. After the background monitoring process wakes up, it switches the pointer base address of base_address.atomic in the control and status module, converts another record grouping module into a write area, thereby locking all the data of the current record grouping module, parsing all the data latched in the shared memory space, compressing and packaging them and storing them in the specified location. 前台任务进程和后台监控进程全部结束执行。The foreground task process and the background monitoring process all terminate execution. 2.如权利要求1所述的共享内存的形态数据访问方法,其特征在于,采用前台任务进程写入各线程数据的过程为:2. The shared memory morphological data access method according to claim 1, wherein the process of using the foreground task process to write the data of each thread is: 对控制与状态模块中的alloc_serial.atomic单元的数据进行原子增一操作,操作后的计算结果作为序列码进行逻辑与运算获得写入偏移量,与base_address.atomic中的数据进行组合获得实际写入的记录地址;Perform an atomic increment operation on the data of the alloc_serial.atomic unit in the control and status module. The calculated result after the operation is used as the serial code for logical AND operation to obtain the write offset, which is combined with the data in base_address.atomic to obtain the actual written record address; 获得记录组团模块的独占写入权,将计算出的序列码写入定长记录单元的serial子单元中记录编号,将各线程的ID写入belongs子单元中,时间戳保持为0或登记当前纳秒时间戳;Obtain the exclusive write right of the record grouping module, write the calculated sequence code into the serial subunit of the fixed-length record unit to record the number, write the ID of each thread into the belongs subunit, and keep the timestamp as 0 or register the current nanosecond timestamp; 将待记录数据写入data.union子单元中,在type.enum子单元中登记数据记录的枚举类型。Write the data to be recorded into the data.union subunit, and register the enumeration type of the data record in the type.enum subunit. 3.如权利要求1所述的共享内存的形态数据访问方法,其特征在于,判断后台监控进程的苏醒原因,若是外部signal信号触发后台监控进程的苏醒,则回到调用waitpid使后台监控进程睡眠等待前台任务进程结束;3. The shared memory morphological data access method as claimed in claim 1 is characterized in that the reason for the background monitoring process to wake up is determined, and if the background monitoring process is woken up by an external signal, then the backend returns to calling waitpid to put the background monitoring process to sleep and wait for the foreground task process to end; 否则,查看控制与状态模块中的前台任务进程退出的状态码,没有状态码信息说明是异常崩溃,则后台监控进程恢复优先级准备重新分裂,有状态码信息说明是正常退出,则释放共享内存空间,前台任务进程和后台监控进程全部结束执行。Otherwise, check the exit status code of the foreground task process in the control and status module. If there is no status code information, it means an abnormal crash, then the background monitoring process restores the priority and prepares to split again. If there is status code information, it means a normal exit, then the shared memory space is released, and the foreground task process and the background monitoring process all end execution. 4.如权利要求1所述的共享内存的形态数据访问方法,其特征在于,让数据完全同步,扫描锁定的记录组团模块标记出包含最大序列号的连续区间的起点与终点;从起点至终点补上时间戳,时间戳补完的同时,逐时记录按type.enum子单元的类型要求进行数据解析为规范化的文本字符串,4. The shared memory morphological data access method as claimed in claim 1 is characterized in that the data is completely synchronized, the locked record grouping module is scanned to mark the starting point and the end point of the continuous interval containing the maximum sequence number; the timestamp is added from the starting point to the end point, and while the timestamp is added, the data is parsed into a standardized text string according to the type requirements of the type.enum subunit hour by hour, 文本字符串信息逐条写入内存盘文件,压缩打包,按触发原因和时间进行命名存储。The text string information is written into the memory disk file one by one, compressed and packaged, and named and stored according to the trigger reason and time. 5.一种如权利要求1-4任一项所述的共享内存的形态数据访问方法的系统,其特征在于,5. A system for accessing data in a shared memory according to any one of claims 1 to 4, characterized in that: 所述控制与状态模块包括base_address.atomic、alloc_serial.atomic以及exit_status,所述记录组团模块包括若干个offset单元,每个offset单元包括定长记录单元,The control and status module includes base_address.atomic, alloc_serial.atomic and exit_status, the record grouping module includes a plurality of offset units, each offset unit includes a fixed-length record unit, 所述控制与状态模块中的base_address.atomic是数据记录的基地址,所述控制与状态模块中的alloc_serial.atomtic是数据记录的总序号,所述控制与状态模块中的exit_status是进程退出的状态码,通过状态码推断出父子进程退出执行的原因。The base_address.atomic in the control and status module is the base address of the data record, the alloc_serial.atomtic in the control and status module is the total serial number of the data record, and the exit_status in the control and status module is the status code of the process exit. The reason why the parent and child processes exit execution can be inferred through the status code. 6.如权利要求5所述的共享内存的形态数据访问方法的系统,其特征在于,所述定长记录单元中的serial子单元用于记录编号,定长记录单元中的belongs子单元用于记录所属线程ID,定长记录单元中的type.enum子单元用于记录类型的枚举编号,定长记录单元中的timestamp子单元用于记录时间戳,定长记录单元中的data.union子单元用于记录的二进制数据。6. The system of the shared memory morphological data access method as described in claim 5 is characterized in that the serial subunit in the fixed-length record unit is used to record the number, the belongs subunit in the fixed-length record unit is used to record the thread ID, the type.enum subunit in the fixed-length record unit is used to record the enumeration number of the type, the timestamp subunit in the fixed-length record unit is used to record the timestamp, and the data.union subunit in the fixed-length record unit is used to record binary data. 7.一种电子设备,包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述程序时实现如权利要求1至4任一项所述的共享内存的形态数据访问方法的步骤。7. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the shared memory morphological data access method as described in any one of claims 1 to 4 are implemented. 8.一种非暂态计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至4任一项所述的共享内存的形态数据访问方法的步骤。8. A non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the shared memory morphological data access method as described in any one of claims 1 to 4 are implemented. 9.一种计算机程序产品,包括计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至4任一项所述的共享内存的形态数据访问方法的步骤。9. A computer program product, comprising a computer program, characterized in that when the computer program is executed by a processor, the steps of the shared memory morphological data access method as described in any one of claims 1 to 4 are implemented.
CN202411176553.2A 2024-08-26 2024-08-26 Method, system and device for accessing form data of shared memory Active CN118689659B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411176553.2A CN118689659B (en) 2024-08-26 2024-08-26 Method, system and device for accessing form data of shared memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411176553.2A CN118689659B (en) 2024-08-26 2024-08-26 Method, system and device for accessing form data of shared memory

Publications (2)

Publication Number Publication Date
CN118689659A CN118689659A (en) 2024-09-24
CN118689659B true CN118689659B (en) 2024-12-13

Family

ID=92766589

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411176553.2A Active CN118689659B (en) 2024-08-26 2024-08-26 Method, system and device for accessing form data of shared memory

Country Status (1)

Country Link
CN (1) CN118689659B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114217925A (en) * 2021-12-07 2022-03-22 中信银行股份有限公司 Business program operation monitoring method and system for realizing abnormal automatic restart
CN116225738A (en) * 2023-02-15 2023-06-06 上海沄熹科技有限公司 A Memory Pool Implementation Method Based on Shared Memory

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101839503B1 (en) * 2016-05-23 2018-03-16 성균관대학교산학협력단 Apparatus and method for providing of address space maintaining
CN106201904B (en) * 2016-06-30 2019-03-26 网易(杭州)网络有限公司 Method and device for memory garbage reclamation
CN110109762A (en) * 2019-03-18 2019-08-09 中科恒运股份有限公司 Sharing Memory Realization method, computer readable storage medium and terminal device
CN117370046A (en) * 2023-10-31 2024-01-09 阿里巴巴达摩院(杭州)科技有限公司 Inter-process communication method, system, device and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114217925A (en) * 2021-12-07 2022-03-22 中信银行股份有限公司 Business program operation monitoring method and system for realizing abnormal automatic restart
CN116225738A (en) * 2023-02-15 2023-06-06 上海沄熹科技有限公司 A Memory Pool Implementation Method Based on Shared Memory

Also Published As

Publication number Publication date
CN118689659A (en) 2024-09-24

Similar Documents

Publication Publication Date Title
EP1337919B1 (en) Security method making deterministic real time execution of multitask applications of control and command type with error confinement
US20130041937A1 (en) Pre-fetching data
CN101256505A (en) Single-process content server device and method based on IO event notification mechanism
CN110930291B (en) GPU video memory management control method and related device
CN115114247B (en) File data processing method and device
US11893415B2 (en) System and method for process and data observation in a networked service environment
CN103034577A (en) Method and device for positioning slow shutdown
CN118245331B (en) Data acquisition method and electronic equipment
CN112667614A (en) A data processing method, device and computer equipment
CN112667371B (en) Asynchronous task processing method, device, equipment and storage medium
CN118689659B (en) Method, system and device for accessing form data of shared memory
WO2024109068A1 (en) Program monitoring method and apparatus, and electronic device and storage medium
CN120541111B (en) Data reporting methods, data reporting toolkits, and data auditing platforms
CN119645777B (en) Method for acquiring transaction execution stream, electronic device, storage medium, and program product
CN119960949B (en) Embedded real-time operating system interrupt statistics method, device, equipment and medium
CN113835854A (en) A task processing method and device
CN110287159B (en) File processing method and device
CN119003589A (en) Script execution method, script execution device, script execution equipment, script execution system, script execution medium and script execution product
CN114816786B (en) Message data consumption method and device based on cache mechanism and multi-threading
US8359602B2 (en) Method and system for task switching with inline execution
CN115269111A (en) Task processing method, system and device and readable medium
CN115525392A (en) Container monitoring method and device, electronic equipment and storage medium
CN114546979A (en) Distributed storage system and management method, device and equipment thereof
CN118733302B (en) Message processing method, device, electronic device and computer-readable storage medium
CN113064832B (en) Application program energy consumption detection method and device

Legal Events

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