A method and an application of multi-process single-write multi-read lock-free shared memory
A shared memory, single write multiple read technology, applied in the direction of multi-program device, program control design, resource allocation, etc., can solve problems such as high overhead, performance impact, conflicts, etc., to improve data access performance, high-performance real-time data The effect of accessibility
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0057] Embodiment 1: A method for multi-process single-write-multiple-read lock-free shared memory. When data is updated, first re-apply for an unused shared memory space from the shared memory pool for the data to be updated, and then write the data into After the memory space, modify the key value relationship of the data to ensure that the reading process can get the updated data, and at the same time, reclaim the memory of the old data area.
[0058] Further, the step of reapplying for an unused shared memory space from the shared memory for the data to be updated includes:
[0059] 1) Apply for shared memory space from the shared memory pool according to the steps of the memory management process;
[0060] The steps to write data into this memory space include:
[0061] 2) Initialize the ref field in the memory space to 0, initialize len to the data length data_len, and copy the data to be added / updated to the data area;
[0062] The steps for modifying the key-value re...
Embodiment 2
[0099] Embodiment 2: In order to further improve the data access performance of the shared memory, the present invention proposes a lock-free shared memory scheme, fully utilizes the characteristics of atomic operations, and completely avoids the use of locks from the design, so as to provide High-performance real-time data access capabilities. The core idea of the present invention is: reapply for an unused shared memory space for the data to be updated from the shared memory, modify the key (key) value (value) relationship of the data after writing the data into the memory space, and ensure that the read The process can get the updated data; at the same time, the memory of the old data area will be reclaimed for the next memory allocation of new data or updated data, which is essentially a scheme of exchanging space for time. Since the key-value relationship is updated only after the data is updated, any data area will not be read and written at the same time, which can co...
Embodiment 3
[0181] Embodiment 3: as Figure 8 As shown, an embodiment of a multi-process single-write-multiple-read lock-free shared memory scheme of the present invention, we use the real-time market tick data of the A-share market (about 3400 stocks) as the target data, the data key is the stock code, the character String type, the market data structure has a fixed length of 984 bytes. The writing process receives market data in real time and writes it into the shared memory, and multiple reading processes frequently query the latest real-time market data from the shared memory, and the target securities to be queried are randomly distributed.
[0182] The operating environment of this embodiment is Windows7SP1 64-bit operating system, memory 8G, and CPU is Intel E5-2650 2.2GHz dual-core processor.
[0183] (1) Process initialization:
[0184] Start the write process, create and map the lock-free shared memory data structure, including three shared memory areas: shared data offset add...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com