CN115080206B - High-speed echo data real-time recording system and method based on multithreading mechanism - Google Patents

High-speed echo data real-time recording system and method based on multithreading mechanism Download PDF

Info

Publication number
CN115080206B
CN115080206B CN202210673222.4A CN202210673222A CN115080206B CN 115080206 B CN115080206 B CN 115080206B CN 202210673222 A CN202210673222 A CN 202210673222A CN 115080206 B CN115080206 B CN 115080206B
Authority
CN
China
Prior art keywords
data
buffer
cmd
queue
thread
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
CN202210673222.4A
Other languages
Chinese (zh)
Other versions
CN115080206A (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.)
Harbin Institute of Technology
Original Assignee
Harbin Institute of Technology
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 Harbin Institute of Technology filed Critical Harbin Institute of Technology
Priority to CN202210673222.4A priority Critical patent/CN115080206B/en
Publication of CN115080206A publication Critical patent/CN115080206A/en
Application granted granted Critical
Publication of CN115080206B publication Critical patent/CN115080206B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S7/00Details of systems according to groups G01S13/00, G01S15/00, G01S17/00
    • G01S7/02Details of systems according to groups G01S13/00, G01S15/00, G01S17/00 of systems according to group G01S13/00
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/163Interprocessor communication
    • 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/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
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01SRADIO DIRECTION-FINDING; RADIO NAVIGATION; DETERMINING DISTANCE OR VELOCITY BY USE OF RADIO WAVES; LOCATING OR PRESENCE-DETECTING BY USE OF THE REFLECTION OR RERADIATION OF RADIO WAVES; ANALOGOUS ARRANGEMENTS USING OTHER WAVES
    • G01S13/00Systems using the reflection or reradiation of radio waves, e.g. radar systems; Analogous systems using reflection or reradiation of waves whose nature or wavelength is irrelevant or unspecified
    • G01S13/02Systems using reflection of radio waves, e.g. primary radar systems; Analogous systems
    • G01S2013/0236Special technical features
    • G01S2013/0245Radar with phased array antenna
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0026PCI express
    • 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
    • Y02ATECHNOLOGIES FOR ADAPTATION TO CLIMATE CHANGE
    • Y02A90/00Technologies having an indirect contribution to adaptation to climate change
    • Y02A90/10Information and communication technologies [ICT] supporting adaptation to climate change, e.g. for weather forecasting or climate simulation
    • 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)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Radar, Positioning & Navigation (AREA)
  • Remote Sensing (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a high-speed echo data real-time recording system and a high-speed echo data real-time recording method based on a multithreading mechanism. The invention aims to solve the problem that the existing method can not realize real-time accurate recording of a large amount of high-speed echo data generated by different interfaces. The system comprises: a high-speed data acquisition board card and an upper computer; the board card comprises an FPGA, a DDR and a peripheral interface; the upper computer comprises a PCIe slot, a hard disk and user software; user software arranged in the upper computer uses a multithreading mechanism to divide a plurality of tasks, each processor executes a thread in the multi-core processor, and the tasks can be executed in parallel; the multithreading mechanism comprises a main thread and an auxiliary thread; the main thread is used for displaying, updating and responding to user operation of the user interface; the auxiliary thread is used for collecting, caching and writing into the hard disk. The invention is used in the technical field of electronic measurement.

Description

High-speed echo data real-time recording system and method based on multithreading mechanism
Technical Field
The invention relates to the technical field of electronic measurement, in particular to a high-speed echo data real-time recording system and a high-speed echo data real-time recording method based on a multithreading mechanism.
Background
Phased array radar consists of a fairly dense array of antennas that changes the beam scanning direction by changing the way the beams emitted by the array of antenna surfaces are synthesized. Under the working mode, a large amount of echo data can be generated, the industrial field is to process a large amount of high-speed data, serial transmission technologies such as 10Gbit Ethernet, fiber Channel and SRIO are advanced and developed, and an interface scheme is provided for data acquisition. Meanwhile, in some practical tasks, in order to monitor the system in real time, real-time requirements are also put forward on the acquisition record of high-speed data. The method accurately records a large amount of high-speed echo data generated by different interfaces in real time, and becomes an important problem to be solved by the radar system.
Disclosure of Invention
The invention aims to solve the problem that the existing method cannot accurately record a large amount of high-speed echo data generated by different interfaces in real time, and provides a high-speed echo data real-time recording system and a high-speed echo data real-time recording method based on a multithreading mechanism.
A high-speed echo data real-time recording system based on a multithreading mechanism, comprising: a high-speed data acquisition board card and an upper computer;
the board card comprises an FPGA, a DDR and a peripheral interface;
the upper PC mainly comprises a PCIe slot, a hard disk and user software;
the FPGA is used for realizing the connection of network ports, optical fibers and PCIe peripheral interfaces and the acquisition and transmission functions of data; the DDR is used for increasing the data transmission bandwidth and is responsible for the first level buffer memory of the FPGA for receiving data;
the PCIe slot arranged in the upper PC is used for connecting a data acquisition board card;
the hard disk arranged in the upper computer PC is used for storing data;
user software arranged in the upper computer PC is used for controlling the data acquisition board card;
user software arranged in the upper computer PC is designed based on a National Instrument LabWindows/CVI platform;
dividing a plurality of tasks in LabWindows/CVI software by using a multithreading mechanism, wherein each processor executes a thread in a multi-core processor, and the tasks can be executed in parallel;
the multithreading mechanism comprises a main thread and an auxiliary thread;
the main thread is used for displaying, updating and responding to user operation of a user interface;
the auxiliary thread worker thread is used for collecting, caching and writing into a hard disk;
the auxiliary threads comprise an auxiliary thread worker thread1, an auxiliary thread worker thread2 and an auxiliary thread worker thread3;
the thread is a thread;
opening up N data buffer areas for received data, wherein the capacity of each data buffer area is 1 frame, and storing the first address of the data buffer area buffer in an array queue;
storing the id of the buffer in the array queue, writing the corresponding id into the queue after 1 buffer is written from the buffer0 by a write assist thread work thread2, taking the id which is already written by the buffer from the queue by a read assist thread work thread3, and then reading data from the corresponding buffer and writing the data into a disk;
the thread1 is used for reading the state_fifo of the board card, and if the state_fifo is empty, the board card waits for updating; if not, writing the data state_data into corresponding commands cmd_fifo and Queue (cmd), and transmitting the data to an upper computer PC through a PCI-e bus of a data acquisition board card;
the thread2 is used for enabling i=0, reading a command cmd from a Queue, selecting to read C2H data into a buffer [ data [ cmd ] i ] of the data [ cmd ] according to the value of the command cmd, writing the data [ cmd ] i into a Queue after reading, judging whether the value of i is N-1, and ending if yes; if not, letting i=i+1, continuing to read the command cmd from the Queue, selecting to read the data of C2H into a buffer [ data [ cmd ] i of the data [ cmd ] according to the value of the command cmd, and writing the data [ cmd ] i into the Queue after reading;
the Thread3 is used for taking out the id of the buffer from the queue, then writing the data in the buffer into the hard disk, judging whether the value of i is N-1, if so, ending; if not, letting i=i+1, continuing to take out the id of the buffer from the queue, and then writing the data in the buffer into the hard disk until the value of i is N-1;
n is the number of buffers in the data buffer.
The method for recording the high-speed echo data in real time based on the multithreading mechanism comprises the following specific processes:
step one, receiving high-speed echo data by adopting a data acquisition board card;
step two, the PCI-e bus interface is adopted to transmit the received high-speed echo data to software in the PC of the upper computer;
the software LabWindows in the upper computer PC is designed based on a CVI platform of National Instrument;
a multithreading mechanism is used in the software LabWindows/CVI to divide a plurality of tasks, each processor executes a thread in a multi-core processor, and the tasks can be executed in parallel and simultaneously;
the multithreading is more than or equal to 2 threads;
the multi-core is 8 cores or 16 cores;
the multithreading mechanism comprises a main thread and an auxiliary thread;
and step three, writing the data received by the internal software of the PC into the hard disk.
The invention has the beneficial effects that:
the FPGA-based hardware platform can realize rich peripheral interface functions, can complete high-speed data acquisition tasks under various transmission protocols, and the real-time performance of an acquisition system is enhanced by the parallel processing capability of the FPGA; real-time data recording software is designed on the basis of a multithreading mechanism in LabWindows/CVI, so that the performance of the software can be enhanced by fully utilizing multi-core processors, and each processor independently executes one thread to ensure that a real-time acquisition task is not interrupted by other factors; meanwhile, the data buffer area is designed by matching with the memory, and the data is written into the buffer area and then sequentially read out and stored in the hard disk, so that the situation that the data is lost due to the fact that the thread scheduling is not time-consuming caused by system factors is avoided, and the integrity of the data is ensured. The method solves the problem that the existing method can not realize real-time accurate recording of a large amount of high-speed echo data generated by different interfaces.
Drawings
FIG. 1 is a general block diagram of the hardware of the present invention;
FIG. 2 is a diagram of a multithreaded software architecture in accordance with the present invention;
FIG. 3 is a diagram of a data buffer structure according to the present invention;
FIG. 4a is a main thread flow diagram in the multithreading software of the present invention;
FIG. 4b is a flow chart of a secondary thread in the multithreading software of the present invention.
Detailed Description
The first embodiment is as follows: the high-speed echo data real-time recording system based on a multithreading mechanism of the embodiment comprises: a high-speed data acquisition board card and an upper computer;
the transmission rate of the single-path support of the high-speed transceiver of the FPGA chip on the data acquisition board card is 0.5-13.1 Gbps;
the board card mainly comprises an FPGA, a DDR and a peripheral interface;
the upper PC mainly comprises a PCIe slot, a hard disk and user software;
the FPGA is used for realizing the connection of peripheral interfaces such as network ports, optical fibers, PCIe (peripheral component interconnect express) and the like and the acquisition and transmission functions of data; the DDR is used for increasing the data transmission bandwidth and is responsible for the first level buffer memory of the FPGA for receiving data;
the acquisition system is built based on the FPGA, and the overall hardware block diagram is shown in figure 1.
The PCIe slot arranged in the upper PC is used for connecting a data acquisition board card;
the hard disk arranged in the upper computer PC is used for storing data;
user software arranged in the upper computer PC is used for controlling the data acquisition board card;
user software arranged in the upper computer PC is designed based on a National Instrument LabWindows/CVI platform;
dividing a plurality of tasks in LabWindows/CVI software by using a multithreading mechanism, wherein each processor executes a thread in a multi-core processor, and the tasks can be executed in parallel; three tasks of data acquisition, user data display and data writing in a hard disk can be simultaneously executed;
the multithreading mechanism comprises a main thread and an auxiliary thread;
the main thread is used for displaying, updating and responding to user operation of a user interface;
the auxiliary thread worker thread is used for collecting, caching and writing into a hard disk;
the auxiliary threads comprise an auxiliary thread worker thread1, an auxiliary thread worker thread2 and an auxiliary thread worker thread3;
the thread is a thread;
the FIFO is implemented in the FPGA by hardware, and can be understood as a buffer in which the content can be accessed first and then read when needed by the user.
Opening up N data buffer areas for the received high-speed echo data, wherein the capacity of each data buffer area is 1 frame (4 MB), and storing the first address of the data buffer area buffer in an array queue;
storing the id (0-N-1) of the buffer in the array queue, writing the corresponding id into the queue after 1 buffer is written from the buffer0 by a write assist thread worker thread2, taking the id which is already written by the buffer from the queue by the read assist thread worker thread3, and then reading data from the corresponding buffer and writing the data into a disk;
the thread1 is used for reading the state_fifo of the board card, and if the state_fifo is empty, the board card waits for updating; if not, writing the data state_data into corresponding commands cmd_fifo and Queue (cmd), and transmitting the data to an upper computer PC through a PCI-e bus of a data acquisition board card;
the thread2 is used for enabling i=0, reading a command cmd from a Queue, selecting to read data of C2H (board card to host) into a buffer [ data [ cmd ] i of data [ cmd ] according to the value of the command cmd, writing the data [ cmd ] i into a Queue after the reading is finished, judging whether the value of i is N-1, and ending if the value of i is N-1; if not, letting i=i+1, continuing to read the command cmd from the Queue, selecting to read the data of C2H (board card to host) into a buffer [ data [ cmd ] i of the data [ cmd ], and writing the data [ cmd ] i into a Queue after reading;
the Thread3 is used for taking out the id of the buffer from the queue, then writing the data in the buffer into the hard disk, judging whether the value of i is N-1, if so, ending; if not, letting i=i+1, continuing to take out the id of the buffer from the queue, and then writing the data in the buffer into the hard disk until the value of i is N-1;
n is the number (setting) of buffers in the data buffer.
The LabWindows/CVI software program uses a thread pool technology in the high-speed echo data real-time recording software;
the LabWindows/CVI thread safety queue is used for protecting data and helping to safely transfer data between threads.
The second embodiment is as follows: the present embodiment differs from the specific embodiment in that the number of threads is 2 or more.
Other steps and parameters are the same as in the first embodiment.
And a third specific embodiment: this embodiment differs from the first or second embodiments in that the multi-core is 8-core or 16-core.
Other steps and parameters are the same as in the first or second embodiment.
The specific embodiment IV is as follows: the method for recording the high-speed echo data in real time based on the multithreading mechanism comprises the following specific processes:
step one, receiving high-speed echo data by adopting a data acquisition board card;
step two, the PCI-e bus interface is adopted to transmit the received high-speed echo data to software in the PC of the upper computer;
the software LabWindows in the upper computer PC is designed based on a CVI platform of National Instrument;
a multithreading mechanism is used in the software LabWindows/CVI to divide a plurality of tasks, each processor executes a thread in a multi-core processor, and the tasks can be executed in parallel and simultaneously; the three tasks of data acquisition, user data display and data writing in the hard disk can be simultaneously executed;
the multithreading is more than or equal to 2 threads;
the multi-core is 8 cores or 16 cores;
the multithreading mechanism comprises a main thread and an auxiliary thread;
and step three, writing the data received by the internal software of the PC into the hard disk.
Fifth embodiment: the fourth difference between the present embodiment and the specific embodiment is that the specific execution process of the main thread is as follows:
step 1: judging whether the main program user interface is loaded successfully, if so, executing the step 2; if not, executing the step 4;
step 2: creating an auxiliary thread, judging whether the auxiliary thread is successfully created, and if so, executing the step 3; if not, executing the step 4;
step 3: responding to the user operation, judging whether to exit, if not, continuing responding to the user operation; if yes, executing the step 4;
step 4: and releasing the memory.
Other steps and parameters are the same as in the fourth embodiment.
Specific embodiment six: the difference between this embodiment and the fourth or fifth embodiment is that the specific execution process of the auxiliary thread in the step 2 is as follows:
step 21, writing a state_fifo after the data acquisition board completes receiving one frame of data each time, wherein the size of one frame of data is 4MB;
the user software reads whether the state_fifo of the data acquisition board card is empty or not, if so, the user software waits for updating; no, go to step 22;
the FIFO is implemented in the FPGA by hardware, and can be understood as a buffer in which the content can be accessed first and then read when needed by the user.
Step 22, writing the data state_data into corresponding commands cmd_fifo and Queue (cmd), transmitting the data to the upper computer PC through the PCI-e bus of the data acquisition board card, and executing step 23;
queue (secure Queue) is a software mechanism for CVI multi-threaded data protection.
The former thread generates data and adds the data into a safety queue; the latter thread displays data and reads the security queue;
step 23, let i=0, read command cmd from Queue (cmd) of step 22, choose to read the data of C2H (board card to host) into buffer [ data [ cmd ] i ] buffer of data [ cmd ] according to the value of command cmd, write data [ cmd ] i into Queue after reading, judge whether buffer [ i ] buffer is full, if yes, go to step 24; if not, repeating the step 23;
step 24, making i=i+1, updating state_fifo of the data acquisition board card, taking out id of the buffer from the queue, writing data in the buffer into the hard disk, judging whether the value of i is N-1, if yes, ending; if not, executing step 24 until the value of i is N-1;
n is the number (setting) of buffers in the data buffer area;
other steps and parameters are the same as those of the fourth or fifth embodiment.
The upper computer software selects the LabWindows/CVI development platform of National Instrument, and the program for data acquisition often comprises a plurality of other tasks such as user interface display, data writing into a disk and the like, and one or more of the tasks has strict time requirements and is easy to be interfered by other tasks. While data collection is a time critical task, it is also likely to be interrupted by the user interface task. Therefore, the multi-threading technology is designed to be used in the LabWindows/CVI software program to divide a plurality of tasks; placing the data acquisition operation in one thread and the user interface processing in another thread; when a user operates an interface, the operating system switches threads and provides time for completing tasks for the data acquisition threads; the situation that when a user operates on an interface, a thread cannot return to a data acquisition task, so that overflow of a data acquisition buffer area is caused is avoided. And software performance may be improved by running a multi-threaded program with a multi-processor computer. One thread may be executed by each processor on the computer, enabling the simultaneous execution of both user data display and data writing tasks to disk.
In a multithreaded program, the program notifies the operating system to create other threads, in addition to the main thread, which are referred to as auxiliary threads. The auxiliary thread in the program is responsible for acquiring data, and the main thread reads the data when it is available and then analyzes the display data. LabWindows/CVI provides two high-level mechanisms for running code in auxiliary processes, thread pools and asynchronous timers, respectively. The thread pool is adapted to perform tasks that are performed several times or within one cycle, while the asynchronous timer is adapted to tasks that are performed periodically. Thread pool techniques are used in the high-speed echo data real-time recording software. In addition, the thread-safe queues provided by the CVI may be used to protect data, helping to transfer data securely between threads. When data needs to be collected by one thread and processed by another thread, the thread safety queue can process all data locks inside.
The thread structure of the software is shown in fig. 2, and the functions of each thread are as follows:
main thread (MainThread): display of UI, update, response of user operation.
Read-1, read the state_fifo of the card, and write the data to the corresponding cmd_fifo, let the card start uploading the data.
And (2) when the front end queue is not empty, reading the data on the board card C2H, and writing the data into the corresponding data queue according to the cmd value.
Thread3, read the data of the front end queue, write to SSD.
The cmtnwfreadtpool function is used in the main function to create a 3-thread pool and the CmtDiscardThreadPool (Poolhandle) function is used to release the thread pool after the entire program is completed. The following code illustrates data collection in the main thread using the auxiliary thread.
int CVICALLBACK ReadDataThreadFunction(void*functionData);
int main(int argc,char*argv[])
{…
CmtScheduleThreadPoolFunction(DEFAULT_THREAD_POOL_HANDLE,ReadDataThreadFunction,NULL,&functionId);
…}
int CVICALLBACK ReadDataThreadFunction(void*functionData)
{
while(!quit)
{
Acquire(...);
}
}
The main Thread calls the CmtSchedulThreadPoolFunction function, and the helper Thread-2 function name readDataThreadFunction of writing data into the buffer zone is imported, and other helper threads are similarly imported. In a Windows system, the priority at which each thread works may be specified. When multiple threads need to run, the thread with the highest priority runs first. When a CmtScheduleThreadFunctionAdv function is used to schedule a function to run in a thread pool, the priority of the thread executing the scheduled function may be specified. The thread pool changes thread priority before running the scheduled function. After the function finishes running, the thread pool restores the thread priority to the original priority. Depending on the system configuration and current state, the thread pool may create new threads to execute, may use existing idle processes, or may wait for an active thread to become idle and then use.
The main thread returns from the CmtScheduleThreadPoolFunction function without waiting for the auxiliary thread function to complete. The readdatathread function in the auxiliary thread is executed concurrently with the call in the main thread. Therefore, when the user performs mouse click drag operation on the user interface in the main thread or performs real-time update display on the data, the auxiliary thread can continuously operate to perform data acquisition, write the data into the buffer area through reading the card state FIFO acquisition instruction, and finally sequentially and circularly read out from the buffer area and store the data into the disk.
Aiming at the radar system which needs to process a large amount of data and feed back the data to the user through an interface, the high-speed echo data recording method based on the multithreading mechanism can fully exert the advantages of multithreading design, enhance the software performance and ensure that data acquisition is not interrupted by other factors. Meanwhile, a data buffer area is designed by matching with a memory, and the mode that data is written into the buffer area and then sequentially read out of the memory is adopted, so that the situation that the data is lost due to the fact that the thread scheduling is not time-consuming caused by system factors is avoided, and the integrity of echo data is ensured.
The present invention is capable of other and further embodiments and its several details are capable of modification and variation in light of the present invention, as will be apparent to those skilled in the art, without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (6)

1. A high-speed echo data real-time recording system based on a multithreading mechanism is characterized in that: the system comprises: a high-speed data acquisition board card and an upper computer;
the board card comprises an FPGA, a DDR and a peripheral interface;
the upper PC mainly comprises a PCIe slot, a hard disk and user software;
the FPGA is used for realizing the connection of network ports, optical fibers and PCIe peripheral interfaces and the acquisition and transmission functions of data; the DDR is used for increasing the data transmission bandwidth and is responsible for the first level buffer memory of the FPGA for receiving data;
the PCIe slot arranged in the upper PC is used for connecting a data acquisition board card;
the hard disk arranged in the upper computer PC is used for storing data;
user software arranged in the upper computer PC is used for controlling the data acquisition board card;
user software arranged in the upper computer PC is designed based on a LabWindows/CVI platform of a national Instrument;
dividing a plurality of tasks in LabWindows/CVI software by using a multithreading mechanism, wherein each processor executes a thread in a multi-core processor, and the tasks can be executed in parallel;
the multithreading mechanism comprises a main thread and an auxiliary thread;
the main thread is used for displaying, updating and responding to user operation of a user interface;
the auxiliary thread workerthread is used for collecting, caching and writing into a hard disk;
the auxiliary threads comprise an auxiliary thread workerthread1, an auxiliary thread workerthread2 and an auxiliary thread workerthread3;
the thread is a thread;
opening up N data buffer areas for received data, wherein the capacity of each data buffer area is 1 frame, and storing the first address of the data buffer area buffer in an array queue;
storing the id of a buffer in the array queue, writing the corresponding id into the queue after 1 buffer is written by a write assist thread work 2 from the buffer0, taking the id which is already written by the buffer out of the queue by the read assist thread work 3, and then reading data from the corresponding buffer and writing the data into a disk;
the thread1 is used for reading the state_fifo of the board card, and if the state_fifo is empty, the board card waits for updating; if not, writing the data state_data into corresponding commands cmd_fifo and Queue (cmd), and transmitting the data to an upper computer PC through a PCI-e bus of a data acquisition board card;
the thread2 is used for enabling i=0, reading a command cmd from a Queue, selecting to read C2H data into a buffer [ data [ cmd ] i ] of the data [ cmd ] according to the value of the command cmd, writing the data [ cmd ] i into a Queue after reading, judging whether the value of i is N-1, and ending if yes; if not, letting i=i+1, continuing to read the command cmd from the Queue, selecting to read the data of C2H into a buffer [ data [ cmd ] i of the data [ cmd ] according to the value of the command cmd, and writing the data [ cmd ] i into the Queue after reading;
the thread3 is used for taking out the id of the buffer from the queue, then writing the data in the buffer into the hard disk, judging whether the value of i is N-1, if so, ending; if not, letting i=i+1, continuing to take out the id of the buffer from the queue, and then writing the data in the buffer into the hard disk until the value of i is N-1;
n is the number of buffers in the data buffer area;
the data of the C2H is the data from the board card to the host.
2. The multithreading-based high-speed echo data real-time recording system according to claim 1, wherein: the multithreading is more than or equal to 2 threads.
3. The multithreading-based high-speed echo data real-time recording system according to claim 2, wherein: the multi-core is 8-core or 16-core.
4. A method for real-time recording of high-speed echo data based on a multithreading mechanism based on the system of claim 1, characterized in that: the method comprises the following specific processes:
step one, receiving high-speed echo data by adopting a data acquisition board card;
step two, the PCI-e bus interface is adopted to transmit the received high-speed echo data to software in the PC of the upper computer;
the software LabWindows in the upper computer PC is designed based on a CVI platform of the national Instrument;
a multithreading mechanism is used in the software LabWindows/CVI to divide a plurality of tasks, each processor executes a thread in a multi-core processor, and the tasks can be executed in parallel and simultaneously;
the multithreading is more than or equal to 2 threads;
the multi-core is 8 cores or 16 cores;
the multithreading mechanism comprises a main thread and an auxiliary thread;
writing data received by internal software of the PC into the hard disk; the specific process is as follows:
opening up N data buffer areas for received data, wherein the capacity of each data buffer area is 1 frame, and storing the first address of the data buffer area buffer in an array queue;
storing the id of a buffer in the array queue, writing the corresponding id into the queue after 1 buffer is written by a write assist thread work 2 from the buffer0, taking the id which is already written by the buffer out of the queue by the read assist thread work 3, and then reading data from the corresponding buffer and writing the data into a disk;
the thread1 is used for reading the state_fifo of the board card, and if the state_fifo is empty, the board card waits for updating; if not, writing the data state_data into corresponding commands cmd_fifo and Queue (cmd), and transmitting the data to an upper computer PC through a PCI-e bus of a data acquisition board card;
the thread2 is used for enabling i=0, reading a command cmd from a Queue, selecting to read C2H data into a buffer [ data [ cmd ] i ] of the data [ cmd ] according to the value of the command cmd, writing the data [ cmd ] i into a Queue after reading, judging whether the value of i is N-1, and ending if yes; if not, letting i=i+1, continuing to read the command cmd from the Queue, selecting to read the data of C2H into a buffer [ data [ cmd ] i of the data [ cmd ] according to the value of the command cmd, and writing the data [ cmd ] i into the Queue after reading;
the Thread3 is used for taking out the id of the buffer from the queue, then writing the data in the buffer into the hard disk, judging whether the value of i is N-1, if so, ending; if not, letting i=i+1, continuing to take out the id of the buffer from the queue, and then writing the data in the buffer into the hard disk until the value of i is N-1;
n is the number of buffers in the data buffer area;
the data of the C2H is the data from the board card to the host.
5. The method for real-time recording of high-speed echo data based on a multithreading mechanism according to claim 4, wherein the method comprises the following steps: the specific execution process of the main thread is as follows:
step 1: judging whether the main program user interface is loaded successfully, if so, executing the step 2; if not, executing the step 4;
step 2: creating an auxiliary thread, judging whether the auxiliary thread is successfully created, and if so, executing the step 3; if not, executing the step 4;
step 3: responding to the user operation, judging whether to exit, if not, continuing responding to the user operation; if yes, executing the step 4;
step 4: and releasing the memory.
6. The method for real-time recording of high-speed echo data based on a multithreading mechanism according to claim 5, wherein the method comprises the following steps: the specific execution process of the auxiliary thread in the step 2 is as follows:
step 21, writing a state_fifo after the data acquisition board completes receiving one frame of data each time, wherein the size of one frame of data is 4MB;
the user software reads whether the state_fifo of the data acquisition board card is empty or not, if so, the user software waits for updating; no, go to step 22;
step 22, writing the data state_data into corresponding commands cmd_fifo and Queue (cmd), transmitting the data to the upper computer PC through the PCI-e bus of the data acquisition board card, and executing step 23;
step 23, let i=0, read command cmd from Queue (cmd) of step 22, choose to read the data of C2H into buffer [ data [ cmd ] i ] buffer of data [ cmd ] according to the value of command cmd, write data [ cmd ] i into the Queue after finishing reading, judge whether buffer [ i ] buffer is full, yes, go to step 24; if not, repeating the step 23;
step 24, making i=i+1, updating state_fifo of the data acquisition board card, taking out id of the buffer from the queue, writing data in the buffer into the hard disk, judging whether the value of i is N-1, if yes, ending;
if not, executing step 24 until the value of i is N-1;
n is the number of buffers in the data buffer.
CN202210673222.4A 2022-06-14 2022-06-14 High-speed echo data real-time recording system and method based on multithreading mechanism Active CN115080206B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210673222.4A CN115080206B (en) 2022-06-14 2022-06-14 High-speed echo data real-time recording system and method based on multithreading mechanism

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210673222.4A CN115080206B (en) 2022-06-14 2022-06-14 High-speed echo data real-time recording system and method based on multithreading mechanism

Publications (2)

Publication Number Publication Date
CN115080206A CN115080206A (en) 2022-09-20
CN115080206B true CN115080206B (en) 2023-08-08

Family

ID=83251071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210673222.4A Active CN115080206B (en) 2022-06-14 2022-06-14 High-speed echo data real-time recording system and method based on multithreading mechanism

Country Status (1)

Country Link
CN (1) CN115080206B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117591300B (en) * 2024-01-17 2024-05-17 杭州长川科技股份有限公司 Multi-thread communication method and device for testing machine and testing machine
CN117872298B (en) * 2024-03-13 2024-06-11 西安电子科技大学 Upper computer system of radar system based on Qt and control method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101777034A (en) * 2010-03-22 2010-07-14 哈尔滨工业大学 RS422 asynchronous serial card with hardware timed sending function and communication method thereof
CN101788922A (en) * 2009-01-22 2010-07-28 国际商业机器公司 Method and device for realizing transaction storage system based on auxiliary thread
CN102331923A (en) * 2011-10-13 2012-01-25 西安电子科技大学 Multi-core and multi-threading processor-based functional macropipeline implementing method
CN113109778A (en) * 2021-02-26 2021-07-13 西安电子科技大学 Multi-system radar preprocessing implementation method based on interrupt response mechanism
CN113671478A (en) * 2021-07-27 2021-11-19 西安电子科技大学 High-speed maneuvering target identification data processing method based on multi-core CPU
CN113866738A (en) * 2021-09-03 2021-12-31 湖北中南鹏力海洋探测系统工程有限公司 Sea state echo acquisition system and method based on ground wave radar

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060020945A1 (en) * 2004-06-07 2006-01-26 Chien Che-Hui C System, circuitry and method for parallel processing real-time signal with open structure

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101788922A (en) * 2009-01-22 2010-07-28 国际商业机器公司 Method and device for realizing transaction storage system based on auxiliary thread
CN101777034A (en) * 2010-03-22 2010-07-14 哈尔滨工业大学 RS422 asynchronous serial card with hardware timed sending function and communication method thereof
CN102331923A (en) * 2011-10-13 2012-01-25 西安电子科技大学 Multi-core and multi-threading processor-based functional macropipeline implementing method
CN113109778A (en) * 2021-02-26 2021-07-13 西安电子科技大学 Multi-system radar preprocessing implementation method based on interrupt response mechanism
CN113671478A (en) * 2021-07-27 2021-11-19 西安电子科技大学 High-speed maneuvering target identification data processing method based on multi-core CPU
CN113866738A (en) * 2021-09-03 2021-12-31 湖北中南鹏力海洋探测系统工程有限公司 Sea state echo acquisition system and method based on ground wave radar

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Jingchao Zhang.An FPGA based real-time radar target simulator with high spur suppression.《 2020 15th IEEE International Conference on Signal Processing (ICSP)》.2021,126-130. *

Also Published As

Publication number Publication date
CN115080206A (en) 2022-09-20

Similar Documents

Publication Publication Date Title
CN115080206B (en) High-speed echo data real-time recording system and method based on multithreading mechanism
US12131186B2 (en) Hardware accelerated dynamic work creation on a graphics processing unit
EP2187316B1 (en) Gated storage system and synchronization controller and method for multiple multi-threaded processors
US7210146B2 (en) Sleep queue management
US11474712B2 (en) Method, apparatus, device and storage medium for managing access request
US20060259823A1 (en) Determining operating context of an executed instruction
CN111767159A (en) Asynchronous system calling system based on coroutine
CN106462395A (en) Thread waiting in a multithreaded processor architecture
CN108333566B (en) ZYNQ-based portable radar test system and test method
US20030177288A1 (en) Multiprocessor system
CN109308213B (en) Multi-task breakpoint debugging method based on improved task scheduling mechanism
CN103019838A (en) Multi-DSP (Digital Signal Processor) platform based distributed type real-time multiple task operating system
US20120017217A1 (en) Multi-core processing system and computer readable recording medium recorded thereon a schedule management program
CN102822802A (en) Multi-core processor sytem, control program, and control method
CN111857669A (en) Software and hardware decoupling software radar system, real-time design method and server
CN113946445A (en) Multithreading module based on ASIC and multithreading control method
Zheng et al. HDF5 Cache VOL: Efficient and scalable parallel I/O through caching data on node-local storage
CN109656868B (en) Memory data transfer method between CPU and GPU
KR20200087067A (en) Key-value based system for parallel computing and method for operating a parallelized application
CN109408239A (en) A kind of asynchronous I O process method based on queue
CN103713944B (en) A kind of processing method of Kernel-level thread, device and system
WO2013148439A1 (en) Hardware managed allocation and deallocation evaluation circuit
US10915355B2 (en) Programmatic implicit multithreading
US9619277B2 (en) Computer with plurality of processors sharing process queue, and process dispatch processing method
US11112999B2 (en) Optimizing I/O latency by software stack latency reduction in a cooperative thread processing model

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