Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6500

Does the splice() system call only move file descriptors?

$
0
0

I am confused about the functionality of the splice system call. On the man-page it says:

Though we talk of copying, actual copies are generally avoided.The kernel does this by implementing a pipe buffer as a set ofreference-counted pointers to pages of kernel memory. The kernelcreates "copies" of pages in a buffer by creating new pointers(for the output buffer) referring to the pages, and increasingthe reference counts for the pages: only pointers are copied, notthe pages of the buffer.

If I e.g. want to splice some data which i previously opened in a file-descriptor, does the Linux kernel just copy references into the pipe-buffer pointing to the page-cache where my data is buffered? This would be my understanding of "zero copy" so that the kernel doesn't have to move real data...

Does then every necessary struct pipe buffer of the pipe's ring buffer point to a page in the page-cache?

Furthermore if the kernel put a real copy into the pipe-buffer there would be two copies inside the memory? One inside the page-cache and one in the pipe buffer...


Viewing all articles
Browse latest Browse all 6500

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>