I am working through Distributed Services with Go
…and to be honest for somebody who hasn’t really done systems programming, the log the author is creating is a bit hard to grokk.
That said, I don’t think you have to read this book to be able to understand the gist of my question, which is what are the different use-cases of using byte arrays vs memory mapped files.
In this book he’s using a buffer of byte arrays backed by a file in one place. My understanding is that flushing the buffer writes what’s in memory to the backing file.
In another place he’s using this memory mapped file package to do a similar thing for an index file.
I understand that writing and reading from memory is quicker than disk io, but is my understanding that flushing a buffer to disc and writing a memory mapped file to disc serves the same purpose? If so, why choose one strategy over another?