在2个进程之间交换大容量数据的最有效方法是什么? [英] What is the most efficient way to exchange high volume data between 2 process?

查看:63
本文介绍了在2个进程之间交换大容量数据的最有效方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我正在为 DVR 构建软件.

Recently I am building the software for a DVR.

它将安装在插入了2个或更多PCIE x4视频编码器卡的x86 pc服务器上.

It will be installed on a x86 pc server with 2 or more PCIE x4 video encoder card plugged in.

我们有2个独立的程序,一个必须从这些编码器卡中获取编码的视频数据,另一个必须将这些数据保存到硬盘驱动器中.为什么我们有2个过程?一些历史问题.

We have 2 seperated proces, one has to get encoded video data from these encoder card, the other has to save these data to hard driver. Why we have 2 process? Some histroy problem.

那么,我们应该使用哪种IPC?套接字,管道还是共享内存?

So, what kind of IPC should we use? Socket, Pipe, or shared memory?

当前我们正在使用套接字.

Currently we are using socket.

推荐答案

使用IPC:

  • 一个共享内存区域:两个进程之间的低开销共享缓冲区(请参阅shmat()).
  • 一个信号量:其计数器为可用帧数(请参阅semop()).从摄像机中抽取视频数据的过程会将一帧放入共享内存区域,并将put()置于信号量上.将帧记录到磁盘的过程将在信号量上获得get(),并且帧将位于共享内存中.

有点像实现以亮片作为计数器的队列.

It's a bit like implementing a queue with a semphore as a counter.

这篇关于在2个进程之间交换大容量数据的最有效方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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