由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - multi-thread 一问,
相关主题
[合集] 请推荐几本Multi-threading的编程书籍一个有关visual stdio 2005的问题
mutex一问调用win32 DLL的问题
C++ string类输入数据的问题About command line in C++
Recommend a C++ IDE?在C/C++里的文件复制操作
how to write some C/C++ program to enable dual monitor?Windows XP与Multithreading Programming
受不了拉 - 技术发展太快!!! 学啥才不过时? (转载)有必要学一学MFC吗?
如何在VC++下把raw图像快速写到硬盘里呢?请教C++程序中手动Ctrl+C后,如何才可以调用一下自己写的退出函数
Help - C++ Debug Assertion Failed【C++ GUI和.Net GUI的工作要看什么书啊?】 (转载)
相关话题的讨论汇总
话题: read话题: aio话题: write话题: thread话题: multi
进入Programming版参与讨论
1 (共1页)
F*******i
发帖数: 190
1
如果 我的程序需要同时 读和写很多数据,
请问可以用multi-thread 来 提高 IO 的 performance 吗?
比如现在有可能是写的太慢了, 导致会miss 掉一些读进来的数据,
如果 可以, 请问 c++ 有什么比较好的工具 或者 tutorial ?
谢谢
p*u
发帖数: 2454
2
I think you need read-write lock for this purpose. you also need to buffer d
ata in your writer thread.
You can check out Linux AIO, though it's not C++ but C.

【在 F*******i 的大作中提到】
: 如果 我的程序需要同时 读和写很多数据,
: 请问可以用multi-thread 来 提高 IO 的 performance 吗?
: 比如现在有可能是写的太慢了, 导致会miss 掉一些读进来的数据,
: 如果 可以, 请问 c++ 有什么比较好的工具 或者 tutorial ?
: 谢谢

F*******i
发帖数: 190
3
Yes, read-write lock and buffer are exactly what I am looking for.
Thanks for the AIO!

d

【在 p*u 的大作中提到】
: I think you need read-write lock for this purpose. you also need to buffer d
: ata in your writer thread.
: You can check out Linux AIO, though it's not C++ but C.

T*****9
发帖数: 2484
4
use lock or semaphore
可以用buffer,然后对这个buffer用2个semaphore,1个lock或者3个semaphore
你可以看看pthread,同时我觉得fifo的实现基本是1读1写(事实上是多读多写),你可
以看看他的实现

【在 F*******i 的大作中提到】
: 如果 我的程序需要同时 读和写很多数据,
: 请问可以用multi-thread 来 提高 IO 的 performance 吗?
: 比如现在有可能是写的太慢了, 导致会miss 掉一些读进来的数据,
: 如果 可以, 请问 c++ 有什么比较好的工具 或者 tutorial ?
: 谢谢

D*******a
发帖数: 3688
5
要做好buffering

【在 F*******i 的大作中提到】
: 如果 我的程序需要同时 读和写很多数据,
: 请问可以用multi-thread 来 提高 IO 的 performance 吗?
: 比如现在有可能是写的太慢了, 导致会miss 掉一些读进来的数据,
: 如果 可以, 请问 c++ 有什么比较好的工具 或者 tutorial ?
: 谢谢

F*******i
发帖数: 190
6
Thanks!
请问有好的c++的库推荐吗?
谢谢,

【在 D*******a 的大作中提到】
: 要做好buffering
D*******a
发帖数: 3688
7
thread,mutex,semaphore本来是OS的东西,所以不同操作系统下面用法不同
不过现在好像可以用boost::thread库

【在 F*******i 的大作中提到】
: Thanks!
: 请问有好的c++的库推荐吗?
: 谢谢,

F*******i
发帖数: 190
8
Thanks!

【在 D*******a 的大作中提到】
: thread,mutex,semaphore本来是OS的东西,所以不同操作系统下面用法不同
: 不过现在好像可以用boost::thread库

d******n
发帖数: 42
9
d******n
发帖数: 42
10
try QT, it has multithread component
相关主题
受不了拉 - 技术发展太快!!! 学啥才不过时? (转载)一个有关visual stdio 2005的问题
如何在VC++下把raw图像快速写到硬盘里呢?调用win32 DLL的问题
Help - C++ Debug Assertion FailedAbout command line in C++
进入Programming版参与讨论
a****l
发帖数: 8211
11
why do you think multi-threading will improve IO performance? If you hard-
drive can only write this fast, how can you make it write faster?
You need to refine your writing routines to make it faster.

