David Sarrazin
|
RE: Performing read operation on fd after mmap
|
David Sarrazin
03/07/2013 5:37 PM
post99744
|
RE: Performing read operation on fd after mmap
Using the fd directly will perform a file operation, and not modify the mmap memory buffers. When the memory buffers
are unmapped, their contents will overwrite whatever changes you made to the file. For this reason, you should only
access the file via the mmap memory buffers OR through the fd, do not mix them.
Your application will know better than the kernel when you are finished with a specific piece of buffer, so you
application can make better decisions about when to flush the changes to disk. Other than this, I don't know if there
is any performance penalty for using mmap versus reading the file directly. I would suggest though, if you are looking
for performance, make sure you do NOT use fopen()/fread()/fwrite(), and do your file access in the largest possible
buffer (32k or 64k read and write sizes offer good performance).
David
-----Original Message-----
From: Balaaji Tirouvengadam [mailto:community-noreply@qnx.com]
Sent: Thursday, March 07, 2013 1:59 PM
To: general-filesystems
Subject: Performing read operation on fd after mmap
Hi,
I am trying to find the performance difference between
1.) using the pointer returned by mmap() of shm_open() retruned fd
2.) shm_open(), call mmap(), ignore the pinter returned and just use the fd
for data read/write operations.
Does the both operation gives same performance results ? wehther the both does only memory operation instead of one
memory and the other as file operation ?
_______________________________________________
General
http://community.qnx.com/sf/go/post99738
To cancel your subscription to this discussion, please e-mail general-filesystems-unsubscribe@community.qnx.com
|
|
|