An apparatus, method and device for multi-producer multi-consumer information storage and sharing
By using a central processing unit and sub-processing units architecture, combined with independent read/write mutual exclusion monitors and register arrays, the problem of low CPU efficiency in the multi-producer, multi-consumer mode is solved, enabling concurrent storage and sharing of information, and ensuring information integrity and system stability.
Patent Information
- Application Number
- CN202311617324.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2043-11-29
AI Technical Summary
In a multi-producer, multi-consumer model, the introduction of mutexes in existing technologies leads to low CPU efficiency and deadlock problems, making it difficult to guarantee the stability and execution efficiency of software programs.
It adopts an architecture of central processing unit and sub-processing units, and achieves concurrent storage and sharing of information by using independent read/write mutual exclusion monitors and registers, combined with register arrays and interconnect circuits, to ensure information integrity.
In the multi-producer and multi-consumer model, concurrent reading and writing of information is achieved, while ensuring information integrity and system stability, improving CPU efficiency, and avoiding deadlock.
Smart Images

Figure CN117850672B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data storage and retrieval technology, and in particular to an information storage and sharing device, method and apparatus for multiple producers and multiple consumers. Background Technology
[0002] Currently, in the multi-producer, multi-consumer model of traditional software technology, mutex locks need to be introduced to ensure data correctness. Otherwise, multiple threads will access queue data at the same time, causing problems such as threads entering the mutex area simultaneously.
[0003] However, in the implementation of the multi-producer, multi-consumer pattern, the introduction of mutex locks can lead to problems such as low CPU efficiency and even deadlocks in the program when the queue access load is large.
[0004] In summary, it can be seen that ensuring the stability and execution efficiency of software programs while implementing a multi-producer, multi-consumer model is a problem that needs to be solved. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of existing technologies by proposing an information storage and sharing apparatus, method, and device that stores and shares fixed-length information among multiple independent processors, while ensuring information integrity while allowing concurrent reading and writing by various producers and consumers.
[0006] The technical solution of the present invention is as follows:
[0007] This invention discloses an information storage and sharing device for multiple producers and multiple consumers, including a central processing unit and at least one sub-processing unit. The central processing unit is used for concurrent write arbitration and includes an independent read / write mutual exclusion monitor and register corresponding to each sub-processor. The central processing unit is responsible for checking and providing feedback on whether the write and read operations to a specific address are successful. The sub-processing unit has independent address lines and data lines, chip select lines, read / write operation lines, and read / write cache registers.
[0008] Furthermore, the specific address points to the latest information address of the entire device, and the location method of each latest information.
[0009] Furthermore, it also includes multiple register arrays, all connected to interconnect circuits and capable of random addressing.
[0010] The present invention also discloses a method for information storage and sharing among multiple producers and multiple consumers, including the following specific operation steps: multiple copies of the same information are arranged on the register array according to the number of sub-processing units, the copy matrix is divided into multiple columns with an equal number of rows, and column numbers are generated. Each column represents the write channel of a sub-processing unit, and each row in the column is a complete copy of information.
[0011] Furthermore, the column number is stored on the central processing unit, indicating which column the latest information is located in; the row number is stored on the sub-processing unit, indicating which row the latest copy in the current column is located in; the number of columns is equal to the number of sub-processing units; the number of rows is greater than or equal to two; for the register units corresponding to the column number and row number, a concurrent read / write arbitration unit is connected to the front end of the interconnect circuit.
[0012] Furthermore, it also includes the following access sequence: the sub-processing unit first obtains the falling edge of the chip select, and then samples the read / write line to determine whether it is a write operation or a read operation.
[0013] Furthermore, the specific steps of the write operation are as follows:
[0014] S11. Sample the data from the data line and store it in the buffer register;
[0015] S12. First addressing: Locate the copy column corresponding to the chip select line cell;
[0016] S13. Second addressing: Find the next write replica corresponding to the replica column;
[0017] S14. Third addressing: Locate the register in the copy corresponding to the address line offset;
[0018] S15. Write the latest line number to the atom;
[0019] S16. Write the atom to the latest column number;
[0020] S17. Feedback success signal.
[0021] Furthermore, the specific steps of the read operation are as follows:
[0022] S21. Atom reads the latest column number;
[0023] S22. First addressing: Addressing to the corresponding column, the latest row number is read atomically;
[0024] S23. Second addressing: Addressing data within the copy according to the address line offset;
[0025] S24. Atomic reads the latest copy address in the column, checks if it has changed, and if it has changed, the read fails and jumps back to step one to retry;
[0026] S25. Send data: Read the register data addressed in the cache register and send it to the data line;
[0027] S26. Feedback success signal.
[0028] The present invention also discloses an electronic device. The electronic device includes a processor and a memory; the memory stores instructions executable by the processor, which, when executed by the processor, enable the processor to implement several methods for storing and sharing information among multiple producers and multiple consumers.
[0029] The present invention also discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for storing and sharing information among multiple producers and multiple consumers.
[0030] Compared with existing technologies, the advantages of this invention are:
[0031] In a multi-producer and multi-consumer mode, this invention stores and shares fixed-length information among multiple independent processors, allowing each producer and consumer to read and write concurrently. At the same time, it ensures information integrity by arranging multiple copies of the same information on the register array according to the number of sub-processing units. Attached Figure Description
[0032] Figure 1 This is a schematic diagram of the overall system structure of the present invention;
[0033] Figure 2 This is a schematic diagram of the method flow of the present invention. Detailed Implementation
[0034] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0035] The technical solution of the present invention will be further described in detail below with reference to the embodiments.
[0036] like Figure 1As shown, this invention discloses an information storage and sharing device for multiple producers and multiple consumers. The device includes a central processing unit (CPU) and multiple sub-processing units. The CPU is used for concurrent write arbitration and includes an independent read / write mutual exclusion monitor and registers corresponding to each sub-processor. The CPU is responsible for checking and providing feedback on the success of writes and reads to specific addresses, which point to the latest information address in the entire device, specifying the location method of each latest information. Each sub-processing unit has independent address lines and data lines, chip select lines, read / write operation lines, and read / write buffer registers. Furthermore, the device internally includes multiple register arrays, all connected to interconnect circuits and capable of random addressing. The front end of the interconnect circuit is the sub-processing unit, and the back end is the register array.
[0037] like Figure 2 As shown, this invention discloses a method for information storage and sharing among multiple producers and consumers. For information to be shared, multiple copies of the same information are arranged on the register array according to the number of sub-processing units. The copy matrix is divided into multiple columns with an equal number of rows, each column representing a write channel of a sub-processing unit. Each row in a column is a complete copy of the information. The column number is stored on the central processing unit, indicating which column the latest information is located in. The row number is stored on the sub-processing unit, indicating which row the latest copy in the current column is located in. The number of columns is equal to the number of sub-processing units. The number of rows is greater than or equal to two. The information requiring concurrent access arbitration only includes the column number on the central processing unit and the row number on each sub-processing unit. For the register units corresponding to the column and row numbers, a concurrent read / write arbitration unit is connected to the front end of the interconnect circuit.
[0038] Access sequence: The sub-processing unit first receives the falling edge of the chip select, then samples the read / write lines to determine the operation type.
[0039] Write operation:
[0040] 1. Sample data from the data line and store it in the buffer register;
[0041] 2. First addressing: Locate the replica column corresponding to the chip select line cell;
[0042] 3. Second addressing: Find the next write replica corresponding to the replica column;
[0043] 4. Third addressing: Locate the register with the corresponding address line offset in the copy;
[0044] 5. Write the latest line number atomically;
[0045] 6. Write the atom to the latest column number;
[0046] 7. A success signal will be sent.
[0047] Read operation:
[0048] 1. Atom reads the latest column number;
[0049] 2. First addressing: Addressing to the corresponding column, the latest row number is read atomically;
[0050] 3. Second addressing: Addressing data within the copy according to the address line offset;
[0051] 4. Atomically read the address of the latest copy in the column, check if it has changed, if it has changed, the read fails, and jump back to step 1 to retry;
[0052] 5. Send data: Read the register data addressed in the cache register and send it to the data bus;
[0053] 6. A success signal will be sent.
[0054] The present invention also discloses an electronic device and a computer-readable storage medium. The electronic device includes a processor and a memory; the memory stores instructions executable by the processor, which, when executed by the processor, enable the processor to implement several methods for storing and sharing information among multiple producers and multiple consumers. The computer-readable storage medium stores a computer program that, when executed by the processor, implements several methods for storing and sharing information among multiple producers and multiple consumers.
[0055] The specific embodiments described in this application are quite detailed, but they should not be construed as limiting the scope of protection of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the technical solution of this application, and these modifications and improvements all fall within the scope of protection of this application.
Claims
1. A method for information storage and sharing among multiple producers and multiple consumers, characterized in that, Based on an information storage and sharing device for multiple producers and multiple consumers, the following specific operation steps are included: multiple copies of the same information are arranged on the register array according to the number of sub-processing units; the copy matrix is divided into multiple columns with an equal number of rows, and column numbers are generated; each column represents the write channel of a sub-processing unit; and each row in the column is a complete copy of information. The information storage and sharing device for multiple producers and consumers includes a central processing unit and at least one sub-processing unit. The central processing unit is used for concurrent write arbitration and includes an independent read / write mutual exclusion monitor and register corresponding to each sub-processor. The central processing unit is responsible for checking and providing feedback on whether the write and read operations to a specific address are successful. The sub-processing unit has independent address lines and data lines, chip select lines, read / write operation lines, and read / write cache registers. The specific address points to the latest information address of the entire device, and the location method of each latest information is specified. The device also includes multiple register arrays, all connected to interconnect circuits and capable of random addressing.
2. The method for information storage and sharing among multiple producers and multiple consumers according to claim 1, characterized in that, It also includes the following access order: the sub-processing unit first obtains the falling edge of the chip select, and then samples the read / write line to determine whether it is a write operation or a read operation.
3. The method for information storage and sharing among multiple producers and multiple consumers according to claim 2, characterized in that, The specific steps of the write operation are as follows: S11. Sample the data from the data line and store it in the buffer register; S12. First addressing: Locate the copy column corresponding to the chip select line cell; S13. Second addressing: Find the next write replica corresponding to the replica column; S14. Third addressing: Locate the register in the copy corresponding to the address line offset; S15. Write the latest line number to the atom; S16. Write the atom to the latest column number; S17. Feedback success signal.
4. The method for information storage and sharing among multiple producers and multiple consumers according to claim 2, characterized in that, The specific steps of the read operation are as follows: S21. Atom reads the latest column number; S22. First addressing: Addressing to the corresponding column, the latest row number is read atomically; S23. Second addressing: Addressing data within the copy according to the address line offset; S24. Atomic reads the address of the latest copy in the column, checks if it has changed, and if it has changed, the read fails and jumps back to step one to retry; S25. Send data: Read the register data addressed in the cache register and send it to the data line; S26. Feedback of success signal.
5. An electronic device, comprising: At least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.
6. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-4.
Citation Information
Patent Citations
Read-write system for parallel data shared by multiple memories among multiple controllers and writing and reading method of read-write system
CN107589958A
