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
4
votes
4 answers

With sendfile(), is it possible to tell when in_fd is at EOF?

Reading through the man page of the Linux system call sendfile, I am wondering whether it is possible for the calling program to know when in_fd is at EOF. Presumably, this could be signaled by a return value of 0, but this leads to the question of…
Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
4
votes
1 answer

How can I achieve zero copy mechanism in POSIX?

I want to share/transfer data between two process locally/network. General IPC mechanism shared memory and Message Queues can be used to transfer data. But these mechanisms involve multiple copies. I came across zero copy mechanism, which…
anikhan
  • 1,147
  • 3
  • 18
  • 44
3
votes
0 answers

How to make gstreamer write video frames at specific memory address, user pointer?

I want to write gstreamer pipeline where video is rendered by OpenGLES2. My first implementation was gstreamer appsink which makes glTexSubImage2D() write to texture, then rendering. It works but extremely slow. OpenGLES2 glTexSubImage2D() is very…
nckm
  • 103
  • 1
  • 10
3
votes
1 answer

Zero-copy construction of an Eigen SparseMatrix

I have the following problem: I have an Eigen::SparseMatrix I need to send over the network, and my network library only supports sending arrays of primitive types. I can retrieve the pointers to the backing arrays of my SparseMatrix by doing…
Bar
  • 2,736
  • 3
  • 33
  • 41
3
votes
0 answers

SendFile and transferTo in Java

I am using CentOs Kernel version 2.6.32.I plan to do a test with and without transferTo(sendFile) using NIO. My Test is to copy a 1GB file from one directory to another. However i didn't find any significant performance improvement because of using…
3
votes
3 answers

Terminology: opposite of "zero copy"?

We're benchmarking some code that we've converted to use sendfile(), the linux zero-copy system call. What's the term for the traditional read()/write() loop that sendfile() replaces? I.e., in our report I want to say "zerocopy is X millisecs, and…
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
3
votes
3 answers

Is Netty's Zero Copy different from OS level Zero Copy?

I found Netty documentation says they have "Transparent Zero Copy" feature in their build-in ByteBuffer. But after the reading, I notice it doesn't mention any kernel space and user space switching, only something about reuse the buffer. So I wonder…
WoooHaaaa
  • 19,732
  • 32
  • 90
  • 138
3
votes
1 answer

Is there device side pointer of host memory for kernel use in OpenCL (like CUDA)?

In CUDA, we can achieve kernel managed data transfer from host memory to device shared memory by device side pointer of host memory. Like this: int *a,*b,*c; // host pointers int *dev_a, *dev_b, *dev_c; // device pointers to host…
jxj
  • 145
  • 3
  • 10
2
votes
2 answers

Linux Zero Copy

I have a PCI device that needs to read and write from userspace. I'm trying to use zero copy; is there a way to allocate, pin, and get the physical address of a userspace address completely within userspace or do I need to have a kernel module that,…
Jonathan
  • 732
  • 5
  • 19
2
votes
2 answers

Numpy array: get the raw bytes without copying

I am trying to concatenate the bytes of multiple Numpy arrays into a single bytearray to send it in an HTTP post request. The most efficient way of doing this, that I can think of, is to create a sufficiently large bytearray object and then write…
2
votes
0 answers

zero-copy from SocketChannel to SocketChannel

With Java's NIO API, is it possible to implement a zero-copy data transfer from one socket to another? I'm aware of FileChannel::transferTo() which does this from file to socket, but there isn't a transferTo() method on SocketChannel.
Gunnar
  • 18,095
  • 1
  • 53
  • 73
2
votes
1 answer

How to use Zero-copy sendmsg/Receive in Boost.Asio

I am using Boost.Asio, I want to improve my system by using Zero-copy sendmsg/Receive. Can I use Zero-copy sendmsg/Receive in Boost.Asio? Could you give me how to use them if I can use them?
masshuroom
  • 53
  • 1
  • 6
2
votes
0 answers

Spring Zero Copy file download

I have to write a Web service that will be hit by a web application to download image.Image URL is not directly exposed to client, it will be be decided by some business logic. I am using Amazon S3 for file storage so how can i implement zero copy…
Prashant
  • 97
  • 3
  • 11
2
votes
2 answers

Sending bufs with 'MSG_ZEROCOPY' flag and 'SO_ZEROCOPY' option in kernel 4.14 behaves worse than non_zerocpy

I have a try on zero_copy of kernel 4.14, follow is the details about zero_copy in kernel 4.14. [1] (https://netdevconf.org/2.1/papers/netdev.pdf) And I test it in squid which is a cache proxy.My code is a little diffrent with above. I use epoll…
zengxiaobai2
  • 101
  • 2
  • 4
2
votes
0 answers

splice() from pipe to TCP buffered?

xpost from linuxquestions.org, sorry... I wrote a small test program to see if a simple proxy would benefit from using splice() but it always takes 200ms for the data that I spliced from a pipe to a TCP socket to be read from the other end of the…
bennymack
  • 33
  • 4