MMAP: NORESERVE AND PRIVATE SUPPORT UNDER AIX 4.1 AND 3.2.5?
ITEM: RTA000052362
QUESTION:
Customer is developing an application on SUN and couldn't find the
answer in IBM doc:
They are using MAP_PRIVATE and MAP_NORESERVE, which allows them to
MMAP a file into user space. The user can modify the file in memory
without modifying the source file (PRIVATE). The NORESERVE prevents
Solaris from reserving the identical amt of disk space as the file,
only modified "pages" needs to have disk space.
The real app will map 1gb files into memory.
---------- ---------- ---------- --------- ---------- ----------
A: Under AIX 3.2.5 and AIX 4.1, memory mapping is done using the 'mmap'
function as you have indicated. This function does accept the
'MAP_PRIVATE' flag. However, when this flag is used, the file
associated with the file descriptor argument is mapped into memory,
but any changes to this memory segment are not reflected back to
the file. Thus, no disk space should be reserved to use memory
mapping in this way. If you wish the modified memory to be mapped
back out to disk, the 'MAP_SHARED' flag can be used.From the
documentation I have read, the 'mmap' routine will simply overwrite
the original file and not set aside any additional file storage.
The 'MAP_NORESERVE' flag is not used in AIX 3.2.5 or 4.1. Additional
detailed information about the 'mmap' subroutine can be found in
InfoExplorer.
---------- ---------- ---------- --------- ---------- ----------
QUESTION:
A clarification: with PRIVATE, that means I've made a private copy
of the file in my own user space. Does that mean I've also made a
copy to disk? Or Does it mean that as I change "pages" of the file
that only pages are saved to disk and merged later if I elect to save
my private copy?
Or, it just remains in memory and nothing gets copied to disk unless
I say so? (Other than paging space.)
Sorry for the questions, but a file this size will grab lots of disk
if I'm running around with multiple copies MMAPed.
---------- ---------- ---------- --------- ---------- ----------
QUESTION:
Futher more, say I had 3 users mmaping PRIVATE a 1/2gb file each and
the system has 2gb of RAM and 512mb of Page Space. Assuming they don't
page is this a problem? Meaning, if a user MMAPs a file does AIX
grab PS even if it doesn't Page? HP RESERVES paging (or swap) space for
every mmapped file, while SUN has the NO RESERVE option. The users
prefer not to reserve PS unless the file is paged and even then on a
per page (4k) basis. The HP implementation is so unacceptable that the
customer will not buy any HPs for this application.
---------- ---------- ---------- --------- ---------- ----------
A: When the 'mmap' routine is run, and a PRIVATE memory mapped segment
is allocated, no memory or paging is allocated until a page is
actually written or 'dirtied'. For example, if user A memory maps
a PRIVATE writable file that is 512 MB in size, no memory or paging
will be allocated. As user A reads from this segment, memory will be
allocated for each page that is read. However, no paging space will
be allocated. As user A writes to this segment, paging space will be
allocated for each page that is modified. Note that only modified
pages will have paging space allocated for them.
When users B and C open PRIVATE writable segments, again, no paging
space will be allocated until pages within these segments are
modified. Since these segments are opened PRIVATE, as user A, B, and
C all modify page X of their memory-mapped segment, three separate
paging space pages will be allocated, one for each user.
The only way I see a problem occurring in your situation, is if each
user modifies a large number of pages within his segment causing total
modified pages to exceed total paging space.
We regret that this response has taken so long but we were unable to
locate sufficiently detailed documentation to cover the issues raised
and had to do determine the behavior of 'mmap' through testing.
---------- ---------- ---------- --------- ---------- ----------
This item was created from library item Q676014 FFBXB
Additional search words:
AIX ALTERNATE FFBXB INDEX IX JAN95 LPPS MMAP NORESERVE OZNEW PRIVATE
RISCO RISCSYSTEM SECURE SOFTWARE SUPPORT SUPPORTED SUPT 3.2.5 4.1
WWQA: ITEM: RTA000052362 ITEM: RTA000052362
Dated: 01/1995 Category: RISCO
This HTML file was generated 99/06/24~12:43:20
Comments or suggestions?
Contact us