关于实时数据接收,处理和保存的设计 [英] The design about real-time data reception,treatment and save

查看:74
本文介绍了关于实时数据接收,处理和保存的设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

各位大家好。关于实时数据接收,处理和保存的设计我有一个问题。我有一个read(cBuf,length)函数来接收实时数据。

我用SetThreadAffinityMask()创建一个核心专有线程。在这个线程中,它具有读取功能和处理等。最近我发现线程丢失帧然后。通过分析,这是因为太慢而无法及时读取数据。

所以我想分成两个线程,一个只实现read()函数,另一个则覆盖其他东西。但是我发现如果添加关键或锁定仍然太慢,当然也许我的糟糕程序是主要原因。

现在,我希望得到一个关于我的问题的解决方案。一个实时的无锁队列还是其他东西?

你能给我一些建议或示例。

Hello, everybody. I have a problem about The design about real-time data reception,treatment and save. I have a read(cBuf,length) function to receive real-time data.
I make a core exclusive thread with SetThreadAffinityMask(). In this thread, it have the read function and treatment etc. Recently I found that the thread lost frame one and then. By analyzing ,It is because too slow to read data in time.
So I want divide into two thread, one only achieve the read() function, and other things are covered by the other. However I found if add critical or lock still too slow, of course maybe my bad program is the main reason.
Now, I want get a solution about my problem. A real-time no-lock queue or something else?
Could you give me some advice or example.

推荐答案

很难根据您发布的详细信息概述获胜策略。可能您可能只是提高代码的性能(微调它)。可能算法实际上可以并行化以利用多核(我认为是)CPU。可能,最后,你根本无法处理实时输入数据速率,并且必须致命地丢失一些帧。
It is difficult to outline a winning strategy based just on the details you posted. Possibly you might just improve the performance of your code (fine tuning it). Possibly the algorithm could be actually parallelized to exploit the multicore (I assume it is) CPU. Possibly, lastly, you simply cannot handle real time such of input data rate and have to fatally lose some frames.


这篇关于关于实时数据接收,处理和保存的设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