English 中文(简体)
如何有效复制金字塔基文档以光盘
原标题:How to copy a ram_base file to disk efficiently
  • 时间:2010-04-03 19:15:07
  •  标签:
  • c
  • linux

我想将一大笔金字塔式文件(存放在DC/shm direcotry)复制到当地磁盘上,是用某种方式复制,而不是用一个代子阅读,还是制造另一个零星的记忆? 我只能在这里使用C语。 我是否能够把记忆档案直接放在软盘上? 感谢!

问题回答

页: 1

感谢你们为帮助gu! 我用毫米口径的卷宗将其编成,把整块直接写到目的地。 影像没有使用,因为我实际上正在书写一个平行的档案系统,该系统不支持微粒操作。

/dev/shm是分享的记忆,这样一来,它就会成为分享记忆的开张,但坦率地说,我认为你会获得任何东西。

when writing your memory file to disk, the bottleneck will be the disk. just be sure to write data in big chunks, and you should be fine.

你可以像任何其他档案一样复制:

cp /dev/shm/tmp ~/tmp

因此,迅速而简单的办法是发布<条码>cp。 经由<编码>系统()进行指挥。

您可尝试看到<代码>splice系统是否要求这样做。 我不敢肯定的是,如果它会限制它能够与它合作的各类档案,但如果它确实工作,那么你会一再以记忆页的大小(或几页的大小)要求将其称之为,直到其完成为止,而且该星座会非常积极地处理。

If this doesn t work you ll need to do either mmap or do plain old read/write. Reading and Writing in memory page sized chunks makes things much more efficient. It can be even more efficient if your buffers are memory page size aligned since it opens up the oppurtunity for the kernel to just move the data to/from your process s memory via memory managment trickery rather than actually copying the data around.

你们所能做的唯一事情是()在页数上与地块一致。 我假定,你需要保证数据为书面数据,即意味着绕过缓冲器,途径是沉积-fadvise()或使用O_DIRECT(我通常使用权宜之计),但O_DIRECT在此是适当的。

在此情况下,仅凭媒体的速度就决定了这种速度。

如果你不需要绕过缓冲,则行动将更快完成,但是没有保证,如果出现一个 re/停电等,数据将实际书写。 由于数据来源是共享的记忆,I m(ain)猜测你希望确保书写。

您能优化的唯一事情是,将数据从共享记忆中获取到您自己的地址空间需要多长时间,因为页数与座数相匹配。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签