On Sat, Feb 06, 2010, Ted Unangst wrote: > cp writes 64k. How does the buffer cache optimize that into a larger > write if cp hasn't even read the data yet? Does it hide the write on > a secret "to be continued" queue? How long does it stay there? What > if you're only writing to a part of the file?
It "caches" the data and flushes it only if neccessary/requested (fflush(3), close(2), cache almost full, sync(8), ...)? Isn't that the "normal" behavior of a cache? > > your big buffers is that you are claiming resources even if you have > > no idea if they are available or not. > What resources? It uses a small fraction of your RAM. If a 4 gig > machine can't spare a couple megs for a file copy, you're in trouble. Putting that kind of "optimization" into programs that read/write large amount of data seems like the wrong way to go. It belongs in a central place. (That's just a comment from a clueless bystander...)