[LC++]Copying files and deleting directories

Jack Lloyd lloyd at acm.jhu.edu
Fri Sep 10 22:11:02 UTC 2004


On Fri, Sep 10, 2004 at 06:15:46AM -0700, Krishna Monian wrote:
> What is a decent sized buffer? About 10K?

Probably. For things like this I usually use 4K. I once compared the
performance of a 4K buffer and a 1K buffer, and it was around 10%
difference. As long as it's large enough that you're not getting swamped by
system call overhead (for example, by doing it a byte at a time), it's probably
fine.

> Regarding the mmap option, would you able to direct me
> to a place that has a good tutorial on it, with some
> sample code.

I can't think of anything online, but Steven's IPC book (Unix Network
Programming volume 2) is excellent, and covers using mmap to copy files.

-Jack




More information about the tuxCPProgramming mailing list