copy_on_write.5 (2010 09)
c
copy_on_write(5) copy_on_write(5)
(Tunable Kernel Parameters)
NAME
copy_on_write - dynamically enable or disable copy-on-write semantics for privately mapped files, private
segments of child process after fork(), and private segments locked by mlock()
VALUES
Failsafe
0 (off)
Default
1 (on) copy-on-write semantics is enabled
Allowed values
0 (off) or 1 (on)
DESCRIPTION
This tunable dynamically enables (
1) or disables (
0) the copy-on-write behavior in
fork(),private
mmap(), and mlock() system calls. When the tunable is disabled, copy-on-access behavior is followed;
this is the legacy behavior (HP-UX 11i v3 and previous releases) where private segments are copied upon
access. Disabling this tunable will preserve that old behavior.
Following is a summary of what happens when the
copy_on_write tunable is enabled:
• For
fork(), a process’ private data (data segment, stack, heap, RSE) is copied only when the
child process writes for the first time.
• For
mmap(),ifMAP_PRIVATE mapping is created for a file for which
MAP_SHARED exists, a
separate copy of the page is created for
MAP_PRIVATE only when it first writes to the page. As
long as MAP_PRIVATE reads, it shares the page with MAP_SHARED mapping. That is, updates
made by shared mapping will be visible to private mapping until private mapping writes.
• For
mlock(), locking privately mapped segments does not result in copying those segments.
However, segments are locked in memory and only when the content of the page changes, a copy
is made and the lock is transferred to the new segment.
Who Is Expected to Change This Tunable?
System administrators who wish to change the default copy-on-write behavior.
Restrictions on Changing
Changes to this tunable take effect immediately.
When Should the Tunable Be Turned Off?
If an application depends on copy-on-access behavior, where a process accessing a privately mapped file
for the first time gets a copy of the page and the contents of the page does not change unless private map-
ping writes to it, the
copy_on_write
tunable should be turned off to get copy-on-access behavior.
What Are the Side Effects of Turning the Tunable Off?
Some workloads might see increased memory consumption since private segments are copied when
accessed for the first time.
When Should the Tunable Be Turned On?
If an application wants industry standard
mmap() semantics, which allows users to share data via
private mapping of a file for which shared mapping exists, the tunable should be enabled. Turning the
tunable on can also reduce memory consumption on some workloads since private segments are only
copied upon write.
What Are the Side Effects of Turning the Tunable On?
Applications that privately map a file for which shared mapping exists can now see the updates per-
formed by shared mapping.
What Other Tunables Should Be Changed at the Same Time?
None.
WARNINGS
All HP-UX kernel tunable parameters are release specific. This parameter may be removed or have its
meaning changed in future releases of HP-UX.
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1