[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Could RAM possibly be just 3-4 times faster than bare hdd writes and reads? or, is the Linux kernel doing its 'magic' in the bg? or, ...



On 2020-06-17 12:26, Reco wrote:

On Wed, Jun 17, 2020 at 12:10:51PM -0700, David Christensen wrote:
2.  AIUI dd(1) uses asynchronous (buffered) I/O unless told otherwise.

You seem to confuse asynchronous and cached I/O too.

From Linux kernel POV, *asynchronous* I/O is a pair of
io_submit/io_getevents syscalls, and dd does not do these regardless of
the options that are provided.
What dd does is a *synchronous* I/O (read/write syscalls or
pread64/pwrite64 for older kernels).

Whenever the I/O is cached (an output file is opened without
O_DIRECT|O_DSYNC flags) or not is orthogonal to whenever it's sync or
async.

It would not surprise me if there are a dozen layers of chip registers, caches, buffers, memory, etc., between a CPU register and whatever device implements data storage in a recent to modern x86_64 computer. And, I can only wonder if reading /dev/zero even comes from a CPU register -- it would not surprise me if an MMU feature does.


I was referring to the 'fdatasync', 'fsync', 'dsync', 'sync', and 'nocache' options to dd(1). Given the terse manual page, and a unwillingness to crawl the dd(1) and/or kernel code, I can only guess at my understanding of what is happening. But, all of those options seem to imply some opposite of asynchronous or buffered I/O as I know it.


"The devil is in the details."


For the true async I/O you'll need something like fio, not dd.

That looks like an interesting tool.


David


Reply to: