0

An answer to this question:

Can I do a copy-on-write memcpy in Linux?

suggests one can achieve copy-on-write of a bunch of memory by:

  1. opening a file
  2. mmap()'ing the source to a file
  3. mmap()'ing the destination to the same file (with MAP_PRIVATE)

But this seems rather fishy w.r.t. speed. I'm sure the I/O costs you something; and maybe there's more unforeseen overhead other than page table work.

So, what can be said with certainty about the speed of this procedure (perhaps as a function of the Linux kernel version)?

einpoklum
  • 118,144
  • 57
  • 340
  • 684

0 Answers0