Re: Re: zero copy from kernel perspective

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi...

> I am working on client server application.
> I want to know how to implement zero copy from socket point of view.
> Like for example when we received something on socket, how is the
> zero copy concept implemented here? I am not able to understand how
> we can use that chunk of data from socket into my application without
> making a copy of it.

Well, here is the illustration:

when a packet is received from the network card, interrupt handler put 
it on kernel space memory. Through functions, it is brought to the 
listener socket.  The system call which is listening for it, take the 
buffer, copy it to user space buffer and continue to do another 
capture.

So how about zero copy? In zero copy, there is no copying from kernel to 
user space. Either the kernel mode page which holds the data is 
remapped to user space, or it is the user space pages which is also 
mapped to kernel space, that is used to keep the packets. Via 
remapping, data duplication is avoided because the page(s) are now 
accessible from kernel and user space's point of view.

Of course, there is a complication for this nice feature. The pages must 
be locked so they always exist in RAM, if not : either the work will 
get longer (since the page must be brought back to RAM) or kernel get 
panics (if data is accessed in uninterruptible style).

I am not too familiar with real world implementation of so called zero 
copy network, so I could say something wrong here. Somebody please 
CMIIW.

regards,

Mulyadi


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux