I wonder if there exist OS using this technique to write to files or devices.
Instead of join buffers (allocating/moving) memory or switch context on each write, just providing list or array of pointer to buffers to write. Each thread will have one's structure. If we use array, then we have limited size.
Additionally, there must be call to flush this data and additionally to mark data as ready. If app flush data, we send data to system buffer/file or device. But data won't be copy to kernel automatically until data is market to be flushed. Flush operation will be made if application request or on context switch. On context switch kernel will only copy data marked as ready.
The idea was partially inspired on OpenGL/Vulcan.
Does any OS using this technique? What are benefits and disadvantages? How much slower/faster is this technique than others?
List of buffers instead of joing buffers + delayed flush
Re: List of buffers instead of joing buffers + delayed flush
You just described scatter/gather IO, https://en.wikipedia.org/wiki/Vectored_I/O for the obligatory pedia link.
The downside is that for hardware that doesn't support it directly, the kernel still has to memcpy things around, and for hardware that can, there's more buffer mapping involved.
The upside can be easier shuffling around on the application side, and sometimes the ability to reuse chunks that get shared across multiple IO operations, depending on the alignment and size restrictions. A particularly granular one could possibly reuse a lot of boilerplate packet header data, especially if there's hardware support for adjusting checksums and/or sequence values.
The downside is that for hardware that doesn't support it directly, the kernel still has to memcpy things around, and for hardware that can, there's more buffer mapping involved.
The upside can be easier shuffling around on the application side, and sometimes the ability to reuse chunks that get shared across multiple IO operations, depending on the alignment and size restrictions. A particularly granular one could possibly reuse a lot of boilerplate packet header data, especially if there's hardware support for adjusting checksums and/or sequence values.
Re: List of buffers instead of joing buffers + delayed flush
Ok.
I read about this mechanism in past on Unix programming for advanced users. Author is Marc J.Rochind. I just forgot about it. Of course - maybe that (mistake) was done, because is not a book about OS programming, but programming under Unix. After reading vectorized IO, I remind myself about this.
I read about this mechanism in past on Unix programming for advanced users. Author is Marc J.Rochind. I just forgot about it. Of course - maybe that (mistake) was done, because is not a book about OS programming, but programming under Unix. After reading vectorized IO, I remind myself about this.