What are the principles for selecting sendfile and mmap?

sendfile and mmap are both typical zero-copy technologies, and sendfile is very efficient when files do not need to be modified. It is said that mmap is more suitable for the transfer of small files, while sendfile is more suitable for large files. How should I understand this? Is this statement correct? If yes, what is the cause?


I think the platform is obsolete, and it would be nice to have a satisfactory answer to the question. The rest do not even have an answer


large files reduce data replication in user mode and kernel state through sendfile, the amount of copying of small files is small, the replication overhead is less than sendfile, and mmap does not know much about it

.
Menu