Avoid copying data between user and kernel space and vice versa

I am developing an active messaging protocol for parallel computing that replaces TCP / IP. My goal is to reduce packet latency. Since the environment is a local area network, I can replace TCP / IP with a simpler protocol to reduce packet latency. I am not writing any device drivers, and I'm just trying to replace the TCP / IP stack with something simpler. Now I wanted to avoid copying package data from user space to kernel space and vice versa . I heard about mmap (). Is this the best way to do this? If so, it will be good if you can provide links to some examples. I am new to Linux and I really appreciate your help .. Thanks ...

Thanks Bala

+3
source share
2 answers

You should use UDP, this is pretty fast already. At least it was fast enough for W32 / SQLSlammer to spread all over the internet.

For your original question, see system calls (vm)spliceand teeLinux.

From the man page:

Three systems cause splicing (2), vmsplice (2) and tee (2)), provide user-space programs with full control over an arbitrary kernel buffer, implemented in the kernel using the same type of pipe buffer used. In the overview, this call system performs the following tasks:

splices (2)

  moves data from the buffer to an arbitrary file descriptor, or vice

vice versa, or from one buffer to another.

tee (2)

  "copies" the data from one buffer to another.

vmsplice (2)

  "copies" data from user space into the buffer.

, . , . "" ( ), , : , .

+3

, TCP/IP ,

, LAN UDP-, , , , ...

SO no, TCP - (UDP). , , TCP ( , , ).

TCP (, TCP_NODELAY))

. , , mmap. ​​ - , .

, / sendfile(), . .

0

Source: https://habr.com/ru/post/1743891/


All Articles