【在 F*******i 的大作中提到】
: 如果 我的程序需要同时 读和写很多数据,
: 请问可以用multi-thread 来 提高 IO 的 performance 吗?
: 比如现在有可能是写的太慢了, 导致会miss 掉一些读进来的数据,
: 如果 可以, 请问 c++ 有什么比较好的工具 或者 tutorial ?
: 谢谢

F*******i
发帖数: 190
12
Thanks for your suggestion.
Here is the situation:
Process data --> Write data --> Read data again>
If I spend too many time on the Write data part, I might miss the new
incoming
data since it is live.
Any comments?

【在 a****l 的大作中提到】
: why do you think multi-threading will improve IO performance? If you hard-
: drive can only write this fast, how can you make it write faster?
: You need to refine your writing routines to make it faster.

a****l
发帖数: 8211
13
Ok, I thought you meant your io is not writing fast enough.
Yes, in this case, it is almost always you must use 2 threads.

【在 F*******i 的大作中提到】
: Thanks for your suggestion.
: Here is the situation:
: Process data --> Write data --> Read data again>
: If I spend too many time on the Write data part, I might miss the new
: incoming
: data since it is live.
: Any comments?

F*******i
发帖数: 190
14
Do you have any good c++ resources about this to recommend?
Thanks again!

【在 a****l 的大作中提到】
: Ok, I thought you meant your io is not writing fast enough.
: Yes, in this case, it is almost always you must use 2 threads.

b***y
发帖数: 2799
15
READ的BUFFER是多大,READ那边进来速度是多大?如果你怕MISS,把READ BUFFER弄大
点不就行了?当然你也可以写一部分,就去CHECK一下READ,然后再接着写。

【在 F*******i 的大作中提到】
: 如果 我的程序需要同时 读和写很多数据,
: 请问可以用multi-thread 来 提高 IO 的 performance 吗?
: 比如现在有可能是写的太慢了, 导致会miss 掉一些读进来的数据,
: 如果 可以, 请问 c++ 有什么比较好的工具 或者 tutorial ?
: 谢谢

m*****e
发帖数: 4193
16
For single producer-consumer model no lock is needed.
Forget AIO, it's not what you need.

d

【在 p*u 的大作中提到】
: I think you need read-write lock for this purpose. you also need to buffer d
: ata in your writer thread.
: You can check out Linux AIO, though it's not C++ but C.

p*u
发帖数: 2454
17
then name something OP can use.

【在 m*****e 的大作中提到】
: For single producer-consumer model no lock is needed.
: Forget AIO, it's not what you need.
:
: d

m*****e
发帖数: 4193
18
He is asking multi-threading.
AIO is completely opposite.

【在 p*u 的大作中提到】
: then name something OP can use.
p*u
发帖数: 2454
19
he asked how to improve performance of read-write.

【在 m*****e 的大作中提到】
: He is asking multi-threading.
: AIO is completely opposite.

m*****e
发帖数: 4193
20
Have you even used AIO and know its current status? Don't just throw fancy
words at a problem.

【在 p*u 的大作中提到】
: he asked how to improve performance of read-write.
p*u
发帖数: 2454
21
只有土鳖才觉得05年就出来的LINUX AIO fancy。

【在 m*****e 的大作中提到】
: Have you even used AIO and know its current status? Don't just throw fancy
: words at a problem.

c****r
发帖数: 15
22
如果是on Windows的话,use asynchronous file writing. 参考WriteFile Win32 API
.
1 (共1页)
进入Programming版参与讨论
相关主题
【C++ GUI和.Net GUI的工作要看什么书啊?】 (转载)how to write some C/C++ program to enable dual monitor?
Visual C++ Express 很土的问题求救受不了拉 - 技术发展太快!!! 学啥才不过时? (转载)
programming windows求教如何在VC++下把raw图像快速写到硬盘里呢?
在visual C++ 程序里播放mp3Help - C++ Debug Assertion Failed
[合集] 请推荐几本Multi-threading的编程书籍一个有关visual stdio 2005的问题
mutex一问调用win32 DLL的问题
C++ string类输入数据的问题About command line in C++
Recommend a C++ IDE?在C/C++里的文件复制操作
相关话题的讨论汇总
话题: read话题: aio话题: write话题: thread话题: multi