Questions tagged [zero-copy]

"Zero-copy" describes computer operations in which the CPU does not perform the task of copying data from one memory area to another.

Zero-copy describes computer operations in which the CPU does not perform the task of copying data from one memory area to another. This technique is used in various software elements (e.g.device drivers, file systems, and network protocol stacks) to increase the performance and more efficiently utilize system resources.

Network applications that use zero copy request that the kernel copy the data directly from the disk file to the socket, without going through the application. Zero copy greatly improves application performance and reduces the number of context switches between kernel and user mode.

References:

100 questions
48
votes
4 answers

"zero copy networking" vs "kernel bypass"?

What is the difference between "zero-copy networking" and "kernel bypass"? Are they two phrases meaning the same thing, or different? Is kernel bypass a technique used within "zero copy networking" and this is the relationship?
user997112
  • 29,025
  • 43
  • 182
  • 361
28
votes
2 answers

Does Linux have zero-copy? splice or sendfile?

When splice was introduced it was discussed on the kernel list that sendfile was re-implemented based off of splice. The documentation for splice SLICE_F_MOVE states: Attempt to move pages instead of copying. This is only a hint to the…
Eloff
  • 20,828
  • 17
  • 83
  • 112
20
votes
1 answer

vmsplice() and TCP

In the original vmsplice() implementation, it was suggested that if you had a user-land buffer 2x the maximum number of pages that could fit in a pipe, a successful vmsplice() on the second half of the buffer would guarantee that the kernel was done…
user239558
  • 6,964
  • 1
  • 28
  • 35
19
votes
2 answers

Which file systems support splicing via Linux's splice(2)?

The man page for the splice system call says that splice may fail and set errno to EINVAL if: Target file system doesn't support splicing; neither of the descriptors refers to a pipe; or offset given for non-seekable device Which file systems…
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
14
votes
2 answers

Is there a way make a std::string that references an externally provided buffer but not own it?

Basically if one has a preloaded buffer for a null terminated string and the length to be referenced, and wants to pass a reference to it into a method that takes a std::string & but not copy the string or have it owned, is it possible to do so…
peterk
  • 5,136
  • 6
  • 33
  • 47
14
votes
2 answers

Zero-copy user-space TCP send of dma_mmap_coherent() mapped memory

I'm running Linux 5.1 on a Cyclone V SoC, which is an FPGA with two ARMv7 cores in one chip. My goal is to gather lots of data from an external interface and stream (part of) this data out through a TCP socket. The challenge here is that the data…
rem
  • 1,298
  • 2
  • 9
  • 16
13
votes
2 answers

Does Python support zero-copy I/O?

I have two open file objects, dest and src. File object dest is opened for writing, with the seek position placed at some offset within the file, and file object src is opened for reading. What I need to do is simply read from the current position…
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
13
votes
1 answer

Send data to multiple sockets using pipes, tee() and splice()

I'm duplicating a "master" pipe with tee() to write to multiple sockets using splice(). Naturally these pipes will get emptied at different rates depending on how much I can splice() to the destination sockets. So when I next go to add data to the…
Eloff
  • 20,828
  • 17
  • 83
  • 112
11
votes
1 answer

Why no zero-copy networking in linux kernel?

I'd like to know the reasons for why the linux kernel (or any other mainstream OS) does not have a feature for zero copy networking ? By zero copy I mean, that an packet/datastream does not get copied for passing to an application in userspace but…
11
votes
1 answer

Using Java to perform Zero Copy data transfers between two or more sockets

Does any one know of any good java libraries/API packages that performs zero copy data transfers between two or more sockets? I know that Java's NIO API can perform zero copy data transfers from disk to socket and vice versa using…
user3155961
  • 111
  • 1
  • 3
10
votes
1 answer

Does Zero-copy exist in Windows OS?

Reading this zero copy article, Does Zero-copy exist in Windows OS (server 2003, 2008, 2008 R2) ?
Lydon Ch
  • 8,637
  • 20
  • 79
  • 132
10
votes
3 answers

communicating between processes with shared-memory results zero-copy?

I am writing a network daemon, on Linux with kernel 2.6, which has one producer process and N of consumer processes, which does not make any change on the data, and does not create any response back to the producer. Whenever the producer process…
ddoman
  • 1,051
  • 1
  • 10
  • 12
10
votes
2 answers

What are the semantics of vmsplice(2), with and without gifting?

I'm trying to understand the functionality of the vmsplice(2) syscall (man page here). I have two questions about the effect of the SPLICE_F_GIFT flag: The man page says that once you gift pages to the kernel, you must never modify the memory…
jacobsa
  • 5,719
  • 1
  • 28
  • 60
9
votes
1 answer

Is there a way to perform zero-copying in .NET?

In Java I'd use the java.nio library and use FileChannel.transferTo() and FileChannel.transferFrom(). Is there something similar in (specifically) C# or am I going to have to load some unamanaged .dll from somewhere? Google has not been useful in…
ldam
  • 4,412
  • 6
  • 45
  • 76
9
votes
2 answers

How do you write zero copy in java? What are the main differences

I was reading about how you can use the java nio library to take advantage of file transfer/buffering at the O/S level which is called 'zero copy'. What are the differences in how you create/write to files then? Are there any drawbacks to using…
loyalflow
  • 14,275
  • 27
  • 107
  • 168
1
2 3 4 5 6 7