Re: doubt regarding mmap/mmap2 system call and implementation

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

 



Hi,

> I have read that mmap/mmap2 system calls are more efficient than a read and
> a write system call. I am unable to understand why is this so?
If you want to transfer large amounts of data in between kernel and
user space, mmap-ing a mem. area is your best choice. That's because
there's no extra transfer happening. Of course, you'll have to reserve
those pages on the kernel side so that they don't get swapped to disk.

> mmap/mmap2 always create a vm_area_struct which is inserted into the
> process's userspace region. Given that this is the case, how is mmap/mmap2
> more efficient than the read/write system call? Shouldn't it be less
> efficient, because each access to mmapped region might be access this
> vm_area_struct mapping?
Read and write syscalls copy the data from kernel to user (and backwards).

Thanks,
Dragos

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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